Skip to content

Commit 72fc2b8

Browse files
committed
java records
1 parent c5a894c commit 72fc2b8

File tree

31 files changed

+3061
-178
lines changed

31 files changed

+3061
-178
lines changed

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ buildscript {
3333
}
3434

3535
dependencies {
36-
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.2'
36+
classpath libs.protobuf.gradle.plugin
3737
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:1.3.0'
3838
classpath 'gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.9'
3939
classpath 'com.google.gms:google-services:4.3.15'
@@ -71,9 +71,11 @@ firebaseContinuousIntegration {
7171
]
7272
}
7373

74+
/*
7475
if(JavaVersion.current() != JavaVersion.VERSION_11){
7576
throw new GradleException("This build must be run with java 11. You're using ${JavaVersion.current()}.")
7677
}
78+
*/
7779

7880
configure(subprojects) {
7981
repositories {

buildSrc/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
plugins {
1616
id("com.ncorti.ktfmt.gradle") version "0.11.0"
1717
id("com.github.sherter.google-java-format") version "0.9"
18-
kotlin("plugin.serialization") version "1.7.10"
18+
kotlin("plugin.serialization") version "1.8.10"
1919
`kotlin-dsl`
2020
}
2121

@@ -48,7 +48,7 @@ dependencies {
4848
implementation("com.google.firebase:perf-plugin:$perfPluginVersion")
4949
implementation("com.google.auto.value:auto-value-annotations:1.8.1")
5050
annotationProcessor("com.google.auto.value:auto-value:1.6.5")
51-
implementation(kotlin("gradle-plugin", "1.7.10"))
51+
implementation(kotlin("gradle-plugin", "1.8.10"))
5252
implementation("org.json:json:20210307")
5353

5454
implementation("org.eclipse.aether:aether-api:1.0.0.v20140518")
@@ -65,8 +65,8 @@ dependencies {
6565

6666
implementation(libs.kotlinx.serialization.json)
6767
implementation("com.google.code.gson:gson:2.8.9")
68-
implementation("com.android.tools.build:gradle:7.4.2")
69-
implementation("com.android.tools.build:builder-test-api:7.4.2")
68+
implementation(libs.gradle)
69+
implementation(libs.builder.test.api)
7070
implementation("gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.9")
7171

7272
testImplementation(libs.bundles.kotest)

buildSrc/src/main/java/com/google/firebase/gradle/plugins/Metalava.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ fun Project.runMetalavaWithArgs(
5959
"HiddenAbstractMethod"
6060
) + arguments
6161

62+
/*
6263
project.javaexec {
6364
main = "com.android.tools.metalava.Driver"
6465
classpath = project.metalavaConfig
6566
args = allArgs
6667
isIgnoreExitValue = ignoreFailure
6768
if (stdOut != null) errorOutput = stdOut
6869
}
70+
*/
6971
}
7072

7173
abstract class GenerateStubsTask : DefaultTask() {

firebase-config/bandwagoner/bandwagoner.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ apply plugin: 'org.jetbrains.kotlin.android'
2222
// apply plugin: 'com.google.gms.google-services'
2323

2424
android {
25+
namespace "com.googletest.firebase.remoteconfig.bandwagoner"
2526
compileSdkVersion project.targetSdkVersion
2627
lintOptions {
2728
abortOnError false

firebase-dynamic-links/firebase-dynamic-links.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ android {
4747
}
4848

4949
testOptions.unitTests.includeAndroidResources = true
50+
buildFeatures {
51+
aidl true
52+
}
5053
}
5154

5255
dependencies {

firebase-firestore-sdk34/CHANGELOG.md

Whitespace-only changes.

firebase-firestore-sdk34/README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# firebase-firestore
2+
3+
This is the Cloud Firestore component of the Firebase Android SDK.
4+
5+
Cloud Firestore is a flexible, scalable database for mobile, web, and server
6+
development from Firebase and Google Cloud Platform. Like Firebase Realtime
7+
Database, it keeps your data in sync across client apps through realtime
8+
listeners and offers offline support for mobile and web so you can build
9+
responsive apps that work regardless of network latency or Internet
10+
connectivity. Cloud Firestore also offers seamless integration with other
11+
Firebase and Google Cloud Platform products, including Cloud Functions.
12+
13+
## Building
14+
15+
All Gradle commands should be run from the source root (which is one level up
16+
from this folder). See the README.md in the source root for instructions on
17+
publishing/testing Cloud Firestore.
18+
19+
To build Cloud Firestore, from the source root run:
20+
```bash
21+
./gradlew :firebase-firestore:assembleRelease
22+
```
23+
24+
## Unit Testing
25+
26+
To run unit tests for Cloud Firestore, from the source root run:
27+
```bash
28+
./gradlew :firebase-firestore:check
29+
```
30+
31+
## Integration Testing
32+
33+
Running integration tests requires a Firebase project because they would try
34+
to connect to the Firestore backends.
35+
36+
See [here](../README.md#project-setup) for how to setup a project.
37+
38+
Once you setup the project, download `google-services.json` and place it in
39+
the source root.
40+
41+
Make sure you have created a Firestore instance for your project, before
42+
you proceed.
43+
44+
By default, integration tests run against the Firestore emulator.
45+
46+
### Setting up the Firestore Emulator
47+
48+
The integration tests require that the Firestore emulator is running on port
49+
8080, which is default when running it via CLI.
50+
51+
* [Install the Firebase CLI](https://firebase.google.com/docs/cli/).
52+
```
53+
npm install -g firebase-tools
54+
```
55+
* [Install the Firestore
56+
emulator](https://firebase.google.com/docs/firestore/security/test-rules-emulator#install_the_emulator).
57+
```
58+
firebase setup:emulators:firestore
59+
```
60+
* Run the emulator
61+
```
62+
firebase emulators:start --only firestore
63+
```
64+
* Select the `Firestore Integration Tests (Firestore Emulator)` run
65+
configuration to run all integration tests.
66+
67+
To run the integration tests against prod, select `FirestoreProdIntegrationTest`
68+
run configuration.
69+
70+
### Run on Local Android Emulator
71+
72+
Then simply run:
73+
```bash
74+
./gradlew :firebase-firestore:connectedCheck
75+
```
76+
77+
### Run on Firebase Test Lab
78+
79+
You can also test on Firebase Test Lab, which allow you to run the integration
80+
tests on devices hosted in Google data center.
81+
82+
See [here](../README.md#running-integration-tests-on-firebase-test-lab) for
83+
instructions of how to setup Firebase Test Lab for your project.
84+
85+
Run:
86+
```bash
87+
./gradlew :firebase-firestore:deviceCheck
88+
```
89+
90+
## Code Formatting
91+
92+
Run below to format Java code:
93+
```bash
94+
./gradlew :firebase-firestore:googleJavaFormat
95+
```
96+
97+
See [here](../README.md#code-formatting) if you want to be able to format code
98+
from within Android Studio.
99+
100+
## Build Local Jar of Firestore SDK
101+
102+
```bash
103+
./gradlew -PprojectsToPublish="firebase-firestore" publishReleasingLibrariesToMavenLocal
104+
```
105+
106+
Developers may then take a dependency on these locally published versions by adding
107+
the `mavenLocal()` repository to your [repositories
108+
block](https://docs.gradle.org/current/userguide/declaring_repositories.html) in
109+
your app module's build.gradle.
110+
111+
## Misc
112+
After importing the project into Android Studio and building successfully
113+
for the first time, Android Studio will delete the run configuration xml files
114+
in `./idea/runConfigurations`. Undo these changes with the command:
115+
116+
```
117+
$ git checkout .idea/runConfigurations
118+
```
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
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+
plugins {
16+
id 'firebase-library'
17+
id 'com.google.protobuf'
18+
}
19+
20+
firebaseLibrary {
21+
libraryGroup "firestore"
22+
publishSources = true
23+
testLab {
24+
enabled = true
25+
timeout = '30m'
26+
}
27+
}
28+
29+
protobuf {
30+
// Configure the protoc executable
31+
protoc {
32+
// Download from repositories
33+
artifact = "com.google.protobuf:protoc:$protocVersion"
34+
}
35+
plugins {
36+
grpc {
37+
artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion"
38+
}
39+
}
40+
generateProtoTasks {
41+
all().each { task ->
42+
task.builtins {
43+
java { option 'lite' }
44+
}
45+
task.plugins {
46+
grpc {
47+
option 'lite'
48+
}
49+
}
50+
}
51+
}
52+
}
53+
54+
android {
55+
adbOptions {
56+
timeOutInMs 60 * 1000
57+
}
58+
59+
namespace "com.google.firebase.firestore.sdk34"
60+
compileSdkVersion 34
61+
defaultConfig {
62+
targetSdkVersion 34
63+
minSdkVersion 19
64+
versionName version
65+
multiDexEnabled true
66+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
67+
consumerProguardFiles 'proguard.txt'
68+
69+
// Acceptable values are: 'emulator', 'qa', 'nightly', and 'prod'.
70+
def targetBackend = findProperty("targetBackend") ?: "emulator"
71+
buildConfigField("String", "TARGET_BACKEND", "\"$targetBackend\"")
72+
73+
def targetDatabaseId = findProperty('targetDatabaseId') ?: "(default)"
74+
buildConfigField("String", "TARGET_DATABASE_ID", "\"$targetDatabaseId\"")
75+
76+
def localProps = new Properties()
77+
78+
try {
79+
file("local.properties").withInputStream { localProps.load(it) }
80+
} catch (FileNotFoundException e) {
81+
}
82+
}
83+
84+
sourceSets {
85+
main {
86+
proto {
87+
srcDir 'src/proto'
88+
}
89+
}
90+
test {
91+
java {
92+
srcDir 'src/testUtil/java'
93+
srcDir 'src/roboUtil/java'
94+
}
95+
}
96+
androidTest {
97+
java {
98+
srcDir 'src/testUtil/java'
99+
}
100+
}
101+
}
102+
compileOptions {
103+
sourceCompatibility JavaVersion.VERSION_17
104+
targetCompatibility JavaVersion.VERSION_17
105+
}
106+
testOptions.unitTests.includeAndroidResources = true
107+
108+
}
109+
110+
tasks.withType(Test) {
111+
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
112+
}
113+
114+
googleJavaFormat {
115+
exclude 'src/testUtil/java/com/google/firebase/firestore/testutil/Assert.java'
116+
exclude 'src/testUtil/java/com/google/firebase/firestore/testutil/ThrowingRunnable.java'
117+
}
118+
119+
dependencies {
120+
/*
121+
implementation 'com.google.firebase:firebase-annotations:16.2.0'
122+
implementation 'com.google.firebase:firebase-common:20.3.1'
123+
implementation project(':protolite-well-known-types')
124+
implementation 'com.google.firebase:firebase-database-collection:18.0.1'
125+
implementation 'com.google.firebase:firebase-components:17.1.0'
126+
implementation 'com.google.firebase:firebase-appcheck-interop:17.0.0'
127+
128+
//To provide @Generated annotations
129+
compileOnly 'javax.annotation:jsr250-api:1.0'
130+
131+
javadocClasspath 'com.google.auto.value:auto-value-annotations:1.6.6'
132+
133+
implementation 'androidx.annotation:annotation:1.1.0'
134+
implementation "io.grpc:grpc-stub:$grpcVersion"
135+
implementation "io.grpc:grpc-protobuf-lite:$grpcVersion"
136+
implementation "io.grpc:grpc-okhttp:$grpcVersion"
137+
implementation "io.grpc:grpc-android:$grpcVersion"
138+
implementation 'com.google.android.gms:play-services-basement:18.1.0'
139+
implementation 'com.google.android.gms:play-services-tasks:18.0.1'
140+
implementation 'com.google.android.gms:play-services-base:18.0.1'
141+
142+
implementation('com.google.firebase:firebase-auth-interop:19.0.2') {
143+
exclude group: "com.google.firebase", module: "firebase-common"
144+
}
145+
146+
compileOnly 'com.google.auto.value:auto-value-annotations:1.6.6'
147+
androidTestAnnotationProcessor 'com.google.auto.value:auto-value:1.6.5'
148+
annotationProcessor 'com.google.auto.value:auto-value:1.6.5'
149+
*/
150+
151+
//implementation project(':firebase-firestore')
152+
testImplementation project(':firebase-firestore-sdk34')
153+
testImplementation 'junit:junit:4.13.2'
154+
testImplementation "androidx.test:core:$androidxTestCoreVersion"
155+
testImplementation "org.hamcrest:hamcrest-junit:2.0.0.0"
156+
testImplementation 'org.mockito:mockito-core:2.25.0'
157+
testImplementation "org.robolectric:robolectric:4.10.3"
158+
testImplementation "com.google.truth:truth:$googleTruthVersion"
159+
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
160+
testImplementation 'com.google.guava:guava-testlib:12.0-rc2'
161+
testImplementation project(path: ':firebase-firestore')
162+
testImplementation libs.google.gson
163+
164+
androidTestImplementation 'junit:junit:4.13.2'
165+
androidTestImplementation("com.google.truth:truth:$googleTruthVersion") {
166+
exclude group: "org.codehaus.mojo", module: "animal-sniffer-annotations"
167+
}
168+
androidTestImplementation 'org.mockito:mockito-core:2.25.0'
169+
androidTestImplementation 'org.mockito:mockito-android:2.25.0'
170+
androidTestImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
171+
androidTestImplementation "androidx.annotation:annotation:1.1.0"
172+
androidTestImplementation 'androidx.test:runner:1.5.2'
173+
androidTestImplementation 'androidx.test:rules:1.5.0'
174+
androidTestImplementation "androidx.test.ext:junit:$androidxTestJUnitVersion"
175+
}
176+
177+
gradle.projectsEvaluated {
178+
tasks.withType(JavaCompile) {
179+
// TODO(wuandy): Also add "-Xlint:unchecked". But currently that
180+
// enables 100+ warnings due to our generated source code.
181+
// TODO(wuandy): Re-enable error on warnings once errorprone issues are fixed.
182+
options.compilerArgs << "-Xlint:deprecation" // << "-Werror"
183+
}
184+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=24.8.0-SNAPSHOT
2+
latestReleasedVersion=24.7.1

0 commit comments

Comments
 (0)