Skip to content

Commit 5d119f1

Browse files
(feat): refactor gradle to use latest builds and to build for java 1.8 (#251)
* refactor gradle to use latest builds and to build for java 1.8 * fix travis build
1 parent d123071 commit 5d119f1

File tree

10 files changed

+52
-44
lines changed

10 files changed

+52
-44
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ language: android
22
env:
33
global:
44
# These parameters should match the parameters for build tools and sdk versions in the gradle file
5-
- ANDROID_BUILD_TOOLS=27.0.0 # should match gradle
5+
- ANDROID_BUILD_TOOLS=28.0.3 # should match gradle
66
- ADB_INSTALL_TIMEOUT=5 # minutes
7-
- ANDROID_API=26 # api is same as gradle file
7+
- ANDROID_API=28 # api is same as gradle file
88
matrix:
99
- EMULATOR_API=22
1010
- EMULATOR_API=21
@@ -34,6 +34,8 @@ cache:
3434
directories:
3535
- $HOME/.gradle/caches/
3636
- $HOME/.gradle/wrapper/
37+
before_install:
38+
- yes | sdkmanager "platforms;android-28"
3739
before_script:
3840
- echo $TRAVIS_BRANCH
3941
- echo $TRAVIS_TAG

android-sdk/build.gradle

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ android {
4848
}
4949

5050
compileOptions {
51-
sourceCompatibility JavaVersion.VERSION_1_7
52-
targetCompatibility JavaVersion.VERSION_1_7
51+
sourceCompatibility JavaVersion.VERSION_1_8
52+
targetCompatibility JavaVersion.VERSION_1_8
5353
}
5454

5555
dexOptions {
@@ -65,6 +65,7 @@ dependencies {
6565
compile ("com.optimizely.ab:core-api:$java_core_ver") {
6666
exclude group: 'com.google.code.findbugs'
6767
}
68+
6869
compile "com.android.support:support-annotations:$support_annotations_ver"
6970

7071
testCompile "junit:junit:$junit_ver"
@@ -102,13 +103,14 @@ android.libraryVariants.all { variant ->
102103

103104
title = "Optimizely X Android SDK"
104105

105-
options.links("http://docs.oracle.com/javase/7/docs/api/");
106+
options.links("http://docs.oracle.com/javase/8/docs/api/");
106107
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
107108

108-
// First add all of your dependencies to the classpath, then add the android jars
109-
classpath += files(variant.javaCompile.classpath.files)
110-
classpath += files(android.getBootClasspath())
111-
109+
doFirst {
110+
// First add all of your dependencies to the classpath, then add the android jars
111+
classpath += files(variant.javaCompile.classpath.files)
112+
classpath += files(android.getBootClasspath())
113+
}
112114
// We're excluding these generated files
113115
exclude '**/BuildConfig.java'
114116
exclude '**/R.java'

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ buildscript {
3434
google()
3535
}
3636
dependencies {
37-
classpath 'com.android.tools.build:gradle:3.0.1'
37+
classpath 'com.android.tools.build:gradle:3.3.1'
3838

3939
// NOTE: Do not place your application dependencies here; they belong
4040
// in the individual module build.gradle files
@@ -49,10 +49,10 @@ allprojects {
4949
}
5050

5151
ext {
52-
compile_sdk_version = 26
53-
build_tools_version = "27.0.0"
52+
compile_sdk_version = 28
53+
build_tools_version = "28.0.3"
5454
min_sdk_version = 14
55-
target_sdk_version = 26
55+
target_sdk_version = 28
5656
java_core_ver = "3.0.0-RC2"
5757
android_logger_ver = "1.3.6"
5858
support_annotations_ver = "24.2.1"

datafile-handler/build.gradle

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ android {
4646
}
4747
}
4848
compileOptions {
49-
sourceCompatibility JavaVersion.VERSION_1_7
50-
targetCompatibility JavaVersion.VERSION_1_7
49+
sourceCompatibility JavaVersion.VERSION_1_8
50+
targetCompatibility JavaVersion.VERSION_1_8
5151
}
5252
}
5353

@@ -89,13 +89,14 @@ android.libraryVariants.all { variant ->
8989

9090
title = "Optimizely X Android Datafile Handler"
9191

92-
options.links("http://docs.oracle.com/javase/7/docs/api/");
92+
options.links("http://docs.oracle.com/javase/8/docs/api/");
9393
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
9494

9595
// First add all of your dependencies to the classpath, then add the android jars
96-
classpath += files(variant.javaCompile.classpath.files)
97-
classpath += files(android.getBootClasspath())
98-
96+
doFirst {
97+
classpath += files(variant.javaCompile.classpath.files)
98+
classpath += files(android.getBootClasspath())
99+
}
99100
// We're excluding these generated files
100101
exclude '**/BuildConfig.java'
101102
exclude '**/R.java'

event-handler/build.gradle

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ android {
4646
}
4747
}
4848
compileOptions {
49-
sourceCompatibility JavaVersion.VERSION_1_7
50-
targetCompatibility JavaVersion.VERSION_1_7
49+
sourceCompatibility JavaVersion.VERSION_1_8
50+
targetCompatibility JavaVersion.VERSION_1_8
5151
}
52-
buildToolsVersion '27.0.0'
52+
buildToolsVersion '28.0.3'
5353
}
5454

5555
dependencies {
@@ -90,13 +90,14 @@ android.libraryVariants.all { variant ->
9090

9191
title = "Optimizely X Android Event Handler"
9292

93-
options.links("http://docs.oracle.com/javase/7/docs/api/");
93+
options.links("http://docs.oracle.com/javase/8/docs/api/");
9494
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
9595

9696
// First add all of your dependencies to the classpath, then add the android jars
97-
classpath += files(variant.javaCompile.classpath.files)
98-
classpath += files(android.getBootClasspath())
99-
97+
doFirst {
98+
classpath += files(variant.javaCompile.classpath.files)
99+
classpath += files(android.getBootClasspath())
100+
}
100101
// We're excluding these generated files
101102
exclude '**/BuildConfig.java'
102103
exclude '**/R.java'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Feb 07 11:56:04 PST 2018
1+
#Mon Feb 11 13:52:51 PST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

shared/build.gradle

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ android {
4646
}
4747
}
4848
compileOptions {
49-
sourceCompatibility JavaVersion.VERSION_1_7
50-
targetCompatibility JavaVersion.VERSION_1_7
49+
sourceCompatibility JavaVersion.VERSION_1_8
50+
targetCompatibility JavaVersion.VERSION_1_8
5151
}
52-
buildToolsVersion '27.0.0'
52+
buildToolsVersion '28.0.1'
5353
}
5454

5555
dependencies {
@@ -94,13 +94,14 @@ android.libraryVariants.all { variant ->
9494

9595
title = "Optimizely X Android Shared"
9696

97-
options.links("http://docs.oracle.com/javase/7/docs/api/");
97+
options.links("http://docs.oracle.com/javase/8/docs/api/");
9898
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
9999

100100
// First add all of your dependencies to the classpath, then add the android jars
101-
classpath += files(variant.javaCompile.classpath.files)
102-
classpath += files(android.getBootClasspath())
103-
101+
doFirst {
102+
classpath += files(variant.javaCompile.classpath.files)
103+
classpath += files(android.getBootClasspath())
104+
}
104105
// We're excluding these generated files
105106
exclude '**/BuildConfig.java'
106107
exclude '**/R.java'

test-app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ dependencies {
4242
}
4343

4444
// compile 'com.optimizely.ab:android-sdk:1.0.0'
45-
compile 'com.android.support:appcompat-v7:24.2.1'
46-
compile 'com.android.support:design:24.2.1'
45+
compile 'com.android.support:appcompat-v7:28.0.0'
46+
compile 'com.android.support:design:28.0.0'
4747
// EXAMPLE REPLACE noveogroup android-looger with slf4j-android logger
4848
// https://mvnrepository.com/artifact/org.slf4j/slf4j-android
4949
compile group: 'org.slf4j', name: 'slf4j-android', version: '1.7.25'
@@ -57,7 +57,7 @@ dependencies {
5757
testCompile project(':android-sdk')
5858

5959
androidTestCompile("com.android.support.test:runner:$support_test_runner_ver")
60-
androidTestCompile "com.android.support:support-annotations:24.2.1"
60+
androidTestCompile "com.android.support:support-annotations:28.0.0"
6161
// Set this dependency to use JUnit 4 rules
6262
androidTestCompile "com.android.support.test:rules:$support_test_runner_ver"
6363
// Set this dependency to build and run Espresso tests

test-app/src/main/java/com/optimizely/ab/android/test_app/MyApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public void onCreate() {
7575
OptimizelyManager.Builder builder = OptimizelyManager.builder();
7676
optimizelyManager = builder.withEventDispatchInterval(60L * 10L)
7777
.withDatafileDownloadInterval(60L * 10L)
78-
.withSDKKey("6hmwpgZcRFp36wH5QLK8Sb")
78+
.withSDKKey("FCnSegiEkRry9rhVMroit4")
7979
.build(getApplicationContext());
8080
}
8181
}

user-profile/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ android {
4646
}
4747
}
4848
compileOptions {
49-
sourceCompatibility JavaVersion.VERSION_1_7
50-
targetCompatibility JavaVersion.VERSION_1_7
49+
sourceCompatibility JavaVersion.VERSION_1_8
50+
targetCompatibility JavaVersion.VERSION_1_8
5151
}
5252
}
5353

@@ -93,9 +93,10 @@ android.libraryVariants.all { variant ->
9393
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
9494

9595
// First add all of your dependencies to the classpath, then add the android jars
96-
classpath += files(variant.javaCompile.classpath.files)
97-
classpath += files(android.getBootClasspath())
98-
96+
doFirst {
97+
classpath += files(variant.javaCompile.classpath.files)
98+
classpath += files(android.getBootClasspath())
99+
}
99100
// We're excluding these generated files
100101
exclude '**/BuildConfig.java'
101102
exclude '**/R.java'

0 commit comments

Comments
 (0)