Skip to content

Commit e8d3028

Browse files
authored
[DEST-854] Update build and bump Firebase to 17.0.1 (#19)
* Update build * Bump Firebase dependency to 17.0.1
1 parent cfee3f2 commit e8d3028

File tree

13 files changed

+376
-127
lines changed

13 files changed

+376
-127
lines changed

.buildscript/deploy_snapshot.sh

-28
This file was deleted.

.buildscript/licenses/android-sdk-license

-1
This file was deleted.

.circleci/config.yml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
version: 2
2+
jobs:
3+
build:
4+
resource_class: large
5+
docker:
6+
- image: circleci/android:api-28
7+
environment:
8+
ANDROID_HOME: /home/circleci/android
9+
CIRCLE_JDK_VERSION: oraclejdk8
10+
steps:
11+
- checkout
12+
- run:
13+
name: Create folders
14+
command: mkdir -p /home/circleci/android/licenses
15+
- restore_cache:
16+
key: dependencies-{{ .Branch }}-{{ checksum "build.gradle" }}
17+
- run:
18+
name: Accept licenses
19+
command: cp /opt/android/sdk/licenses/* $ANDROID_HOME/licenses
20+
- run:
21+
name: Install dependencies
22+
command: ./gradlew dependencies
23+
- run:
24+
name: Run tests
25+
command: ./gradlew check test --profile
26+
- save_cache:
27+
key: dependencies-{{ .Branch }}-{{ checksum "build.gradle" }}
28+
paths:
29+
- /home/circleci/.android
30+
- /home/circleci/android
31+
- /home/circleci/.gradle
32+
- /usr/local/android-sdk-linux/platforms/android-28
33+
- /usr/local/android-sdk-linux/build-tools/28.0.0
34+
- /usr/local/android-sdk-linux/extras/android/m2repository
35+
- store_artifacts:
36+
path: analytics-core/build/test-report
37+
destination: reports
38+
- store_artifacts:
39+
path: analytics-integrations/*/build/test-report
40+
destination: reports
41+
- store_artifacts:
42+
path: build/reports/profile
43+
destination: reports
44+
- persist_to_workspace:
45+
root: .
46+
paths: [.]
47+
48+
publish_snapshot:
49+
resource_class: small
50+
docker:
51+
- image: circleci/android:api-28
52+
environment:
53+
ANDROID_HOME: /home/circleci/android
54+
CIRCLE_JDK_VERSION: oraclejdk8
55+
56+
steps:
57+
- attach_workspace: { at: . }
58+
- restore_cache:
59+
key: dependencies-{{ .Branch }}-{{ checksum "build.gradle" }}
60+
- run:
61+
name: Set up signature
62+
command: |
63+
if [ "$SIGNATURE_SECRET" == "" ]; then {
64+
echo "Invalid signature configuration"
65+
exit 1
66+
} fi
67+
base64 -d - <<< "$SIGNATURE_SECRET" > $SIGNATURE_SECRET_FILE
68+
gpg --batch --yes --import $SIGNATURE_SECRET_FILE <<< $SIGNATURE_PASSWORD
69+
- run:
70+
name: Publish SNAPSHOT
71+
command: ./gradlew uploadArchives
72+
73+
publish:
74+
resource_class: small
75+
docker:
76+
- image: circleci/android:api-28
77+
environment:
78+
ANDROID_HOME: /home/circleci/android
79+
CIRCLE_JDK_VERSION: oraclejdk8
80+
81+
steps:
82+
- attach_workspace: { at: . }
83+
- restore_cache:
84+
key: dependencies-{{ .Branch }}-{{ checksum "build.gradle" }}
85+
- run:
86+
name: Set up signature
87+
command: |
88+
if [ "$SIGNATURE_SECRET" == "" ]; then {
89+
echo "Invalid signature configuration"
90+
exit 1
91+
} fi
92+
base64 -d - <<< "$SIGNATURE_SECRET" > $SIGNATURE_SECRET_FILE
93+
gpg --batch --yes --import $SIGNATURE_SECRET_FILE <<< $SIGNATURE_PASSWORD
94+
- run:
95+
name: Verify tag
96+
command: |
97+
VERSION=$(grep VERSION gradle.properties | awk -F= '{ print $2 }' | awk -F- '{ print $1 }')
98+
if [ "$CIRCLE_TAG" != "$VERSION" ]; then {
99+
echo "Tag $CIRCLE_TAG does not match the package version ($VERSION)"
100+
exit 1
101+
} fi
102+
- run:
103+
name: Publish new version
104+
command: ./gradlew uploadArchives -Prelease
105+
- run:
106+
name: Mark release
107+
command: ./gradlew closeAndReleaseRepository
108+
109+
110+
workflows:
111+
version: 2
112+
run:
113+
jobs:
114+
- build:
115+
context: Android
116+
filters:
117+
tags:
118+
only: /.*/
119+
- publish_snapshot:
120+
context: Android
121+
requires: [ build ]
122+
filters:
123+
branches:
124+
only: /master/
125+
tags:
126+
only: /.*/
127+
- publish:
128+
context: Android
129+
requires: [ build ]
130+
filters:
131+
branches:
132+
ignore: /.*/
133+
tags:
134+
only: /[0-9]+(\.[0-9]+)*(-.+)?/

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ To install the Segment-Firebase integration, simply add this line to your gradle
1414
compile 'com.segment.analytics.android.integrations:firebase:+'
1515
```
1616

17+
Don't forget to add the following dependencies to make sure [Firebase works](https://firebase.google.com/docs/android/setup/):
18+
```
19+
apply plugin: 'com.android.application'
20+
21+
android {
22+
// ...
23+
}
24+
25+
// Add the following line to the bottom of the file:
26+
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
27+
```
28+
1729
## Usage
1830

1931
After adding the dependency, you must register the integration with our SDK. To do this, import the Firebase integration:

RELEASING.md

-12
This file was deleted.

build.gradle

+41-28
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,79 @@
11
buildscript {
22
repositories {
3+
mavenCentral()
34
jcenter()
45
google()
56
}
67

78
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.1.3'
9+
classpath 'com.android.tools.build:gradle:3.2.0'
910
classpath 'com.f2prateek.javafmt:javafmt:0.1.6'
11+
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0'
1012
}
1113
}
1214

15+
// Use -Prelease or $ORG_GRADLE_PROJECT_RELEASE="true" to mark the project as a release
16+
ext.isRelease = hasProperty('release')
17+
1318
apply plugin: 'com.android.library'
1419
apply plugin: 'com.f2prateek.javafmt'
1520

1621
android {
17-
compileSdkVersion 26
18-
buildToolsVersion '27.0.3'
22+
compileSdkVersion 28
23+
buildToolsVersion '28.0.2'
1924

2025
defaultConfig {
2126
minSdkVersion 14
22-
targetSdkVersion 26
23-
compileSdkVersion 26
27+
targetSdkVersion 28
2428
}
2529

2630
compileOptions {
2731
sourceCompatibility JavaVersion.VERSION_1_7
2832
targetCompatibility JavaVersion.VERSION_1_7
2933
}
3034

35+
36+
lintOptions {
37+
abortOnError false
38+
}
39+
3140
testOptions {
32-
// unitTests.returnDefaultValues = true
41+
unitTests {
42+
all {
43+
jvmArgs '-noverify'
44+
}
45+
includeAndroidResources = true
46+
}
3347
}
3448
}
3549

3650
dependencies {
3751
repositories {
52+
mavenCentral()
3853
jcenter()
39-
maven {
40-
url "https://maven.google.com"
41-
}
54+
google()
4255
}
4356

44-
implementation 'com.google.firebase:firebase-core:16.0.3'
45-
46-
implementation 'com.segment.analytics.android:analytics:4.2.6'
47-
48-
testImplementation 'com.segment.analytics.android:analytics-tests:4.2.6'
57+
api 'com.segment.analytics.android:analytics:4.3.1'
58+
api 'com.google.firebase:firebase-core:17.0.1'
4959

60+
testImplementation 'com.segment.analytics.android:analytics-tests:4.3.1'
5061
testImplementation 'junit:junit:4.12'
51-
52-
testImplementation 'org.robolectric:robolectric:3.4.2'
53-
54-
testImplementation 'org.assertj:assertj-core:1.7.1'
55-
56-
testImplementation 'org.mockito:mockito-core:1.10.19'
57-
58-
testImplementation 'org.powermock:powermock:1.6.6'
59-
testImplementation 'org.powermock:powermock-module-junit4:1.6.6'
60-
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.6'
61-
testImplementation 'org.powermock:powermock-api-mockito:1.6.6'
62-
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.6'
62+
testImplementation 'org.skyscreamer:jsonassert:1.5.0'
63+
testImplementation 'org.robolectric:robolectric:4.3'
64+
testImplementation 'org.mockito:mockito-core:2.28.0'
65+
66+
// Required for local (non-android) testing
67+
testImplementation 'org.json:json:20180813'
68+
69+
testImplementation 'org.powermock:powermock-core:2.0.2'
70+
testImplementation 'org.powermock:powermock-module-junit4:2.0.2'
71+
testImplementation 'org.powermock:powermock-module-junit4-rule:2.0.2'
72+
testImplementation 'org.powermock:powermock-api-mockito2:2.0.2'
73+
testImplementation 'org.powermock:powermock-classloading-xstream:2.0.2'
6374
}
6475

65-
apply plugin: 'com.f2prateek.javafmt'
66-
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
76+
apply from: rootProject.file('gradle/attach-jar.gradle')
77+
apply from: rootProject.file('gradle/upload.gradle')
78+
apply from: rootProject.file('gradle/sign.gradle')
79+
apply from: rootProject.file('gradle/promote.gradle')

circle.yml

-28
This file was deleted.

gradle.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
GROUP=com.segment.analytics.android.integrations
22

3-
VERSION_CODE=121
4-
VERSION_NAME=1.2.1-SNAPSHOT
3+
VERSION=1.3.0
54

65
POM_ARTIFACT_ID=firebase
76
POM_PACKAGING=aar

gradle/promote.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
apply plugin: 'io.codearte.nexus-staging'
3+
4+
nexusStaging {
5+
packageGroup = "com.segment.analytics.android.integrations"
6+
stagingProfileId = "73905a9e454559"
7+
}

gradle/sign.gradle

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
import org.gradle.plugins.signing.Sign
3+
4+
// We inject the signature configuration from env vars
5+
gradle.taskGraph.whenReady { taskGraph ->
6+
if (taskGraph.allTasks.any { it instanceof Sign }) {
7+
8+
def id = System.getenv("SIGNATURE_KEY_ID")
9+
def file = System.getenv("SIGNATURE_SECRET_FILE")
10+
def password = System.getenv("SIGNATURE_PASSWORD")
11+
12+
if (id == null || id.isEmpty() || file == null || file.isEmpty() || password == null || password.isEmpty()) {
13+
throw new InvalidUserDataException("Signature is not properly configured. See README.md")
14+
}
15+
16+
allprojects { ext."signing.keyId" = id }
17+
allprojects { ext."signing.secretKeyRingFile" = file }
18+
allprojects { ext."signing.password" = password }
19+
20+
}
21+
}
22+
23+
apply plugin: 'signing'
24+
25+
signing {
26+
sign configurations.archives
27+
}

0 commit comments

Comments
 (0)