Skip to content

Commit 205b523

Browse files
authored
Rewrite code for binary size collection. (#1480)
* Rewrite code for binary size collection. - Move apk generation code into a separate gradle project. - Move metrics uploading code into fireci. - A failure from a SDK does not affect metrics collection for other SDKs. - Misc. cleanup.
1 parent fa026c9 commit 205b523

Some content is hidden

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

42 files changed

+347
-1007
lines changed

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ apply plugin: com.google.firebase.gradle.plugins.publish.PublishingPlugin
5656
apply plugin: com.google.firebase.gradle.plugins.ci.ContinuousIntegrationPlugin
5757
apply plugin: com.google.firebase.gradle.plugins.ci.SmokeTestsPlugin
5858
apply plugin: com.google.firebase.gradle.plugins.ci.metrics.MetricsPlugin
59-
apply plugin: com.google.firebase.gradle.plugins.measurement.coverage.CheckCoveragePlugin
59+
apply plugin: com.google.firebase.gradle.plugins.ci.CheckCoveragePlugin
6060

6161
firebaseContinuousIntegration {
6262
ignorePaths = [
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.

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

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

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

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

0 commit comments

Comments
 (0)