Skip to content

Commit 22ee484

Browse files
authored
Add firebase-app-distribution-stub SDK (#3292)
* Add a stubbed version of firebase-app-distribution * Add tests for stubbed FirebaseAppDistribution * Fix api.txt * Fix lint error * Update api.txt for kotlin library * Add Firebase dependencies to ktx package * Fix kotlin tests
1 parent 36a76f9 commit 22ee484

File tree

21 files changed

+908
-0
lines changed

21 files changed

+908
-0
lines changed
+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Signature format: 2.0
2+
package com.google.firebase.appdistribution {
3+
4+
public abstract class AppDistributionRelease {
5+
ctor public AppDistributionRelease();
6+
method @NonNull public abstract com.google.firebase.appdistribution.BinaryType getBinaryType();
7+
method @NonNull public abstract String getDisplayVersion();
8+
method @Nullable public abstract String getReleaseNotes();
9+
method @NonNull public abstract long getVersionCode();
10+
}
11+
12+
public enum BinaryType {
13+
enum_constant public static final com.google.firebase.appdistribution.BinaryType AAB;
14+
enum_constant public static final com.google.firebase.appdistribution.BinaryType APK;
15+
}
16+
17+
public class FirebaseAppDistribution {
18+
ctor public FirebaseAppDistribution();
19+
method @NonNull public com.google.android.gms.tasks.Task<com.google.firebase.appdistribution.AppDistributionRelease> checkForNewRelease();
20+
method @NonNull public static com.google.firebase.appdistribution.FirebaseAppDistribution getInstance();
21+
method public boolean isTesterSignedIn();
22+
method @NonNull public com.google.android.gms.tasks.Task<java.lang.Void> signInTester();
23+
method public void signOutTester();
24+
method @NonNull public com.google.firebase.appdistribution.UpdateTask updateApp();
25+
method @NonNull public com.google.firebase.appdistribution.UpdateTask updateIfNewReleaseAvailable();
26+
}
27+
28+
public class FirebaseAppDistributionException extends com.google.firebase.FirebaseException {
29+
ctor public FirebaseAppDistributionException();
30+
method @NonNull public com.google.firebase.appdistribution.FirebaseAppDistributionException.Status getErrorCode();
31+
method @Nullable public com.google.firebase.appdistribution.AppDistributionRelease getRelease();
32+
}
33+
34+
public enum FirebaseAppDistributionException.Status {
35+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status APP_RUNNING_IN_PRODUCTION;
36+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status AUTHENTICATION_CANCELED;
37+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status AUTHENTICATION_FAILURE;
38+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status DOWNLOAD_FAILURE;
39+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status FOREGROUND_ACTIVITY_NOT_AVAILABLE;
40+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status INSTALLATION_CANCELED;
41+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status INSTALLATION_FAILURE;
42+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status INSTALLATION_FAILURE_SIGNATURE_MISMATCH;
43+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status NETWORK_FAILURE;
44+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status RELEASE_URL_EXPIRED;
45+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status UNKNOWN;
46+
enum_constant public static final com.google.firebase.appdistribution.FirebaseAppDistributionException.Status UPDATE_NOT_AVAILABLE;
47+
}
48+
49+
public interface OnProgressListener {
50+
method public void onProgressUpdate(@NonNull com.google.firebase.appdistribution.UpdateProgress);
51+
}
52+
53+
public abstract class UpdateProgress {
54+
ctor public UpdateProgress();
55+
method @NonNull public abstract long getApkBytesDownloaded();
56+
method @NonNull public abstract long getApkFileTotalBytes();
57+
method @NonNull public abstract com.google.firebase.appdistribution.UpdateStatus getUpdateStatus();
58+
}
59+
60+
public enum UpdateStatus {
61+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus DOWNLOADED;
62+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus DOWNLOADING;
63+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus DOWNLOAD_FAILED;
64+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus INSTALL_CANCELED;
65+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus INSTALL_FAILED;
66+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus NEW_RELEASE_CHECK_FAILED;
67+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus NEW_RELEASE_NOT_AVAILABLE;
68+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus PENDING;
69+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus REDIRECTED_TO_PLAY;
70+
enum_constant public static final com.google.firebase.appdistribution.UpdateStatus UPDATE_CANCELED;
71+
}
72+
73+
public abstract class UpdateTask extends com.google.android.gms.tasks.Task<java.lang.Void> {
74+
ctor public UpdateTask();
75+
method @NonNull public abstract com.google.firebase.appdistribution.UpdateTask addOnProgressListener(@NonNull com.google.firebase.appdistribution.OnProgressListener);
76+
method @NonNull public abstract com.google.firebase.appdistribution.UpdateTask addOnProgressListener(@Nullable java.util.concurrent.Executor, @NonNull com.google.firebase.appdistribution.OnProgressListener);
77+
}
78+
79+
}
80+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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(':firebase-components')
43+
implementation project(':firebase-common')
44+
implementation 'com.google.android.gms:play-services-tasks:17.0.0'
45+
46+
testImplementation 'junit:junit:4.13.2'
47+
testImplementation "com.google.truth:truth:$googleTruthVersion"
48+
49+
compileOnly 'com.google.auto.value:auto-value-annotations:1.6.5'
50+
annotationProcessor 'com.google.auto.value:auto-value:1.6.5'
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
latestReleasedVersion=0.0.1
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Signature format: 2.0
2+
package com.google.firebase.app.distribution.ktx {
3+
4+
public final class FirebaseAppDistributionKt {
5+
ctor public FirebaseAppDistributionKt();
6+
method @NonNull public static com.google.firebase.appdistribution.FirebaseAppDistribution getAppDistribution(@NonNull com.google.firebase.ktx.Firebase);
7+
}
8+
9+
}
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
android.enableUnitTestBinaryResources=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
id 'kotlin-android'
18+
}
19+
20+
firebaseLibrary {
21+
releaseWith project(':firebase-app-distribution-stub')
22+
testLab.enabled = true
23+
publishJavadoc = true
24+
publishSources = true
25+
}
26+
27+
android {
28+
compileSdkVersion project.targetSdkVersion
29+
defaultConfig {
30+
minSdkVersion 16
31+
multiDexEnabled true
32+
targetSdkVersion project.targetSdkVersion
33+
versionName version
34+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
35+
}
36+
sourceSets {
37+
main.java.srcDirs += 'src/main/kotlin'
38+
test.java {
39+
srcDir 'src/test/kotlin'
40+
}
41+
androidTest.java.srcDirs += 'src/androidTest/kotlin'
42+
}
43+
testOptions.unitTests.includeAndroidResources = true
44+
}
45+
46+
dependencies {
47+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
48+
49+
implementation project(':firebase-common')
50+
implementation project(':firebase-components')
51+
implementation project(':firebase-common:ktx')
52+
implementation 'androidx.annotation:annotation:1.1.0'
53+
implementation project(':firebase-app-distribution-stub')
54+
55+
testImplementation "org.robolectric:robolectric:$robolectricVersion"
56+
testImplementation 'junit:junit:4.12'
57+
testImplementation "com.google.truth:truth:$googleTruthVersion"
58+
testImplementation 'org.mockito:mockito-core:2.25.0'
59+
60+
androidTestImplementation 'junit:junit:4.12'
61+
androidTestImplementation "com.google.truth:truth:$googleTruthVersion"
62+
androidTestImplementation 'androidx.test:runner:1.2.0'
63+
androidTestImplementation 'androidx.test:core:1.2.0'
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.google.firebase.app.distribution.ktx">
3+
<!--Although the *SdkVersion is captured in gradle build files, this is required for non gradle builds-->
4+
<!--<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />-->
5+
<uses-permission android:name="android.permission.INTERNET"/>
6+
<application>
7+
<uses-library android:name="android.test.runner" />
8+
</application>
9+
10+
<instrumentation
11+
android:name="androidx.test.runner.AndroidJUnitRunner"
12+
android:targetPackage="3com.google.firebase.app.distribution.ktx" />
13+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
package com.google.firebase.app.distribution.ktx
16+
17+
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
18+
import com.google.common.truth.Truth
19+
import com.google.firebase.appdistribution.FirebaseAppDistribution
20+
import com.google.firebase.ktx.Firebase
21+
import org.junit.Test
22+
import org.junit.runner.RunWith
23+
24+
@RunWith(AndroidJUnit4ClassRunner::class)
25+
class FirebaseAppDistributionTests {
26+
@Test
27+
fun appDistribution_default_returnsInstanceOfFirebaseAppDistribution() {
28+
Truth.assertThat(Firebase.appDistribution).isInstanceOf(FirebaseAppDistribution::class.java)
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
16+
package="com.google.firebase.app.distribution.ktx">
17+
<uses-sdk android:minSdkVersion="16"/>
18+
19+
<application>
20+
</application>
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
package com.google.firebase.app.distribution.ktx
16+
17+
import com.google.firebase.appdistribution.FirebaseAppDistribution
18+
import com.google.firebase.ktx.Firebase
19+
20+
/** Returns the [FirebaseAppDistribution] instance of the default [FirebaseApp]. */
21+
val Firebase.appDistribution: FirebaseAppDistribution
22+
get() = FirebaseAppDistribution.getInstance()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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.app.distribution">
18+
19+
<application>
20+
</application>
21+
</manifest>

0 commit comments

Comments
 (0)