From 7625683624d9e5cc1c6c53797d400fe544324a65 Mon Sep 17 00:00:00 2001 From: Nicholas Doglio Date: Mon, 16 Jan 2023 08:42:22 -0500 Subject: [PATCH] Update script to support releaseImplementation (#56) Co-authored-by: Nick Doglio --- expected_build_gradle.kts | 2 ++ gradlekotlinconverter.kts | 3 ++- test_build_gradle | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) mode change 100755 => 100644 gradlekotlinconverter.kts diff --git a/expected_build_gradle.kts b/expected_build_gradle.kts index a252ef1..7e15179 100644 --- a/expected_build_gradle.kts +++ b/expected_build_gradle.kts @@ -54,6 +54,8 @@ configurations.classpath { implementation(kotlin("stdlib", KotlinCompilerVersion.VERSION)) implementation(kotlin("stdlib", KotlinCompilerVersion.VERSION)) +releaseImplementation(kotlin("stdlib", KotlinCompilerVersion.VERSION)) +debugImplementation(kotlin("stdlib", KotlinCompilerVersion.VERSION)) classpath(kotlin("gradle-plugin", version = "$kotlin_version")) classpath(kotlin("gradle-plugin", version = "1.3.20")) diff --git a/gradlekotlinconverter.kts b/gradlekotlinconverter.kts old mode 100755 new mode 100644 index ce70eef..408d3b2 --- a/gradlekotlinconverter.kts +++ b/gradlekotlinconverter.kts @@ -251,9 +251,10 @@ fun String.convertCompileToImplementation(): String { // implementation(":epoxy-annotations") fun String.convertDependencies(): String { - val testKeywords = "testImplementation|androidTestImplementation|debugImplementation|compileOnly|testCompileOnly|runtimeOnly|developmentOnly" + val testKeywords = "testImplementation|androidTestImplementation|debugImplementation|releaseImplementation|compileOnly|testCompileOnly|runtimeOnly|developmentOnly" val gradleKeywords = "($testKeywords|implementation|api|annotationProcessor|classpath|kaptTest|kaptAndroidTest|kapt|check|ksp|coreLibraryDesugaring|detektPlugins|lintPublish|lintCheck)".toRegex() + // ignore cases like kapt { correctErrorTypes = true } and apply plugin: ('kotlin-kapt") but pass kapt("...") // ignore keyWord followed by a space and a { or a " and a ) val validKeywords = "(?!$gradleKeywords\\s*(\\{|\"\\)|\\.))$gradleKeywords.*".toRegex() diff --git a/test_build_gradle b/test_build_gradle index 24c8a6c..c9ffdc5 100644 --- a/test_build_gradle +++ b/test_build_gradle @@ -48,6 +48,8 @@ configurations.classpath.exclude group: 'com.android.tools.external.lombok' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" +releaseImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" +debugImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20")