diff --git a/build-tools/tooling-api-impl/src/test/java/com/itsaky/androidide/tooling/impl/MultiModuleAndroidProjectTest.kt b/build-tools/tooling-api-impl/src/test/java/com/itsaky/androidide/tooling/impl/MultiModuleAndroidProjectTest.kt index 6e579cd8c..0c70cd00f 100644 --- a/build-tools/tooling-api-impl/src/test/java/com/itsaky/androidide/tooling/impl/MultiModuleAndroidProjectTest.kt +++ b/build-tools/tooling-api-impl/src/test/java/com/itsaky/androidide/tooling/impl/MultiModuleAndroidProjectTest.kt @@ -34,6 +34,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 import java.io.File +import kotlin.jvm.Throws /** @author Akash Yadav */ @RunWith(JUnit4::class) @@ -141,24 +142,43 @@ class MultiModuleAndroidProjectTest { * Android Gradle Plugin. This test runs only in the CI environment. */ @Test + @Throws(CIOnlyException::class) fun `test CI-only simple multi module project initialization with multiple AGP versions`() { - val isCi = System.getenv("TEST_TOOLING_API_IMPL").let { it == "true" } - if (!isCi) { - println("Skipping project initialization test with multiple AGP versions") - println("This test is supposed to run only in CI environment") - return - } - - val versions = listOf("7.2.0", "7.2.1", "7.2.2", "7.3.0") - val client = MultiVersionTestClient() - for (version in versions) { - client.version = version - val (server, project) = ToolingApiTestLauncher().launchServer(client = client) - server - .initialize(InitializeProjectMessage(File("../../tests/test-project").absolutePath)) - .get() - doAssertions(project = project, server = server) - MultiVersionTestClient.buildFile.delete() + ciOnlyTest { + val versions = listOf("7.2.0", "7.2.1", "7.2.2", "7.3.0") + val client = MultiVersionTestClient() + for (version in versions) { + client.version = version + val (server, project) = ToolingApiTestLauncher().launchServer(client = client) + server + .initialize(InitializeProjectMessage(File("../../tests/test-project").absolutePath)) + .get() + doAssertions(project = project, server = server) + MultiVersionTestClient.buildFile.delete() + } } } + + private fun ciOnlyTest(test: () -> Unit) { + try { + assertIsCI() + test() + } catch (err: CIOnlyException) { + if(shouldTestMultipleVersions()) { + throw err + } + } + } + + private fun assertIsCI() { + if (!shouldTestMultipleVersions()) { + throw CIOnlyException() + } + } + + private fun shouldTestMultipleVersions() : Boolean { + return System.getenv("TEST_TOOLING_API_IMPL").let { it == "true" } + } + + private class CIOnlyException : IllegalStateException() } diff --git a/tests/test-home/.androidide/init/model.jar b/tests/test-home/.androidide/init/model.jar index 920120bde..0fc984dbc 100644 Binary files a/tests/test-home/.androidide/init/model.jar and b/tests/test-home/.androidide/init/model.jar differ diff --git a/tests/test-project/app/build.gradle b/tests/test-project/app/build.gradle index 93379179a..27ae0ab14 100644 --- a/tests/test-project/app/build.gradle +++ b/tests/test-project/app/build.gradle @@ -39,12 +39,31 @@ task thisIsATestTask () { dependencies { implementation fileTree (dir: "libs", include: ["*.jar"]) - implementation 'androidx.appcompat:appcompat:1.3.1' - implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.appcompat:appcompat:1.5.1' + + // Issue #488 + implementation 'com.unity3d.ads:unity-ads:4.4.0' + implementation 'com.google.android.gms:play-services-ads:21.2.0' + implementation platform('com.google.firebase:firebase-bom:30.5.0') + implementation 'com.google.firebase:firebase-perf' + implementation 'com.google.firebase:firebase-analytics' + implementation 'com.google.firebase:firebase-crashlytics' + implementation 'com.google.firebase:firebase-auth' + implementation 'com.google.firebase:firebase-firestore' + implementation 'com.google.android.gms:play-services-auth:20.3.0' + implementation 'com.google.firebase:firebase-messaging' + implementation 'com.google.firebase:firebase-database' + implementation fileTree(dir: 'libs', include: ['*.aar']) + implementation 'com.google.android.gms:play-services-appset:16.0.2' + implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1' + implementation 'com.google.android.gms:play-services-basement:18.1.0' + implementation 'com.google.firebase:firebase-inappmessaging-display' + implementation 'com.google.android.material:material:1.8.0-alpha01' + implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'unresolved:unresolved:unresolved' implementation project (path: ':another-android-library') -// implementation project (path: ':android-library') + + implementation platform('com.google.firebase:firebase-bom:30.5.0') } diff --git a/tests/test-project/build.gradle b/tests/test-project/build.gradle index fc73698b5..f95aa85f6 100644 --- a/tests/test-project/build.gradle +++ b/tests/test-project/build.gradle @@ -1,7 +1,7 @@ /* DO NOT EDIT - Automatically generated file */ buildscript { ext { - build_gradle_version = "7.2.0" + build_gradle_version = "7.3.0" } project.ext {