From 14c2d14fc243de8d0c6e2db440eef05309be951f Mon Sep 17 00:00:00 2001 From: Oleg Godovykh Date: Wed, 29 Apr 2015 14:18:44 -0400 Subject: [PATCH] provide both jar and aar --- .../src/main/resources/android-java/build.mustache | 12 ++++++++++++ samples/client/petstore/android-java/build.gradle | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/android-java/build.mustache b/modules/swagger-codegen/src/main/resources/android-java/build.mustache index c6f559143d..dfe5e1725d 100644 --- a/modules/swagger-codegen/src/main/resources/android-java/build.mustache +++ b/modules/swagger-codegen/src/main/resources/android-java/build.mustache @@ -40,4 +40,16 @@ dependencies { compile "org.apache.httpcomponents:httpclient:$httpclient_version" compile "org.apache.httpcomponents:httpmime:$httpclient_version" testCompile "junit:junit:$junit_version" +} + +afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}.jar" + artifacts.add('archives', task); + } } \ No newline at end of file diff --git a/samples/client/petstore/android-java/build.gradle b/samples/client/petstore/android-java/build.gradle index c6f559143d..dfe5e1725d 100644 --- a/samples/client/petstore/android-java/build.gradle +++ b/samples/client/petstore/android-java/build.gradle @@ -40,4 +40,16 @@ dependencies { compile "org.apache.httpcomponents:httpclient:$httpclient_version" compile "org.apache.httpcomponents:httpmime:$httpclient_version" testCompile "junit:junit:$junit_version" +} + +afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}.jar" + artifacts.add('archives', task); + } } \ No newline at end of file