diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 92dd8b05..7c70ea85 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -43,7 +43,7 @@ webjar-material-design-icons = "4.0.0" webjar-materialize = "1.0.0" webjars-locator-lite = "0.0.4" -composable-preview-scanner = "0.1.3" +composable-preview-scanner = "0.3.2" [libraries] roborazzi = { module = "io.github.takahirom.roborazzi:roborazzi", version.ref = "roborazzi-for-replacing-by-include-build" } @@ -56,7 +56,7 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" } kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit" } # for sample -composable-preview-scanner = { module = "com.github.sergio-sastre.ComposablePreviewScanner:android", version.ref = "composable-preview-scanner" } +composable-preview-scanner = { module = "io.github.sergio-sastre.ComposablePreviewScanner:android", version.ref = "composable-preview-scanner" } androidx-activity = { module = "androidx.activity:activity", version.ref = "androidx-activity" } androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" } diff --git a/include-build/roborazzi-gradle-plugin/src/integrationTest/java/io/github/takahirom/roborazzi/PreviewGenerateTest.kt b/include-build/roborazzi-gradle-plugin/src/integrationTest/java/io/github/takahirom/roborazzi/PreviewGenerateTest.kt index 5f7b2a9d..c6a9f8d6 100644 --- a/include-build/roborazzi-gradle-plugin/src/integrationTest/java/io/github/takahirom/roborazzi/PreviewGenerateTest.kt +++ b/include-build/roborazzi-gradle-plugin/src/integrationTest/java/io/github/takahirom/roborazzi/PreviewGenerateTest.kt @@ -196,7 +196,6 @@ class PreviewModule( repositories { mavenCentral() google() - maven { url = uri("https://jitpack.io") } } """.trimIndent() } else { @@ -220,7 +219,6 @@ class PreviewModule( repositories { mavenCentral() google() - maven { url = uri("https://jitpack.io") } } $androidBlock diff --git a/include-build/roborazzi-gradle-plugin/src/integrationTest/projects/sample-generate-preview-tests/build.gradle.kts b/include-build/roborazzi-gradle-plugin/src/integrationTest/projects/sample-generate-preview-tests/build.gradle.kts index 026f3fc9..47127caa 100644 --- a/include-build/roborazzi-gradle-plugin/src/integrationTest/projects/sample-generate-preview-tests/build.gradle.kts +++ b/include-build/roborazzi-gradle-plugin/src/integrationTest/projects/sample-generate-preview-tests/build.gradle.kts @@ -19,7 +19,6 @@ roborazzi { repositories { mavenCentral() google() - maven { url = uri("https://jitpack.io") } } android { diff --git a/include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/GenerateComposePreviewRobolectricTestsExtension.kt b/include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/GenerateComposePreviewRobolectricTestsExtension.kt index 722204dd..c36dccb4 100644 --- a/include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/GenerateComposePreviewRobolectricTestsExtension.kt +++ b/include-build/roborazzi-gradle-plugin/src/main/java/io/github/takahirom/roborazzi/GenerateComposePreviewRobolectricTestsExtension.kt @@ -4,7 +4,6 @@ import com.android.build.api.variant.Variant import com.android.build.gradle.TestedExtension import org.gradle.api.DefaultTask import org.gradle.api.Project -import org.gradle.api.artifacts.repositories.MavenArtifactRepository import org.gradle.api.file.DirectoryProperty import org.gradle.api.logging.Logger import org.gradle.api.model.ObjectFactory @@ -16,7 +15,6 @@ import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskCollection import org.gradle.api.tasks.testing.Test -import org.gradle.invocation.DefaultGradle import java.io.File import java.net.URLEncoder import java.util.Locale @@ -235,39 +233,11 @@ fun verifyGenerateComposePreviewRobolectricTests( if ((extension.enable.orNull) != true) { return@afterEvaluate } - verifyMavenRepository(project) verifyLibraryDependencies(project) verifyAndroidConfig(androidExtension, logger) } } -private fun verifyMavenRepository(project: Project) { - // Check if the jitpack repository is added. - val hasJitpackRepo = project.repositories.any { - it is MavenArtifactRepository && - it.url.toString().contains("https://jitpack.io") - } - // settingsEvaluated{} is not called - // when it is already evaluated so we need to call `settingsEvaluated` - // before the project is evaluated. - // So we need to use the following workaround. - // https://github.com/gradle/gradle/issues/27741 - val setting = (project.gradle as? DefaultGradle)?.getSettings() ?: return - val hasJitpackRepoInSettings = setting.pluginManagement.repositories.any { - it is MavenArtifactRepository && it.url.toString().contains("https://jitpack.io") - } || setting.dependencyResolutionManagement.repositories.any { - it is MavenArtifactRepository && it.url.toString().contains("https://jitpack.io") - } - if (!hasJitpackRepo && !hasJitpackRepoInSettings) { - error( - "Roborazzi: Please add the following 'maven' repository to the 'repositories' block in the 'build.gradle' file.\n" + - "build.gradle: \nrepositories {\nmaven { url 'https://jitpack.io' } \n}\n" + - "build.gradle.kts: \nrepositories {\nmaven { url = uri(\"https://jitpack.io\") } \n}\n" + - "This is necessary to download the ComposablePreviewScanner." - ) - } -} - private fun verifyTestConfig( testTaskProvider: TaskCollection, logger: Logger @@ -345,7 +315,7 @@ private fun verifyLibraryDependencies( "io.github.takahirom.roborazzi:roborazzi-compose-preview-scanner-support", "junit:junit", "org.robolectric:robolectric", - "com.github.sergio-sastre.ComposablePreviewScanner:android", + "io.github.sergio-sastre.ComposablePreviewScanner:android", ) requiredLibraries.forEach { allDependencies.checkExists(it) } } diff --git a/roborazzi-compose-preview-scanner-support/build.gradle b/roborazzi-compose-preview-scanner-support/build.gradle index 32947ef6..66af990e 100644 --- a/roborazzi-compose-preview-scanner-support/build.gradle +++ b/roborazzi-compose-preview-scanner-support/build.gradle @@ -8,7 +8,6 @@ if (System.getenv("INTEGRATION_TEST") != "true") { repositories { google() mavenCentral() - maven { url = uri("https://jitpack.io") } } android.buildFeatures.compose = true diff --git a/sample-generate-preview-tests/build.gradle.kts b/sample-generate-preview-tests/build.gradle.kts index 5d56f701..007d87c5 100644 --- a/sample-generate-preview-tests/build.gradle.kts +++ b/sample-generate-preview-tests/build.gradle.kts @@ -15,7 +15,6 @@ roborazzi { repositories { mavenCentral() google() - maven { url = uri("https://jitpack.io") } } android {