diff --git a/.bazel/.ci.bazelrc b/.bazel/.ci.bazelrc index 6d048ae0..5983ec77 100644 --- a/.bazel/.ci.bazelrc +++ b/.bazel/.ci.bazelrc @@ -1,2 +1,2 @@ common:ci --noshow_progress -common:ci --color=no \ No newline at end of file +common:ci --color=yes \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbd2d5b1..753247ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: find "$(pwd -P)" -type f \ \( -name "*.bazel" -o -name "WORKSPACE" \) \ -not -path "*/buildsystem/*" \ - -exec bazelisk run //:buildifier -- --mode=check -v {} + + -exec bazelisk run //:buildifier --config=ci -- --mode=check -v {} + bazel-build: runs-on: ubuntu-latest steps: @@ -55,7 +55,7 @@ jobs: - name: Bazel Android Lint uses: ./.github/actions/bazel with: - bazel-command: test //sample-android:sample-android-flavor1-free-debug.lint_test + bazel-command: test //sample-android:sample-android-demo-free-debug.lint_test cache-key: bazel-lint grazel-build: diff --git a/.gitignore b/.gitignore index 61fb0922..a26494f4 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,9 @@ !.idea/runConfigurations.xml !.idea/.name +/.aswb +/.ijwb + .DS_Store /captures .externalNativeBuild diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a6a2db4..45cd1851 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,13 +8,6 @@ A full test suite can be executed via the following command and will be tested o ./gradlew check ``` -- `sample-android` -- `sample-android-flavor` -- `sample-android-lib` -- `sample-kotlin-lib` -- `sample-lib-flavor1` -- `sample-lib-flavor2` - In order to test your changes and see if the `BUILD.bazel` is being generated as intended, execute the following command in the project root directory diff --git a/README.MD b/README.md similarity index 100% rename from README.MD rename to README.md diff --git a/build.gradle b/build.gradle index 54cb791e..12cd6c14 100644 --- a/build.gradle +++ b/build.gradle @@ -19,26 +19,21 @@ import com.android.build.gradle.BaseExtension buildscript { apply from: "constants.gradle" - repositories { - google() - mavenCentral() - gradlePluginPortal() - } - dependencies { - classpath libs.kotlin.gradle.plugin - classpath libs.android.gradle.plugin - classpath libs.google.firebase.crashlytics - classpath libs.google.mobile.services - classpath "com.grab:grazel:$versionName" - } } - plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.kapt) apply false + alias(libs.plugins.kotlin.parcelize) apply false + alias(libs.plugins.google.mobile.services) apply false + alias(libs.plugins.firebase.crashlytics) apply false id "idea" + id "com.grab.grazel" } -apply plugin: "com.grab.grazel" allprojects { + // TODO(arun) Add support for repository in settings.gradle and then remove this repositories { google() mavenCentral() diff --git a/buildsystem/BUILD.bazel b/buildsystem/BUILD.bazel deleted file mode 100644 index a44148b1..00000000 --- a/buildsystem/BUILD.bazel +++ /dev/null @@ -1,10 +0,0 @@ -filegroup( - name = "debug-keystore", - srcs = [ - "debug.keystore", - ], - visibility = [ - "//visibility:public", - ] -) - diff --git a/flavor-libs/BUILD.bazel b/flavors/BUILD.bazel similarity index 100% rename from flavor-libs/BUILD.bazel rename to flavors/BUILD.bazel diff --git a/sample-android-flavor/.gitignore b/flavors/sample-android-flavor/.gitignore similarity index 100% rename from sample-android-flavor/.gitignore rename to flavors/sample-android-flavor/.gitignore diff --git a/sample-android-flavor/BUILD.bazel b/flavors/sample-android-flavor/BUILD.bazel similarity index 80% rename from sample-android-flavor/BUILD.bazel rename to flavors/sample-android-flavor/BUILD.bazel index 20d9dae2..7670c152 100644 --- a/sample-android-flavor/BUILD.bazel +++ b/flavors/sample-android-flavor/BUILD.bazel @@ -1,10 +1,10 @@ load("@grab_bazel_common//rules:defs.bzl", "android_library") android_library( - name = "sample-android-flavor-flavor1-free-debug", + name = "sample-android-flavor-demo-free-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/flavor/**/*.kt", - "src/flavor1/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt", + "src/demo/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt", ]), custom_package = "com.grab.grazel.android.flavor", enable_compose = True, @@ -19,7 +19,9 @@ android_library( }, }, resources = { - "src/flavor1/res": { + "src/demo/res": { + }, + "src/free/res": { }, "src/main/res": { }, @@ -29,7 +31,7 @@ android_library( ], deps = [ "//:parcelize", - "//flavor-libs/sample-library-flavor1", + "//flavors/sample-library-demo", "@debug_maven//:androidx_core_core", "@maven//:androidx_appcompat_appcompat", "@maven//:androidx_compose_ui_ui", @@ -39,10 +41,10 @@ android_library( ) android_library( - name = "sample-android-flavor-flavor1-paid-debug", + name = "sample-android-flavor-demo-paid-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/flavor/**/*.kt", - "src/flavor1/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt", + "src/demo/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt", ]), custom_package = "com.grab.grazel.android.flavor", enable_compose = True, @@ -57,7 +59,7 @@ android_library( }, }, resources = { - "src/flavor1/res": { + "src/demo/res": { }, "src/main/res": { }, @@ -67,7 +69,7 @@ android_library( ], deps = [ "//:parcelize", - "//flavor-libs/sample-library-flavor1", + "//flavors/sample-library-demo", "@debug_maven//:androidx_core_core", "@maven//:androidx_appcompat_appcompat", "@maven//:androidx_compose_ui_ui", @@ -77,10 +79,10 @@ android_library( ) android_library( - name = "sample-android-flavor-flavor2-free-debug", + name = "sample-android-flavor-full-free-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/flavor/**/*.kt", - "src/flavor2/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt", + "src/full/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt", ]), custom_package = "com.grab.grazel.android.flavor", enable_compose = True, @@ -95,7 +97,9 @@ android_library( }, }, resources = { - "src/flavor2/res": { + "src/full/res": { + }, + "src/free/res": { }, "src/main/res": { }, @@ -105,7 +109,7 @@ android_library( ], deps = [ "//:parcelize", - "//flavor-libs/sample-library-flavor2", + "//flavors/sample-library-full", "@debug_maven//:androidx_core_core", "@maven//:androidx_appcompat_appcompat", "@maven//:androidx_compose_ui_ui", @@ -115,10 +119,10 @@ android_library( ) android_library( - name = "sample-android-flavor-flavor2-paid-debug", + name = "sample-android-flavor-full-paid-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/flavor/**/*.kt", - "src/flavor2/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt", + "src/full/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt", ]), custom_package = "com.grab.grazel.android.flavor", enable_compose = True, @@ -133,7 +137,7 @@ android_library( }, }, resources = { - "src/flavor2/res": { + "src/full/res": { }, "src/main/res": { }, @@ -143,7 +147,7 @@ android_library( ], deps = [ "//:parcelize", - "//flavor-libs/sample-library-flavor2", + "//flavors/sample-library-full", "@debug_maven//:androidx_core_core", "@maven//:androidx_appcompat_appcompat", "@maven//:androidx_compose_ui_ui", diff --git a/sample-android-flavor/build.gradle b/flavors/sample-android-flavor/build.gradle similarity index 85% rename from sample-android-flavor/build.gradle rename to flavors/sample-android-flavor/build.gradle index 389ade2e..40e95048 100644 --- a/sample-android-flavor/build.gradle +++ b/flavors/sample-android-flavor/build.gradle @@ -13,26 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -apply plugin: "com.android.library" -apply plugin: "kotlin-android" -apply plugin: "kotlin-kapt" -apply plugin: "kotlin-parcelize" +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.kapt) + alias(libs.plugins.kotlin.parcelize) +} android { compileSdkVersion 33 buildToolsVersion "33.0.1" defaultConfig { + minSdkVersion 21 resValue "string", "generated_value", "generated" } flavorDimensions "service", "release" productFlavors { - flavor1 { + demo { dimension "service" } - flavor2 { + full { dimension "service" } free { @@ -65,8 +67,8 @@ android { } dependencies { - flavor1Implementation project(path: ':flavor-libs:sample-library-flavor1') - flavor2Implementation project(path: ":flavor-libs:sample-library-flavor2") + demoImplementation project(path: ":flavors:sample-library-demo") + fullImplementation project(path: ":flavors:sample-library-full") implementation libs.androidx.appcompat implementation libs.androidx.core diff --git a/sample-android-flavor/src/flavor1/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt b/flavors/sample-android-flavor/src/demo/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt similarity index 100% rename from sample-android-flavor/src/flavor1/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt rename to flavors/sample-android-flavor/src/demo/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt diff --git a/sample-android-flavor/src/flavor1/res/values/strings.xml b/flavors/sample-android-flavor/src/demo/res/values/strings.xml similarity index 100% rename from sample-android-flavor/src/flavor1/res/values/strings.xml rename to flavors/sample-android-flavor/src/demo/res/values/strings.xml diff --git a/sample-android-flavor/src/freeApp/res/layout/activity_flavor.xml b/flavors/sample-android-flavor/src/free/res/layout/activity_flavor.xml similarity index 100% rename from sample-android-flavor/src/freeApp/res/layout/activity_flavor.xml rename to flavors/sample-android-flavor/src/free/res/layout/activity_flavor.xml diff --git a/sample-android-flavor/src/freeApp/res/values/strings.xml b/flavors/sample-android-flavor/src/free/res/values/strings.xml similarity index 100% rename from sample-android-flavor/src/freeApp/res/values/strings.xml rename to flavors/sample-android-flavor/src/free/res/values/strings.xml diff --git a/sample-android-flavor/src/flavor2/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt b/flavors/sample-android-flavor/src/full/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt similarity index 100% rename from sample-android-flavor/src/flavor2/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt rename to flavors/sample-android-flavor/src/full/java/com/grab/grazel/android/flavor/HelloFlavorMessage.kt diff --git a/sample-android-flavor/src/flavor2/res/values/strings.xml b/flavors/sample-android-flavor/src/full/res/values/strings.xml similarity index 100% rename from sample-android-flavor/src/flavor2/res/values/strings.xml rename to flavors/sample-android-flavor/src/full/res/values/strings.xml diff --git a/sample-android-flavor/src/main/AndroidManifest.xml b/flavors/sample-android-flavor/src/main/AndroidManifest.xml similarity index 100% rename from sample-android-flavor/src/main/AndroidManifest.xml rename to flavors/sample-android-flavor/src/main/AndroidManifest.xml diff --git a/sample-android-flavor/src/main/java/com/grab/grazel/android/flavor/BindingAdapter.kt b/flavors/sample-android-flavor/src/main/java/com/grab/grazel/android/flavor/BindingAdapter.kt similarity index 100% rename from sample-android-flavor/src/main/java/com/grab/grazel/android/flavor/BindingAdapter.kt rename to flavors/sample-android-flavor/src/main/java/com/grab/grazel/android/flavor/BindingAdapter.kt diff --git a/sample-android-flavor/src/main/java/com/grab/grazel/android/flavor/FlavorActivity.kt b/flavors/sample-android-flavor/src/main/java/com/grab/grazel/android/flavor/FlavorActivity.kt similarity index 100% rename from sample-android-flavor/src/main/java/com/grab/grazel/android/flavor/FlavorActivity.kt rename to flavors/sample-android-flavor/src/main/java/com/grab/grazel/android/flavor/FlavorActivity.kt diff --git a/sample-android-flavor/src/main/res/layout/activity_flavor.xml b/flavors/sample-android-flavor/src/main/res/layout/activity_flavor.xml similarity index 100% rename from sample-android-flavor/src/main/res/layout/activity_flavor.xml rename to flavors/sample-android-flavor/src/main/res/layout/activity_flavor.xml diff --git a/sample-android-flavor/src/main/res/values/strings.xml b/flavors/sample-android-flavor/src/main/res/values/strings.xml similarity index 100% rename from sample-android-flavor/src/main/res/values/strings.xml rename to flavors/sample-android-flavor/src/main/res/values/strings.xml diff --git a/flavor-libs/sample-library-flavor1/.gitignore b/flavors/sample-library-demo/.gitignore similarity index 100% rename from flavor-libs/sample-library-flavor1/.gitignore rename to flavors/sample-library-demo/.gitignore diff --git a/flavor-libs/sample-library-flavor1/BUILD.bazel b/flavors/sample-library-demo/BUILD.bazel similarity index 78% rename from flavor-libs/sample-library-flavor1/BUILD.bazel rename to flavors/sample-library-demo/BUILD.bazel index e677b330..ec77401f 100644 --- a/flavor-libs/sample-library-flavor1/BUILD.bazel +++ b/flavors/sample-library-demo/BUILD.bazel @@ -1,7 +1,7 @@ load("@grab_bazel_common//rules:defs.bzl", "kotlin_library", "kotlin_test") kotlin_library( - name = "sample-library-flavor1", + name = "sample-library-demo", srcs = glob([ "src/main/java/com/grab/grazel/android/flavor/ModuleName.kt", ]), @@ -14,12 +14,12 @@ kotlin_library( ) kotlin_test( - name = "sample-library-flavor1-test", + name = "sample-library-demo-test", srcs = glob([ "src/test/java/com/grab/grazel/flavor1/ModuleNameTest.kt", ]), associates = [ - "//flavor-libs/sample-library-flavor1:sample-library-flavor1", + "//flavors/sample-library-demo:sample-library-demo", ], visibility = [ "//visibility:public", diff --git a/flavor-libs/sample-library-flavor2/build.gradle b/flavors/sample-library-demo/build.gradle similarity index 92% rename from flavor-libs/sample-library-flavor2/build.gradle rename to flavors/sample-library-demo/build.gradle index 148140da..12210944 100644 --- a/flavor-libs/sample-library-flavor2/build.gradle +++ b/flavors/sample-library-demo/build.gradle @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -apply plugin: "java-library" -apply plugin: "kotlin" +plugins { + id("kotlin") +} dependencies { testImplementation libs.junit diff --git a/flavor-libs/sample-library-flavor1/src/main/java/com/grab/grazel/android/flavor/ModuleName.kt b/flavors/sample-library-demo/src/main/java/com/grab/grazel/android/flavor/ModuleName.kt similarity index 100% rename from flavor-libs/sample-library-flavor1/src/main/java/com/grab/grazel/android/flavor/ModuleName.kt rename to flavors/sample-library-demo/src/main/java/com/grab/grazel/android/flavor/ModuleName.kt diff --git a/flavor-libs/sample-library-flavor1/src/test/java/com/grab/grazel/flavor1/ModuleNameTest.kt b/flavors/sample-library-demo/src/test/java/com/grab/grazel/flavor1/ModuleNameTest.kt similarity index 100% rename from flavor-libs/sample-library-flavor1/src/test/java/com/grab/grazel/flavor1/ModuleNameTest.kt rename to flavors/sample-library-demo/src/test/java/com/grab/grazel/flavor1/ModuleNameTest.kt diff --git a/flavor-libs/sample-library-flavor2/.gitignore b/flavors/sample-library-full/.gitignore similarity index 100% rename from flavor-libs/sample-library-flavor2/.gitignore rename to flavors/sample-library-full/.gitignore diff --git a/flavor-libs/sample-library-flavor2/BUILD.bazel b/flavors/sample-library-full/BUILD.bazel similarity index 78% rename from flavor-libs/sample-library-flavor2/BUILD.bazel rename to flavors/sample-library-full/BUILD.bazel index a820849e..e5a295c7 100644 --- a/flavor-libs/sample-library-flavor2/BUILD.bazel +++ b/flavors/sample-library-full/BUILD.bazel @@ -1,7 +1,7 @@ load("@grab_bazel_common//rules:defs.bzl", "kotlin_library", "kotlin_test") kotlin_library( - name = "sample-library-flavor2", + name = "sample-library-full", srcs = glob([ "src/main/java/com/grab/grazel/android/flavor/ModuleName.kt", ]), @@ -14,12 +14,12 @@ kotlin_library( ) kotlin_test( - name = "sample-library-flavor2-test", + name = "sample-library-full-test", srcs = glob([ "src/test/java/com/grab/grazel/flavor2/ModuleNameTest.kt", ]), associates = [ - "//flavor-libs/sample-library-flavor2:sample-library-flavor2", + "//flavors/sample-library-full:sample-library-full", ], visibility = [ "//visibility:public", diff --git a/flavor-libs/sample-library-flavor1/build.gradle b/flavors/sample-library-full/build.gradle similarity index 92% rename from flavor-libs/sample-library-flavor1/build.gradle rename to flavors/sample-library-full/build.gradle index 148140da..12210944 100644 --- a/flavor-libs/sample-library-flavor1/build.gradle +++ b/flavors/sample-library-full/build.gradle @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -apply plugin: "java-library" -apply plugin: "kotlin" +plugins { + id("kotlin") +} dependencies { testImplementation libs.junit diff --git a/flavor-libs/sample-library-flavor2/src/main/java/com/grab/grazel/android/flavor/ModuleName.kt b/flavors/sample-library-full/src/main/java/com/grab/grazel/android/flavor/ModuleName.kt similarity index 100% rename from flavor-libs/sample-library-flavor2/src/main/java/com/grab/grazel/android/flavor/ModuleName.kt rename to flavors/sample-library-full/src/main/java/com/grab/grazel/android/flavor/ModuleName.kt diff --git a/flavor-libs/sample-library-flavor2/src/test/java/com/grab/grazel/flavor2/ModuleNameTest.kt b/flavors/sample-library-full/src/test/java/com/grab/grazel/flavor2/ModuleNameTest.kt similarity index 100% rename from flavor-libs/sample-library-flavor2/src/test/java/com/grab/grazel/flavor2/ModuleNameTest.kt rename to flavors/sample-library-full/src/test/java/com/grab/grazel/flavor2/ModuleNameTest.kt diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d8e9ab38..4631b899 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ androidx-monitor = "1.6.1" androidx-compose = "1.4.3" activity-compose = "1.7.2" annotation-jvm = "1.6.0" -crashlytics = "2.9.5" +crashlytics = "2.9.9" dagger = "2.47" dokka = "1.4.32" emoji2 = "1.3.0" @@ -38,7 +38,6 @@ sceneform-ux = "1.15.0" timber = "5.0.1" auto-service = "1.1.1" truth = "1.1.3" -jetbrains-kotlin-jvm = "1.8.10" [libraries] android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" } @@ -75,9 +74,7 @@ databinding-runtime = { module = "androidx.databinding:databinding-runtime", ver 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-firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "crashlytics" } google-guava = { module = "com.google.guava:guava", version.ref = "guava" } -google-mobile-services = { module = "com.google.gms:google-services", version.ref = "google-services" } google-truth = { module = "com.google.truth:truth", version.ref = "truth" } javapoet = { module = "com.squareup:javapoet", version.ref = "javapoet" } junit = { module = "junit:junit", version.ref = "junit" } @@ -97,6 +94,15 @@ timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } auto-service = { module = "com.google.auto.service:auto-service", version.ref = "auto-service" } [plugins] +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" } +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" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +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 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 032b6e95..168825ac 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.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/gradle/Project.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/gradle/Project.kt index ddfa0c8e..d836dab0 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/gradle/Project.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/gradle/Project.kt @@ -35,7 +35,7 @@ const val ANDROID_LIBRARY_PLUGIN = "com.android.library" const val LINT_PLUGIN_ID = "com.android.lint" const val ANDROID_DYNAMIC_FEATURE = "com.android.dynamic-feature" const val FIREBASE_CRASHLYTICS_PLUGIN = "com.google.firebase.crashlytics" -const val GOOGLE_PLAY_SERVICES_PLUGIN = "com.google.firebase.crashlytics" +const val GOOGLE_PLAY_SERVICES_PLUGIN = "com.google.gms.google-services" val Project.isAndroidLibrary get() = plugins.hasPlugin(ANDROID_LIBRARY_PLUGIN) val Project.isAndroidApplication get() = plugins.hasPlugin(ANDROID_APPLICATION_PLUGIN) @@ -53,6 +53,7 @@ val Project.hasDatabinding: Boolean (buildFeatures as? ApplicationBuildFeatures)?.dataBinding == true || buildFeatures.viewBinding == true } == true + val Project.hasCompose: Boolean get() = extensions.findByType()?.buildFeatures?.compose == true diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/Crashlytics.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/Crashlytics.kt index 1a6cb9b5..123b54f0 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/Crashlytics.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/migrate/android/Crashlytics.kt @@ -17,8 +17,6 @@ package com.grab.grazel.migrate.android import com.grab.grazel.GrazelExtension -import com.grab.grazel.gradle.variant.AndroidVariantDataSource -import com.grab.grazel.gradle.variant.getMigratableBuildVariants import com.grab.grazel.gradle.variant.MatchedVariant import com.grab.grazel.gradle.variant.nameSuffix import org.gradle.api.Project 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 0ed68581..b882c67c 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 @@ -28,6 +28,7 @@ import org.gradle.api.Task import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.ConfigurationContainer import org.gradle.api.artifacts.dsl.ArtifactHandler +import org.gradle.api.artifacts.dsl.DependencyFactory import org.gradle.api.artifacts.dsl.DependencyHandler import org.gradle.api.artifacts.dsl.DependencyLockingHandler import org.gradle.api.artifacts.dsl.RepositoryHandler @@ -512,6 +513,10 @@ class FakeProject(private val name: String) : Project { TODO("Not yet implemented") } + override fun getDependencyFactory(): DependencyFactory { + TODO("Not yet implemented") + } + override fun getBuildscript(): ScriptHandler { TODO("Not yet implemented") } diff --git a/keystore/BUILD.bazel b/keystore/BUILD.bazel new file mode 100644 index 00000000..bb11ee34 --- /dev/null +++ b/keystore/BUILD.bazel @@ -0,0 +1,9 @@ +filegroup( + name = "debug-keystore", + srcs = [ + "debug.keystore", + ], + visibility = [ + "//visibility:public", + ], +) diff --git a/buildsystem/debug.keystore b/keystore/debug.keystore similarity index 100% rename from buildsystem/debug.keystore rename to keystore/debug.keystore diff --git a/lint/custom-lint-rules/build.gradle b/lint/custom-lint-rules/build.gradle index 4f214a1f..fd60209d 100644 --- a/lint/custom-lint-rules/build.gradle +++ b/lint/custom-lint-rules/build.gradle @@ -1,11 +1,6 @@ plugins { - id 'kotlin' - id 'com.android.lint' -} - -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + id "kotlin" + id "com.android.lint" } dependencies { diff --git a/sample-android-library/BUILD.bazel b/sample-android-library/BUILD.bazel index 5950b701..39f0ac8c 100644 --- a/sample-android-library/BUILD.bazel +++ b/sample-android-library/BUILD.bazel @@ -1,7 +1,7 @@ load("@grab_bazel_common//rules:defs.bzl", "android_library", "android_unit_test") android_library( - name = "sample-android-library-flavor1-free-debug", + name = "sample-android-library-demo-free-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/sample/SampleViewModel.kt", ]), @@ -20,7 +20,7 @@ android_library( ) android_library( - name = "sample-android-library-flavor1-paid-debug", + name = "sample-android-library-demo-paid-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/sample/SampleViewModel.kt", ]), @@ -39,7 +39,7 @@ android_library( ) android_library( - name = "sample-android-library-flavor2-free-debug", + name = "sample-android-library-full-free-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/sample/SampleViewModel.kt", ]), @@ -58,7 +58,7 @@ android_library( ) android_library( - name = "sample-android-library-flavor2-paid-debug", + name = "sample-android-library-full-paid-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/sample/SampleViewModel.kt", ]), @@ -77,12 +77,12 @@ android_library( ) android_unit_test( - name = "sample-android-library-flavor1-free-debug-test", + name = "sample-android-library-demo-free-debug-test", srcs = glob([ "src/test/java/com/grab/grazel/android/sample/SampleViewModelTest.kt", ]), associates = [ - "//sample-android-library:sample-android-library-flavor1-free-debug_kt", + "//sample-android-library:sample-android-library-demo-free-debug_kt", ], custom_package = "com.grab.grazel.android.sample.lib", resources = glob([ @@ -93,18 +93,18 @@ android_unit_test( ], deps = [ "//:parcelize", - "//sample-android-library:sample-android-library-flavor1-free-debug", + "//sample-android-library:sample-android-library-demo-free-debug", "@test_maven//:junit_junit", ], ) android_unit_test( - name = "sample-android-library-flavor1-paid-debug-test", + name = "sample-android-library-demo-paid-debug-test", srcs = glob([ "src/test/java/com/grab/grazel/android/sample/SampleViewModelTest.kt", ]), associates = [ - "//sample-android-library:sample-android-library-flavor1-paid-debug_kt", + "//sample-android-library:sample-android-library-demo-paid-debug_kt", ], custom_package = "com.grab.grazel.android.sample.lib", resources = glob([ @@ -115,18 +115,18 @@ android_unit_test( ], deps = [ "//:parcelize", - "//sample-android-library:sample-android-library-flavor1-paid-debug", + "//sample-android-library:sample-android-library-demo-paid-debug", "@test_maven//:junit_junit", ], ) android_unit_test( - name = "sample-android-library-flavor2-free-debug-test", + name = "sample-android-library-full-free-debug-test", srcs = glob([ "src/test/java/com/grab/grazel/android/sample/SampleViewModelTest.kt", ]), associates = [ - "//sample-android-library:sample-android-library-flavor2-free-debug_kt", + "//sample-android-library:sample-android-library-full-free-debug_kt", ], custom_package = "com.grab.grazel.android.sample.lib", resources = glob([ @@ -137,18 +137,18 @@ android_unit_test( ], deps = [ "//:parcelize", - "//sample-android-library:sample-android-library-flavor2-free-debug", + "//sample-android-library:sample-android-library-full-free-debug", "@test_maven//:junit_junit", ], ) android_unit_test( - name = "sample-android-library-flavor2-paid-debug-test", + name = "sample-android-library-full-paid-debug-test", srcs = glob([ "src/test/java/com/grab/grazel/android/sample/SampleViewModelTest.kt", ]), associates = [ - "//sample-android-library:sample-android-library-flavor2-paid-debug_kt", + "//sample-android-library:sample-android-library-full-paid-debug_kt", ], custom_package = "com.grab.grazel.android.sample.lib", resources = glob([ @@ -159,7 +159,7 @@ android_unit_test( ], deps = [ "//:parcelize", - "//sample-android-library:sample-android-library-flavor2-paid-debug", + "//sample-android-library:sample-android-library-full-paid-debug", "@test_maven//:junit_junit", ], ) diff --git a/sample-android-library/build.gradle b/sample-android-library/build.gradle index c528bcb8..3ebb5b33 100644 --- a/sample-android-library/build.gradle +++ b/sample-android-library/build.gradle @@ -14,14 +14,18 @@ * limitations under the License. */ -apply plugin: "com.android.library" -apply plugin: "kotlin-android" -apply plugin: "kotlin-parcelize" +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) +} android { compileSdkVersion 33 buildToolsVersion "33.0.1" - + defaultConfig { + minSdkVersion 21 + } buildFeatures { viewBinding true } diff --git a/sample-android/BUILD.bazel b/sample-android/BUILD.bazel index f0f9af87..be13df6c 100644 --- a/sample-android/BUILD.bazel +++ b/sample-android/BUILD.bazel @@ -3,7 +3,7 @@ load("@tools_android//tools/crashlytics:defs.bzl", "crashlytics_android_library" load("@tools_android//tools/googleservices:defs.bzl", "google_services_xml") android_binary( - name = "sample-android-flavor1-free-debug", + name = "sample-android-demo-free-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/sample/**/*.kt", ]), @@ -15,7 +15,7 @@ android_binary( "strings": { "SOME_STRING": "Something", "VERSION_NAME": "1.0", - "VARIANT_NAME": "flavor1FreeDebug", + "VARIANT_NAME": "demoFreeDebug", }, "booleans": { "SOME_BOOLEAN": "false", @@ -30,7 +30,7 @@ android_binary( }, crunch_png = False, custom_package = "com.grab.grazel.android.sample", - debug_key = "//buildsystem:debug-keystore", + debug_key = "//keystore:debug-keystore", enable_compose = True, enable_data_binding = True, incremental_dexing = True, @@ -83,11 +83,11 @@ android_binary( "//visibility:public", ], deps = [ - ":crashlytics-flavor1-free-debug", + ":crashlytics-demo-free-debug", "//:dagger", "//:parcelize", - "//sample-android-flavor:sample-android-flavor-flavor1-free-debug", - "//sample-android-library:sample-android-library-flavor1-free-debug", + "//flavors/sample-android-flavor:sample-android-flavor-demo-free-debug", + "//sample-android-library:sample-android-library-demo-free-debug", "//sample-kotlin-library", "@debug_maven//:androidx_core_core", "@debug_maven//:androidx_lifecycle_lifecycle_common", @@ -110,7 +110,7 @@ android_binary( ) android_binary( - name = "sample-android-flavor1-paid-debug", + name = "sample-android-demo-paid-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/sample/**/*.kt", ]), @@ -122,7 +122,7 @@ android_binary( "strings": { "SOME_STRING": "Something", "VERSION_NAME": "1.0", - "VARIANT_NAME": "flavor1PaidDebug", + "VARIANT_NAME": "demoPaidDebug", }, "booleans": { "SOME_BOOLEAN": "false", @@ -137,7 +137,7 @@ android_binary( }, crunch_png = False, custom_package = "com.grab.grazel.android.sample", - debug_key = "//buildsystem:debug-keystore", + debug_key = "//keystore:debug-keystore", enable_compose = True, enable_data_binding = True, incremental_dexing = True, @@ -190,11 +190,11 @@ android_binary( "//visibility:public", ], deps = [ - ":crashlytics-flavor1-paid-debug", + ":crashlytics-demo-paid-debug", "//:dagger", "//:parcelize", - "//sample-android-flavor:sample-android-flavor-flavor1-paid-debug", - "//sample-android-library:sample-android-library-flavor1-paid-debug", + "//flavors/sample-android-flavor:sample-android-flavor-demo-paid-debug", + "//sample-android-library:sample-android-library-demo-paid-debug", "//sample-kotlin-library", "@debug_maven//:androidx_core_core", "@debug_maven//:androidx_lifecycle_lifecycle_common", @@ -217,7 +217,7 @@ android_binary( ) android_binary( - name = "sample-android-flavor2-free-debug", + name = "sample-android-full-free-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/sample/**/*.kt", ]), @@ -229,7 +229,7 @@ android_binary( "strings": { "SOME_STRING": "Something", "VERSION_NAME": "1.0", - "VARIANT_NAME": "flavor2FreeDebug", + "VARIANT_NAME": "fullFreeDebug", }, "booleans": { "SOME_BOOLEAN": "false", @@ -244,7 +244,7 @@ android_binary( }, crunch_png = False, custom_package = "com.grab.grazel.android.sample", - debug_key = "//buildsystem:debug-keystore", + debug_key = "//keystore:debug-keystore", enable_compose = True, enable_data_binding = True, incremental_dexing = True, @@ -297,11 +297,11 @@ android_binary( "//visibility:public", ], deps = [ - ":crashlytics-flavor2-free-debug", + ":crashlytics-full-free-debug", "//:dagger", "//:parcelize", - "//sample-android-flavor:sample-android-flavor-flavor2-free-debug", - "//sample-android-library:sample-android-library-flavor2-free-debug", + "//flavors/sample-android-flavor:sample-android-flavor-full-free-debug", + "//sample-android-library:sample-android-library-full-free-debug", "//sample-kotlin-library", "@debug_maven//:androidx_core_core", "@debug_maven//:androidx_lifecycle_lifecycle_common", @@ -324,7 +324,7 @@ android_binary( ) android_binary( - name = "sample-android-flavor2-paid-debug", + name = "sample-android-full-paid-debug", srcs = glob([ "src/main/java/com/grab/grazel/android/sample/**/*.kt", ]), @@ -336,7 +336,7 @@ android_binary( "strings": { "SOME_STRING": "Something", "VERSION_NAME": "1.0", - "VARIANT_NAME": "flavor2PaidDebug", + "VARIANT_NAME": "fullPaidDebug", }, "booleans": { "SOME_BOOLEAN": "false", @@ -351,7 +351,7 @@ android_binary( }, crunch_png = False, custom_package = "com.grab.grazel.android.sample", - debug_key = "//buildsystem:debug-keystore", + debug_key = "//keystore:debug-keystore", enable_compose = True, enable_data_binding = True, incremental_dexing = True, @@ -404,11 +404,11 @@ android_binary( "//visibility:public", ], deps = [ - ":crashlytics-flavor2-paid-debug", + ":crashlytics-full-paid-debug", "//:dagger", "//:parcelize", - "//sample-android-flavor:sample-android-flavor-flavor2-paid-debug", - "//sample-android-library:sample-android-library-flavor2-paid-debug", + "//flavors/sample-android-flavor:sample-android-flavor-full-paid-debug", + "//sample-android-library:sample-android-library-full-paid-debug", "//sample-kotlin-library", "@debug_maven//:androidx_core_core", "@debug_maven//:androidx_lifecycle_lifecycle_common", @@ -431,58 +431,58 @@ android_binary( ) crashlytics_android_library( - name = "crashlytics-flavor1-free-debug", + name = "crashlytics-demo-free-debug", package_name = "com.grab.grazel.android.sample.free", build_id = "042cb4d8-56f8-41a0-916a-9da28e94d1ba", resource_files = google_services_xml( package_name = "com.grab.grazel.android.sample.free", - google_services_json = "src/flavor1FreeDebug/google-services.json", + google_services_json = "src/demoFreeDebug/google-services.json", ), ) crashlytics_android_library( - name = "crashlytics-flavor1-paid-debug", + name = "crashlytics-demo-paid-debug", package_name = "com.grab.grazel.android.sample.paid", build_id = "042cb4d8-56f8-41a0-916a-9da28e94d1ba", resource_files = google_services_xml( package_name = "com.grab.grazel.android.sample.paid", - google_services_json = "src/flavor1Paid/google-services.json", + google_services_json = "src/demoPaid/google-services.json", ), ) crashlytics_android_library( - name = "crashlytics-flavor2-free-debug", + name = "crashlytics-full-free-debug", package_name = "com.grab.grazel.android.sample.free", build_id = "042cb4d8-56f8-41a0-916a-9da28e94d1ba", resource_files = google_services_xml( package_name = "com.grab.grazel.android.sample.free", - google_services_json = "src/flavor2Free/google-services.json", + google_services_json = "src/fullFree/google-services.json", ), ) crashlytics_android_library( - name = "crashlytics-flavor2-paid-debug", + name = "crashlytics-full-paid-debug", package_name = "com.grab.grazel.android.sample.paid", build_id = "042cb4d8-56f8-41a0-916a-9da28e94d1ba", resource_files = google_services_xml( package_name = "com.grab.grazel.android.sample.paid", - google_services_json = "src/flavor2Paid/google-services.json", + google_services_json = "src/fullPaid/google-services.json", ), ) android_instrumentation_binary( - name = "sample-android-flavor1-free-debug-android-test", + name = "sample-android-demo-free-debug-android-test", srcs = glob([ "src/androidTest/java/JavaTest.java", "src/androidTest/java/KotlinTest.kt", ]), associates = [ - "//sample-android:lib_sample-android-flavor1-free-debug_kt", + "//sample-android:lib_sample-android-demo-free-debug_kt", ], custom_package = "com.grab.grazel.android.sample", - debug_key = "//buildsystem:debug-keystore", + debug_key = "//keystore:debug-keystore", enable_compose = True, - instruments = ":sample-android-flavor1-free-debug", + instruments = ":sample-android-demo-free-debug", manifest_values = { "versionCode": "1", "versionName": "1.0", @@ -500,9 +500,9 @@ android_instrumentation_binary( test_instrumentation_runner = "androidx.test.runner.AndroidJUnitRunner", deps = [ "//:dagger", - "//sample-android:lib_sample-android-flavor1-free-debug", - "//sample-android-flavor:sample-android-flavor-flavor1-free-debug", - "//sample-android-library:sample-android-library-flavor1-free-debug", + "//flavors/sample-android-flavor:sample-android-flavor-demo-free-debug", + "//sample-android:lib_sample-android-demo-free-debug", + "//sample-android-library:sample-android-library-demo-free-debug", "//sample-kotlin-library", "@android_test_maven//:androidx_lifecycle_lifecycle_common", "@android_test_maven//:androidx_test_espresso_espresso_core", @@ -528,18 +528,18 @@ android_instrumentation_binary( ) android_instrumentation_binary( - name = "sample-android-flavor1-paid-debug-android-test", + name = "sample-android-demo-paid-debug-android-test", srcs = glob([ "src/androidTest/java/JavaTest.java", "src/androidTest/java/KotlinTest.kt", ]), associates = [ - "//sample-android:lib_sample-android-flavor1-paid-debug_kt", + "//sample-android:lib_sample-android-demo-paid-debug_kt", ], custom_package = "com.grab.grazel.android.sample", - debug_key = "//buildsystem:debug-keystore", + debug_key = "//keystore:debug-keystore", enable_compose = True, - instruments = ":sample-android-flavor1-paid-debug", + instruments = ":sample-android-demo-paid-debug", manifest_values = { "versionCode": "1", "versionName": "1.0", @@ -557,9 +557,9 @@ android_instrumentation_binary( test_instrumentation_runner = "androidx.test.runner.AndroidJUnitRunner", deps = [ "//:dagger", - "//sample-android:lib_sample-android-flavor1-paid-debug", - "//sample-android-flavor:sample-android-flavor-flavor1-paid-debug", - "//sample-android-library:sample-android-library-flavor1-paid-debug", + "//flavors/sample-android-flavor:sample-android-flavor-demo-paid-debug", + "//sample-android:lib_sample-android-demo-paid-debug", + "//sample-android-library:sample-android-library-demo-paid-debug", "//sample-kotlin-library", "@android_test_maven//:androidx_lifecycle_lifecycle_common", "@android_test_maven//:androidx_test_espresso_espresso_core", @@ -585,18 +585,18 @@ android_instrumentation_binary( ) android_instrumentation_binary( - name = "sample-android-flavor2-free-debug-android-test", + name = "sample-android-full-free-debug-android-test", srcs = glob([ "src/androidTest/java/JavaTest.java", "src/androidTest/java/KotlinTest.kt", ]), associates = [ - "//sample-android:lib_sample-android-flavor2-free-debug_kt", + "//sample-android:lib_sample-android-full-free-debug_kt", ], custom_package = "com.grab.grazel.android.sample", - debug_key = "//buildsystem:debug-keystore", + debug_key = "//keystore:debug-keystore", enable_compose = True, - instruments = ":sample-android-flavor2-free-debug", + instruments = ":sample-android-full-free-debug", manifest_values = { "versionCode": "1", "versionName": "1.0", @@ -614,9 +614,9 @@ android_instrumentation_binary( test_instrumentation_runner = "androidx.test.runner.AndroidJUnitRunner", deps = [ "//:dagger", - "//sample-android:lib_sample-android-flavor2-free-debug", - "//sample-android-flavor:sample-android-flavor-flavor2-free-debug", - "//sample-android-library:sample-android-library-flavor2-free-debug", + "//flavors/sample-android-flavor:sample-android-flavor-full-free-debug", + "//sample-android:lib_sample-android-full-free-debug", + "//sample-android-library:sample-android-library-full-free-debug", "//sample-kotlin-library", "@android_test_maven//:androidx_lifecycle_lifecycle_common", "@android_test_maven//:androidx_test_espresso_espresso_core", @@ -642,18 +642,18 @@ android_instrumentation_binary( ) android_instrumentation_binary( - name = "sample-android-flavor2-paid-debug-android-test", + name = "sample-android-full-paid-debug-android-test", srcs = glob([ "src/androidTest/java/JavaTest.java", "src/androidTest/java/KotlinTest.kt", ]), associates = [ - "//sample-android:lib_sample-android-flavor2-paid-debug_kt", + "//sample-android:lib_sample-android-full-paid-debug_kt", ], custom_package = "com.grab.grazel.android.sample", - debug_key = "//buildsystem:debug-keystore", + debug_key = "//keystore:debug-keystore", enable_compose = True, - instruments = ":sample-android-flavor2-paid-debug", + instruments = ":sample-android-full-paid-debug", manifest_values = { "versionCode": "1", "versionName": "1.0", @@ -671,9 +671,9 @@ android_instrumentation_binary( test_instrumentation_runner = "androidx.test.runner.AndroidJUnitRunner", deps = [ "//:dagger", - "//sample-android:lib_sample-android-flavor2-paid-debug", - "//sample-android-flavor:sample-android-flavor-flavor2-paid-debug", - "//sample-android-library:sample-android-library-flavor2-paid-debug", + "//flavors/sample-android-flavor:sample-android-flavor-full-paid-debug", + "//sample-android:lib_sample-android-full-paid-debug", + "//sample-android-library:sample-android-library-full-paid-debug", "//sample-kotlin-library", "@android_test_maven//:androidx_lifecycle_lifecycle_common", "@android_test_maven//:androidx_test_espresso_espresso_core", diff --git a/sample-android/build.gradle b/sample-android/build.gradle index 61160ab3..f3cab8f8 100644 --- a/sample-android/build.gradle +++ b/sample-android/build.gradle @@ -15,12 +15,14 @@ import com.android.build.api.variant.BuildConfigField * See the License for the specific language governing permissions and * limitations under the License. */ - -apply plugin: "com.android.application" -apply plugin: "kotlin-android" -apply plugin: "kotlin-kapt" -apply plugin: "kotlin-parcelize" -apply plugin: "com.google.firebase.crashlytics" +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.kapt) + alias(libs.plugins.kotlin.parcelize) + alias(libs.plugins.firebase.crashlytics) + alias(libs.plugins.google.mobile.services) +} android { compileSdkVersion 33 @@ -41,7 +43,9 @@ android { resValue "string", "generated_value", "This string was generated with resValue" - manifestPlaceholders = [orientation: "portrait"] + manifestPlaceholders = [ + orientation: "portrait" + ] vectorDrawables { useSupportLibrary true } @@ -49,7 +53,7 @@ android { signingConfigs { debug { - storeFile file("../buildsystem/debug.keystore") + storeFile file("../keystore/debug.keystore") } } @@ -65,14 +69,14 @@ android { } } - flavorDimensions "service", "release" + flavorDimensions += ["service", "release"] def resConfigs = ["en", "id", "in", "km", "ms", "my", "th", "vi", "zh", "ko", "ja"] productFlavors { - flavor1 { + demo { resourceConfigurations += resConfigs dimension "service" } - flavor2 { + full { resourceConfigurations += resConfigs dimension "service" } @@ -102,11 +106,6 @@ android { } } - buildFeatures { - compose true - dataBinding true - } - composeOptions { kotlinCompilerExtensionVersion libs.versions.androidx.compose.get() } @@ -121,16 +120,17 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = "1.8" } packagingOptions { resources { - excludes += '/META-INF/{AL2.0,LGPL2.1}' + excludes += "/META-INF/{AL2.0,LGPL2.1}" } } buildFeatures { compose = true + dataBinding true } lint { @@ -146,7 +146,7 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation project(path: ":sample-kotlin-library") implementation project(path: ":sample-android-library") - implementation project(path: ":sample-android-flavor") + implementation project(path: ":flavors:sample-android-flavor") implementation libs.androidx.appcompat implementation libs.androidx.lifecycle.runtime implementation libs.androidx.lifecycle.common @@ -180,6 +180,4 @@ dependencies { androidTestImplementation libs.androidx.test.junit androidTestImplementation libs.androidx.test.espresso.core androidTestImplementation libs.androidx.monitor -} - -apply plugin: "com.google.gms.google-services" \ No newline at end of file +} \ No newline at end of file diff --git a/sample-android/lint.xml b/sample-android/lint.xml index a4270208..6edd3dc1 100644 --- a/sample-android/lint.xml +++ b/sample-android/lint.xml @@ -1,5 +1,4 @@ - - - \ No newline at end of file diff --git a/sample-android/lint_baseline.xml b/sample-android/lint_baseline.xml index 44e9513b..97adc965 100755 --- a/sample-android/lint_baseline.xml +++ b/sample-android/lint_baseline.xml @@ -1,73 +1,11 @@ - - - - - - - - - - - - - - - - - - - - + file="../../../../android-armeabi-v7a-fastbuild/bin/sample-android/sample-android-demo-free-debug_res/out/res/values-id"/> @@ -120,7 +58,7 @@ errorLine1=" <string name="generated_value">This string was generated with resValue</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~"> @@ -131,7 +69,7 @@ errorLine1=" <string name="type">debug</string>" errorLine2=" ~~~~~~~~~~~"> @@ -142,40 +80,7 @@ errorLine1=" <string name="flavor">free</string>" errorLine2=" ~~~~~~~~~~~~~"> - - - - - - - - - - - - @@ -186,7 +91,7 @@ errorLine1="<string name="custom_resource_set">Debug</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -197,7 +102,7 @@ errorLine1="<string name="open_compose_activity">Open Compose Activity</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -208,7 +113,7 @@ errorLine1="<string name="open_flavor_activity">Open Another Activity</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -219,7 +124,7 @@ errorLine1="<string name="overridable_resource">Overridable resource - From frees</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -230,7 +135,7 @@ errorLine1="<string name="title_activity_compose">ComposeActivity</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -239,7 +144,7 @@ id="Typos" message="Did you mean "flavor!" instead of "flavor1"?"> @@ -250,7 +155,7 @@ errorLine1="<string name="overridable_resource1">Overridable resource - From free</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -283,7 +188,7 @@ errorLine1=" <string name="type">debug</string>" errorLine2=" ~~~~~~~~~~~"> @@ -294,7 +199,7 @@ errorLine1=" <string name="flavor">free</string>" errorLine2=" ~~~~~~~~~~~~~"> @@ -305,7 +210,7 @@ errorLine1="<string name="overridable_resource1">Overridable resource - From free</string>" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> @@ -316,7 +221,7 @@ errorLine1="<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">" errorLine2="^"> @@ -327,7 +232,7 @@ errorLine1="<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">" errorLine2="^"> @@ -338,7 +243,7 @@ errorLine1=" <EditText" errorLine2=" ~~~~~~~~"> @@ -349,49 +254,36 @@ errorLine1=" <EditText" errorLine2=" ~~~~~~~~"> - - - - + message="Do not concatenate text displayed with `setText`. Use resource string with placeholders."> + message="String literal in `setText` can not be translated. Use Android resources instead."> @@ -402,7 +294,7 @@ errorLine1=" android:text="Hello World from Grazel!"" errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> diff --git a/sample-android/src/flavor1Free/google-services.json b/sample-android/src/demoFree/google-services.json similarity index 100% rename from sample-android/src/flavor1Free/google-services.json rename to sample-android/src/demoFree/google-services.json diff --git a/sample-android/src/flavor1FreeDebug/google-services.json b/sample-android/src/demoFreeDebug/google-services.json similarity index 100% rename from sample-android/src/flavor1FreeDebug/google-services.json rename to sample-android/src/demoFreeDebug/google-services.json diff --git a/sample-android/src/flavor1Paid/google-services.json b/sample-android/src/demoPaid/google-services.json similarity index 100% rename from sample-android/src/flavor1Paid/google-services.json rename to sample-android/src/demoPaid/google-services.json diff --git a/sample-android/src/flavor2Free/google-services.json b/sample-android/src/fullFree/google-services.json similarity index 100% rename from sample-android/src/flavor2Free/google-services.json rename to sample-android/src/fullFree/google-services.json diff --git a/sample-android/src/flavor2Paid/google-services.json b/sample-android/src/fullPaid/google-services.json similarity index 100% rename from sample-android/src/flavor2Paid/google-services.json rename to sample-android/src/fullPaid/google-services.json diff --git a/sample-kotlin-library/build.gradle b/sample-kotlin-library/build.gradle index 12391616..bec1afea 100644 --- a/sample-kotlin-library/build.gradle +++ b/sample-kotlin-library/build.gradle @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -apply plugin: "java-library" -apply plugin: "kotlin" -apply plugin: "com.android.lint" +plugins { + id("kotlin") + id("com.android.lint") +} lint { baseline file("lint-baseline-kotlin.xml") diff --git a/settings.gradle b/settings.gradle index bf8e61c8..3db4ad32 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,9 @@ pluginManagement { repositories { gradlePluginPortal() mavenCentral() + google() } + includeBuild("grazel-gradle-plugin") plugins { id "com.gradle.enterprise" version "3.6.3" } @@ -27,12 +29,22 @@ plugins { } rootProject.name = "grazel" +dependencyResolutionManagement { + // TODO(arun) Incompatible with repository calculation in grazel + //repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + include(":sample-android") -include(':sample-android-library') -include(":sample-android-flavor") -include(':flavor-libs:sample-library-flavor1') -include(":flavor-libs:sample-library-flavor2") -include(':sample-kotlin-library') +include(":sample-android-library") +include(":flavors:sample-android-flavor") +include(":flavors:sample-library-demo") +include(":flavors:sample-library-full") +include(":sample-kotlin-library") +include(":lint:custom-lint-rules") def isCiServer = System.getenv().containsKey("CI") || true if (isCiServer) { @@ -44,10 +56,3 @@ if (isCiServer) { } } } - -includeBuild("grazel-gradle-plugin") { - dependencySubstitution { - substitute module("com.grab:grazel") using project(":") - } -} -include ':lint:custom-lint-rules'