Skip to content

Commit f866315

Browse files
committed
Merge branch 'master' of github.com:firebase/firebase-android-sdk into arete-floc
2 parents a7ef2db + 00956bc commit f866315

File tree

769 files changed

+135746
-81880
lines changed

Some content is hidden

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

769 files changed

+135746
-81880
lines changed

.opensource/project.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
"pages": {
99
"README.md": "Development Guide",
1010
"docs/ktx/common.md": "Common KTX",
11-
"docs/ktx/firestore.md": "Firestore KTX"
11+
"docs/ktx/firestore.md": "Firestore KTX",
12+
"docs/ktx/functions.md": "Functions KTX",
13+
"docs/ktx/inappmessaging.md": "In-App Messaging KTX",
14+
"docs/ktx/inappmessaging-display.md": "In-App Messaging Display KTX",
15+
"docs/ktx/remote-config.md": "Remote Config KTX",
16+
"docs/ktx/storage.md": "Storage KTX",
17+
"docs/ktx/database.md": "Realtime Database KTX"
1218
},
1319
"related": [
1420
"firebase/quickstart-android"
@@ -23,4 +29,4 @@
2329
"href": "https://firebase.github.io/firebase-android-sdk/reference/kotlin/firebase-ktx/"
2430
}
2531
]
26-
}
32+
}

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ dependencies:
88
* `firebase-common`
99
* `firebase-common-ktx`
1010
* `firebase-database`
11+
* `firebase-database-ktx`
1112
* `firebase-database-collection`
1213
* `firebase-datatransport`
1314
* `firebase-firestore`
1415
* `firebase-firestore-ktx`
1516
* `firebase-functions`
1617
* `firebase-functions-ktx`
18+
* `firebase-inappmessaging`
19+
* `firebase-inappmessaging-ktx`
1720
* `firebase-inappmessaging-display`
21+
* `firebase-inappmessaging-display-ktx`
1822
* `firebase-remote-config`
23+
* `firebase-remote-config-ktx`
1924
* `firebase-storage`
20-
25+
* `firebase-storage-ktx`
26+
2127

2228
Firebase is an app development platform with tools to help you build, grow and
2329
monetize your app. More information about Firebase can be found at
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"customLib1":{"length":15,"start":11}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
customLib1:
2+
Test license
3+

buildSrc/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ dependencies {
4242
implementation 'io.opencensus:opencensus-api:0.18.0'
4343
implementation 'io.opencensus:opencensus-exporter-stats-stackdriver:0.18.0'
4444
runtime 'io.opencensus:opencensus-impl:0.18.0'
45+
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
4546

4647
implementation 'com.android.tools.build:gradle:3.4.1'
4748
testImplementation 'junit:junit:4.12'
49+
testImplementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
4850
testImplementation('org.spockframework:spock-core:1.1-groovy-2.4') {
4951
exclude group: 'org.codehaus.groovy'
5052
}

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import com.google.common.collect.ImmutableSet;
1818
import com.google.firebase.gradle.plugins.ci.device.FirebaseTestLabExtension;
19+
import java.util.Collections;
1920
import java.util.HashSet;
2021
import java.util.Set;
2122
import java.util.stream.Collectors;
@@ -39,7 +40,7 @@ public class FirebaseLibraryExtension {
3940
public boolean publishSources;
4041

4142
/** Static analysis configuration. */
42-
public final FirebaseStaticAnalysis staticAnalysis = new FirebaseStaticAnalysis();
43+
public final FirebaseStaticAnalysis staticAnalysis;
4344

4445
/** Firebase Test Lab configuration/ */
4546
public final FirebaseTestLabExtension testLab;
@@ -78,6 +79,20 @@ public FirebaseLibraryExtension(Project project) {
7879
artifactId.set(new DefaultProvider<>(project::getName));
7980
groupId.set(new DefaultProvider<>(() -> project.getGroup().toString()));
8081
}
82+
this.staticAnalysis = initializeStaticAnalysis(project);
83+
}
84+
85+
private FirebaseStaticAnalysis initializeStaticAnalysis(Project project) {
86+
return new FirebaseStaticAnalysis(
87+
projectsFromProperty(project, "firebase.checks.errorproneProjects"),
88+
projectsFromProperty(project, "firebase.checks.lintProjects"));
89+
}
90+
91+
private Set<String> projectsFromProperty(Project project, String propertyName) {
92+
if (!project.hasProperty(propertyName)) {
93+
return Collections.emptySet();
94+
}
95+
return ImmutableSet.copyOf(project.property(propertyName).toString().split(",", -1));
8196
}
8297

8398
/** Configure Firebase Test Lab. */

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

Lines changed: 82 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,22 @@
1515
package com.google.firebase.gradle.plugins;
1616

1717
import com.android.build.gradle.LibraryExtension;
18+
import com.android.build.gradle.api.AndroidSourceSet;
1819
import com.google.common.collect.ImmutableList;
1920
import com.google.common.collect.ImmutableMap;
20-
import com.google.common.collect.ImmutableSet;
21+
import com.google.firebase.gradle.plugins.apiinfo.ApiInformationTask;
22+
import com.google.firebase.gradle.plugins.apiinfo.GenerateApiTxtFileTask;
23+
import com.google.firebase.gradle.plugins.apiinfo.GenerateStubsTask;
24+
import com.google.firebase.gradle.plugins.apiinfo.GetMetalavaJarTask;
2125
import com.google.firebase.gradle.plugins.ci.device.FirebaseTestServer;
26+
import java.io.File;
27+
import java.nio.file.Paths;
2228
import org.gradle.api.Plugin;
2329
import org.gradle.api.Project;
2430
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile;
2531

26-
import java.util.Set;
27-
2832
public class FirebaseLibraryPlugin implements Plugin<Project> {
2933

30-
private static final Set<String> KOTLIN_CHECKS =
31-
ImmutableSet.of(
32-
"FirebaseNoHardKeywords",
33-
"FirebaseLambdaLast",
34-
"FirebaseUnknownNullness",
35-
"FirebaseKotlinPropertyAccess");
36-
3734
@Override
3835
public void apply(Project project) {
3936
project.apply(ImmutableMap.of("plugin", "com.android.library"));
@@ -65,6 +62,8 @@ public void apply(Project project) {
6562
});
6663
}
6764

65+
setupApiInformationAnalysis(project, android);
66+
6867
android.testServer(new FirebaseTestServer(project, firebaseLibrary.testLab));
6968

7069
setupStaticAnalysis(project, android, firebaseLibrary);
@@ -81,6 +80,79 @@ public void apply(Project project) {
8180
ImmutableList.of("-module-name", kotlinModuleName(project))));
8281
}
8382

83+
private static void setupApiInformationAnalysis(Project project, LibraryExtension android) {
84+
File metalavaOutputJarFile = new File(project.getRootProject().getBuildDir(), "metalava.jar");
85+
AndroidSourceSet mainSourceSet = android.getSourceSets().getByName("main");
86+
File outputFile =
87+
project
88+
.getRootProject()
89+
.file(
90+
Paths.get(
91+
project.getRootProject().getBuildDir().getPath(),
92+
"apiinfo",
93+
project.getPath().substring(1).replace(":", "_")));
94+
File outputApiFile = new File(outputFile.getAbsolutePath() + "_api.txt");
95+
96+
project
97+
.getTasks()
98+
.register(
99+
"getMetalavaJar",
100+
GetMetalavaJarTask.class,
101+
task -> {
102+
task.setOutputFile(metalavaOutputJarFile);
103+
});
104+
project
105+
.getTasks()
106+
.register(
107+
"apiInformation",
108+
ApiInformationTask.class,
109+
task -> {
110+
task.setApiTxt(project.file("api.txt"));
111+
task.setMetalavaJarPath(metalavaOutputJarFile.getAbsolutePath());
112+
task.setSourceSet(mainSourceSet);
113+
task.setOutputFile(outputFile);
114+
task.setBaselineFile(project.file("baseline.txt"));
115+
task.setOutputApiFile(outputApiFile);
116+
if (project.hasProperty("updateBaseline")) {
117+
task.setUpdateBaseline(true);
118+
} else {
119+
task.setUpdateBaseline(false);
120+
}
121+
task.dependsOn("getMetalavaJar");
122+
});
123+
124+
project
125+
.getTasks()
126+
.register(
127+
"generateApiTxtFile",
128+
GenerateApiTxtFileTask.class,
129+
task -> {
130+
task.setApiTxt(project.file("api.txt"));
131+
task.setMetalavaJarPath(metalavaOutputJarFile.getAbsolutePath());
132+
task.setSourceSet(mainSourceSet);
133+
task.setBaselineFile(project.file("baseline.txt"));
134+
if (project.hasProperty("updateBaseline")) {
135+
task.setUpdateBaseline(true);
136+
} else {
137+
task.setUpdateBaseline(false);
138+
}
139+
task.dependsOn("getMetalavaJar");
140+
});
141+
142+
project
143+
.getTasks()
144+
.register(
145+
"docStubs",
146+
GenerateStubsTask.class,
147+
task -> {
148+
task.setMetalavaJarPath(metalavaOutputJarFile.getAbsolutePath());
149+
task.setOutputDir(new File(project.getBuildDir(), "doc-stubs"));
150+
task.dependsOn("getMetalavaJar");
151+
152+
task.setSourceSet(mainSourceSet);
153+
});
154+
}
155+
84156
private static void setupStaticAnalysis(
85157
Project project, LibraryExtension android, FirebaseLibraryExtension library) {
86158
project.afterEvaluate(
@@ -106,11 +178,6 @@ private static void setupStaticAnalysis(
106178
}
107179
}));
108180

109-
library.staticAnalysis.subscribeToKotlinInteropLintDisabled(
110-
() ->
111-
android.lintOptions(
112-
lintOptions -> lintOptions.disable(KOTLIN_CHECKS.toArray(new String[0]))));
113-
114181
project.getTasks().register("firebaseLint", task -> task.dependsOn("lint"));
115182
}
116183

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

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,15 @@
1414

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

17-
import com.google.common.collect.ImmutableSet;
18-
19-
import java.util.HashSet;
2017
import java.util.Set;
21-
import java.util.function.Consumer;
2218

2319
public class FirebaseStaticAnalysis {
2420
public Set<String> errorproneCheckProjects;
2521
public Set<String> androidLintCheckProjects;
2622

27-
28-
private boolean disableKotlinInteropLint;
29-
30-
private final Set<Runnable> kotlinInteropLintDisabledSubscribers = new HashSet<>();
31-
32-
public FirebaseStaticAnalysis() {
33-
this(ImmutableSet.of(":tools:errorprone"), ImmutableSet.of(":tools:lint"));
34-
}
35-
36-
public FirebaseStaticAnalysis(Set<String> errorproneCheckProjects, Set<String> androidLintCheckProjects) {
23+
public FirebaseStaticAnalysis(
24+
Set<String> errorproneCheckProjects, Set<String> androidLintCheckProjects) {
3725
this.errorproneCheckProjects = errorproneCheckProjects;
3826
this.androidLintCheckProjects = androidLintCheckProjects;
3927
}
40-
41-
/** Indicates whether Kotlin Interop Lint checks are enabled for public APIs of the library. */
42-
public void disableKotlinInteropLint() {
43-
if (disableKotlinInteropLint) {
44-
return;
45-
}
46-
disableKotlinInteropLint = true;
47-
for (Runnable subscription : kotlinInteropLintDisabledSubscribers) {
48-
subscription.run();
49-
}
50-
}
51-
52-
void subscribeToKotlinInteropLintDisabled(Runnable subscription) {
53-
this.kotlinInteropLintDisabledSubscribers.add(subscription);
54-
if (disableKotlinInteropLint) {
55-
subscription.run();
56-
}
57-
}
5828
}

0 commit comments

Comments
 (0)