add possibility to create aar library

This commit is contained in:
Oleg Godovykh 2015-04-29 13:39:00 -04:00
parent b6495a9fc2
commit 119a981701
5 changed files with 59 additions and 61 deletions

View File

@ -11,7 +11,8 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
protected String groupId = "io.swagger"; protected String groupId = "io.swagger";
protected String artifactId = "swagger-android-client"; protected String artifactId = "swagger-android-client";
protected String artifactVersion = "1.0.0"; protected String artifactVersion = "1.0.0";
protected String sourceFolder = "src/main/java"; protected String projectFolder = "src/main";
protected String sourceFolder = projectFolder + "/java";
public CodegenType getTag() { public CodegenType getTag() {
return CodegenType.CLIENT; return CodegenType.CLIENT;
@ -51,6 +52,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
additionalProperties.put("artifactVersion", artifactVersion); additionalProperties.put("artifactVersion", artifactVersion);
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("apiInvoker.mustache", supportingFiles.add(new SupportingFile("apiInvoker.mustache",
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "ApiInvoker.java")); (sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "ApiInvoker.java"));
supportingFiles.add(new SupportingFile("httpPatch.mustache", supportingFiles.add(new SupportingFile("httpPatch.mustache",

View File

@ -1,48 +1,43 @@
apply plugin: 'com.android.application' buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.library'
android { android {
compileSdkVersion 22 compileSdkVersion 22
buildToolsVersion "22.0.0" buildToolsVersion '22.0.0'
defaultConfig { defaultConfig {
applicationId "{{invokerPackage}}"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 22 targetSdkVersion 22
versionCode 1
versionName "{{artifactVersion}}"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
exclude 'META-INF/services/com.fasterxml.jackson.core.ObjectCodec'
} }
} }
ext { ext {
swagger_annotations_version = '1.5.3-M1' swagger_annotations_version = "1.5.3-M1"
jackson_version = '2.5.2' jackson_version = "2.5.2"
apache_httpclient_version = '4.3.5.1' httpclient_version = "4.3.3"
apache_httpmime_version = '4.4.1' junit_version = "4.8.1"
} }
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile "com.wordnik:swagger-annotations:$swagger_annotations_version" compile "com.wordnik:swagger-annotations:$swagger_annotations_version"
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "org.apache.httpcomponents:httpclient-android:$apache_httpclient_version" compile "org.apache.httpcomponents:httpcore:$httpclient_version"
compile "org.apache.httpcomponents:httpmime:$apache_httpmime_version" compile "org.apache.httpcomponents:httpclient:$httpclient_version"
compile "org.apache.httpcomponents:httpmime:$httpclient_version"
testCompile "junit:junit:$junit_version"
} }

View File

@ -0,0 +1,3 @@
<manifest package="{{invokerPackage}}">
<application />
</manifest>

View File

@ -1,48 +1,43 @@
apply plugin: 'com.android.application' buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.library'
android { android {
compileSdkVersion 22 compileSdkVersion 22
buildToolsVersion "22.0.0" buildToolsVersion '22.0.0'
defaultConfig { defaultConfig {
applicationId "io.swagger.client"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 22 targetSdkVersion 22
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
exclude 'META-INF/services/com.fasterxml.jackson.core.ObjectCodec'
} }
} }
ext { ext {
swagger_annotations_version = '1.5.3-M1' swagger_annotations_version = "1.5.3-M1"
jackson_version = '2.5.2' jackson_version = "2.5.2"
apache_httpclient_version = '4.3.5.1' httpclient_version = "4.3.3"
apache_httpmime_version = '4.4.1' junit_version = "4.8.1"
} }
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile "com.wordnik:swagger-annotations:$swagger_annotations_version" compile "com.wordnik:swagger-annotations:$swagger_annotations_version"
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "org.apache.httpcomponents:httpclient-android:$apache_httpclient_version" compile "org.apache.httpcomponents:httpcore:$httpclient_version"
compile "org.apache.httpcomponents:httpmime:$apache_httpmime_version" compile "org.apache.httpcomponents:httpclient:$httpclient_version"
compile "org.apache.httpcomponents:httpmime:$httpclient_version"
testCompile "junit:junit:$junit_version"
} }

View File

@ -0,0 +1,3 @@
<manifest package="io.swagger.client">
<application />
</manifest>