Skip to content

Commit 7f9e234

Browse files
committed
Merge branch 'master' of github.com:firebase/firebase-android-sdk
2 parents c153bf5 + 2f8e8ac commit 7f9e234

File tree

94 files changed

+967
-1350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+967
-1350
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ Firebase Android libraries exercise all three types of tests recommended by the
6363
Depending on the requirements of the specific project, some or all of these
6464
tests may be used to support changes.
6565

66+
> :warning: **Running tests with errorprone**
67+
>
68+
> To run with errorprone add `withErrorProne` to the command line, e.g.
69+
>
70+
> `./gradlew :<firebase-project>:check withErrorProne`.
71+
6672
### Unit Testing
6773

6874
These are tests that run on your machine's local Java Virtual Machine (JVM). At

apk-size/apk-size.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
buildscript {
16+
17+
repositories {
18+
google()
19+
jcenter()
20+
21+
}
22+
dependencies {
23+
classpath 'com.android.tools.build:gradle:3.4.2'
24+
}
25+
}
26+
27+
apply from: '../sdkProperties.gradle'
28+
29+
task clean(type: Delete) {
30+
delete rootProject.buildDir
31+
}

apk-size/app/build.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
apply plugin: "com.android.application"
16+
apply from: "default.gradle"
17+
android {
18+
flavorDimensions "apkSize"
19+
20+
compileOptions {
21+
sourceCompatibility JavaVersion.VERSION_1_8
22+
targetCompatibility JavaVersion.VERSION_1_8
23+
}
24+
}
25+
26+
apply from: "src/base/base.gradle"
27+
apply from: "configure.gradle"

apk-size/app/configure.gradle

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
16+
repositories {
17+
maven {
18+
url '../../build/m2repository/'
19+
}
20+
google()
21+
jcenter()
22+
}
23+
24+
// firebase-inappmessaging-display fails with `java.lang.OutOfMemoryError (no error message)`
25+
// in task `:transformDexArchiveWithExternalLibsDexMergerForFirebase-inappmessaging-displayRelease`
26+
//
27+
// firebase-inappmessaging-display-ktx fails with `java.lang.OutOfMemoryError: GC overhead limit exceeded`
28+
// in task `:transformClassesAndResourcesWithR8ForFirebase-inappmessaging-display-ktxAggressive`
29+
//
30+
// Setting max heap size to 16g in gradle.properties and android.dexOptions did not help.
31+
// When running with `gradle --continue`, failing tasks did not timeout. Thus, disable for now.
32+
// TODO (yifany): Needs further investigation.
33+
def blacklist = [
34+
'firebase-inappmessaging-display',
35+
'firebase-inappmessaging-display-ktx'
36+
]
37+
if (project.hasProperty('sdks')) {
38+
project.android {
39+
sdks.split(',').each { sdk ->
40+
def (groupId, artifactId, version) = sdk.split(':')
41+
if (blacklist.contains(artifactId)) {
42+
return
43+
}
44+
productFlavors.create(artifactId) {
45+
dimension 'apkSize'
46+
}
47+
dependencies.add("${artifactId}Implementation", sdk)
48+
}
49+
}
50+
}

apk-size/settings.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
rootProject.name='apk-size'
16+
rootProject.buildFileName='apk-size.gradle'
17+
include ':app'

build.gradle

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,20 @@ buildscript {
4343
}
4444

4545
apply from: 'sdkProperties.gradle'
46+
apply from: "gradle/errorProne.gradle"
4647

4748
ext {
4849
playServicesVersion = '16.0.1'
4950
supportAnnotationsVersion = '28.0.0'
50-
errorproneVersion = '2.3.2'
51-
errorproneJavacVersion = '9+181-r4173-1'
5251
googleTruthVersion = '0.45'
53-
robolectricVersion = '4.1'
52+
robolectricVersion = '4.3.1'
5453
}
5554

5655
apply plugin: com.google.firebase.gradle.plugins.publish.PublishingPlugin
5756
apply plugin: com.google.firebase.gradle.plugins.ci.ContinuousIntegrationPlugin
5857
apply plugin: com.google.firebase.gradle.plugins.ci.SmokeTestsPlugin
5958
apply plugin: com.google.firebase.gradle.plugins.ci.metrics.MetricsPlugin
60-
apply plugin: com.google.firebase.gradle.plugins.measurement.coverage.CheckCoveragePlugin
59+
apply plugin: com.google.firebase.gradle.plugins.ci.CheckCoveragePlugin
6160

6261
firebaseContinuousIntegration {
6362
ignorePaths = [
@@ -72,12 +71,7 @@ configure(subprojects) {
7271
jcenter()
7372
mavenLocal()
7473
}
75-
apply plugin: 'net.ltgt.errorprone'
76-
dependencies {
77-
errorprone "com.google.errorprone:error_prone_core:$errorproneVersion"
78-
errorproneJavac "com.google.errorprone:javac:$errorproneJavacVersion"
7974

80-
}
8175
apply plugin: 'com.github.sherter.google-java-format'
8276
googleJavaFormat {
8377
toolVersion = '1.7'
@@ -99,10 +93,6 @@ configure(subprojects) {
9993
exclude '**/package-info.java'
10094
}
10195

102-
tasks.withType(JavaCompile) {
103-
options.errorprone.excludedPaths = '.*/build/generated/.*'
104-
}
105-
10696
apply plugin: "org.jlleitschuh.gradle.ktlint"
10797
}
10898

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2020 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.gradle.plugins;
16+
17+
import groovy.lang.Closure;
18+
import java.util.function.Consumer;
19+
20+
public final class ClosureUtil {
21+
22+
private static final Object FAKE_THIS = new Object();
23+
24+
private ClosureUtil() {}
25+
26+
/** Create a groovy closure backed by a lambda. */
27+
public static <T> Closure<T> closureOf(Consumer<T> action) {
28+
return new Closure<T>(FAKE_THIS) {
29+
void doCall(T t) {
30+
action.accept(t);
31+
}
32+
};
33+
}
34+
}

buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/FirebaseLibraryPlugin.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
package com.google.firebase.gradle.plugins;
1616

17+
import static com.google.firebase.gradle.plugins.ClosureUtil.closureOf;
18+
1719
import com.android.build.gradle.LibraryExtension;
1820
import com.android.build.gradle.api.AndroidSourceSet;
1921
import com.google.common.collect.ImmutableList;
@@ -51,6 +53,20 @@ public void apply(Project project) {
5153
.getByName("release")
5254
.setSigningConfig(types.getByName("debug").getSigningConfig()));
5355

56+
// see https://github.com/robolectric/robolectric/issues/5456
57+
android.testOptions(
58+
options ->
59+
options
60+
.getUnitTests()
61+
.all(
62+
closureOf(
63+
test -> {
64+
test.systemProperty("robolectric.dependency.repo.id", "central");
65+
test.systemProperty(
66+
"robolectric.dependency.repo.url", "https://repo1.maven.org/maven2");
67+
test.systemProperty("javax.net.ssl.trustStoreType", "JKS");
68+
})));
69+
5470
// skip debug tests in CI
5571
// TODO(vkryachko): provide ability for teams to control this if needed
5672
if (System.getenv().containsKey("FIREBASE_CI")) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
package com.google.firebase.gradle.plugins.measurement.coverage
15+
package com.google.firebase.gradle.plugins.ci
1616

1717
import com.google.firebase.gradle.plugins.FirebaseLibraryExtension
1818
import com.google.firebase.gradle.plugins.FirebaseLibraryPlugin

buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/measurement/MetricsReportUploader.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)