forked from loafle/openapi-generator-original
[Android][Volley] Build fixes (#18899)
* [android] Fix useAndroidMavenGradlePlugin type in template * [android][volley] Use version variables in template * [android][volley] Exclude httpclient As it is incompatible with Android * [android][volley] Resolve file conflict between httpcomponents modules * [android] Update Gradle, the plugins, build tools This fixes building with current Android Studio. Android Gradle plugin version 8.0.0 was chosen for wider compatibility with Android Studio versions (as far back as 2022.2.1). The Maven plugin has been abandoned since the functionality is now built in, and manual jar tasks are not necessary with it. * [android] Regenerate samples
This commit is contained in:
parent
6f9ad31df3
commit
989a79811a
@ -459,8 +459,6 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
if (additionalProperties.containsKey(USE_ANDROID_MAVEN_GRADLE_PLUGIN)) {
|
||||
this.setUseAndroidMavenGradlePlugin(Boolean.valueOf((String) additionalProperties
|
||||
.get(USE_ANDROID_MAVEN_GRADLE_PLUGIN)));
|
||||
} else {
|
||||
additionalProperties.put(USE_ANDROID_MAVEN_GRADLE_PLUGIN, useAndroidMavenGradlePlugin);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(ANDROID_GRADLE_VERSION)) {
|
||||
@ -483,8 +481,9 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
this.setSerializableModel(Boolean.valueOf(additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL).toString()));
|
||||
}
|
||||
|
||||
// need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string
|
||||
// need to put back boolean properties into additionalProperties as the values in additionalProperties are strings
|
||||
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
|
||||
additionalProperties.put(USE_ANDROID_MAVEN_GRADLE_PLUGIN, useAndroidMavenGradlePlugin);
|
||||
|
||||
//make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
@ -524,7 +523,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
// supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle"));
|
||||
supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle"));
|
||||
supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle"));
|
||||
supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
|
||||
supportingFiles.add(new SupportingFile("apiInvoker.mustache",
|
||||
|
@ -1,50 +1,26 @@
|
||||
{{#useAndroidMavenGradlePlugin}}
|
||||
group = '{{groupId}}'
|
||||
project.version = '{{artifactVersion}}'
|
||||
{{/useAndroidMavenGradlePlugin}}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
{{#androidGradleVersion}}
|
||||
classpath 'com.android.tools.build:gradle:{{{.}}}'
|
||||
{{/androidGradleVersion}}
|
||||
{{^androidGradleVersion}}
|
||||
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||
{{/androidGradleVersion}}
|
||||
{{#useAndroidMavenGradlePlugin}}
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
{{/useAndroidMavenGradlePlugin}}
|
||||
}
|
||||
plugins {
|
||||
{{#androidGradleVersion}}
|
||||
id 'com.android.library' version '{{{.}}}'
|
||||
{{/androidGradleVersion}}
|
||||
{{^androidGradleVersion}}
|
||||
id 'com.android.library' version '8.0.0'
|
||||
{{/androidGradleVersion}}
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
{{#useAndroidMavenGradlePlugin}}
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
{{/useAndroidMavenGradlePlugin}}
|
||||
|
||||
android {
|
||||
namespace "{{invokerPackage}}"
|
||||
{{#androidSdkVersion}}
|
||||
compileSdkVersion {{{.}}}
|
||||
{{/androidSdkVersion}}
|
||||
{{^androidSdkVersion}}
|
||||
compileSdkVersion 25
|
||||
compileSdkVersion 33
|
||||
{{/androidSdkVersion}}
|
||||
{{#androidBuildToolsVersion}}
|
||||
buildToolsVersion '{{{.}}}'
|
||||
{{/androidBuildToolsVersion}}
|
||||
{{^androidBuildToolsVersion}}
|
||||
buildToolsVersion '25.0.2'
|
||||
buildToolsVersion '34.0.0'
|
||||
{{/androidBuildToolsVersion}}
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
defaultConfig {
|
||||
@ -53,27 +29,20 @@ android {
|
||||
targetSdkVersion {{{.}}}
|
||||
{{/androidSdkVersion}}
|
||||
{{^androidSdkVersion}}
|
||||
targetSdkVersion 25
|
||||
targetSdkVersion 33
|
||||
{{/androidSdkVersion}}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
publishing {
|
||||
singleVariant('release') {
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.6"
|
||||
gson_version = "2.10.1"
|
||||
@ -83,38 +52,29 @@ ext {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
compile "com.google.code.gson:gson:$gson_version"
|
||||
compile "org.apache.httpcomponents:httpcore:$httpcore_version"
|
||||
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
|
||||
compile ("org.apache.httpcomponents:httpcore:$httpcore_version") {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.gson:gson:$gson_version"
|
||||
implementation "org.apache.httpcomponents:httpcore:$httpcore_version"
|
||||
implementation "org.apache.httpcomponents:httpclient:$httpclient_version"
|
||||
implementation ("org.apache.httpcomponents:httpcore:$httpcore_version") {
|
||||
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||
}
|
||||
compile ("org.apache.httpcomponents:httpmime:$httpclient_version") {
|
||||
implementation ("org.apache.httpcomponents:httpmime:$httpclient_version") {
|
||||
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||
}
|
||||
testCompile "junit:junit:$junit_version"
|
||||
testImplementation "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.destinationDirectory
|
||||
task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
publishing {
|
||||
publications {
|
||||
release(MavenPublication) {
|
||||
groupId = '{{groupId}}'
|
||||
artifactId = '{{artifactId}}'
|
||||
version = '{{artifactVersion}}'
|
||||
|
||||
afterEvaluate {
|
||||
from components.release
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{{#useAndroidMavenGradlePlugin}}
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
{{/useAndroidMavenGradlePlugin}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -1,44 +1,35 @@
|
||||
{{#useAndroidMavenGradlePlugin}}
|
||||
group = '{{groupId}}'
|
||||
project.version = '{{artifactVersion}}'
|
||||
{{/useAndroidMavenGradlePlugin}}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
google()
|
||||
maven {
|
||||
url 'https://dl.google.com/dl/android/maven2'
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.+'
|
||||
{{#useAndroidMavenGradlePlugin}}
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
{{/useAndroidMavenGradlePlugin}}
|
||||
}
|
||||
plugins {
|
||||
{{#androidGradleVersion}}
|
||||
id 'com.android.library' version '{{{.}}}'
|
||||
{{/androidGradleVersion}}
|
||||
{{^androidGradleVersion}}
|
||||
id 'com.android.library' version '8.0.0'
|
||||
{{/androidGradleVersion}}
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
{{#useAndroidMavenGradlePlugin}}
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
{{/useAndroidMavenGradlePlugin}}
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion '28.0.3'
|
||||
namespace "{{invokerPackage}}"
|
||||
{{#androidSdkVersion}}
|
||||
compileSdkVersion {{{.}}}
|
||||
{{/androidSdkVersion}}
|
||||
{{^androidSdkVersion}}
|
||||
compileSdkVersion 33
|
||||
{{/androidSdkVersion}}
|
||||
{{#androidBuildToolsVersion}}
|
||||
buildToolsVersion '{{{.}}}'
|
||||
{{/androidBuildToolsVersion}}
|
||||
{{^androidBuildToolsVersion}}
|
||||
buildToolsVersion '34.0.0'
|
||||
{{/androidBuildToolsVersion}}
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 26
|
||||
{{#androidSdkVersion}}
|
||||
targetSdkVersion {{{.}}}
|
||||
{{/androidSdkVersion}}
|
||||
{{^androidSdkVersion}}
|
||||
targetSdkVersion 33
|
||||
{{/androidSdkVersion}}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
@ -47,24 +38,23 @@ android {
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
// Rename the aar correctly
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
if (outputFile != null && outputFileName.endsWith('.aar')) {
|
||||
outputFileName = "${archivesBaseName}-${version}.aar"
|
||||
}
|
||||
}
|
||||
packagingOptions {
|
||||
resources.excludes += "META-INF/DEPENDENCIES"
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.returnDefaultValues = true
|
||||
}
|
||||
publishing {
|
||||
singleVariant('release') {
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.6"
|
||||
gson_version = "2.10.1"
|
||||
httpcore_version = "4.4.16"
|
||||
httpmime_version = "4.5.14"
|
||||
volley_version = "1.2.1"
|
||||
junit_version = "4.13.2"
|
||||
@ -75,32 +65,28 @@ ext {
|
||||
dependencies {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.gson:gson:$gson_version"
|
||||
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
|
||||
implementation ("org.apache.httpcomponents:httpcore:$httpcore_version") {
|
||||
exclude(group: "org.apache.httpcomponents", module: "httpclient")
|
||||
}
|
||||
implementation ("org.apache.httpcomponents:httpmime:$httpmime_version") {
|
||||
exclude(group: "org.apache.httpcomponents", module: "httpclient")
|
||||
}
|
||||
implementation "com.android.volley:volley:${volley_version}"
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.robolectric:robolectric:${robolectric_version}"
|
||||
testImplementation "net.jodah:concurrentunit:${concurrent_unit_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.destinationDirectory
|
||||
task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
publishing {
|
||||
publications {
|
||||
release(MavenPublication) {
|
||||
groupId = '{{groupId}}'
|
||||
artifactId = '{{artifactId}}'
|
||||
version = '{{artifactVersion}}'
|
||||
|
||||
afterEvaluate {
|
||||
from components.release
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{{#useAndroidMavenGradlePlugin}}
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
{{/useAndroidMavenGradlePlugin}}
|
||||
|
@ -1 +1,17 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "{{artifactId}}"
|
||||
|
@ -1 +1 @@
|
||||
6.0.0-SNAPSHOT
|
||||
7.7.0-SNAPSHOT
|
||||
|
@ -117,13 +117,6 @@ Class | Method | HTTP request | Description
|
||||
## Documentation for Authorization
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### petstore_auth
|
||||
|
||||
|
||||
@ -134,6 +127,13 @@ Authentication schemes defined for the API:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Recommendation
|
||||
|
||||
|
@ -1,92 +1,60 @@
|
||||
group = 'org.openapitools'
|
||||
project.version = '1.0.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
}
|
||||
plugins {
|
||||
id 'com.android.library' version '8.0.0'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion '25.0.2'
|
||||
namespace "org.openapitools.client"
|
||||
compileSdkVersion 33
|
||||
buildToolsVersion '34.0.0'
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
targetSdkVersion 33
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
publishing {
|
||||
singleVariant('release') {
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.6"
|
||||
gson_version = "2.8.9"
|
||||
gson_version = "2.10.1"
|
||||
httpclient_version = "4.5.13"
|
||||
httpcore_version = "4.4.4"
|
||||
junit_version = "4.13"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
compile "com.google.code.gson:gson:$gson_version"
|
||||
compile "org.apache.httpcomponents:httpcore:$httpcore_version"
|
||||
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
|
||||
compile ("org.apache.httpcomponents:httpcore:$httpcore_version") {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.gson:gson:$gson_version"
|
||||
implementation "org.apache.httpcomponents:httpcore:$httpcore_version"
|
||||
implementation "org.apache.httpcomponents:httpclient:$httpclient_version"
|
||||
implementation ("org.apache.httpcomponents:httpcore:$httpcore_version") {
|
||||
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||
}
|
||||
compile ("org.apache.httpcomponents:httpmime:$httpclient_version") {
|
||||
implementation ("org.apache.httpcomponents:httpmime:$httpclient_version") {
|
||||
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
|
||||
}
|
||||
testCompile "junit:junit:$junit_version"
|
||||
testImplementation "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}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
publishing {
|
||||
publications {
|
||||
release(MavenPublication) {
|
||||
groupId = 'org.openapitools'
|
||||
artifactId = 'openapi-android-client'
|
||||
version = '1.0.0'
|
||||
|
||||
afterEvaluate {
|
||||
from components.release
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -39,12 +39,12 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<systemPropertyVariables>
|
||||
<property>
|
||||
<name>loggerPath</name>
|
||||
<value>conf/log4j.properties</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</systemPropertyVariables>
|
||||
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||
<parallel>methods</parallel>
|
||||
<forkMode>pertest</forkMode>
|
||||
@ -172,7 +172,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-core-version>1.6.6</swagger-core-version>
|
||||
<gson-version>2.8.9</gson-version>
|
||||
<gson-version>2.10.1</gson-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<httpclient-version>4.5.13</httpclient-version>
|
||||
|
@ -1 +1,17 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "openapi-android-client"
|
||||
|
@ -38,4 +38,12 @@ public class ApiException extends Exception {
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiException{" +
|
||||
"code=" + code +
|
||||
", message=" + message +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import java.util.*;
|
||||
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import org.openapitools.client.model.Pet;
|
||||
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
|
@ -16,6 +16,7 @@ gradle/wrapper/gradle-wrapper.properties
|
||||
gradlew
|
||||
gradlew.bat
|
||||
pom.xml
|
||||
settings.gradle
|
||||
src/main/AndroidManifest.xml
|
||||
src/main/java/org/openapitools/client/ApiException.java
|
||||
src/main/java/org/openapitools/client/ApiInvoker.java
|
||||
|
@ -1 +1 @@
|
||||
6.0.0-SNAPSHOT
|
||||
7.7.0-SNAPSHOT
|
||||
|
@ -117,13 +117,6 @@ Class | Method | HTTP request | Description
|
||||
## Documentation for Authorization
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### petstore_auth
|
||||
|
||||
|
||||
@ -134,6 +127,13 @@ Authentication schemes defined for the API:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
## Recommendation
|
||||
|
||||
|
@ -1,38 +1,15 @@
|
||||
group = 'org.openapitools'
|
||||
project.version = '1.0.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
google()
|
||||
maven {
|
||||
url 'https://dl.google.com/dl/android/maven2'
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
}
|
||||
plugins {
|
||||
id 'com.android.library' version '8.0.0'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion '28.0.3'
|
||||
namespace "org.openapitools.client"
|
||||
compileSdkVersion 33
|
||||
buildToolsVersion '34.0.0'
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 26
|
||||
targetSdkVersion 33
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
@ -41,25 +18,24 @@ android {
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
// Rename the aar correctly
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.all { output ->
|
||||
if (outputFile != null && outputFileName.endsWith('.aar')) {
|
||||
outputFileName = "${archivesBaseName}-${version}.aar"
|
||||
}
|
||||
}
|
||||
packagingOptions {
|
||||
resources.excludes += "META-INF/DEPENDENCIES"
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.returnDefaultValues = true
|
||||
}
|
||||
publishing {
|
||||
singleVariant('release') {
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.6.6"
|
||||
gson_version = "2.8.9"
|
||||
httpmime_version = "4.5.13"
|
||||
gson_version = "2.10.1"
|
||||
httpcore_version = "4.4.16"
|
||||
httpmime_version = "4.5.14"
|
||||
volley_version = "1.2.1"
|
||||
junit_version = "4.13.2"
|
||||
robolectric_version = "4.5.1"
|
||||
@ -69,30 +45,28 @@ ext {
|
||||
dependencies {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.gson:gson:$gson_version"
|
||||
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
|
||||
implementation ("org.apache.httpcomponents:httpcore:$httpcore_version") {
|
||||
exclude(group: "org.apache.httpcomponents", module: "httpclient")
|
||||
}
|
||||
implementation ("org.apache.httpcomponents:httpmime:$httpmime_version") {
|
||||
exclude(group: "org.apache.httpcomponents", module: "httpclient")
|
||||
}
|
||||
implementation "com.android.volley:volley:${volley_version}"
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.robolectric:robolectric:${robolectric_version}"
|
||||
testImplementation "net.jodah:concurrentunit:${concurrent_unit_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}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
publishing {
|
||||
publications {
|
||||
release(MavenPublication) {
|
||||
groupId = 'org.openapitools'
|
||||
artifactId = 'petstore-android-volley'
|
||||
version = '1.0.0'
|
||||
|
||||
afterEvaluate {
|
||||
from components.release
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
15
samples/client/petstore/android/volley/gradle.properties
Normal file
15
samples/client/petstore/android/volley/gradle.properties
Normal file
@ -0,0 +1,15 @@
|
||||
## For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
#
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx1024m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
#
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. For more details, visit
|
||||
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||
# org.gradle.parallel=true
|
||||
#Sun Jun 16 04:30:24 ART 2024
|
||||
#android.enableJetifier=true
|
||||
#android.useAndroidX=true
|
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -54,8 +54,8 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<swagger-annotations-version>1.6.6</swagger-annotations-version>
|
||||
<httpcomponents-httpmime-version>4.5.13</httpcomponents-httpmime-version>
|
||||
<google-code-gson-version>2.8.9</google-code-gson-version>
|
||||
<httpcomponents-httpmime-version>4.5.14</httpcomponents-httpmime-version>
|
||||
<google-code-gson-version>2.10.1</google-code-gson-version>
|
||||
<volley-library-version>1.2.1</volley-library-version>
|
||||
<android-platform-version>4.1.1.4</android-platform-version>
|
||||
</properties>
|
||||
|
17
samples/client/petstore/android/volley/settings.gradle
Normal file
17
samples/client/petstore/android/volley/settings.gradle
Normal file
@ -0,0 +1,17 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "petstore-android-volley"
|
@ -58,4 +58,12 @@ public class ApiException extends Exception {
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiException{" +
|
||||
"code=" + code +
|
||||
", message=" + message +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -203,9 +203,9 @@ public class ApiInvoker {
|
||||
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
INSTANCE.authentications = new HashMap<String, Authentication>();
|
||||
INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
// TODO: comment out below as OAuth does not exist
|
||||
//INSTANCE.authentications.put("petstore_auth", new OAuth());
|
||||
INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
// Prevent the authentications from being modified.
|
||||
INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import com.android.volley.VolleyError;
|
||||
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import org.openapitools.client.model.Pet;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
|
Loading…
x
Reference in New Issue
Block a user