|
| 1 | +apply plugin: 'idea' |
| 2 | +apply plugin: 'eclipse' |
| 3 | + |
| 4 | +group = 'org.openapitools' |
| 5 | +version = '1.0.0' |
| 6 | + |
| 7 | +buildscript { |
| 8 | + repositories { |
| 9 | + jcenter { |
| 10 | + url "http://jcenter.bintray.com/" |
| 11 | + } |
| 12 | + } |
| 13 | + dependencies { |
| 14 | + classpath 'com.android.tools.build:gradle:2.3.+' |
| 15 | + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' |
| 16 | + } |
| 17 | +} |
| 18 | + |
| 19 | +repositories { |
| 20 | + jcenter { |
| 21 | + url "http://jcenter.bintray.com/" |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | + |
| 26 | +if(hasProperty('target') && target == 'android') { |
| 27 | + |
| 28 | + apply plugin: 'com.android.library' |
| 29 | + apply plugin: 'com.github.dcendents.android-maven' |
| 30 | + |
| 31 | + android { |
| 32 | + compileSdkVersion 25 |
| 33 | + buildToolsVersion '25.0.2' |
| 34 | + defaultConfig { |
| 35 | + minSdkVersion 14 |
| 36 | + targetSdkVersion 25 |
| 37 | + } |
| 38 | + compileOptions { |
| 39 | + sourceCompatibility JavaVersion.VERSION_1_6 |
| 40 | + targetCompatibility JavaVersion.VERSION_1_6 |
| 41 | + } |
| 42 | + |
| 43 | + // Rename the aar correctly |
| 44 | + libraryVariants.all { variant -> |
| 45 | + variant.outputs.each { output -> |
| 46 | + def outputFile = output.outputFile |
| 47 | + if (outputFile != null && outputFile.name.endsWith('.aar')) { |
| 48 | + def fileName = "${project.name}-${variant.baseName}-${version}.aar" |
| 49 | + output.outputFile = new File(outputFile.parent, fileName) |
| 50 | + } |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | + dependencies { |
| 55 | + provided 'javax.annotation:jsr250-api:1.0' |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + afterEvaluate { |
| 60 | + android.libraryVariants.all { variant -> |
| 61 | + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar |
| 62 | + task.description = "Create jar artifact for ${variant.name}" |
| 63 | + task.dependsOn variant.javaCompile |
| 64 | + task.from variant.javaCompile.destinationDir |
| 65 | + task.destinationDir = project.file("${project.buildDir}/outputs/jar") |
| 66 | + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" |
| 67 | + artifacts.add('archives', task); |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + task sourcesJar(type: Jar) { |
| 72 | + from android.sourceSets.main.java.srcDirs |
| 73 | + classifier = 'sources' |
| 74 | + } |
| 75 | + |
| 76 | + artifacts { |
| 77 | + archives sourcesJar |
| 78 | + } |
| 79 | + |
| 80 | +} else { |
| 81 | + |
| 82 | + apply plugin: 'java' |
| 83 | + apply plugin: 'maven' |
| 84 | + sourceCompatibility = JavaVersion.VERSION_1_6 |
| 85 | + targetCompatibility = JavaVersion.VERSION_1_6 |
| 86 | + |
| 87 | + install { |
| 88 | + repositories.mavenInstaller { |
| 89 | + pom.artifactId = 'petstore-jersey2-java6' |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + task execute(type:JavaExec) { |
| 94 | + main = System.getProperty('mainClass') |
| 95 | + classpath = sourceSets.main.runtimeClasspath |
| 96 | + } |
| 97 | +} |
| 98 | + |
| 99 | +ext { |
| 100 | + swagger_annotations_version = "1.5.20" |
| 101 | + jackson_version = "2.9.6" |
| 102 | + jersey_version = "2.6" |
| 103 | + commons_io_version=2.5 |
| 104 | + commons_lang3_version=3.6 |
| 105 | + junit_version = "4.12" |
| 106 | + threetenbp_version = "2.6.4" |
| 107 | +} |
| 108 | + |
| 109 | +dependencies { |
| 110 | + compile "io.swagger:swagger-annotations:$swagger_annotations_version" |
| 111 | + compile "org.glassfish.jersey.core:jersey-client:$jersey_version" |
| 112 | + compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version" |
| 113 | + compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version" |
| 114 | + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" |
| 115 | + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" |
| 116 | + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" |
| 117 | + compile "commons-io:commons-io:$commons_io_version" |
| 118 | + compile "org.apache.commons:commons-lang3:$commons_lang3_version" |
| 119 | + compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" |
| 120 | + compile "com.brsanthu:migbase64:2.2" |
| 121 | + testCompile "junit:junit:$junit_version" |
| 122 | +} |
0 commit comments