diff --git a/buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/FirebaseLibraryPlugin.java b/buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/FirebaseLibraryPlugin.java index 5950a5477dd..522065eab14 100644 --- a/buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/FirebaseLibraryPlugin.java +++ b/buildSrc/src/main/groovy/com/google/firebase/gradle/plugins/FirebaseLibraryPlugin.java @@ -20,7 +20,6 @@ import com.google.firebase.gradle.plugins.ci.device.FirebaseTestServer; import org.gradle.api.Plugin; import org.gradle.api.Project; -import org.gradle.api.tasks.bundling.Jar; import org.jetbrains.kotlin.gradle.tasks.KotlinCompile; public class FirebaseLibraryPlugin implements Plugin { @@ -33,6 +32,28 @@ public void apply(Project project) { LibraryExtension android = project.getExtensions().getByType(LibraryExtension.class); + // In the case of and android library signing config only affects instrumentation test APK. + // We need it signed with default debug credentials in order for FTL to accept the APK. + android.buildTypes( + types -> + types + .getByName("release") + .setSigningConfig(types.getByName("debug").getSigningConfig())); + + // skip debug tests in CI + // TODO(vkryachko): provide ability for teams to control this if needed + if (System.getenv().containsKey("FIREBASE_CI")) { + android.setTestBuildType("release"); + project + .getTasks() + .all( + task -> { + if ("testDebugUnitTest".equals(task.getName())) { + task.setEnabled(false); + } + }); + } + android.testServer(new FirebaseTestServer(project, firebaseLibrary.testLab)); // reduce the likelihood of kotlin module files colliding. diff --git a/root-project.gradle b/root-project.gradle index 7ee1e9d0401..664cce0efd9 100644 --- a/root-project.gradle +++ b/root-project.gradle @@ -140,38 +140,6 @@ configure(subprojects) { } } -/** - * Disable "debug" build type for all subprojects. - * - * They are identical to "release" and are not used in either release or smoke tests. Disabling them - * to reduce the number of tests we run on pre/post-submit. - */ -configure(subprojects) { - afterEvaluate { Project sub -> - if (!sub.plugins.hasPlugin('com.android.library') && !sub.plugins.hasPlugin('com.android.application')) { - return - } - - // skip debug unit tests in CI - // TODO(vkryachko): provide ability for teams to control this if needed - if (System.getenv().containsKey("FIREBASE_CI")) { - sub.tasks.all {Task task -> - if (task.name == 'testDebugUnitTest') { - task.enabled = false - } - } - } - sub.android { - testBuildType "release" - - buildTypes { - // In the case of and android library signing config only affects instrumentation test APK. - // We need it signed with default debug credentials in order for FTL to accept the APK. - release.signingConfig = debug.signingConfig - } - } - } -} /** * Configure "Preguarding" and Desugaring for the subprojects.