Skip to content

Commit 288ec66

Browse files
Merge branch 'master' into mrschmidt-sslerror
2 parents b188eae + 8eb2e7e commit 288ec66

File tree

52 files changed

+1208
-173
lines changed

Some content is hidden

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

52 files changed

+1208
-173
lines changed

buildSrc/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ dependencies {
3737
implementation 'org.jsoup:jsoup:1.11.2'
3838
implementation 'digital.wup:android-maven-publish:3.6.2'
3939
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20'
40+
implementation 'org.json:json:20180813'
4041

4142
implementation 'io.opencensus:opencensus-api:0.18.0'
4243
implementation 'io.opencensus:opencensus-exporter-stats-stackdriver:0.18.0'
4344
runtime 'io.opencensus:opencensus-impl:0.18.0'
4445

4546
implementation 'com.android.tools.build:gradle:3.2.1'
4647
testImplementation 'junit:junit:4.12'
47-
testImplementation 'org.json:json:20180813'
4848
testImplementation('org.spockframework:spock-core:1.1-groovy-2.4') {
4949
exclude group: 'org.codehaus.groovy'
5050
}

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.firebase.gradle.plugins.ci.device.FirebaseTestServer;
2121
import org.gradle.api.Plugin;
2222
import org.gradle.api.Project;
23-
import org.gradle.api.tasks.bundling.Jar;
2423
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile;
2524

2625
public class FirebaseLibraryPlugin implements Plugin<Project> {
@@ -33,6 +32,28 @@ public void apply(Project project) {
3332

3433
LibraryExtension android = project.getExtensions().getByType(LibraryExtension.class);
3534

35+
// In the case of and android library signing config only affects instrumentation test APK.
36+
// We need it signed with default debug credentials in order for FTL to accept the APK.
37+
android.buildTypes(
38+
types ->
39+
types
40+
.getByName("release")
41+
.setSigningConfig(types.getByName("debug").getSigningConfig()));
42+
43+
// skip debug tests in CI
44+
// TODO(vkryachko): provide ability for teams to control this if needed
45+
if (System.getenv().containsKey("FIREBASE_CI")) {
46+
android.setTestBuildType("release");
47+
project
48+
.getTasks()
49+
.all(
50+
task -> {
51+
if ("testDebugUnitTest".equals(task.getName())) {
52+
task.setEnabled(false);
53+
}
54+
});
55+
}
56+
3657
android.testServer(new FirebaseTestServer(project, firebaseLibrary.testLab));
3758

3859
// reduce the likelihood of kotlin module files colliding.

buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/ci/AffectedProjectFinder.groovy

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ class AffectedProjectFinder {
2525
Set<String> changedPaths;
2626

2727
@Builder
28+
AffectedProjectFinder(Project project, List<Pattern> ignorePaths) {
29+
this(project, changedPaths(project.rootDir), ignorePaths)
30+
}
31+
2832
AffectedProjectFinder(Project project,
2933
Set<String> changedPaths,
3034
List<Pattern> ignorePaths) {
@@ -49,6 +53,13 @@ class AffectedProjectFinder {
4953
return project.subprojects
5054
}
5155

56+
private static Set<String> changedPaths(File workDir) {
57+
return 'git diff --name-only --submodule=diff HEAD@{0} HEAD@{1}'
58+
.execute([], workDir)
59+
.text
60+
.readLines()
61+
}
62+
5263
/**
5364
* Performs a post-order project tree traversal and returns a set of projects that own the
5465
* 'changedPaths'.

buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/ci/ContinuousIntegrationPlugin.groovy

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ class ContinuousIntegrationPlugin implements Plugin<Project> {
9797

9898
def affectedProjects = AffectedProjectFinder.builder()
9999
.project(project)
100-
.changedPaths(changedPaths(project.rootDir))
101100
.ignorePaths(extension.ignorePaths)
102101
.build()
103102
.find()
@@ -143,13 +142,6 @@ class ContinuousIntegrationPlugin implements Plugin<Project> {
143142
}
144143
}
145144

146-
private static Set<String> changedPaths(File workDir) {
147-
return 'git diff --name-only --submodule=diff HEAD@{0} HEAD@{1}'
148-
.execute([], workDir)
149-
.text
150-
.readLines()
151-
}
152-
153145
private static final ANDROID_PLUGINS = ["com.android.application", "com.android.library",
154146
"com.android.test"]
155147

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
package com.google.firebase.gradle.plugins.ci
16+
17+
import com.google.firebase.gradle.plugins.FirebaseLibraryExtension
18+
import com.google.firebase.gradle.plugins.ci.AffectedProjectFinder
19+
import org.gradle.api.Plugin
20+
import org.gradle.api.Project
21+
import org.gradle.api.artifacts.ProjectDependency
22+
import org.json.JSONArray
23+
import org.json.JSONObject
24+
25+
/** Builds Firebase libraries for consumption by the smoke tests. */
26+
class SmokeTestsPlugin implements Plugin<Project> {
27+
@Override
28+
public void apply(Project project) {
29+
def assembleAllTask = project.task("assembleAllForSmokeTests")
30+
31+
// Wait until after the projects have been evaluated or else we might skip projects.
32+
project.gradle.projectsEvaluated {
33+
def changedProjects = getChangedProjects(project)
34+
def changedArtifacts = new HashSet<String>()
35+
def allArtifacts = new HashSet<String>()
36+
37+
// Visit each project and add the artifacts to the appropriate sets.
38+
project.subprojects {
39+
def firebaseLibrary = it.extensions.findByType(FirebaseLibraryExtension)
40+
if (firebaseLibrary == null) {
41+
return
42+
}
43+
44+
def groupId = firebaseLibrary.groupId.get()
45+
def artifactId = firebaseLibrary.artifactId.get()
46+
def artifact = "$groupId:$artifactId:$it.version-SNAPSHOT"
47+
allArtifacts.add(artifact)
48+
49+
if (changedProjects.contains(it)) {
50+
changedArtifacts.add(artifact)
51+
}
52+
}
53+
54+
// Reuse the publish task for building the libraries.
55+
def publishAllTask = project.tasks.getByPath("publishAllToBuildDir")
56+
assembleAllTask.dependsOn(publishAllTask)
57+
58+
// Generate a JSON file listing the artifacts after everything is complete.
59+
assembleAllTask.doLast {
60+
def changed = new JSONArray()
61+
changedArtifacts.each { changed.put(it) }
62+
63+
def all = new JSONArray()
64+
allArtifacts.each { all.put(it) }
65+
66+
def json = new JSONObject()
67+
json.put("all", all)
68+
json.put("changed", changed)
69+
70+
def path = project.buildDir.toPath()
71+
path.resolve("m2repository/changed-artifacts.json").write(json.toString())
72+
}
73+
}
74+
}
75+
76+
private static Set<Project> getChangedProjects(Project p) {
77+
Set<Project> roots = new AffectedProjectFinder(p, []).find()
78+
HashSet<Project> changed = new HashSet<>()
79+
80+
getChangedProjectsLoop(roots, changed)
81+
return changed
82+
}
83+
84+
private static void getChangedProjectsLoop(Collection<Project> projects, Set<Project> changed) {
85+
for (Project p : projects) {
86+
// Skip project if it is not a Firebase library.
87+
if (p.extensions.findByType(FirebaseLibraryExtension) == null) {
88+
continue;
89+
}
90+
91+
// Skip processing and recursion if this project has already been added to the set.
92+
if (!changed.add(p)) {
93+
continue;
94+
}
95+
96+
// Find all (head) dependencies to other projects in this respository.
97+
def all = p.configurations.releaseRuntimeClasspath.allDependencies
98+
def affected =
99+
all.findAll { it instanceof ProjectDependency }.collect { it.getDependencyProject() }
100+
101+
// Recurse with the new dependencies.
102+
getChangedProjectsLoop(affected, changed)
103+
}
104+
}
105+
}

buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/license/RemoteLicenseFetcher.groovy

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import org.jsoup.nodes.Document
2121

2222
/**
2323
* Parse licenses from remote urls*/
24-
class RemoteLicenseFetcher implements Serializable {
24+
abstract class RemoteLicenseFetcher implements Serializable {
2525
private static final HtmlToPlainText TEXT_FORMATTER = new HtmlToPlainText()
2626

2727
private final String remoteUrl
@@ -51,7 +51,7 @@ class RemoteLicenseFetcher implements Serializable {
5151
Thread.sleep(i * 1000)
5252
}
5353

54-
return processDocument(Jsoup.connect(remoteUrl).get())
54+
return getTextAttempt()
5555
} catch (IOException ex) {
5656
if (storedEx == null) {
5757
storedEx = ex
@@ -64,10 +64,8 @@ class RemoteLicenseFetcher implements Serializable {
6464
throw storedEx
6565
}
6666

67-
/** Extracts the license text from the rest of the document. */
68-
String processDocument(Document doc) {
69-
return TEXT_FORMATTER.getPlainText(doc)
70-
}
67+
/** Attempts to download and extract the license exactly once. */
68+
abstract String getTextAttempt()
7169

7270
static final class AndroidSdkTermsFetcher extends RemoteLicenseFetcher {
7371

@@ -76,10 +74,11 @@ class RemoteLicenseFetcher implements Serializable {
7674
}
7775

7876
@Override
79-
String processDocument(Document doc) {
77+
String getTextAttempt() {
8078
// TODO(vkryachko, allisonbm92): Fix this silent failure.
8179
// This evaluates to an empty string. The HTML for this page must have changed since this
8280
// filter was original written. Interestingly, this is a hard-failure if run from Java.
81+
def doc = Jsoup.connect(getRemoteUrl()).get()
8382
return TEXT_FORMATTER.getPlainText(doc.select("#body-content > div.jd-descr > div")[0])
8483
}
8584
}
@@ -89,6 +88,11 @@ class RemoteLicenseFetcher implements Serializable {
8988
Apache2LicenseFetcher() {
9089
super("http://www.apache.org/licenses/LICENSE-2.0.txt")
9190
}
91+
92+
@Override
93+
String getTextAttempt() {
94+
return getRemoteUrl().toURL().getText()
95+
}
9296
}
9397

9498
static final class AnotherApache2LicenseFetcher extends RemoteLicenseFetcher {
@@ -98,7 +102,8 @@ class RemoteLicenseFetcher implements Serializable {
98102
}
99103

100104
@Override
101-
String processDocument(Document doc) {
105+
String getTextAttempt() {
106+
def doc = Jsoup.connect(getRemoteUrl()).get()
102107
return TEXT_FORMATTER.getPlainText(doc.select("#content-wrapper").get(0))
103108
}
104109
}
@@ -108,6 +113,11 @@ class RemoteLicenseFetcher implements Serializable {
108113
YetAnotherApache2LicenseFetcher() {
109114
super("http://www.apache.org/licenses/LICENSE-2.0")
110115
}
116+
117+
@Override
118+
String getTextAttempt() {
119+
return getRemoteUrl().toURL().getText()
120+
}
111121
}
112122

113123
static final class BSDLicenseFetcher extends RemoteLicenseFetcher {
@@ -117,7 +127,8 @@ class RemoteLicenseFetcher implements Serializable {
117127
}
118128

119129
@Override
120-
String processDocument(Document doc) {
130+
String getTextAttempt() {
131+
def doc = Jsoup.connect(getRemoteUrl()).get()
121132
return TEXT_FORMATTER.getPlainText(doc.select("#content-wrapper").get(0))
122133
}
123134
}
@@ -129,7 +140,8 @@ class RemoteLicenseFetcher implements Serializable {
129140
}
130141

131142
@Override
132-
String processDocument(Document doc) {
143+
String getTextAttempt() {
144+
def doc = Jsoup.connect(getRemoteUrl()).get()
133145
return TEXT_FORMATTER.getPlainText(doc.select("#deed").get(0))
134146
}
135147
}
@@ -141,7 +153,8 @@ class RemoteLicenseFetcher implements Serializable {
141153
}
142154

143155
@Override
144-
String processDocument(Document doc) {
156+
String getTextAttempt() {
157+
def doc = Jsoup.connect(getRemoteUrl()).get()
145158
return TEXT_FORMATTER.getPlainText(doc.select("#content-wrapper").get(0))
146159
}
147160
}
@@ -153,7 +166,8 @@ class RemoteLicenseFetcher implements Serializable {
153166
}
154167

155168
@Override
156-
String processDocument(Document doc) {
169+
String getTextAttempt() {
170+
def doc = Jsoup.connect(getRemoteUrl()).get()
157171
return TEXT_FORMATTER.getPlainText(doc.select("#content-wrapper").get(0))
158172
}
159173
}
@@ -166,7 +180,8 @@ class RemoteLicenseFetcher implements Serializable {
166180
}
167181

168182
@Override
169-
String processDocument(Document doc) {
183+
String getTextAttempt() {
184+
def doc = Jsoup.connect(getRemoteUrl()).get()
170185
return TEXT_FORMATTER.getPlainText(doc.select("body > table > tbody > tr:nth-child(2) > td:nth-child(2) > table > tbody > tr:nth-child(3) > td > en > blockquote").get(0))
171186
}
172187
}

buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/publish/Publisher.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Publisher {
7474
pom.dependencies.dependency.each {
7575
// remove multidex as it is supposed to be added by final applications and is needed for
7676
// some libraries only for instrumentation tests to build.
77-
if (it.groupId.text() in ['com.android.support', 'androidx'] && it.artifactId.text() == 'multidex') {
77+
if (it.groupId.text() in ['com.android.support', 'androidx.multidex'] && it.artifactId.text() == 'multidex') {
7878
it.parent().remove(it)
7979
}
8080
it.appendNode('type', [:], deps["${it.groupId.text()}:${it.artifactId.text()}"])

fiamui-app/fiamui-app.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ android {
5353

5454
dependencies {
5555
implementation project(path: ":firebase-inappmessaging-display")
56-
implementation "com.google.firebase:firebase-measurement-connector:17.0.1"
56+
implementation "com.google.firebase:firebase-measurement-connector:18.0.0"
5757
implementation('com.google.firebase:firebase-inappmessaging:17.0.3') {
5858
exclude group: 'com.google.firebase', module: 'firebase-common'
5959
}
60-
implementation('com.google.firebase:firebase-analytics:16.0.4') {
60+
implementation('com.google.firebase:firebase-analytics:17.0.0') {
6161
exclude group: 'com.google.firebase', module: 'firebase-common'
6262
}
6363

@@ -67,7 +67,7 @@ dependencies {
6767
implementation "com.google.code.findbugs:jsr305:3.0.2"
6868
implementation "com.squareup.okhttp:okhttp:2.7.5"
6969
implementation "com.google.auto.value:auto-value-annotations:1.6.5"
70-
implementation "com.google.android.gms:play-services-basement:16.2.0"
70+
implementation "com.google.android.gms:play-services-basement:17.0.0"
7171

7272
// The following dependencies are not required to use the FIAM UI library.
7373
// They are used to make some aspects of the demo app implementation simpler for

firebase-common/firebase-common.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ android {
5858
}
5959

6060
dependencies {
61-
implementation 'com.google.android.gms:play-services-basement:16.2.0'
62-
implementation "com.google.android.gms:play-services-tasks:16.0.1"
61+
implementation 'com.google.android.gms:play-services-basement:17.0.0'
62+
implementation "com.google.android.gms:play-services-tasks:17.0.0"
6363

6464
api 'com.google.auto.value:auto-value-annotations:1.6.5'
6565
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'

firebase-common/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=17.1.1
2-
latestReleasedVersion=17.1.0
1+
version=18.0.1
2+
latestReleasedVersion=18.0.0

0 commit comments

Comments
 (0)