From 8106e5e9bf968e5256d674667d114399ef313d1e Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Tue, 14 Aug 2018 10:35:15 +0200 Subject: [PATCH] Make it possible to use a custom AAR to build servoapp --- support/android/apk/servoapp/build.gradle | 6 ++++- .../android/apk/servoview-local/build.gradle | 12 ++++++++++ support/android/apk/settings.gradle | 24 ++++++++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 support/android/apk/servoview-local/build.gradle diff --git a/support/android/apk/servoapp/build.gradle b/support/android/apk/servoapp/build.gradle index 7355fc018514..abb49af4b1a8 100644 --- a/support/android/apk/servoapp/build.gradle +++ b/support/android/apk/servoapp/build.gradle @@ -123,5 +123,9 @@ android { dependencies { implementation 'com.android.support.constraint:constraint-layout:1.1.2' - implementation project(':servoview') + if (findProject(':servoview-local')) { + implementation project(':servoview-local') + } else { + implementation project(':servoview') + } } diff --git a/support/android/apk/servoview-local/build.gradle b/support/android/apk/servoview-local/build.gradle new file mode 100644 index 000000000000..f00a8239e232 --- /dev/null +++ b/support/android/apk/servoview-local/build.gradle @@ -0,0 +1,12 @@ +configurations.maybeCreate("default") + +if (gradle.hasProperty('servoViewLocal')) { + def aar = new File(gradle.servoViewLocal) + if (aar.exists()) { + artifacts.add('default', aar) + } else { + throw new GradleException('Failed to find ServoView AAR at: ' + gradle.servoViewLocal) + } +} else { + throw new GradleException('Local ServoView AAR path not defined') +} diff --git a/support/android/apk/settings.gradle b/support/android/apk/settings.gradle index 196244ebecae..3d36551554c6 100644 --- a/support/android/apk/settings.gradle +++ b/support/android/apk/settings.gradle @@ -1 +1,23 @@ -include ':servoapp', ':servoview' +include ':servoapp' + +def userPropertiesFile = new File('user.properties') +if (userPropertiesFile.exists()) { + println("Loading user.properties") + def props = new Properties() + userPropertiesFile.withInputStream { + props.load(it) + } + props.each { prop -> + println(prop.key + " = " + prop.value) + gradle.ext.set(prop.key, prop.value) + } + if (gradle.hasProperty('servoViewLocal')) { + println("Using local build of servoview") + include ':servoview-local' + project(':servoview-local').projectDir = new File('servoview-local') + } else { + include ':servoview' + } +} else { + include ':servoview' +}