|
| 1 | +apply plugin: 'idea' |
| 2 | +apply plugin: 'eclipse' |
| 3 | + |
| 4 | +group = 'io.kubernetes' |
| 5 | +version = '1.0-SNAPSHOT' |
| 6 | + |
| 7 | +buildscript { |
| 8 | + repositories { |
| 9 | + jcenter() |
| 10 | + } |
| 11 | + dependencies { |
| 12 | + classpath 'com.android.tools.build:gradle:1.5.+' |
| 13 | + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +repositories { |
| 18 | + jcenter() |
| 19 | +} |
| 20 | + |
| 21 | + |
| 22 | +if(hasProperty('target') && target == 'android') { |
| 23 | + |
| 24 | + apply plugin: 'com.android.library' |
| 25 | + apply plugin: 'com.github.dcendents.android-maven' |
| 26 | + |
| 27 | + android { |
| 28 | + compileSdkVersion 23 |
| 29 | + buildToolsVersion '23.0.2' |
| 30 | + defaultConfig { |
| 31 | + minSdkVersion 14 |
| 32 | + targetSdkVersion 23 |
| 33 | + } |
| 34 | + compileOptions { |
| 35 | + sourceCompatibility JavaVersion.VERSION_1_7 |
| 36 | + targetCompatibility JavaVersion.VERSION_1_7 |
| 37 | + } |
| 38 | + |
| 39 | + // Rename the aar correctly |
| 40 | + libraryVariants.all { variant -> |
| 41 | + variant.outputs.each { output -> |
| 42 | + def outputFile = output.outputFile |
| 43 | + if (outputFile != null && outputFile.name.endsWith('.aar')) { |
| 44 | + def fileName = "${project.name}-${variant.baseName}-${version}.aar" |
| 45 | + output.outputFile = new File(outputFile.parent, fileName) |
| 46 | + } |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + dependencies { |
| 51 | + provided 'javax.annotation:jsr250-api:1.0' |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + afterEvaluate { |
| 56 | + android.libraryVariants.all { variant -> |
| 57 | + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar |
| 58 | + task.description = "Create jar artifact for ${variant.name}" |
| 59 | + task.dependsOn variant.javaCompile |
| 60 | + task.from variant.javaCompile.destinationDir |
| 61 | + task.destinationDir = project.file("${project.buildDir}/outputs/jar") |
| 62 | + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" |
| 63 | + artifacts.add('archives', task); |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | + task sourcesJar(type: Jar) { |
| 68 | + from android.sourceSets.main.java.srcDirs |
| 69 | + classifier = 'sources' |
| 70 | + } |
| 71 | + |
| 72 | + artifacts { |
| 73 | + archives sourcesJar |
| 74 | + } |
| 75 | + |
| 76 | +} else { |
| 77 | + |
| 78 | + apply plugin: 'java' |
| 79 | + apply plugin: 'maven' |
| 80 | + |
| 81 | + sourceCompatibility = JavaVersion.VERSION_1_7 |
| 82 | + targetCompatibility = JavaVersion.VERSION_1_7 |
| 83 | + |
| 84 | + install { |
| 85 | + repositories.mavenInstaller { |
| 86 | + pom.artifactId = 'client-java' |
| 87 | + } |
| 88 | + } |
| 89 | + |
| 90 | + task execute(type:JavaExec) { |
| 91 | + main = System.getProperty('mainClass') |
| 92 | + classpath = sourceSets.main.runtimeClasspath |
| 93 | + } |
| 94 | +} |
| 95 | + |
| 96 | +dependencies { |
| 97 | + compile 'io.swagger:swagger-annotations:1.5.8' |
| 98 | + compile 'com.squareup.okhttp:okhttp:2.7.5' |
| 99 | + compile 'com.squareup.okhttp:logging-interceptor:2.7.5' |
| 100 | + compile 'com.google.code.gson:gson:2.6.2' |
| 101 | + compile 'joda-time:joda-time:2.9.3' |
| 102 | + testCompile 'junit:junit:4.12' |
| 103 | +} |
0 commit comments