diff --git a/.bazel/.default.bazelrc b/.bazel/.default.bazelrc index f4b5aee8..ace5e06f 100644 --- a/.bazel/.default.bazelrc +++ b/.bazel/.default.bazelrc @@ -28,9 +28,12 @@ common --experimental_worker_for_repo_fetching=platform # JAVA - START common --experimental_strict_java_deps=off # Turn off strict java deps -common --java_runtime_version=remotejdk_11 # Use inbuilt Java 11 for hermeticity -common --tool_java_runtime_version=remotejdk_11 -common --jvmopt="-Djava.locale.providers=COMPAT,SPI" # Use Java 8 default locale provider +common --java_runtime_version=remotejdk_17 # Use inbuilt Java 17 for hermeticity +common --tool_java_runtime_version=remotejdk_17 +common --tool_java_language_version=17 +common --java_language_version=17 +## See https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Locale.html#legacy_language_codes +build --jvmopt="-Djava.locale.providers=COMPAT,SPI -Djava.locale.useOldISOCodes=true" # Use Java 8 default locale provider common --experimental_java_classpath=bazel common --experimental_java_header_input_pruning # JAVA - END diff --git a/.github/actions/bazel/action.yml b/.github/actions/bazel/action.yml index 20953cab..66cbe559 100644 --- a/.github/actions/bazel/action.yml +++ b/.github/actions/bazel/action.yml @@ -12,11 +12,11 @@ runs: steps: - name: Setup Bazelisk uses: bazelbuild/setup-bazelisk@v2 - - name: Install JDK 11 + - name: Install JDK 17 uses: actions/setup-java@v3 with: distribution: "zulu" - java-version: "11" + java-version: "17" - name: Mount bazel cache uses: actions/cache@v3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 753247ac..02b65d9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ on: - master pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + env: TERM: dumb @@ -14,12 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Install JDK 11 - uses: actions/setup-java@v2 + uses: actions/checkout@v4 + - name: Install JDK 17 + uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "11" + java-version: "17" - name: Lint run: | find "$(pwd -P)" -type f \ @@ -29,7 +33,7 @@ jobs: bazel-build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Bazel build uses: ./.github/actions/bazel with: @@ -38,7 +42,7 @@ jobs: bazel-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Query targets run: | bazelisk query 'kind(kt_jvm_test, ...)' --output label > /tmp/targets @@ -51,7 +55,7 @@ jobs: bazel-android-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Bazel Android Lint uses: ./.github/actions/bazel with: @@ -61,7 +65,12 @@ jobs: grazel-build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Install JDK 17 + uses: actions/setup-java@v4 + with: + distribution: "zulu" + java-version: "17" - uses: burrunan/gradle-cache-action@v1.12 name: grazel-build with: @@ -75,7 +84,12 @@ jobs: grazel-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Install JDK 17 + uses: actions/setup-java@v4 + with: + distribution: "zulu" + java-version: "17" - uses: burrunan/gradle-cache-action@v1.12 name: grazel-test with: @@ -89,7 +103,12 @@ jobs: grazel-gradle-plugin-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Install JDK 17 + uses: actions/setup-java@v4 + with: + distribution: "zulu" + java-version: "17" - uses: burrunan/gradle-cache-action@v1.12 name: grazel-gradle-plugin-test with: @@ -104,14 +123,14 @@ jobs: migrate-to-bazel-validation: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Bazelisk uses: bazelbuild/setup-bazelisk@v2 - - name: Install JDK 11 + - name: Install JDK 17 uses: actions/setup-java@v3 with: distribution: "zulu" - java-version: "11" + java-version: "17" - uses: burrunan/gradle-cache-action@v1.12 name: migrate-to-bazel-validation with: diff --git a/.gitignore b/.gitignore index a26494f4..77f2b29f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,8 @@ .idea/google-java-format.xml .idea/shelf .idea/modules/app/ +.idea/deploymentTargetSelector.xml +.idea/other.xml /.idea/git_toolbox_prj.xml /.idea/uiDesigner.xml /.idea/terminal.xml @@ -40,6 +42,7 @@ bin/ gen/ out/ build/ +!**/src/**/build/ /build .ART # Project files diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index ac464705..0fc31131 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,9 +1,5 @@ - - diff --git a/BUILD.bazel b/BUILD.bazel index ce9fc0c2..1ea03605 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -19,7 +19,7 @@ define_kt_toolchain( experimental_strict_kotlin_deps = "off", experimental_use_abi_jars = True, javac_options = "//:kt_javac_options", - jvm_target = "11", + jvm_target = "17", kotlinc_options = "//:kt_kotlinc_options", language_version = "1.7", ) diff --git a/WORKSPACE b/WORKSPACE index f48fbd49..221fa422 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -314,11 +314,11 @@ maven_install( "androidx.core:core:1.10.1", "androidx.cursoradapter:cursoradapter:1.0.0", "androidx.customview:customview:1.0.0", - "androidx.databinding:databinding-adapters:7.2.2", - "androidx.databinding:databinding-common:7.2.2", - "androidx.databinding:databinding-ktx:7.2.2", - "androidx.databinding:databinding-runtime:7.2.2", - "androidx.databinding:viewbinding:7.2.2", + "androidx.databinding:databinding-adapters:8.1.4", + "androidx.databinding:databinding-common:8.1.4", + "androidx.databinding:databinding-ktx:8.1.4", + "androidx.databinding:databinding-runtime:8.1.4", + "androidx.databinding:viewbinding:8.1.4", "androidx.drawerlayout:drawerlayout:1.0.0", "androidx.emoji2:emoji2:1.3.0", "androidx.fragment:fragment:1.3.6", @@ -466,7 +466,7 @@ test_maven_pinned_maven_install() android_sdk_repository( name = "androidsdk", - api_level = 33, + api_level = 34, build_tools_version = "33.0.1", ) diff --git a/build-logic/gradle b/build-logic/gradle new file mode 120000 index 00000000..3337596a --- /dev/null +++ b/build-logic/gradle @@ -0,0 +1 @@ +../gradle \ No newline at end of file diff --git a/build-logic/gradle.properties b/build-logic/gradle.properties new file mode 120000 index 00000000..7677fb73 --- /dev/null +++ b/build-logic/gradle.properties @@ -0,0 +1 @@ +../gradle.properties \ No newline at end of file diff --git a/build-logic/gradlew b/build-logic/gradlew new file mode 120000 index 00000000..502f5a2d --- /dev/null +++ b/build-logic/gradlew @@ -0,0 +1 @@ +../gradlew \ No newline at end of file diff --git a/build-logic/gradlew.bat b/build-logic/gradlew.bat new file mode 120000 index 00000000..28401328 --- /dev/null +++ b/build-logic/gradlew.bat @@ -0,0 +1 @@ +../gradlew.bat \ No newline at end of file diff --git a/build-logic/plugin/build.gradle.kts b/build-logic/plugin/build.gradle.kts new file mode 100644 index 00000000..770b1b29 --- /dev/null +++ b/build-logic/plugin/build.gradle.kts @@ -0,0 +1,31 @@ +plugins { + `java-gradle-plugin` + `kotlin-dsl` + alias(libs.plugins.ksp) // KSP +} + +kotlin { + jvmToolchain(17) + explicitApi() +} + +gradlePlugin { + val build by plugins.creating { + id = "com.grab.grazel.build.common" + implementationClass = "com.grab.grazel.build.BuildLogicPlugin" + } +} + +dependencies { + /* implementation(libs.coroutines) + implementation(libs.coroutines.jvm)*/ + compileOnly(libs.android.gradle.plugin) + compileOnly(libs.kotlin.gradle.plugin) + + testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") + testRuntimeOnly("org.junit.platform:junit-platform-launcher") +} + +tasks.named("test") { + useJUnitPlatform() +} diff --git a/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/BuildLogicPlugin.kt b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/BuildLogicPlugin.kt new file mode 100644 index 00000000..1758a759 --- /dev/null +++ b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/BuildLogicPlugin.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2024 Grabtaxi Holdings PTE LTD (GRAB) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.grab.grazel.build + +import com.grab.grazel.build.android.configureAndroid +import com.grab.grazel.build.gradle.ConfigurablePlugin +import com.grab.grazel.build.jvm.configureJvm + +public class BuildLogicPlugin : ConfigurablePlugin({ + configureJvm() + configureAndroid() +}) diff --git a/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/android/Android.kt b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/android/Android.kt new file mode 100644 index 00000000..ca17eb0f --- /dev/null +++ b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/android/Android.kt @@ -0,0 +1,56 @@ +/* + * Copyright 2024 Grabtaxi Holdings PTE LTD (GRAB) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.grab.grazel.build.android + +import com.android.build.api.variant.AndroidComponentsExtension +import com.android.build.api.variant.ApplicationAndroidComponentsExtension +import com.android.build.api.variant.DynamicFeatureAndroidComponentsExtension +import com.android.build.api.variant.LibraryAndroidComponentsExtension +import com.android.build.api.variant.TestAndroidComponentsExtension +import com.android.build.api.variant.Variant +import com.android.build.api.variant.VariantBuilder +import com.android.build.gradle.BaseExtension +import com.android.build.gradle.LintPlugin +import com.grab.grazel.build.gradle.configureIfExist +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.withType +import com.android.build.gradle.BasePlugin as AndroidBasePlugin + +internal fun Project.android(builder: BaseExtension.() -> Unit) { + configure(builder) +} + +internal fun Project.androidComponents( + builder: AndroidComponentsExtension<*, out VariantBuilder, out Variant>.() -> Unit +) { + configureIfExist(builder) + configureIfExist(builder) + configureIfExist(builder) + configureIfExist(builder) +} + +internal fun Project.configureAndroid() { + require(this == rootProject) { "Should be only called from root project" } + subprojects { + plugins.withType { + if (this !is LintPlugin) { + androidCommon() + } + } + } +} \ No newline at end of file diff --git a/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/android/AndroidCommon.kt b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/android/AndroidCommon.kt new file mode 100644 index 00000000..47105a9d --- /dev/null +++ b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/android/AndroidCommon.kt @@ -0,0 +1,60 @@ +/* + * Copyright 2024 Grabtaxi Holdings PTE LTD (GRAB) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.grab.grazel.build.android + +import com.grab.grazel.build.gradle.libs +import com.grab.grazel.build.gradle.version +import org.gradle.api.JavaVersion +import org.gradle.api.Project + +internal fun Project.androidCommon() { + android { + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + } + + composeOptions { + kotlinCompilerExtensionVersion = libs.version("androidx.compose")!! + } + + packagingOptions { + resources.excludes += listOf( + "META-INF/AL2.0", + "META-INF/LGPL2.1", + "META-INF/licenses/**" + ) + } + + lintOptions { + lintConfig = rootProject.file("lint.xml") + } + } + + androidComponents { + beforeVariants(selector().withBuildType("release")) { + it.enable = false + } + } +} \ No newline at end of file diff --git a/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/gradle/Catalog.kt b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/gradle/Catalog.kt new file mode 100644 index 00000000..6f743194 --- /dev/null +++ b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/gradle/Catalog.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2024 Grabtaxi Holdings PTE LTD (GRAB) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.grab.grazel.build.gradle + +import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.kotlin.dsl.getByType + + +internal val Project.catalogs get() = extensions.getByType() + +internal val Project.libs: VersionCatalog get() = catalogs.named("libs") + +internal fun VersionCatalog.version(reference: String): String? { + return findVersion(reference).orElse(null)?.toString() +} + +internal fun VersionCatalog.library(reference: String): String? { + return findLibrary(reference).orElse(null)?.toString() +} \ No newline at end of file diff --git a/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/gradle/Gradle.kt b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/gradle/Gradle.kt new file mode 100644 index 00000000..d90bc9fc --- /dev/null +++ b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/gradle/Gradle.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2024 Grabtaxi Holdings PTE LTD (GRAB) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.grab.grazel.build.gradle + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.findByType + +public open class ConfigurablePlugin( + private val configuration: Project.() -> Unit +) : Plugin { + override fun apply(project: Project): Unit = configuration(project) +} + +/** + * Configures a gradle extension if it exists and does nothing otherwise + */ +internal inline fun Project.configureIfExist(builder: T.() -> Unit) { + extensions.findByType()?.apply(builder) +} diff --git a/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/jvm/Java.kt b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/jvm/Java.kt new file mode 100644 index 00000000..d77a5968 --- /dev/null +++ b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/jvm/Java.kt @@ -0,0 +1,47 @@ +/* + * Copyright 2024 Grabtaxi Holdings PTE LTD (GRAB) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.grab.grazel.build.jvm + +import com.grab.grazel.build.gradle.configureIfExist +import org.gradle.api.Project +import org.gradle.api.plugins.JavaPlugin +import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.jvm.toolchain.JavaLanguageVersion +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension +import org.jetbrains.kotlin.gradle.plugin.KotlinBasePlugin + +internal const val JAVA_VERSION = 17 + +internal fun Project.configureJvm() { + require(this == rootProject) { "Should be only called from root project" } + subprojects { + plugins.withType { + configure { + toolchain { + languageVersion.set(JavaLanguageVersion.of(JAVA_VERSION)) + } + } + } + plugins.withType { + configureIfExist { + jvmToolchain(JAVA_VERSION) + } + } + } +} \ No newline at end of file diff --git a/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/properties/LocalProperties.kt b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/properties/LocalProperties.kt new file mode 100644 index 00000000..0b89109d --- /dev/null +++ b/build-logic/plugin/src/main/kotlin/com/grab/grazel/build/properties/LocalProperties.kt @@ -0,0 +1,41 @@ +/* + * Copyright 2024 Grabtaxi Holdings PTE LTD (GRAB) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.grab.grazel.build.properties + +import org.gradle.api.Project +import org.gradle.api.provider.Provider +import java.util.Properties + + +internal const val LOCAL_PROPERTIES = "local.properties" + +public val Project.localProperties: Provider + get() = provider { + rootProject + .file(LOCAL_PROPERTIES) + .inputStream() + .use { stream -> Properties().apply { load(stream) } } + } + +public fun Project.localProperty(key: String): Provider = + localProperties.map { it.getProperty(key) } + +public fun Project.properties(key: String): Provider = providers.gradleProperty(key) +public fun Project.environment(key: String): Provider = providers.environmentVariable(key) + +public fun Project.localOrEnvProperty(key: String): Provider = + localProperty(key).orElse(environment(key)) diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 00000000..01cee138 --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,22 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +rootProject.name = "build-logic" +include("plugin") diff --git a/build.gradle b/build.gradle index 77a5f286..51af8663 100644 --- a/build.gradle +++ b/build.gradle @@ -13,14 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - -import com.android.build.gradle.BaseExtension - buildscript { apply from: "constants.gradle" } plugins { + id "com.grab.grazel.build.common" alias(libs.plugins.android.application) apply false alias(libs.plugins.android.library) apply false alias(libs.plugins.kotlin.android) apply false @@ -48,34 +45,6 @@ allprojects { force "com.google.dagger:dagger-compiler:2.47" } } - - // TODO(arun) Move these to convention plugins - plugins.withType(com.android.build.gradle.BasePlugin).configureEach { plugin -> - (project.extensions.getByName("android") as BaseExtension).with { - compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - } - lint { - lintConfig = rootProject.file("lint.xml") - } - } - } - - tasks.withType(JavaCompile).configureEach { task -> - task.sourceCompatibility = JavaVersion.VERSION_11 - task.targetCompatibility = JavaVersion.VERSION_11 - } - - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask.class).configureEach { - compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11) - compilerOptions.languageVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_7 - } -} - -tasks.named("wrapper") { - gradleVersion = libs.versions.gradle.wrapper.get() - distributionType = Wrapper.DistributionType.ALL } grazel { @@ -120,7 +89,7 @@ grazel { } } mavenInstall { - httpArchiveRepository { + httpArchiveRepository { sha256 = "d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac" stripPrefix = "rules_jvm_external-5.3" url = String.format("https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz", "5.3", "5.3") @@ -166,7 +135,7 @@ grazel { abiJars = true multiplexWorkers = true languageVersion = "1.7" - jvmTarget = "11" + jvmTarget = "17" } } dagger { diff --git a/flavors/sample-android-flavor/build.gradle b/flavors/sample-android-flavor/build.gradle index 40e95048..8e68a417 100644 --- a/flavors/sample-android-flavor/build.gradle +++ b/flavors/sample-android-flavor/build.gradle @@ -21,11 +21,9 @@ plugins { } android { - compileSdkVersion 33 buildToolsVersion "33.0.1" defaultConfig { - minSdkVersion 21 resValue "string", "generated_value", "generated" } @@ -64,6 +62,7 @@ android { ] } } + namespace "com.grab.grazel.android.flavor" } dependencies { diff --git a/flavors/sample-android-flavor/src/main/AndroidManifest.xml b/flavors/sample-android-flavor/src/main/AndroidManifest.xml index 28eef41f..94079b26 100644 --- a/flavors/sample-android-flavor/src/main/AndroidManifest.xml +++ b/flavors/sample-android-flavor/src/main/AndroidManifest.xml @@ -15,11 +15,11 @@ --> + package="com.grab.grazel.android.flavor"> + android:exported="true" /> \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 151dadd6..c79aca57 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,11 +16,9 @@ org.gradle.jvmargs=-Xmx4096m -Dkotlin.compiler.execution.strategy="in-process" org.gradle.parallel=true org.gradle.caching=true -# Android flags +# Android Gradle Plugin flags android.enableJetifier=true android.useAndroidX=true +android.defaults.buildfeatures.buildconfig=true # Kotlin code style -kotlin.code.style=official - -#lint version -android.experimental.lint.version = 8.5.0-alpha02 \ No newline at end of file +kotlin.code.style=official \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 97ab3d82..f24a7b8e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] activity = "1.7.2" -android-gradle-plugin = "7.2.2" +android-gradle-plugin = "8.1.4" androidx-appcompat = "1.6.1" androidx-constraintlayout = "2.1.4" androidx-constraintlayout-core = "1.0.4" @@ -14,7 +14,7 @@ activity-compose = "1.7.2" annotation-jvm = "1.6.0" crashlytics = "2.9.9" dagger = "2.47" -dokka = "1.4.32" +dokka = "1.8.20" emoji2 = "1.3.0" google-services = "4.3.15" gradle-plugin-publish = "0.14.0" @@ -23,7 +23,7 @@ guava = "30.1-jre" javapoet = "1.13.0" junit = "4.13.2" kotlin = "1.8.10" -kotlin-dsl = "2.3.3" +kotlin-dsl = "4.0.7" kotlin-serialization = "1.5.1" kotlinx-coroutines-android = "1.3.9" kotlinx-coroutines-core-jvm = "1.7.2" @@ -39,6 +39,7 @@ slack-lint-checks = "0.2.3" timber = "5.0.1" auto-service = "1.1.1" truth = "1.1.3" +ksp = "1.8.10-1.0.9" [libraries] android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" } @@ -72,7 +73,6 @@ androidx-compose-animation-core = { module = "androidx.compose.animation:animati androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" } databinding-common = { module = "androidx.databinding:databinding-common", version.ref = "android-gradle-plugin" } databinding-runtime = { module = "androidx.databinding:databinding-runtime", version.ref = "android-gradle-plugin" } -dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } google-dagger = { module = "com.google.dagger:dagger", version.ref = "dagger" } google-dagger-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "dagger" } google-guava = { module = "com.google.guava:guava", version.ref = "guava" } @@ -99,6 +99,7 @@ auto-service = { module = "com.google.auto.service:auto-service", version.ref = android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" } android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" } android-lint = { id = "com.android.lint", version.ref = "android-gradle-plugin" } +dokka-gradle-plugin = { id = "org.jetbrains.dokka", version.ref = "dokka" } google-mobile-services = { id = "com.google.gms.google-services", version.ref = "google-services" } firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } @@ -107,4 +108,5 @@ kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } kotlin-dsl = { id = "org.gradle.kotlin.kotlin-dsl", version.ref = "kotlin-dsl" } gradle-publish = { id = "com.gradle.plugin-publish", version.ref = "gradle-plugin-publish" } -kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } \ No newline at end of file +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 168825ac..00331ae4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -15,6 +15,6 @@ # distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/grazel-gradle-plugin/build.gradle b/grazel-gradle-plugin/build.gradle index 3b9a8f7c..13e364e9 100644 --- a/grazel-gradle-plugin/build.gradle +++ b/grazel-gradle-plugin/build.gradle @@ -13,30 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -import org.gradle.api.internal.classpath.ModuleRegistry -import org.gradle.api.internal.project.ProjectInternal - - buildscript { apply from: "../constants.gradle" dependencies { classpath libs.kotlin.gradle.plugin classpath libs.nexus.gradle.publish.plugin - classpath libs.dokka.gradle.plugin } } plugins { id "java-gradle-plugin" + id "com.grab.grazel.build.common" alias(libs.plugins.kotlin.dsl) + alias(libs.plugins.dokka.gradle.plugin) alias(libs.plugins.gradle.publish) alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.kotlin.kapt) id "maven-publish" id "idea" } -apply plugin: "kotlin-kapt" - apply from: "gradle-scripts/functional-test.gradle" apply from: "gradle/publish-root-config.gradle" apply from: "gradle/publishing.gradle" @@ -45,11 +40,6 @@ group = groupId version = versionName description = "A Gradle plugin to automate Bazel migration for Android projects" -repositories { - google() - mavenCentral() -} - idea { module { sourceDirs -= file("src/functionalTest/kotlin") @@ -62,7 +52,7 @@ pluginBundle { website = project.findProperty("website") vcsUrl = project.findProperty("website") description = project.description - tags = ["bazel migration", "buildscript generation", "automation"] + tags = ["bazel migration", "buildscript generation", "automation", "bazel"] mavenCoordinates { groupId = project.group artifactId = project.name @@ -98,30 +88,11 @@ dependencies { testImplementation libs.junit testImplementation libs.kotlin.test testImplementation libs.android.gradle.plugin - testImplementation gradleTestKit() testImplementation libs.mockito.kotlin - - /** - * In Gradle 6.7-rc-1 BuildEventsListenerRegistry service is not created in we need it in order - * to instantiate AGP. This creates a fake one and injects it - * https://issuetracker.google.com/issues/193859160 - * https://github.com/gradle/gradle/issues/17783 - */ - def toolingApiBuildersJar = (project as ProjectInternal).services.get(ModuleRegistry.class) - .getModule("gradle-tooling-api-builders") - .classpath - .asFiles - .first() - testRuntimeOnly(files(toolingApiBuildersJar)) -} - -tasks.withType(JavaCompile).configureEach { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + testImplementation gradleTestKit() } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask.class).configureEach { - compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11) compilerOptions.freeCompilerArgs.add("-Xopt-in=kotlin.ExperimentalStdlibApi") } diff --git a/grazel-gradle-plugin/settings.gradle b/grazel-gradle-plugin/settings.gradle index bb011ef4..d7c7f929 100644 --- a/grazel-gradle-plugin/settings.gradle +++ b/grazel-gradle-plugin/settings.gradle @@ -13,14 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + includeBuild("../build-logic") { + setName("grazel-build-logic") + } +} -/* - * This file was generated by the Gradle "init" task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/6.4.1/userguide/multi_project_builds.html - */ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} rootProject.name = "grazel-gradle-plugin" diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidManifestParser.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidManifestParser.kt index e614ec37..f4922b6b 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidManifestParser.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/AndroidManifestParser.kt @@ -43,12 +43,13 @@ internal class DefaultAndroidManifestParser @Inject constructor() : AndroidManif extension: BaseExtension, androidSourceSets: List ): String? { - val packageName = extension.defaultConfig.applicationId // TODO(arun) Handle suffixes + val packageName = extension.defaultConfig.applicationId ?: extension.namespace return if (packageName == null) { // Try parsing from AndroidManifest.xml val manifestFile = androidManifestFile(androidSourceSets) ?: return null XmlSlurper().parse(manifestFile) .list() + .asSequence() .filterIsInstance() .firstOrNull { it.name() == "manifest" } ?.attributes()?.get("package")?.toString() diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/ResValuesData.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/ResValuesData.kt index ea24fd83..b6e405b5 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/ResValuesData.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/ResValuesData.kt @@ -20,6 +20,7 @@ import com.android.build.gradle.BaseExtension import com.android.builder.model.Version.ANDROID_GRADLE_PLUGIN_VERSION import com.grab.grazel.gradle.variant.MatchedVariant import com.grab.grazel.util.merge +import org.gradle.util.internal.VersionNumber data class ResValuesData( val stringValues: Map = emptyMap() @@ -60,10 +61,9 @@ internal fun BaseExtension.extractResValue( * output: generated_value */ private fun getKeyValue(key: String): String { - val agpVersion = ANDROID_GRADLE_PLUGIN_VERSION.split(".") - val majorVersion = agpVersion[0].toInt() - val minorVersion = agpVersion[1].toInt() - return if (majorVersion >= 7 && minorVersion >= 2) { + val agpVersion = VersionNumber.parse(ANDROID_GRADLE_PLUGIN_VERSION) + val baseAgpVersion = VersionNumber.parse("7.2.2") + return if (agpVersion >= baseAgpVersion) { key.split("/").last() } else { key diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/fake/FakeProject.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/fake/FakeProject.kt index b882c67c..2ece4356 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/fake/FakeProject.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/fake/FakeProject.kt @@ -316,7 +316,7 @@ class FakeProject(private val name: String) : Project { TODO("Not yet implemented") } - override fun provider(value: Callable): Provider { + override fun provider(value: Callable): Provider { TODO("Not yet implemented") } @@ -579,6 +579,10 @@ class FakeProject(private val name: String) : Project { TODO("Not yet implemented") } + override fun components(configuration: Action) { + TODO("Not yet implemented") + } + override fun getNormalization(): InputNormalizationHandler { TODO("Not yet implemented") } diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/fake/FakeWorkerExecutor.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/fake/FakeWorkerExecutor.kt index 59b9d246..08bb962c 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/fake/FakeWorkerExecutor.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/fake/FakeWorkerExecutor.kt @@ -6,21 +6,12 @@ import org.gradle.workers.ProcessWorkerSpec import org.gradle.workers.WorkAction import org.gradle.workers.WorkParameters import org.gradle.workers.WorkQueue -import org.gradle.workers.WorkerConfiguration import org.gradle.workers.WorkerExecutor import org.gradle.workers.WorkerSpec -class FakeWorkerExecutor( -) : WorkerExecutor { +class FakeWorkerExecutor : WorkerExecutor { val workQueue = FakeWorkQueue() - override fun submit( - actionClass: Class?, - configAction: Action? - ) { - // no-op - } - override fun noIsolation() = workQueue override fun noIsolation(action: Action?) = workQueue diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/DefaultDependenciesDataSourceTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/DefaultDependenciesDataSourceTest.kt index ead9b7f6..d80391d6 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/DefaultDependenciesDataSourceTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/DefaultDependenciesDataSourceTest.kt @@ -72,6 +72,7 @@ class DefaultDependenciesDataSourceTest { mavenCentral() } configure { + namespace = "test" compileSdkVersion(30) } configureProject(this) diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/dependencies/ResolvedComponentsVisitorTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/dependencies/ResolvedComponentsVisitorTest.kt index 9a449110..c3823be2 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/dependencies/ResolvedComponentsVisitorTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/dependencies/ResolvedComponentsVisitorTest.kt @@ -67,6 +67,7 @@ class ResolvedComponentsVisitorTest { mavenCentral() } configure { + namespace = "test" compileSdkVersion(30) } dependencies { diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/DefaultVariantMatcherTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/DefaultVariantMatcherTest.kt index 67d3719d..1379ef02 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/DefaultVariantMatcherTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/DefaultVariantMatcherTest.kt @@ -28,6 +28,7 @@ import com.grab.grazel.util.addGrazelExtension import com.grab.grazel.util.assertErrorMessage import com.grab.grazel.util.createGrazelComponent import com.grab.grazel.util.doEvaluate +import org.codehaus.groovy.runtime.ArrayTypeUtils.dimension import org.gradle.api.Project import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.dependencies @@ -57,6 +58,7 @@ internal class DefaultVariantMatcherTest { apply(KOTLIN_KAPT) } configure { + namespace = "test" defaultConfig { compileSdkVersion(32) } @@ -73,6 +75,7 @@ internal class DefaultVariantMatcherTest { apply(KOTLIN_KAPT) } configure { + namespace = "test" defaultConfig { compileSdkVersion(32) } diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/VariantTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/VariantTest.kt index 672fc781..87f4378f 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/VariantTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/VariantTest.kt @@ -50,7 +50,7 @@ class VariantTest { androidVariant(appExtension.applicationVariants.first()).let { buildVariant -> assertEquals( - 28, + 26, buildVariant.variantConfigurations.size, "Variant configuration parsed for build variant" ) @@ -81,7 +81,7 @@ class VariantTest { val allConfigurations = androidProject.configurations.map { it.name } assertEquals( - 254, + 253, (allConfigurations - parsedConfigurations).size, "Remaining unparsed configurations size at 254" ) diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/VariantTestProject.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/VariantTestProject.kt index 52e0a5ba..0c2afcc6 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/VariantTestProject.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/gradle/variant/VariantTestProject.kt @@ -31,6 +31,7 @@ fun setupAndroidVariantProject(androidProject: Project) { mavenCentral() } configure { + namespace = "test" defaultConfig { compileSdkVersion(32) } diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/AndroidWorkspaceRepositoriesTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/AndroidWorkspaceRepositoriesTest.kt index 3baf04ad..4df0c4ff 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/AndroidWorkspaceRepositoriesTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/AndroidWorkspaceRepositoriesTest.kt @@ -116,6 +116,7 @@ class AndroidWorkspaceRepositoriesTest : GrazelPluginTest() { apply(ANDROID_APPLICATION_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { compileSdkVersion(29) buildToolsVersion("29.0.3") diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/BuildConfigFieldsTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/BuildConfigFieldsTest.kt index 729e0593..7715e359 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/BuildConfigFieldsTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/BuildConfigFieldsTest.kt @@ -55,6 +55,7 @@ class BuildConfigFieldsTest : GrazelPluginTest() { apply(ANDROID_APPLICATION_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { compileSdkVersion(29) versionCode = 1 @@ -64,7 +65,7 @@ class BuildConfigFieldsTest : GrazelPluginTest() { buildConfigField("boolean", "SOME_BOOLEAN", "false") buildConfigField("String", "SOME_STRING", "\"Something\"") } - + buildFeatures.buildConfig = true } doEvaluate() } diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/DaggerWorkspaceRuleTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/DaggerWorkspaceRuleTest.kt index 506785a7..20035395 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/DaggerWorkspaceRuleTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/DaggerWorkspaceRuleTest.kt @@ -58,6 +58,7 @@ class DaggerWorkspaceRuleTest { apply(KOTLIN_ANDROID_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { compileSdkVersion(30) } diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryDataExtractorTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryDataExtractorTest.kt index 97c7e2d5..c6f181aa 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryDataExtractorTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/AndroidInstrumentationBinaryDataExtractorTest.kt @@ -112,6 +112,7 @@ class AndroidInstrumentationBinaryDataExtractorTest : GrazelPluginTest() { apply(KOTLIN_ANDROID_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { applicationId = "com.example.androidlibrary" compileSdkVersion(31) diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/AndroidLibraryDataKtTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/AndroidLibraryDataKtTest.kt index c49ffdff..0e55190e 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/AndroidLibraryDataKtTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/AndroidLibraryDataKtTest.kt @@ -18,12 +18,14 @@ package com.grab.grazel.migrate.android import com.android.build.gradle.AppExtension import com.grab.grazel.GrazelPluginTest +import com.grab.grazel.bazel.rules.resValue import com.grab.grazel.buildProject import com.grab.grazel.gradle.ANDROID_APPLICATION_PLUGIN import com.grab.grazel.gradle.variant.MatchedVariant import com.grab.grazel.util.addGrazelExtension import com.grab.grazel.util.doEvaluate import com.grab.grazel.util.truth +import org.codehaus.groovy.runtime.ArrayTypeUtils.dimension import org.gradle.api.Project import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.the @@ -46,6 +48,7 @@ class AndroidLibraryDataKtTest : GrazelPluginTest() { apply(ANDROID_APPLICATION_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { compileSdkVersion(compilerSdkVersion) } diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultAndroidLibraryDataExtractorTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultAndroidLibraryDataExtractorTest.kt index aac1c1df..018f254b 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultAndroidLibraryDataExtractorTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultAndroidLibraryDataExtractorTest.kt @@ -45,6 +45,7 @@ class DefaultAndroidLibraryDataExtractorTest { apply(KOTLIN_KAPT) } configure { + namespace = "test" defaultConfig { compileSdkVersion(32) } @@ -61,6 +62,7 @@ class DefaultAndroidLibraryDataExtractorTest { apply(KOTLIN_KAPT) } configure { + namespace = "test" defaultConfig { compileSdkVersion(32) } diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultAndroidUnitTestDataExtractorTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultAndroidUnitTestDataExtractorTest.kt index 20fea1c3..58528cb2 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultAndroidUnitTestDataExtractorTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultAndroidUnitTestDataExtractorTest.kt @@ -73,6 +73,7 @@ class DefaultAndroidUnitTestDataExtractorTest : GrazelPluginTest() { apply(KOTLIN_ANDROID_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { compileSdkVersion(30) } diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultManifestValuesBuilderTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultManifestValuesBuilderTest.kt index 5d7fd1f3..67375b96 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultManifestValuesBuilderTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/android/DefaultManifestValuesBuilderTest.kt @@ -52,6 +52,7 @@ class DefaultManifestValuesBuilderTest : GrazelPluginTest() { apply(ANDROID_LIBRARY_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { compileSdkVersion(29) manifestPlaceholders.putAll(setOf("libraryPlaceholder" to "true")) @@ -69,6 +70,7 @@ class DefaultManifestValuesBuilderTest : GrazelPluginTest() { apply(ANDROID_APPLICATION_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { applicationId = "com.test.grazel" compileSdkVersion(29) diff --git a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/dependencies/DefaultArtifactPinnerTest.kt b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/dependencies/DefaultArtifactPinnerTest.kt index 6bee1cfe..332c9174 100644 --- a/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/dependencies/DefaultArtifactPinnerTest.kt +++ b/grazel-gradle-plugin/src/test/kotlin/com/grab/grazel/migrate/dependencies/DefaultArtifactPinnerTest.kt @@ -61,6 +61,7 @@ class DefaultArtifactPinnerTest { apply(ANDROID_APPLICATION_PLUGIN) } extensions.configure { + namespace = "test" defaultConfig { compileSdkVersion(23) } diff --git a/maven_install.json b/maven_install.json index 86f8a4a0..3dd527af 100755 --- a/maven_install.json +++ b/maven_install.json @@ -1,9 +1,13 @@ { "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", - "__INPUT_ARTIFACTS_HASH": -686536093, - "__RESOLVED_ARTIFACTS_HASH": 383063452, + "__INPUT_ARTIFACTS_HASH": -963884179, + "__RESOLVED_ARTIFACTS_HASH": -1204912076, "conflict_resolution": { "androidx.annotation:annotation:1.5.0": "androidx.annotation:annotation:1.6.0", + "androidx.databinding:databinding-adapters:7.2.2": "androidx.databinding:databinding-adapters:8.1.4", + "androidx.databinding:databinding-common:7.2.2": "androidx.databinding:databinding-common:8.1.4", + "androidx.databinding:databinding-runtime:7.2.2": "androidx.databinding:databinding-runtime:8.1.4", + "androidx.databinding:viewbinding:7.2.2": "androidx.databinding:viewbinding:8.1.4", "org.jetbrains.kotlin:kotlin-reflect:1.8.10": "org.jetbrains.kotlin:kotlin-reflect:1.9.20" }, "artifacts": { @@ -279,33 +283,33 @@ }, "androidx.databinding:databinding-adapters:aar": { "shasums": { - "jar": "f3c55dc71252ba5f7ff17d519a8d94e954e6c31ba263820719c6d141c5230195" + "jar": "7909833618f8628b5afadc764949a5e764906320864730bec124392337585f8e" }, - "version": "7.2.2" + "version": "8.1.4" }, "androidx.databinding:databinding-common": { "shasums": { - "jar": "852e465a49271dbc7f6abfbe367368aeb6d3130a1faaf9617ccb9de6118d1ca2" + "jar": "66cab82639dac0f6c2433464c093b074d608c4bb887ec38a9b8bc4ac98126732" }, - "version": "7.2.2" + "version": "8.1.4" }, "androidx.databinding:databinding-ktx:aar": { "shasums": { - "jar": "ba4b761a3936a8477f0734fa8faf0f27d7b3d744f734aa4a2d4a8c00d024bb4e" + "jar": "f209c99c1796df3015719600a6cc781bf4095578d1564d949cac2df8d90262cb" }, - "version": "7.2.2" + "version": "8.1.4" }, "androidx.databinding:databinding-runtime:aar": { "shasums": { - "jar": "251ed9021de0d049db23e349b53ec65f8c440ec3e8f360787158de114bc23676" + "jar": "dd2d8598912be8a4fd250f7b302c8341a0eaec389dcc000a8744a0ac5ae83a32" }, - "version": "7.2.2" + "version": "8.1.4" }, "androidx.databinding:viewbinding:aar": { "shasums": { - "jar": "84edc51571d02791e262b3acf9927a44b51c47de66ce6d8cd6d126311cb6784f" + "jar": "e71da76a17b18be4fc00c539644a46f8e4610764ca94868ee10d3be736f0cc68" }, - "version": "7.2.2" + "version": "8.1.4" }, "androidx.drawerlayout:drawerlayout:aar": { "shasums": { diff --git a/sample-android-library/build.gradle b/sample-android-library/build.gradle index 3ebb5b33..ae35fbcb 100644 --- a/sample-android-library/build.gradle +++ b/sample-android-library/build.gradle @@ -21,14 +21,11 @@ plugins { } android { - compileSdkVersion 33 buildToolsVersion "33.0.1" - defaultConfig { - minSdkVersion 21 - } buildFeatures { viewBinding true } + namespace "com.grab.grazel.android.sample.lib" } dependencies { diff --git a/sample-android/build.gradle b/sample-android/build.gradle index 2252cec1..592845d6 100644 --- a/sample-android/build.gradle +++ b/sample-android/build.gradle @@ -25,12 +25,10 @@ plugins { } android { - compileSdkVersion 33 buildToolsVersion "33.0.1" defaultConfig { applicationId "com.grab.grazel.android.sample" - minSdkVersion 21 targetSdkVersion 31 versionCode 1 versionName "1.0" @@ -115,13 +113,6 @@ android { variant.buildConfigFields.put("VARIANT_NAME", new BuildConfigField("String", "\"$variant.name\"", null)) } } - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } - kotlinOptions { - jvmTarget = "11" - } packagingOptions { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" @@ -136,6 +127,7 @@ android { lint { baseline = file("lint_baseline.xml") } + namespace "com.grab.grazel.android.sample" } dependencies { diff --git a/settings.gradle b/settings.gradle index 3db4ad32..1dc77203 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,13 +19,13 @@ pluginManagement { mavenCentral() google() } + includeBuild("build-logic") includeBuild("grazel-gradle-plugin") - plugins { - id "com.gradle.enterprise" version "3.6.3" - } } plugins { - id "com.gradle.enterprise" + id("com.gradle.enterprise") version "3.6.3" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("com.android.settings") version "8.1.4" } rootProject.name = "grazel" @@ -38,6 +38,11 @@ dependencyResolutionManagement { } } +android { + compileSdk 34 + minSdk 21 +} + include(":sample-android") include(":sample-android-library") include(":flavors:sample-android-flavor")