mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 14:40:53 +00:00
merged
This commit is contained in:
commit
e58f8db9aa
@ -13,6 +13,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
protected String projectFolder = "src/main";
|
protected String projectFolder = "src/main";
|
||||||
protected String sourceFolder = projectFolder + "/java";
|
protected String sourceFolder = projectFolder + "/java";
|
||||||
|
protected Boolean useAndroidMavenGradlePlugin = true;
|
||||||
|
|
||||||
public CodegenType getTag() {
|
public CodegenType getTag() {
|
||||||
return CodegenType.CLIENT;
|
return CodegenType.CLIENT;
|
||||||
@ -52,6 +53,9 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
additionalProperties.put("artifactVersion", artifactVersion);
|
additionalProperties.put("artifactVersion", artifactVersion);
|
||||||
|
|
||||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
|
additionalProperties.put("useAndroidMavenGradlePlugin", useAndroidMavenGradlePlugin);
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle"));
|
||||||
supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle"));
|
supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle"));
|
||||||
supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
|
supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
|
||||||
supportingFiles.add(new SupportingFile("apiInvoker.mustache",
|
supportingFiles.add(new SupportingFile("apiInvoker.mustache",
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
|
{{#useAndroidMavenGradlePlugin}}
|
||||||
|
group = '{{groupId}}'
|
||||||
|
project.version = '{{artifactVersion}}'
|
||||||
|
{{/useAndroidMavenGradlePlugin}}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.2'
|
classpath 'com.android.tools.build:gradle:1.2.2'
|
||||||
|
{{#useAndroidMavenGradlePlugin}}
|
||||||
|
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
||||||
|
{{/useAndroidMavenGradlePlugin}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,7 +21,11 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
|
{{#useAndroidMavenGradlePlugin}}
|
||||||
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
{{/useAndroidMavenGradlePlugin}}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 22
|
||||||
@ -22,6 +34,17 @@ android {
|
|||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rename the aar correctly
|
||||||
|
libraryVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
def outputFile = output.outputFile
|
||||||
|
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||||
|
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||||
|
output.outputFile = new File(outputFile.parent, fileName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +60,12 @@ dependencies {
|
|||||||
compile "com.google.code.gson:gson:$gson_version"
|
compile "com.google.code.gson:gson:$gson_version"
|
||||||
compile "org.apache.httpcomponents:httpcore:$httpclient_version"
|
compile "org.apache.httpcomponents:httpcore:$httpclient_version"
|
||||||
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
|
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
|
||||||
compile "org.apache.httpcomponents:httpmime:$httpclient_version"
|
compile ("org.apache.httpcomponents:httpcore:$httpcore_version") {
|
||||||
|
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||||
|
}
|
||||||
|
compile ("org.apache.httpcomponents:httpmime:$httpmime_version") {
|
||||||
|
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||||
|
}
|
||||||
testCompile "junit:junit:$junit_version"
|
testCompile "junit:junit:$junit_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +76,18 @@ afterEvaluate {
|
|||||||
task.dependsOn variant.javaCompile
|
task.dependsOn variant.javaCompile
|
||||||
task.from variant.javaCompile.destinationDir
|
task.from variant.javaCompile.destinationDir
|
||||||
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||||
task.archiveName = "${project.name}-${variant.baseName}.jar"
|
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||||
artifacts.add('archives', task);
|
artifacts.add('archives', task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{#useAndroidMavenGradlePlugin}}
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
from android.sourceSets.main.java.srcDirs
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
{{/useAndroidMavenGradlePlugin}}
|
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "{{artifactId}}"
|
@ -1,9 +1,15 @@
|
|||||||
|
group = 'io.swagger'
|
||||||
|
project.version = '1.0.0'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.2.2'
|
classpath 'com.android.tools.build:gradle:1.2.2'
|
||||||
|
|
||||||
|
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,7 +19,9 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 22
|
||||||
@ -22,6 +30,17 @@ android {
|
|||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rename the aar correctly
|
||||||
|
libraryVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
def outputFile = output.outputFile
|
||||||
|
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||||
|
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||||
|
output.outputFile = new File(outputFile.parent, fileName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +56,12 @@ dependencies {
|
|||||||
compile "com.google.code.gson:gson:$gson_version"
|
compile "com.google.code.gson:gson:$gson_version"
|
||||||
compile "org.apache.httpcomponents:httpcore:$httpclient_version"
|
compile "org.apache.httpcomponents:httpcore:$httpclient_version"
|
||||||
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
|
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
|
||||||
compile "org.apache.httpcomponents:httpmime:$httpclient_version"
|
compile ("org.apache.httpcomponents:httpcore:$httpcore_version") {
|
||||||
|
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||||
|
}
|
||||||
|
compile ("org.apache.httpcomponents:httpmime:$httpmime_version") {
|
||||||
|
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||||
|
}
|
||||||
testCompile "junit:junit:$junit_version"
|
testCompile "junit:junit:$junit_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +72,16 @@ afterEvaluate {
|
|||||||
task.dependsOn variant.javaCompile
|
task.dependsOn variant.javaCompile
|
||||||
task.from variant.javaCompile.destinationDir
|
task.from variant.javaCompile.destinationDir
|
||||||
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||||
task.archiveName = "${project.name}-${variant.baseName}.jar"
|
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||||
artifacts.add('archives', task);
|
artifacts.add('archives', task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
from android.sourceSets.main.java.srcDirs
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
1
samples/client/petstore/android-java/settings.gradle
Normal file
1
samples/client/petstore/android-java/settings.gradle
Normal file
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "swagger-android-client"
|
Loading…
x
Reference in New Issue
Block a user