From 00c97c8ff6a0b50027d6805d78b1b0f185c174e3 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 25 Mar 2016 17:35:21 +0800 Subject: [PATCH] update build.gradle for android (default, volley) --- .../src/main/resources/android/build.mustache | 20 ++++++++++--------- .../libraries/volley/apiInvoker.mustache | 3 ++- .../android/libraries/volley/build.mustache | 9 +++++---- .../petstore/android/default/build.gradle | 20 ++++++++++--------- .../java/io/swagger/client/model/Name.java | 14 +++++++++++++ .../petstore/android/volley/build.gradle | 4 ++-- .../java/io/swagger/client/ApiInvoker.java | 3 ++- .../java/io/swagger/client/model/Name.java | 14 +++++++++++++ 8 files changed, 61 insertions(+), 26 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/android/build.mustache b/modules/swagger-codegen/src/main/resources/android/build.mustache index dff1897046..41c9a2dfbb 100644 --- a/modules/swagger-codegen/src/main/resources/android/build.mustache +++ b/modules/swagger-codegen/src/main/resources/android/build.mustache @@ -8,9 +8,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' + classpath 'com.android.tools.build:gradle:1.5.+' {{#useAndroidMavenGradlePlugin}} - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' {{/useAndroidMavenGradlePlugin}} } } @@ -28,11 +28,12 @@ apply plugin: 'com.github.dcendents.android-maven' {{/useAndroidMavenGradlePlugin}} android { - compileSdkVersion 22 - buildToolsVersion '22.0.0' + compileSdkVersion 23 + buildToolsVersion '23.0.2' + useLibrary 'org.apache.http.legacy' defaultConfig { minSdkVersion 14 - targetSdkVersion 22 + targetSdkVersion 23 } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 @@ -55,16 +56,17 @@ android { ext { swagger_annotations_version = "1.5.0" gson_version = "2.3.1" - httpclient_version = "4.3.3" - junit_version = "4.8.1" + httpclient_version = "4.5.2" + httpcore_version = "4.4.4" + junit_version = "4.12" } dependencies { compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "com.google.code.gson:gson:$gson_version" - compile "org.apache.httpcomponents:httpcore:$httpclient_version" + compile "org.apache.httpcomponents:httpcore:$httpcore_version" compile "org.apache.httpcomponents:httpclient:$httpclient_version" - compile ("org.apache.httpcomponents:httpcore:$httpclient_version") { + compile ("org.apache.httpcomponents:httpcore:$httpcore_version") { exclude(group: 'org.apache.httpcomponents', module: 'httpclient') } compile ("org.apache.httpcomponents:httpmime:$httpclient_version") { diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache index 4369613449..e76bf1357e 100644 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache @@ -197,7 +197,8 @@ public class ApiInvoker { INSTANCE.authentications.put("{{name}}", new HttpBasicAuth()); {{/isBasic}} {{#isOAuth}} - INSTANCE.authentications.put("{{name}}", new OAuth()); + // TODO: comment out below as OAuth does not exist + //INSTANCE.authentications.put("{{name}}", new OAuth()); {{/isOAuth}} {{/authMethods}} // Prevent the authentications from being modified. diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache index 197dd32b7c..fabdd14a6d 100644 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache @@ -8,9 +8,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' + classpath 'com.android.tools.build:gradle:1.5.+' {{#useAndroidMavenGradlePlugin}} - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' {{/useAndroidMavenGradlePlugin}} } } @@ -59,9 +59,10 @@ android { ext { swagger_annotations_version = "1.5.0" gson_version = "2.3.1" - httpclient_version = "4.3.3" + httpclient_version = "4.5.2" + httpcore_version = "4.4.4" volley_version = "1.0.19" - junit_version = "4.8.1" + junit_version = "4.12" robolectric_version = "3.0" concurrent_unit_version = "0.4.2" } diff --git a/samples/client/petstore/android/default/build.gradle b/samples/client/petstore/android/default/build.gradle index 417503cb51..e48f72b313 100644 --- a/samples/client/petstore/android/default/build.gradle +++ b/samples/client/petstore/android/default/build.gradle @@ -6,9 +6,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' + classpath 'com.android.tools.build:gradle:1.5.+' - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' } } @@ -24,11 +24,12 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 22 - buildToolsVersion '22.0.0' + compileSdkVersion 23 + buildToolsVersion '23.0.2' + useLibrary 'org.apache.http.legacy' defaultConfig { minSdkVersion 14 - targetSdkVersion 22 + targetSdkVersion 23 } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 @@ -51,16 +52,17 @@ android { ext { swagger_annotations_version = "1.5.0" gson_version = "2.3.1" - httpclient_version = "4.3.3" - junit_version = "4.8.1" + httpclient_version = "4.5.2" + httpcore_version = "4.4.4" + junit_version = "4.12" } dependencies { compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "com.google.code.gson:gson:$gson_version" - compile "org.apache.httpcomponents:httpcore:$httpclient_version" + compile "org.apache.httpcomponents:httpcore:$httpcore_version" compile "org.apache.httpcomponents:httpclient:$httpclient_version" - compile ("org.apache.httpcomponents:httpcore:$httpclient_version") { + compile ("org.apache.httpcomponents:httpcore:$httpcore_version") { exclude(group: 'org.apache.httpcomponents', module: 'httpclient') } compile ("org.apache.httpcomponents:httpmime:$httpclient_version") { diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java index 5c308de749..9763aca7b3 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java @@ -10,6 +10,8 @@ public class Name { @SerializedName("name") private Integer name = null; + @SerializedName("snake_case") + private Integer snakeCase = null; /** @@ -23,6 +25,17 @@ public class Name { } + /** + **/ + @ApiModelProperty(value = "") + public Integer getSnakeCase() { + return snakeCase; + } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + @Override public String toString() { @@ -30,6 +43,7 @@ public class Name { sb.append("class Name {\n"); sb.append(" name: ").append(name).append("\n"); + sb.append(" snakeCase: ").append(snakeCase).append("\n"); sb.append("}\n"); return sb.toString(); } diff --git a/samples/client/petstore/android/volley/build.gradle b/samples/client/petstore/android/volley/build.gradle index 799f9309a2..e678620cb0 100644 --- a/samples/client/petstore/android/volley/build.gradle +++ b/samples/client/petstore/android/volley/build.gradle @@ -6,9 +6,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.2' + classpath 'com.android.tools.build:gradle:1.5.0' - classpath 'com.github.dcendents:android-maven-plugin:1.2' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' } } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java index 86a0d6cb2d..21ee5f3628 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java @@ -229,7 +229,8 @@ public class ApiInvoker { - INSTANCE.authentications.put("petstore_auth", new OAuth()); + // TODO: comment out below as OAuth does not exist + //INSTANCE.authentications.put("petstore_auth", new OAuth()); // Prevent the authentications from being modified. diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java index 5c308de749..9763aca7b3 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java @@ -10,6 +10,8 @@ public class Name { @SerializedName("name") private Integer name = null; + @SerializedName("snake_case") + private Integer snakeCase = null; /** @@ -23,6 +25,17 @@ public class Name { } + /** + **/ + @ApiModelProperty(value = "") + public Integer getSnakeCase() { + return snakeCase; + } + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + @Override public String toString() { @@ -30,6 +43,7 @@ public class Name { sb.append("class Name {\n"); sb.append(" name: ").append(name).append("\n"); + sb.append(" snakeCase: ").append(snakeCase).append("\n"); sb.append("}\n"); return sb.toString(); }