Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions firebase-appdistribution-gradle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
### App Distribution Gradle plugin version 5.2.0
### App Distribution Gradle plugin version 5.2.1

* {{fixed}} Fixed compatibility with AGP 9.0.0.

* {{fixed}} Fixed issue causing distribution properties (configured with `firebaseAppDistribution { }`) to work incorrectly within Android buildType configurations on Kotlin Gradle builds.

* {{deprecated}} Support for AGP < 8.1.0 (and Gradle < 8.0) has been deprecated and will be removed in a future release.

* {{deprecated}} Previously, we allowed `firebaseAppDistribution { }` at the root of an app's gradle build (in addition to inside its buildTypes and productFlavors). This undocumented feature has been renamed to `firebaseAppDistributionDefault { }`. In a future release, the original DSL, `firebaseAppDistribution { }`, will only work in productFlavors and buildTypes.
* {{fixed}} Declare dependency on GoogleServices plugin

Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ dependencies {
testImplementation(gradleApi())
testImplementation(libs.junit)
testImplementation("com.android.tools.build:gradle:7.2.0")
testImplementation("org.mockito:mockito-core:3.3.3")
testImplementation("com.github.stefanbirkner:system-rules:1.19.0")
testImplementation("org.mockito:mockito-core:4.11.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0")
Expand Down
2 changes: 1 addition & 1 deletion firebase-appdistribution-gradle/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
groupId=com.google.firebase
artifactId=firebase-appdistribution-gradle
version=5.2.0
version=5.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class AddTestersTaskTest {
fun testAddTesters_failsIfTooManyTesters() {
testGroovyBuild.writeBuildFiles()
testGradleProject.writeServiceCredentialsFile()
val tooManyEmailsBuffer = StringBuffer()
val tooManyEmailsBuffer = StringBuilder()
for (i in 0..1000) {
tooManyEmailsBuffer.append("tester" + i + "e.mail\n")
tooManyEmailsBuffer.append("tester${i}e.mail\n")
}
val tooManyEmailsFile = testGradleProject.createFile("too-many-emails.txt")
writeFile(tooManyEmailsFile, tooManyEmailsBuffer.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ class RemoveTestersTaskTest {
fun testRemoveTesters_failsIfTooManyTesters() {
testGroovyBuild.writeBuildFiles()
testGradleProject.writeServiceCredentialsFile()
val tooManyEmailsBuffer = StringBuffer()
val tooManyEmailsBuffer = StringBuilder()
for (i in 0..1000) {
tooManyEmailsBuffer.append("tester" + i + "e.mail\n")
tooManyEmailsBuffer.append("tester${i}e.mail\n")
}
val tooManyEmailsFile = testGradleProject.createFile("too-many-emails.txt")
writeFile(tooManyEmailsFile, tooManyEmailsBuffer.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class TestGradleProject : ExternalResource() {
*/
@Throws(IOException::class)
private fun writeLocalProperties() =
writeFile(localProperties, "sdk.dir=${System.getenv("ANDROID_SDK_ROOT")}")
writeFile(localProperties, "sdk.dir=${System.getenv("ANDROID_HOME")}")

/** Utility for creating a file in the project dir */
@Throws(IOException::class) fun createFile(fileName: String?) = projectDir.newFile(fileName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,10 @@ class UploadDistributionTaskTest {
companion object {
// Latest gradle, AGP and google-services plugin versions. Update this when new releases come
// out.
private const val LATEST_GRADLE_VERSION = "9.2.1"
private const val LATEST_AGP_VERSION = "9.0.0-beta01"
// Also remember to update the latest AGP/gradle versions in BeePlusGradleProject.java.
// firebase-appdistribution-gradle/src/prodTest/java/com/google/firebase/appdistribution/gradle/BeePlusGradleProject.java#L59-L60
private const val LATEST_GRADLE_VERSION = "9.3.0"
private const val LATEST_AGP_VERSION = "9.1.0-alpha05"
private const val LATEST_GOOGLE_SERVICES_VERSION = "4.4.4"
// For tests against Gradle 9, we get the error:
// "In order to compile Java 9+ source, please set compileSdkVersion to 30 or above"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ constructor(
GET_TEST_RETRIEVAL_FAILURE("App Distribution could not retrieve the test."),
GET_TEST_TIMEOUT("It took longer than expected to process your test, please try again."),
GET_TEST_FAILED("Automated test failed or was inconclusive."),
TEST_CASE_NOT_FOUND("Could not find find test case with ID"),
TEST_CASE_NOT_FOUND("Could not find test case with ID"),
TEST_CASE_WITH_LOGIN_RESOURCES(
"Username or password resources for automatic login cannot be specified when test cases IDs are set"
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ object UploadDistributionTaskConfigurator {
val googleServicesOutputDirectory =
try {
task.project.tasks.named(googleServicesTaskName).flatMap { googleServicesTask ->
task.mustRunAfter(googleServicesTask)
val resourceDirProp = googleServicesTask.property("intermediateDir") as File
task.project.objects.directoryProperty().fileValue(resourceDirProp)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ private static String getRequiredSystemProperty(String propertyName) {
}

static final String PACKAGE_NAME = "com.firebase.appdistribution.prober";
static final String LATEST_AGP_VERSION = "9.0.0-beta01";
static final String LATEST_GRADLE_VERSION = "9.2.1";
// Also remember to update the latest AGP/gradle versions in UploadDistributionTaskTest.kt
// firebase-appdistribution-gradle/src/integrationTest/java/com/google/firebase/appdistribution/gradle/UploadDistributionTaskTest.kt#L724-L726
static final String LATEST_AGP_VERSION = "9.1.0-alpha05";
static final String LATEST_GRADLE_VERSION = "9.3.0";
// The project number for App Distro Probes. We need to use this project
// because this is the one that's actually linked to play for BeePlus,
// which is required for AAB uploads.
Expand Down Expand Up @@ -106,7 +108,7 @@ public BuildResult runAddTesters(Collection<String> emails) {
String.join(",", emails))
.withPluginClasspath(pluginClasspathFiles)
.withGradleVersion(LATEST_GRADLE_VERSION)
.withEnvironment(ImmutableMap.of("FIREBASE_TOKEN", getToken()))
.withEnvironment(getEnvironment())
.build();
}

Expand All @@ -122,7 +124,7 @@ public BuildResult runAddTesters(File emailsFile) {
emailsFile.getAbsolutePath())
.withPluginClasspath(pluginClasspathFiles)
.withGradleVersion(LATEST_GRADLE_VERSION)
.withEnvironment(ImmutableMap.of("FIREBASE_TOKEN", getToken()))
.withEnvironment(getEnvironment())
.build();
}

Expand All @@ -139,7 +141,7 @@ public BuildResult runRemoveTesters(Collection<String> emails) {
"--debug")
.withPluginClasspath(pluginClasspathFiles)
.withGradleVersion(LATEST_GRADLE_VERSION)
.withEnvironment(ImmutableMap.of("FIREBASE_TOKEN", getToken()))
.withEnvironment(getEnvironment())
.build();
}

Expand All @@ -156,7 +158,7 @@ public BuildResult runRemoveTesters(File emailsFile) {
"--debug")
.withPluginClasspath(pluginClasspathFiles)
.withGradleVersion(LATEST_GRADLE_VERSION)
.withEnvironment(ImmutableMap.of("FIREBASE_TOKEN", getToken()))
.withEnvironment(getEnvironment())
.build();
}

Expand All @@ -166,7 +168,7 @@ public BuildResult runUploadApk() {
.withArguments("assembleDebug", "appDistributionUploadDebug", "--info")
.withPluginClasspath(pluginClasspathFiles)
.withGradleVersion(LATEST_GRADLE_VERSION)
.withEnvironment(ImmutableMap.of("FIREBASE_TOKEN", getToken()))
.withEnvironment(getEnvironment())
.build();
}

Expand All @@ -176,7 +178,7 @@ public BuildResult runUploadAab() {
.withArguments("bundleDebug", "appDistributionUploadDebug", "--info")
.withPluginClasspath(pluginClasspathFiles)
.withGradleVersion(LATEST_GRADLE_VERSION)
.withEnvironment(ImmutableMap.of("FIREBASE_TOKEN", getToken()))
.withEnvironment(getEnvironment())
.build();
}

Expand All @@ -189,6 +191,18 @@ private String getToken() {
return token;
}

private ImmutableMap<String, String> getEnvironment() {
ImmutableMap.Builder<String, String> env = ImmutableMap.builder();
env.put("FIREBASE_TOKEN", getToken());
String androidHome = System.getenv("ANDROID_HOME");
if (isNullOrEmpty(androidHome)) {
throw new IllegalStateException(
"ANDROID_HOME environment variable not set. This is required for production tests.");
}
env.put("ANDROID_HOME", androidHome);
return env.build();
}

/** Writes the {@code build.gradle} file for the test project with default build file options */
public void writeBuildFile() throws IOException {
writeBuildFile(BuildFileUploadOptions.builder().build());
Expand Down Expand Up @@ -222,7 +236,7 @@ public void writeBuildFile(BuildFileUploadOptions options) throws IOException {
+ "\n"
+ "android {\n"
+ " namespace '%s'\n"
+ " compileSdkVersion 27\n"
+ " compileSdkVersion 30\n"
+ "\n"
+ " defaultConfig {\n"
+ " applicationId '%s'\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ big changes, similar to how one would do manual testing via a test matrix.
Before running the tests, you need to create a `local.properties` file in the root directory of the `firebase-android-buildtools` project with the following properties:

```properties
sdk.dir=<path_to_android_sdk>
firebase.appId=<your_firebase_app_id>
firebase.projectNumber=<your_project_number>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public class InstrumentationApiCompatTest {
private static final String GRADLE_RELEASES_URL =
"https://api.github.com/repos/gradle/gradle/releases/latest";
// Latest verified versions. Update these as new versions are released and verified.
private static final String VERIFIED_AGP_VERSION = "9.0.0-alpha14";
private static final String VERIFIED_GRADLE_VERSION = "9.2.0";
private static final String VERIFIED_AGP_VERSION = "9.1.0-alpha03";
private static final String VERIFIED_GRADLE_VERSION = "9.2.1";
private final OkHttpClient client = new OkHttpClient();

@RegisterExtension public GradleBuildProject gradleBuildProject = new GradleBuildProject();
Expand Down Expand Up @@ -88,6 +88,14 @@ public void gradleBuildRunsInstrumentationForAllVariants_latestGradleAndAgp() th
LOGGER.log(Level.INFO, "Latest AGP Version: {0}", latestAgpVersion);
LOGGER.log(Level.WARNING, "If this test fails, please file an issue or a bug");

if (latestAgpVersion.equals(VERIFIED_AGP_VERSION)
&& latestGradleVersion.equals(VERIFIED_GRADLE_VERSION)) {
LOGGER.log(
Level.INFO,
"Latest gradle and AGP versions are identical to verified versions. Skipping test.");
return;
}

GradleBuildResult result =
gradleBuildProject
.getJavaRunnerBuilder()
Expand Down
Loading