Skip to content

Commit db24d0b

Browse files
committed
Merge branch 'master' into crashlytics-smoke-tests
2 parents cf7130c + 1b0fdcf commit db24d0b

File tree

32 files changed

+1217
-203
lines changed

32 files changed

+1217
-203
lines changed

alternative-root-project.gradle

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ buildscript {
3333
dependencies {
3434
classpath 'com.android.tools.build:gradle:3.4.3'
3535
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.14'
36-
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:1.2.1'
37-
classpath 'gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8'
38-
classpath 'com.google.gms:google-services:4.3.0'
39-
classpath 'digital.wup:android-maven-publish:3.6.2'
36+
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:1.3.0'
37+
classpath 'gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.9'
38+
classpath 'com.google.gms:google-services:4.3.3'
39+
classpath 'digital.wup:android-maven-publish:3.6.3'
4040
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
41-
classpath 'org.jlleitschuh.gradle:ktlint-gradle:7.1.0'
41+
classpath 'org.jlleitschuh.gradle:ktlint-gradle:9.2.1'
4242
}
4343
}
4444

45+
apply from: 'sdkProperties.gradle'
46+
4547
ext {
4648
playServicesVersion = '16.0.1'
4749
supportAnnotationsVersion = '28.0.0'
@@ -55,12 +57,4 @@ ext {
5557

5658
apply from: 'build.gradle'
5759

58-
configure(subprojects) {
59-
afterEvaluate {
60-
tasks.verifyGoogleJavaFormat {
61-
exclude '**/build/classes/**'
62-
}
63-
}
64-
}
65-
6660
apply plugin: MultiProjectReleasePlugin

ci/fireci/fireci/gradle.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
import logging
1616
import os
1717
import subprocess
18-
import sys
19-
2018

2119
_logger = logging.getLogger('fireci.gradle')
2220

@@ -39,9 +37,19 @@ def run(*args, gradle_opts='', workdir=None, check=True):
3937
command = ['./gradlew'] + list(args)
4038
_logger.info('Executing gradle command: "%s" in directory: "%s"',
4139
" ".join(command), workdir if workdir else '.')
42-
return subprocess.run(
40+
41+
with subprocess.Popen(
4342
command,
4443
cwd=workdir,
4544
env=new_env,
46-
check=check,
47-
)
45+
stdout=subprocess.PIPE,
46+
stderr=subprocess.STDOUT,
47+
) as p:
48+
for line in p.stdout:
49+
_logger.info(line.decode().rstrip())
50+
51+
p.communicate()
52+
53+
if check and p.returncode:
54+
raise subprocess.CalledProcessError(p.returncode, p.args, p.stdout, p.stderr)
55+
return subprocess.CompletedProcess(p.args, p.returncode, p.stdout, p.stderr)

ci/fireci/fireci/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
from .internal import main
2020

2121
logging.basicConfig(
22-
format='%(name)s: [%(levelname)s] %(message)s',
22+
datefmt='%Y-%m-%d %H:%M:%S %z %Z',
23+
format='[%(levelname).1s] %(asctime)s %(name)s: %(message)s',
2324
level=logging.INFO,
2425
)
2526
logging.getLogger('fireci').setLevel(logging.DEBUG)

ci/fireci/tests/gradle_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
class GradleTest(unittest.TestCase):
2929

3030
@in_tempdir
31-
def test_when_gradle_suceeds_should_not_throw(self):
31+
def test_when_gradle_succeeds_should_not_throw(self):
3232
create_artifacts(
3333
Artifact('gradlew', content=scripts.with_exit(0), mode=0o744))
3434
self.assertEqual(gradle.run('tasks').returncode, 0)
3535

3636
@in_tempdir
37-
def test_when_gradle_suceeds_should_not_throw(self):
37+
def test_when_gradle_fails_should_throw(self):
3838
create_artifacts(
3939
Artifact('gradlew', content=scripts.with_exit(1), mode=0o744))
4040
self.assertRaises(subprocess.CalledProcessError,

ci/fireci/tests/integ_tests.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
1615
import pathlib
17-
import subprocess
1816
import unittest
1917

2018
from click.testing import CliRunner
@@ -41,7 +39,7 @@ def test_gradle_invocation(self):
4139
['./gradlew'] + args,
4240
{'GRADLE_OPTS': 'opts'},
4341
('sdk1/build/output/file1', 'content1'),
44-
('sdk1/build/outputss/file2', 'content2'),
42+
('sdk1/build/outputs/file2', 'content2'),
4543
),
4644
mode=0o744))
4745
result = self.runner.invoke(cli, [
@@ -53,7 +51,7 @@ def test_gradle_invocation(self):
5351
artifacts = pathlib.Path('_artifacts')
5452
self.assertTrue(artifacts.exists())
5553

56-
output_file = artifacts / 'sdk1_build_outputss' / 'file2'
54+
output_file = artifacts / 'sdk1_build_outputs' / 'file2'
5755
self.assertFalse(output_file.exists())
5856

5957
output_file = artifacts / 'sdk1_build_output' / 'file1'

encoders/README.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Firebase Encoders
2+
3+
This project provides libraries and code generation infrastructure that allows
4+
encoding java classes into various target serialization formats(currently
5+
supported: **json** and **proto**).
6+
7+
The project consists of multiple parts:
8+
9+
* `firebase_encoders` - Core API and Annotations library.
10+
* `processor` - Java plugin that automatically generates encoders for
11+
`@Encodable` annotated POJOs.
12+
* `firebase_encoders_json` - JSON serialization support.
13+
* `firebase_encoders_proto` - Protobuf serialization support.
14+
* `protoc_gen` - Protobuf compiler plugin that generates encoder-compliant
15+
classes. Can be used with `firebase_encoders_proto` and
16+
`firebase_encoders_json`.
17+
* `reflective` - Can be used to encode any given class via Java
18+
reflection(**not recommented**).
19+
20+
### Protobuf gettings started
21+
22+
##### Step1. Place proto files into **src/main/proto/**
23+
24+
*src/main/proto/my.proto*
25+
```proto
26+
syntax = "proto3";
27+
28+
package com.example.my;
29+
30+
import "google/protobuf/timestamp.proto";
31+
32+
message SimpleProto {
33+
int32 value = 1;
34+
.google.protobuf.Timestamp time = 2;
35+
}
36+
```
37+
38+
39+
##### Step2. Add the following configurations into gradle module build file.
40+
41+
*example.gradle*
42+
```gradle
43+
plugins {
44+
id "java-library"
45+
id 'com.google.protobuf'
46+
}
47+
48+
// add a dependency on the protoc plugin's fat jar to make it available to protobuf below.
49+
configurations.create("protobuild")
50+
dependencies {
51+
protobuild project(path: ":encoders:protoc-gen-firebase-encoders", configuration: "shadow")
52+
}
53+
54+
protobuf {
55+
protoc {
56+
artifact = "com.google.protobuf:protoc:$protocVersion"
57+
}
58+
plugins {
59+
firebaseEncoders {
60+
path = configurations.protobuild.asPath
61+
}
62+
}
63+
generateProtoTasks {
64+
all().each { task ->
65+
task.dependsOn configurations.protobuild
66+
task.inputs.file 'code-gen-cfg.textproto'
67+
task.plugins {
68+
firebaseEncoders {
69+
option file('code-gen-cfg.textproto').path
70+
}
71+
}
72+
// In most cases you don't need the full Java output
73+
task.builtins {
74+
remove java
75+
}
76+
}
77+
}
78+
}
79+
80+
dependencies {
81+
implementation project(":encoders:firebase-encoders")
82+
implementation project(":encoders:firebase-encoders-proto")
83+
annotationProcessor project(":encoders:firebase-encoders-processor")
84+
}
85+
```
86+
87+
##### Step3. Create a code-gen-cfg.textproto file at the module root folder(same location as the gradle module build file).
88+
89+
*code-gen-cfg.textproto*
90+
91+
Note:
92+
- The filename must be the same as the filename determined in the gradle build file.
93+
- Only need to specify the "root" proto object, anything it references will automatically be included.
94+
```textproto
95+
# code_gen_cfg.textproto
96+
# proto-file: src/main/proto/my.proto
97+
# proto-message: SimpleProto
98+
99+
# all types will be vendored in this package
100+
vendor_package: "com.google"
101+
102+
# marks a type as a "root" message
103+
include: "com.example.my.SimpleProto"
104+
```
105+
106+
With the above configuration here's a list of classes that will be generated:
107+
108+
```
109+
com.google.com.example.my.SimpleProto
110+
com.google.com.example.my.SimpleProto$Builder
111+
com.google.google.protobuf.Timestamp
112+
com.google.google.protobuf.Timestamp$Builder
113+
```
114+
115+
Only `root` classes are "encodable" meaning that they have the following
116+
methods:
117+
118+
```java
119+
public class SimpleProto {
120+
public void writeTo(OutputStream output) throws IOException;
121+
public byte[] toByteArray();
122+
}
123+
```
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2021 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+
}
18+
19+
android {
20+
compileSdkVersion project.targetSdkVersion
21+
22+
defaultConfig {
23+
minSdkVersion 16
24+
targetSdkVersion project.targetSdkVersion
25+
multiDexEnabled true
26+
versionName version
27+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
28+
}
29+
compileOptions {
30+
sourceCompatibility JavaVersion.VERSION_1_8
31+
targetCompatibility JavaVersion.VERSION_1_8
32+
}
33+
testOptions {
34+
unitTests {
35+
includeAndroidResources = true
36+
}
37+
}
38+
}
39+
40+
dependencies {
41+
implementation 'org.jetbrains:annotations:15.0'
42+
implementation project(path: ':firebase-components')
43+
implementation project(path: ':firebase-installations-interop')
44+
implementation project(path: ':firebase-common')
45+
implementation 'com.android.support:appcompat-v7:28.0.0'
46+
implementation project(path: ':firebase-installations')
47+
48+
testImplementation 'junit:junit:4.12'
49+
testImplementation 'junit:junit:4.12'
50+
testImplementation "org.robolectric:robolectric:$robolectricVersion"
51+
testImplementation "com.google.truth:truth:$googleTruthVersion"
52+
testImplementation 'org.mockito:mockito-core:2.25.0'
53+
androidTestImplementation "org.mockito:mockito-android:2.25.0"
54+
testImplementation 'androidx.test:core:1.2.0'
55+
56+
implementation 'com.google.android.gms:play-services-tasks:17.0.0'
57+
58+
compileOnly 'com.google.auto.value:auto-value-annotations:1.6.5'
59+
annotationProcessor 'com.google.auto.value:auto-value:1.6.5'
60+
61+
implementation 'com.android.support:customtabs:28.0.0'
62+
implementation "androidx.browser:browser:1.3.0"
63+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2021 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+
version=0.0.1
16+
android.useAndroidX=true
17+
android.enableJetifier=true
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2021 Google LLC -->
3+
<!-- -->
4+
<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
5+
<!-- you may not use this file except in compliance with the License. -->
6+
<!-- You may obtain a copy of the License at -->
7+
<!-- -->
8+
<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
9+
<!-- -->
10+
<!-- Unless required by applicable law or agreed to in writing, software -->
11+
<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
12+
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
13+
<!-- See the License for the specific language governing permissions and -->
14+
<!-- limitations under the License. -->
15+
16+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
17+
package="com.google.firebase.appdistribution">
18+
19+
<application>
20+
<service
21+
android:name="com.google.firebase.components.ComponentDiscoveryService"
22+
android:exported="false">
23+
<meta-data
24+
android:name="com.google.firebase.components:com.google.firebase.appdistribution.FirebaseAppDistributionRegistrar"
25+
android:value="com.google.firebase.components.ComponentRegistrar" />
26+
</service>
27+
28+
<activity android:name=".SignInResultActivity" android:exported="true">
29+
<intent-filter>
30+
<action android:name="android.intent.action.VIEW"/>
31+
<category android:name="android.intent.category.DEFAULT"/>
32+
<category android:name="android.intent.category.BROWSABLE"/>
33+
34+
<data android:scheme="appdistribution-${applicationId}" android:host="authredirect" />
35+
36+
</intent-filter>
37+
</activity>
38+
</application>
39+
</manifest>

0 commit comments

Comments
 (0)