Skip to content

Commit e3879a8

Browse files
committed
binding generator now takes jar to be built with from android runtime
1 parent b3ae0d7 commit e3879a8

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* Compiles binding generator
34
* to run: "gradle build"
@@ -6,14 +7,21 @@
67
*/
78
apply plugin: "java"
89

10+
def compiteCompileSdkVersion () {
11+
if(project.hasProperty("compileSdk")) {
12+
return compileSdk
13+
}
14+
return "android-22"
15+
}
16+
917
//workaround because there is a problem when the binding generator is compiled with java 1.7/1.8
1018
sourceCompatibility = 1.6
1119
targetCompatibility = 1.6
1220

1321
def pathToAndroidSdkPlatforms = "$System.env.ANDROID_HOME" + "/platforms"
1422

1523
dependencies {
16-
compile files(pathToAndroidSdkPlatforms + "/android-22/android.jar")
24+
compile files(pathToAndroidSdkPlatforms + "/" + compiteCompileSdkVersion() + "/android.jar")
1725
}
1826

1927
sourceSets {
@@ -24,7 +32,4 @@ sourceSets {
2432
}
2533
def isOutClassesDirSet = project.hasProperty("outClassesDir")
2634
main.output.classesDir = isOutClassesDirSet ? outClassesDir : "$rootDir/build/classesss"
27-
}
28-
29-
30-
35+
}

src/build.gradle

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def distDir = "$rootDir/dist"
2020
def isWinOs = System.properties['os.name'].toLowerCase().contains('windows')
2121
def pathToAndroidSdkPlatforms = "$System.env.ANDROID_HOME" + "/platforms"
2222
def pathToBindingGeneratorJar = "../binding-generator/Generator/build/libs/Generator.jar"
23+
def envVars = new LinkedList<String>()
2324

2425
buildscript {
2526
repositories {
@@ -71,6 +72,7 @@ def computeSupportVersion() {
7172
//configuration of the android plugin for gradle
7273
android {
7374
compileSdkVersion compiteCompileSdkVersion()
75+
envVars.addFirst("-PcompileSdk=" + compileSdkVersion);
7476
buildToolsVersion computeBuildToolsVersion()
7577

7678
defaultConfig {
@@ -172,13 +174,21 @@ task revertNdkConfiguration (type: Exec) {
172174
}
173175

174176
task generateBindingGeneratorClasses (type: Exec ) {
175-
workingDir "../binding-generator/Generator"
177+
workingDir "../binding-generator/Generator"
176178

177179
if(isWinOs) {
178-
commandLine "cmd", "/c", "gradlew", "build", "-PoutClassesDir=$rootDir/build/intermediates/classes/release"
180+
envVars.addFirst("-PoutClassesDir=$rootDir/build/intermediates/classes/release");
181+
envVars.addFirst("build");
182+
envVars.addFirst("gradlew");
183+
envVars.addFirst("/c");
184+
envVars.addFirst("cmd");
185+
commandLine envVars.toArray();
179186
}
180187
else {
181-
commandLine "./gradlew", "build", "-PoutClassesDir=$rootDir/build/intermediates/classes/release"
188+
envVars.addFirst("-PoutClassesDir=$rootDir/build/intermediates/classes/release");
189+
envVars.addFirst("build");
190+
envVars.addFirst("./gradlew");
191+
commandLine envVars.toArray();
182192
}
183193
}
184194

0 commit comments

Comments
 (0)