Skip to content

Commit adcf26c

Browse files
committed
Convert addBuildTypeUsingDslFinalize to be 9.0 compatible
The changes include: - remove KGP (required) - update to new DSL (optional but best practice) This also adds two quick script to use convert.sh more easily when making workingcopies, and update the kotlin version for 9.0 recipe to be aligned with AGP's dependency (2.1.20) Bug: 446130745 Test: existing validation Change-Id: I23b651fe3147f0250730b1b0a960f7ccb091d58b
1 parent 4c360c2 commit adcf26c

File tree

7 files changed

+14
-23
lines changed

7 files changed

+14
-23
lines changed

apply-workingcopy.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Usage: ./apply-workingcopy.sh <working-copy-folder>
2+
./convert.sh convert --overwrite --mode source --source $1 --destination recipes/

make-workingcopy.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Usage: ./make-workingcopy.sh recipes/<recipe-name> <destination> <agpversion>
2+
./convert.sh convert --mode workingcopy --source $1 --destination $2 --agpVersion $3

recipes/addBuildTypeUsingDslFinalize/app/build.gradle.kts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@
1616

1717
plugins {
1818
alias(libs.plugins.android.application)
19-
alias(libs.plugins.kotlin.android)
2019
id("android.recipes.addBuildTypeUsingDslFinalize")
2120
}
2221

2322
android {
2423
namespace = "com.example.android.recipes.addBuildTypeUsingDslFinalize"
25-
compileSdk = $COMPILE_SDK
24+
compileSdk {
25+
version = release($COMPILE_SDK)
26+
}
2627
defaultConfig {
27-
minSdk = $MINIMUM_SDK
28-
targetSdk = $COMPILE_SDK
28+
minSdk {
29+
version = release($MINIMUM_SDK)
30+
}
31+
targetSdk {
32+
version = release($COMPILE_SDK)
33+
}
2934
}
3035
}

recipes/addBuildTypeUsingDslFinalize/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616

1717
plugins {
1818
alias(libs.plugins.android.application) apply false
19-
alias(libs.plugins.kotlin.android) apply false
2019
}

recipes/addBuildTypeUsingDslFinalize/gradle.properties

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
1111
# This option should only be used with decoupled projects. More details, visit
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
org.gradle.parallel=true
14-
# AndroidX package structure to make it clearer which packages are bundled with the
15-
# Android operating system, and which are packaged with your app's APK
16-
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17-
android.useAndroidX=true
1814
# Kotlin code style for this project: "official" or "obsolete":
1915
kotlin.code.style=official
20-
# Enables namespacing of each library's R class so that its R class includes only the
21-
# resources declared in the library itself and none from the library's dependencies,
22-
# thereby reducing the size of the R class for that library
23-
android.nonTransitiveRClass=true
24-
25-
# TODO(b/385745419): Migrate to built-in Kotlin
26-
android.builtInKotlin=false
27-
# TODO(b/417183956) Migrate to new variant API
28-
android.enableLegacyVariantApi=true
29-
# TODO(b/418804641): Migrate to new DSL
30-
android.newDsl=false
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[versions]
22
androidGradlePlugin = $AGP_VERSION
3-
kotlin = $KOTLIN_VERSION
43

54
[plugins]
65
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
7-
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
86

97

version_mappings.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
8.11;8.13;2.1.20
1313
8.12;8.13;2.1.20
1414
8.13;8.13;2.1.20
15-
9.0;9.0;2.2.20-RC
15+
9.0;9.0;2.1.20

0 commit comments

Comments
 (0)