Skip to content

Commit e8336b8

Browse files
authored
Merge branch 'main' into fie-quota-retry
2 parents e99dd50 + 26c8a5a commit e8336b8

File tree

217 files changed

+3444
-1783
lines changed

Some content is hidden

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

217 files changed

+3444
-1783
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Check Vertex AI Responses
2+
3+
on: pull_request
4+
5+
jobs:
6+
check-version:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Clone mock responses
11+
run: firebase-vertexai/update_responses.sh
12+
- name: Find cloned and latest versions
13+
run: |
14+
CLONED=$(git describe --tags)
15+
LATEST=$(git tag --sort=v:refname | tail -n1)
16+
echo "cloned_tag=$CLONED" >> $GITHUB_ENV
17+
echo "latest_tag=$LATEST" >> $GITHUB_ENV
18+
working-directory: firebase-vertexai/src/test/resources/vertexai-sdk-test-data
19+
- name: Find comment from previous run if exists
20+
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e
21+
id: fc
22+
with:
23+
issue-number: ${{github.event.number}}
24+
body-includes: Vertex AI Mock Responses Check
25+
- name: Comment on PR if newer version is available
26+
if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}}
27+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
28+
with:
29+
issue-number: ${{github.event.number}}
30+
body: >
31+
### Vertex AI Mock Responses Check :warning:
32+
33+
A newer major version of the mock responses for Vertex AI unit tests is available.
34+
[update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-vertexai/update_responses.sh)
35+
should be updated to clone the latest version of the responses: `${{env.latest_tag}}`
36+
- name: Delete comment when version gets updated
37+
if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}}
38+
uses: detomarco/delete-comment@850734dd44d8b15fef55b45252613b903ceb06f0
39+
with:
40+
comment-id: ${{ steps.fc.outputs.comment-id }}

.github/workflows/check_format.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Check Format
2+
concurrency:
3+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
4+
cancel-in-progress: true
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
determine_changed:
13+
name: "Determine changed modules"
14+
runs-on: ubuntu-22.04
15+
if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request'
16+
outputs:
17+
modules: ${{ steps.changed-modules.outputs.modules }}
18+
steps:
19+
- uses: actions/[email protected]
20+
with:
21+
fetch-depth: 2
22+
submodules: true
23+
24+
- name: Set up JDK 17
25+
uses: actions/[email protected]
26+
with:
27+
java-version: 17
28+
distribution: temurin
29+
cache: gradle
30+
31+
- id: changed-modules
32+
run: |
33+
git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json
34+
echo modules=$(cat modules.json) >> $GITHUB_OUTPUT
35+
36+
check_format:
37+
name: "Check Format"
38+
runs-on: ubuntu-22.04
39+
needs:
40+
- determine_changed
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
module: ${{ fromJSON(needs.determine_changed.outputs.modules) }}
45+
46+
steps:
47+
- uses: actions/[email protected]
48+
with:
49+
fetch-depth: 2
50+
submodules: true
51+
52+
- name: Set up JDK 17
53+
uses: actions/[email protected]
54+
with:
55+
java-version: 17
56+
distribution: temurin
57+
cache: gradle
58+
59+
- name: ${{ matrix.module }} Check Format
60+
run: |
61+
./gradlew ${{matrix.module}}:spotlessCheck
62+
63+
# A job that fails if any job in the check_format matrix fails,
64+
# to be used as a required check for merging.
65+
check_all:
66+
runs-on: ubuntu-22.04
67+
if: always()
68+
name: Check Format (matrix)
69+
needs: check_format
70+
steps:
71+
- name: Check matrix
72+
if: needs.check_format.result != 'success'
73+
run: exit 1

.github/workflows/post_release_cleanup.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
- name: Create Pull Request
2929
uses: peter-evans/create-pull-request@v4
3030
with:
31+
token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }}
32+
committer: google-oss-bot <[email protected]>
33+
assignees: ${{ github.actor }}
3134
base: 'main'
3235
branch: 'releases/${{ inputs.name }}.mergeback'
3336
add-paths: |

README.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -217,21 +217,11 @@ your app module's build.gradle.
217217

218218
### Code Formatting
219219

220-
#### Java
220+
Java and Kotlin are both formatted using `spotless`.
221221

222-
N/A for now
223-
224-
225-
#### Kotlin
226-
227-
Kotlin code in this repo is formatted with the `ktfmt` tool. You can enable
228-
this formatting in Android Studio by downloading and installing the
229-
[ktfmt plugin](https://plugins.jetbrains.com/plugin/14912-ktfmt).
230-
Enable the plugin in Preferences | Editor | ktfmt Settings. and set code style to Google (internal).
231-
232-
To run formatting on your entire project you can run
222+
To run formatting on a project, run
233223
```bash
234-
./gradlew :<firebase-project>:ktfmtFormat
224+
./gradlew :<firebase-project>:spotlessApply
235225
```
236226

237227
### Contributing

appcheck/firebase-appcheck/src/main/java/com/google/firebase/appcheck/internal/NetworkClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ String getHeartBeat() {
212212
return null;
213213
}
214214
}
215+
215216
/** Gets the Android package's SHA-1 fingerprint. */
216217
private String getFingerprintHashForPackage() {
217218
byte[] hash;

build.gradle

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ buildscript {
2929
artifact()
3030
}
3131
}
32-
32+
maven {
33+
url "https://plugins.gradle.org/m2/"
34+
}
3335
}
3436

3537
dependencies {
3638
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.4'
3739
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:3.1.0'
3840
classpath 'com.google.gms:google-services:4.3.15'
39-
classpath "com.ncorti.ktfmt.gradle:plugin:0.11.0"
4041
classpath 'com.google.firebase:firebase-appdistribution-gradle:5.0.0'
4142
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5'
43+
classpath "com.diffplug.spotless:spotless-plugin-gradle:7.0.0.BETA1"
4244
}
4345
}
4446

@@ -83,10 +85,17 @@ configure(subprojects) {
8385
}
8486
}
8587

86-
apply plugin: "com.ncorti.ktfmt.gradle"
88+
apply plugin: "com.diffplug.spotless"
8789

88-
ktfmt {
89-
googleStyle()
90+
spotless {
91+
java {
92+
target 'src/**/*.java'
93+
googleJavaFormat('1.22.0').reorderImports(false).skipJavadocFormatting()
94+
}
95+
kotlin {
96+
target 'src/**/*.kt'
97+
ktfmt('0.41').googleStyle()
98+
}
9099
}
91100
}
92101

encoders/firebase-encoders-processor/src/test/resources/ExpectedAtEmptyAnnotation.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,14 @@
1414

1515
package com.example;
1616

17-
import java.lang.Class;
18-
import java.lang.Object;
19-
import java.lang.Override;
20-
import java.lang.String;
2117
import java.lang.annotation.Annotation;
2218

2319
public final class AtEmptyAnnotation {
2420
private static final AtEmptyAnnotation BUILDER = new AtEmptyAnnotation();
2521

2622
private static final EmptyAnnotation INSTANCE = new EmptyAnnotationImpl();
2723

28-
private AtEmptyAnnotation() {
29-
}
24+
private AtEmptyAnnotation() {}
3025

3126
public static AtEmptyAnnotation builder() {
3227
return BUILDER;
@@ -37,8 +32,7 @@ public EmptyAnnotation build() {
3732
}
3833

3934
private static final class EmptyAnnotationImpl implements EmptyAnnotation {
40-
EmptyAnnotationImpl() {
41-
}
35+
EmptyAnnotationImpl() {}
4236

4337
@Override
4438
public Class<? extends Annotation> annotationType() {
@@ -65,4 +59,4 @@ public String toString() {
6559
return sb.toString();
6660
}
6761
}
68-
}
62+
}

encoders/firebase-encoders-processor/src/test/resources/ExpectedAtMyAnnotation.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414

1515
package com.example;
1616

17-
import java.lang.Class;
18-
import java.lang.Object;
19-
import java.lang.Override;
20-
import java.lang.String;
2117
import java.lang.annotation.Annotation;
2218
import java.util.Arrays;
2319

@@ -90,7 +86,8 @@ public static AtMyAnnotation builder() {
9086
}
9187

9288
public MyAnnotation build() {
93-
return new MyAnnotationImpl(intVal, longVal, boolVal, shortVal, floatVal, doubleVal, doubleArrayVal, strVal, enumVal);
89+
return new MyAnnotationImpl(
90+
intVal, longVal, boolVal, shortVal, floatVal, doubleVal, doubleArrayVal, strVal, enumVal);
9491
}
9592

9693
private static final class MyAnnotationImpl implements MyAnnotation {
@@ -112,8 +109,16 @@ private static final class MyAnnotationImpl implements MyAnnotation {
112109

113110
private final MyAnnotation.MyEnum enumVal;
114111

115-
MyAnnotationImpl(int intVal, long longVal, boolean boolVal, short shortVal, float floatVal,
116-
double doubleVal, double[] doubleArrayVal, String strVal, MyAnnotation.MyEnum enumVal) {
112+
MyAnnotationImpl(
113+
int intVal,
114+
long longVal,
115+
boolean boolVal,
116+
short shortVal,
117+
float floatVal,
118+
double doubleVal,
119+
double[] doubleArrayVal,
120+
String strVal,
121+
MyAnnotation.MyEnum enumVal) {
117122
this.intVal = intVal;
118123
this.longVal = longVal;
119124
this.boolVal = boolVal;
@@ -195,16 +200,18 @@ public boolean equals(Object other) {
195200

196201
@Override
197202
public int hashCode() {
198-
return + (-15901618 ^ ((int)intVal))
199-
+ (1338661755 ^ ((int)(longVal ^ (longVal >>> 32))))
203+
return +(-15901618 ^ ((int) intVal))
204+
+ (1338661755 ^ ((int) (longVal ^ (longVal >>> 32))))
200205
+ (-373377111 ^ (boolVal ? 1231 : 1237))
201-
+ (-549529221 ^ ((int)shortVal))
206+
+ (-549529221 ^ ((int) shortVal))
202207
+ (1880085339 ^ (Float.floatToIntBits(floatVal)))
203-
+ (696767088 ^ ((int) ((Double.doubleToLongBits(doubleVal) >>> 32) ^ Double.doubleToLongBits(doubleVal))))
208+
+ (696767088
209+
^ ((int)
210+
((Double.doubleToLongBits(doubleVal) >>> 32)
211+
^ Double.doubleToLongBits(doubleVal))))
204212
+ (-1932334201 ^ Arrays.hashCode(doubleArrayVal))
205213
+ (-1615429424 ^ strVal.hashCode())
206-
+ (-170319456 ^ enumVal.hashCode())
207-
;
214+
+ (-170319456 ^ enumVal.hashCode());
208215
}
209216

210217
@Override

0 commit comments

Comments
 (0)