Grazel is a Gradle plugin to automate generation of valid Bazel files for a given Android/Kotlin/Java project.

Related tags

Gradle plugin Grazel
Overview

Grazel

Grazel stands for Gradle to Bazel.

It is a Gradle plugin that enables you to migrate Android projects to Bazel build system in an incremental and automated fashion.

How it works

It works by automatically generating Bazel scripts for given Android project based on your Gradle configuration. For simple projects, it should be able to migrate, fully build and launch the app with bazel mobile-install //.

In advanced cases, where entire project might not be migratable, it migrates part of the graph and sets up hybrid build where part of the graph can be built with Bazel and rest with Gradle.

Components

  • Gradle plugin
  • A Kotlin Starlark DSL to generate Starlark code in a type-safe way.
  • Grab Bazel Common - Custom rules to bridge the gap between Gradle/Bazel.

Goals

  • Reduce the overall migration effort for migration via automation.
  • Setup hybrid build to establish early feedback loop on CI during migration.
  • Minimal source changes to not impact feature delivery - supported by Grab Bazel Common.
  • Gradle as source of truth until migration is complete.

For documentation, please visit link.

License

Copyright 2021 Grabtaxi Holdings PTE LTE (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.
Comments
  • Grazel not supporting private repositories

    Grazel not supporting private repositories

    I'm trying to migrate to bazel, but I cannot find a way of adding private repo, it seems like rules_jvm_external does support this ->

    maven_install(
        artifacts = [
            "junit:junit:4.12",
            "androidx.test.espresso:espresso-core:3.1.1",
            "org.hamcrest:hamcrest-library:1.3",
        ],
        repositories = [
            # Private repositories are supported through HTTP Basic auth
            "http://username:password@localhost:8081/artifactory/my-repository",
            "https://maven.google.com",
            "https://repo1.maven.org/maven2",
        ],
    )
    

    Is it missing or I is it me who missed it in the docs?

    Thanks

    needs info 
    opened by sylwek845 5
  • ./gradlew migrateToBazel and dynamic modules

    ./gradlew migrateToBazel and dynamic modules

    Hello,

    I have integraded grazel in a multi module project but I got failure when running the gradle task ./gradlew migrateToBazel this is the stack trace

    Caused by: java.util.NoSuchElementException: List contains no element matching the predicate.
            at com.grab.grazel.migrate.android.DefaultAndroidManifestParser.androidManifestFile(AndroidManifestParser.kt:86)
            at com.grab.grazel.migrate.android.DefaultAndroidManifestParser.parsePackageName(AndroidManifestParser.kt:49)
            at com.grab.grazel.migrate.android.DefaultAndroidLibraryDataExtractor.extract(AndroidLibraryDataExtractor.kt:84)
            at com.grab.grazel.migrate.android.DefaultAndroidLibraryDataExtractor.extract(AndroidLibraryDataExtractor.kt:65)
            at com.grab.grazel.migrate.builder.KtAndroidLibTargetBuilder.build(KtAndroidLibTargetBuilder.kt:69)
            at com.grab.grazel.migrate.internal.ProjectBazelFileBuilder.build(ProjectBazelFileBuilder.kt:39)
            at com.grab.grazel.tasks.internal.GenerateBazelScriptsTask.action(GenerateBazelScriptsTask.kt:65)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:555)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:540)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:523)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
    
    
    
    bug 
    opened by meladRaouf 5
  • Add rules for grab_bazel_common toolchain

    Add rules for grab_bazel_common toolchain

    Proposed Changes

    This change is made together with grab/grab-bazel-common#26 to allow the use of toolchains.

    Buildifier was also added into the toolchains that can be generated via bazel which removes the need to depend on Grazel users to manually download buildifier. This removes the problem we faced when different buildifier version is used where the newer buildifier versions formats the files differently which causes line changes in out git diff.

    Changes in this PR uses the declared toolchains to download the required buildifier version and using it for Bazel script formatting

    Testing

    Issues Fixed

    opened by minkuan88 2
  • Fix support for Gradle 7.0

    Fix support for Gradle 7.0

    It seems that as part of the 0.1.0 release some work was done to support Gradle 7.x, but the annotations applied did not work due to Kotlin's getter/setter quirk.

    I've fixed that and additionally updated the repository to Gradle 7.1.1, but the build still does not complete with that version due to another build bug as can be seen here.

    dependencies 
    opened by msfjarvis 2
  • Update `buildifier` tasks to use Property API and task input/output

    Update `buildifier` tasks to use Property API and task input/output

    Proposed Changes

    Adding on to #21, this change improves on the recently added buildifier task to use gradle's Property API along side task input/output instead of dependsOn

    opened by minkuan88 1
  • Fix `buildifier` formatting failure on CI

    Fix `buildifier` formatting failure on CI

    Proposed Changes

    Keystores files were generated and formatted as part of project buildscript generation. This was incompatible with new buildifier's task based workflow. With this change we simply avoid formatting it and just rely on Kotlin DSL to generate correct syntax.

    opened by arunkumar9t2 1
  • Decouple CrashlyticsTarget from AndroidBinaryTarget

    Decouple CrashlyticsTarget from AndroidBinaryTarget

    Proposed Changes

    According to the crashlytics README.md in tools_android, there is no need for the output of google_services_xml to be added to the resource_files of android_binary as the underlying implementation for crashlytics_android_libarary is already an android_library which can be added to android_binary as a dependency.

    This PR also decouples the CrashlyticsTarget away from AndroidBinaryTargetBuilder and have a separate CrashlyticsTargetBuilder instead. A sort order was also implemented for TargetBuilder so that the order of these targets within BUILD.bazel is more deterministic

    Testing

    Issues Fixed

    opened by minkuan88 0
  • Restore overrideArtifactVersions extension config

    Restore overrideArtifactVersions extension config

    Proposed Changes

    The overrideArtifactVersions implementation was removed in this commit but we will still require this capability

    Testing

    Issues Fixed

    opened by minkuan88 0
  • Part 1: Implement per repository `maven_install` for content filtering

    Part 1: Implement per repository `maven_install` for content filtering

    Proposed Changes

    This is initial work on refactoring the version handling logic to make it handle variant specific configurations better as well allow grouping dependencies by repositories it was fetched from. This change allows us to implement multiple maven_install rules in WORKSPACE so that we could implement repository content filtering similar to Gradle: https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:repository-content-filtering

    Most of the work is done by newly added class MavenInstallArtifactsCalculator which groups each variant and their dependencies. Later this logic could be extended to split this bucket by repositories each dependency was resolved from.

    Testing

    Issues Fixed

    enhancement dependencies 
    opened by arunkumar9t2 0
  • Downgrade kotlin version to 1.6.10 for compose 1.1.1 compatibility

    Downgrade kotlin version to 1.6.10 for compose 1.1.1 compatibility

    Proposed Changes

    In order to support the stable version of jetpack compose (version 1.1.1) that is compatible with kotlin 1.6, the kotlin version 1.16.10 should be used instead.

    See: https://developer.android.com/jetpack/androidx/releases/compose-kotlin

    The kotlin version got bumped to 1.16.21 in #28 during the gradle catalog change

    Testing

    Issues Fixed

    opened by minkuan88 0
  • Add android instrumentation test migration

    Add android instrumentation test migration

    Proposed Changes

    Adding Android Instrumentation test features that was implemented in https://github.com/grab/grab-bazel-common/pull/58

    Testing

    Issues Fixed

    opened by minkuan88 0
  • BUILD.bazel not generated.

    BUILD.bazel not generated.

    Problem 1. Not sure why this is happening but it seems like some of my modules getting the Deleted test/test_fixtures_ui/BUILD.bazel and I don;t see the migrated BUILD.bazel file

    > Task :test:test_fixtures_ui:generateBazelScripts
    Deleted test/test_fixtures_ui/BUILD.bazel
    
    > Task :test:test_fixtures:generateBazelScripts
    Generated test/test_fixtures/BUILD.bazel
    

    my config

    grazel {
        android {
            features {
                dataBinding = true
            }
            variantFilter {
                this.setIgnore(name != "release" && name != "prodEnv")
            }
            ndkApiLevel = 28
        }
    
        rules {
            bazelCommon {
                gitRepository {
                    commit = "646475fa68b984f476871f0e8073234e8cae559c" // Commit hash
                    remote = "https://github.com/grab/grab-bazel-common.git"
                }
            }
            test {
                enableTestMigration = true
                detectSourceSets = true
            }
            dependencies {
                overrideArtifactVersions.add("androidx.navigation:navigation-runtime:2.3.2")
            }
            mavenInstall {
                httpArchiveRepository {
                    sha256 = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"
                    stripPrefix = "rules_jvm_external-4.5"
                    url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.5.zip"
                }
                artifactPinning {
                    enabled.set(false)
                }
                versionConflictPolicy = "pinned"
            }
        }
    

    Problem 2.

    When I enable artifactPinning I get dependency conflict ->

    Error in fail: Error while fetching artifact with coursier: Resolution error: Conflicting dependencies:
    androidx.navigation:navigation-runtime:2.3.2 or [2.3.0] or [2.4.0] wanted by
    
      androidx.hilt:hilt-navigation:1.0.0 wants 2.3.2
      └─ androidx.hilt:hilt-navigation-compose:1.0.0
    
      androidx.navigation:navigation-fragment:2.3.0 wants [2.3.0]
      └─ com.datadoghq:dd-sdk-android:1.15.0
    
      androidx.navigation:navigation-runtime-ktx:2.4.0 wants [2.4.0]
      ├─ androidx.navigation:navigation-compose:2.4.0 wants androidx.navigation:navigation-runtime-ktx:[2.4.0]
      │  └─ androidx.hilt:hilt-navigation-compose:1.0.0
      └─ com.datadoghq:dd-sdk-android:1.15.0 wants androidx.navigation:navigation-runtime-ktx:2.3.0
    
    

    but adding overrideArtifactVersions.add("androidx.navigation:navigation-runtime:2.3.2") doesn't work at all.

    and I do get the same

    > Task :test:test_fixtures_ui:generateBazelScripts
    Deleted test/test_fixtures_ui/BUILD.bazel
    
    
    opened by sylwek845 1
  • Part 2: Per variant repositories

    Part 2: Per variant repositories

    Proposed Changes

    Continuing from #44 this change further implements generating multiple maven_installs in WORKSPACE by introducing new Variant<T> suite of classes.

    Variant is a new abstraction to represent both Android and Jvm variants and currently abstracts Configuration parsing and supports largely moving away from ConfigurationDataSource implementation earlier. The new Variant APIs currently answers the following questions:

    • What variants should we migrate in a given Gradle project? VariantBuilder helps to answer this information by returning set of Varaint<*>
    • From there, we currently use these instances to find configurations and dependencies.
      • Because of this we are able to ensure a particular version of dependency used by a Gradle variant matches in Bazel. For example, debugImplementation('com.x:y-debug) will map to debug_maven@//com_x with alias to y-debug.

    In a later stage, we can extend Variant<T> to further represent source set and other information needed for migration. Earlier non flavored migration assumption made #30 difficult, this new structure should largely simplify extending Grazel going forward by making it variant first. Eventually a single Gradle project instance will be migrated as follows. The new structure also makes it bit easier to write unit tests on each stage (added in this PR).

    graph LR
        A[Project] --> B[Variants]
        B-->C[Targets]
        C-->D[BUILD.bazel]
    

    Caveats

    WORKSPACE definitions currently are verbose, there is potential for improvement in MavenInstallArtifactsCalculator to reduce each classpath graph of a variant from a global default classpath i.e @maven//... [In progress]

    opened by arunkumar9t2 0
  • Sample Application Crashes at runtime

    Sample Application Crashes at runtime

    I'm trying to get the sample android application running happily. The only change I've made to the repo is updating build_tools_version to 30.0.3 from 30.0.2 in the WORKSPACE file.

    Running: android 8.1.0 Installing with: bazel mobile-install //sample-android:sample-android

    The app crashes almost immediately after starting. The stack trace I see immediately is:

    2022-08-22 14:10:30.834 31847-31847/com.grab.grazel.android.sample E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.grab.grazel.android.sample, PID: 31847
        java.lang.RuntimeException: Unable to start activity ComponentInfo{com.grab.grazel.android.sample/com.grab.grazel.android.sample.MainActivity}: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
            at android.app.ActivityThread.-wrap11(Unknown Source:0)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:164)
            at android.app.ActivityThread.main(ActivityThread.java:6494)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
         Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
         Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
         Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.newInstance0(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
            at android.view.LayoutInflater.createView(LayoutInflater.java:647)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
            at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699)
            at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
            at com.grab.grazel.android.sample.MainActivity.onCreate(MainActivity.kt:51)
            at android.app.Activity.performCreate(Activity.java:7036)
            at android.app.Activity.performCreate(Activity.java:7027)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
            at android.app.ActivityThread.-wrap11(Unknown Source:0)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:164)
            at android.app.ActivityThread.main(ActivityThread.java:6494)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
         Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/constraintlayout/widget/R$styleable;
            at androidx.constraintlayout.widget.ConstraintLayout.init(ConstraintLayout.java:590)
            at androidx.constraintlayout.widget.ConstraintLayout.<init>(ConstraintLayout.java:567)
            at java.lang.reflect.Constructor.newInstance0(Native Method) 
            at java.lang.reflect.Constructor.newInstance(Constructor.java:334) 
            at android.view.LayoutInflater.createView(LayoutInflater.java:647) 
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) 
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
            at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:699) 
            at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195) 
            at com.grab.grazel.android.sample.MainActivity.onCreate(MainActivity.kt:51) 
            at android.app.Activity.performCreate(Activity.java:7036) 
            at android.app.Activity.performCreate(Activity.java:7027) 
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
            at android.app.ActivityThread.-wrap11(Unknown Source:0) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
            at android.os.Handler.dispatchMessage(Handler.java:106) 
            at android.os.Looper.loop(Looper.java:164) 
            at android.app.ActivityThread.main(ActivityThread.java:6494) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
    2022-08-22 14:10:30.835 31847-31847/com.grab.grazel.android.sample E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.constraintlayout.widget.R$styleable" on path: DexPathList[[dex file "/data/local/tmp/incrementaldeployment/com.grab.grazel.android.sample/dex/incremental_classes5.dex", dex file "/data/local/tmp/incrementaldeployment/com.grab.grazel.android.sample/dex/incremental_classes3.dex", dex file "/data/local/tmp/incrementaldeployment/com.grab.grazel.android.sample/dex/incremental_classes4.dex", dex file "/data/local/tmp/incrementaldeployment/com.grab.grazel.android.sample/dex/incremental_classes1.dex", dex file "/data/local/tmp/incrementaldeployment/com.grab.grazel.android.sample/dex/incremental_classes2.dex"],nativeLibraryDirectories=[/data/user/0/com.grab.grazel.android.sample/lib, /system/lib, /vendor/lib]]
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
            at com.google.devtools.build.android.incrementaldeployment.IncrementalClassLoader$DelegateClassLoader.findClass(IncrementalClassLoader.java:57)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            	... 26 more
    

    I want to check to see if the sample app is working for others, and if it is, what could I be doing differently.

    bug 
    opened by BD-SAM 1
  • desugar_java8 failed on executing kapt dependencies

    desugar_java8 failed on executing kapt dependencies

    I got the following error when I ran bazelisk mobile-install:

    ERROR: /private/var/tmp/*/738fc54fee5051b993b283099c23f8de/external/maven/BUILD:9056:11: Desugaring external/maven/v1/https/repo1.maven.org/maven2/com/google/auto/auto-common/0.10/auto-common-0.10.jar for Android failed: (Exit 1): desugar_java8 failed: error executing command 
      (cd /private/var/tmp/*/738fc54fee5051b993b283099c23f8de/execroot/doc_android_client && \
      exec env - \
        PATH=/Users/*/Library/Caches/bazelisk/downloads/bazelbuild/bazel-5.1.1-darwin-x86_64/bin:/Users/*/.bytebm/bin:/Users/*/.rvm/gems/ruby-2.5.0/bin:/Users/*/.rvm/gems/ruby-2.5.0@global/bin:/Users/*/.rvm/rubies/ruby-2.5.0/bin:/Users/*/.nvm/versions/node/v12.21.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/puppetlabs/bin:/Library/Apple/usr/bin:/Users/*/.rvm/bin:/Users/*/library/android/sdk/tools/bin:/Users/*/library/android/sdk/platform-tools:/Users/*/Library/Android/sdk/tools:/Users/*/Tools/gradle-profiler/bin:/Users/*/bin:/Users/*/Tools:/Users/*/as.sh:/Users/*/.rvm/bin \
      bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/bazel_tools/tools/android/desugar_java8 @bazel-out/android-armeabi-v7a-fastbuild/bin/external/maven/_dx/com_google_auto_auto_common/auto-common-0.10.jar_desugared.jar-0.params)
    # Configuration: 3d1e1e8c918685c3805362c4c2aea87c66c0efef8a46a537f832c4b02b91eb91
    # Execution platform: @local_config_platform//:host
    java.lang.IllegalStateException: Couldn't desugar invokedynamic for com/google/auto/common/GeneratedAnnotationSpecs.apply using java/lang/invoke/LambdaMetafactory.metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; (6) with arguments [(Ljava/lang/Object;)Ljava/lang/Object;, com/squareup/javapoet/AnnotationSpec$Builder.build()Lcom/squareup/javapoet/AnnotationSpec; (5), (Lcom/squareup/javapoet/AnnotationSpec$Builder;)Lcom/squareup/javapoet/AnnotationSpec;]
    	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:474)
    	at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn(MethodVisitor.java:461)
    	at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn(MethodVisitor.java:461)
    	at com.google.devtools.build.android.desugar.strconcat.IndyStringConcatDesugaring$IndifiedStringConcatInvocationConverter.visitInvokeDynamicInsn(IndyStringConcatDesugaring.java:141)
    	at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn(MethodVisitor.java:461)
    	at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2444)
    	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1487)
    	at org.objectweb.asm.ClassReader.accept(ClassReader.java:717)
    	at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:542)
    	at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:319)
    	at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:239)
    	at com.google.devtools.build.android.desugar.Desugar.processRequest(Desugar.java:1012)
    	at com.google.devtools.build.android.desugar.Desugar.runPersistentWorker(Desugar.java:972)
    	at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:950)
    Caused by: java.lang.ClassNotFoundException: Class com.squareup.javapoet.AnnotationSpec$Builder not found
    	at com.google.devtools.build.android.desugar.io.HeaderClassLoader.findClass(HeaderClassLoader.java:53)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    	at com.google.devtools.build.android.desugar.LambdaDesugaring.loadFromInternal(LambdaDesugaring.java:337)
    	at com.google.devtools.build.android.desugar.LambdaDesugaring.access$500(LambdaDesugaring.java:56)
    	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.toMethodHandle(LambdaDesugaring.java:655)
    	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.toJvmMetatype(LambdaDesugaring.java:644)
    	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:408)
    	... 13 more
    Target //assemble/doc-sdk-demo:doc-sdk-demo failed to build
    

    I think desugar should only process runtime dependencies. Is anything wrong with my grazel configuration?

    grazel {
        android {
            ndkEnable = false
        }
        rules {
            bazelCommon {
                gitRepository {
                    commit = "3568b6190f4f805d2c18af243e79b506dd99bfce"
                    remote = "https://github.com/grab/grab-bazel-common.git"
                }
            }
            mavenInstall {
                httpArchiveRepository {
                    sha256 = "f36441aa876c4f6427bfb2d1f2d723b48e9d930b62662bf723ddfb8fc80f0140"
                    stripPrefix = "rules_jvm_external-4.1"
                    url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.1.zip"
                }
                resolveTimeout = 5400
                artifactPinning {
                    enabled.set(true)
                }
                versionConflictPolicy = "pinned"
            }
            kotlin {
                gitRepository {
                    commit = "eae21653baad4b403fee9e8a706c9d4fbd0c27c6"
                    remote = "https://github.com/bazelbuild/rules_kotlin.git"
                }
                compiler {
                    version = "1.4.20"
                    sha = "46720991a716e90bfc0cf3f2c81b2bd735c14f4ea6a5064c488e04fd76e6b6c7"
                }
                kotlinC {
                    useIr = false
                }
                toolchain {
                    enabled = true
                    apiVersion = "1.4"
                    reportUnusedDeps = "off"
                    strictKotlinDeps = "off"
                    abiJars = true
                    multiplexWorkers = true
                    languageVersion = "1.4"
                    jvmTarget = "1.8"
                }
            }
        }
    }
    

    Look forward to your kind reply.

    opened by jeraldsun 0
  • NoSuchMethodError for getSigningConfig() when running migrateToBazel

    NoSuchMethodError for getSigningConfig() when running migrateToBazel

    Got the following exception when running ./gradlew migrateToBazel against a multi-module Android project:

    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:generateBazelScripts'.
    > 'com.android.builder.model.SigningConfig com.android.builder.model.BuildType.getSigningConfig()'
    
    * Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:generateBazelScripts'.
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:188)
            at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:186)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:174)
            at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
            at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
            at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
            at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
            at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
            at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:79)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
            at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:402)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:389)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:382)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:368)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
            at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
            at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
            at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
    Caused by: java.lang.NoSuchMethodError: 'com.android.builder.model.SigningConfig com.android.builder.model.BuildType.getSigningConfig()'
            at com.grab.grazel.migrate.android.DefaultKeyStoreExtractor.extract(KeyStoreExtractor.kt:48)
            at com.grab.grazel.migrate.android.DefaultAndroidBinaryDataExtractor.extract(AndroidBinaryDataExtractor.kt:77)
            at com.grab.grazel.migrate.builder.AndroidBinaryTargetBuilder.buildAndroidBinaryTargets(AndroidBinaryTargetBuilder.kt:81)
            at com.grab.grazel.migrate.builder.AndroidBinaryTargetBuilder.build(AndroidBinaryTargetBuilder.kt:65)
            at com.grab.grazel.migrate.internal.ProjectBazelFileBuilder.build(ProjectBazelFileBuilder.kt:39)
            at com.grab.grazel.tasks.internal.GenerateBazelScriptsTask.action(GenerateBazelScriptsTask.kt:60)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:502)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:74)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:74)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:487)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:470)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:106)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:271)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:249)
            at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:89)
            at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:40)
            at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:53)
            at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:50)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:79)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
            at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:50)
            at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:40)
            at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:68)
            at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:38)
            at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:50)
            at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:36)
            at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
            at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
            at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
            at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
            at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:29)
            at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:58)
            at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:39)
            at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:60)
            at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:27)
            at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:180)
            at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:75)
            at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:46)
            at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:40)
            at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:29)
            at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
            at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:105)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:98)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:53)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:37)
            at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:85)
            at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:42)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
            at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:92)
            at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:50)
            at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:114)
            at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:57)
            at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:73)
            at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:92)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:92)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:33)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
            at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43)
            at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.withWorkspace(ExecuteActionsTaskExecuter.java:284)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
            at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
            at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
            at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:44)
            at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:33)
            at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:185)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:174)
            at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
            at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
            at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
            at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
            at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
            at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:79)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:79)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
            at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:402)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:389)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:382)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:368)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
            at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
            at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
            at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
    
    opened by as6o 3
Releases(0.4.0)
  • 0.4.0(Nov 1, 2022)

    Full Changelog: https://github.com/grab/Grazel/compare/0.3.2...0.4.0

    What's Changed

    • Fix Workflow error by @rifqimfahmi in https://github.com/grab/Grazel/pull/13
    • Use rules_kotlin >= 1.5.0 format changes by @minkuan88 in https://github.com/grab/Grazel/pull/14
    • Ignore google-java-format plugin metadata from git by @arunkumar9t2 in https://github.com/grab/Grazel/pull/15
    • Add editor config and format all related files by @arunkumar9t2 in https://github.com/grab/Grazel/pull/16
    • Refactor tag generation for transitive classpath reduction by @arunkumar9t2 in https://github.com/grab/Grazel/pull/17
    • Add rules for grab_bazel_common toolchain by @minkuan88 in https://github.com/grab/Grazel/pull/20
    • Fix buildifier formatting failure on CI by @arunkumar9t2 in https://github.com/grab/Grazel/pull/21
    • Add a task to generate databinding metadata in bazelrc compatible format by @arunkumar9t2 in https://github.com/grab/Grazel/pull/24
    • Add support to version_conflict_policy for maven_install by @minkuan88 in https://github.com/grab/Grazel/pull/26
    • Add support to detect source set dirs for tests by @minkuan88 in https://github.com/grab/Grazel/pull/27
    • Flavors support by @mohamadk in https://github.com/grab/Grazel/pull/30
    • Add flavor and build types fallback logic by @mohamadk in https://github.com/grab/Grazel/pull/31
    • add kotlin_extension configurations by @mohamadk in https://github.com/grab/Grazel/pull/33
    • Change test targets names by @mohamadk in https://github.com/grab/Grazel/pull/34
    • Bump bazel dependencies to support bazel 6.0.0-pre.20220818.1 by @minkuan88 in https://github.com/grab/Grazel/pull/36
    • Migrate dependency versions into dependency catalog by @minkuan88 in https://github.com/grab/Grazel/pull/28
    • Add android instrumentation test migration by @minkuan88 in https://github.com/grab/Grazel/pull/37
    • Update rules jvm external by @arunkumar9t2 in https://github.com/grab/Grazel/pull/38
    • Update bazel common android tools refactor by @minkuan88 in https://github.com/grab/Grazel/pull/35
    • Refactor CI by @arunkumar9t2 in https://github.com/grab/Grazel/pull/23
    • Update Copyright headers by @arunkumar9t2 in https://github.com/grab/Grazel/pull/40
    • Bump version to 0.4.0 by @minkuan88 in https://github.com/grab/Grazel/pull/41

    New Contributors

    • @rifqimfahmi made their first contribution in https://github.com/grab/Grazel/pull/13
    • @mohamadk made their first contribution in https://github.com/grab/Grazel/pull/30

    Full Changelog: https://github.com/grab/Grazel/compare/0.3.2...0.4.0

    Source code(tar.gz)
    Source code(zip)
  • 0.3.2(Apr 27, 2022)

    Issues Fixed

    • Partial support for dynamic features: Grazel will generate android_binary rule for modules applying dynamic features plugin.
    • Fixed case where pure Kotlin/Java module with android jar dependency in Gradle did not have android dependency generated in Bazel.

    Full Changelog: https://github.com/grab/Grazel/compare/0.3.1...0.3.2

    Source code(tar.gz)
    Source code(zip)
  • 0.3.1(Apr 27, 2022)

    Issues fixed

    • Fix case where grab_kt_jvm_test was generated instead of grab_android_local_test even though module had android jar in its classpath.

    Full Changelog: https://github.com/grab/Grazel/compare/0.3.0...0.3.1

    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Apr 27, 2022)

    Grazel now supports rules_jvm_external's artifact pinning and ability to generate override targets in WORKSPACE's maven_install rule.

    Docs:

    • https://grab.github.io/Grazel/grazel_extension/#override-targets
    • https://grab.github.io/Grazel/grazel_extension/#artifact-pinning

    Changes

    • Maven artifact pinning and override targets by @arunkumar9t2 in https://github.com/grab/Grazel/pull/10

    Full Changelog: https://github.com/grab/Grazel/compare/0.2.0...0.3.0

    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Jan 12, 2022)

    Changelog

    Features

    • Grazel now automatically infers dependency exclude rules declared in Gradle and maps it to rules_jvm_external equivalent. For example,

      implementation("androidx.constraintlayout:constraintlayout:2.1.1") {
          exclude group: "androidx.appcompat", module: "appcompat"
      }
      

      will generate the following in WORKSPACE file

      maven_install(
        artifacts = [
            ...
            maven.artifact(
                group = "androidx.constraintlayout",
                artifact = "constraintlayout",
                version = "2.1.1",
                exclusions = [
                    "androidx.appcompat:appcompat",
                ],
            ),
      )
      
    • Grazel can generate unit test rules from bazel-common. Only Kotlin is supported at the moment. Please read readme for more details. For example,

      load("@grab_bazel_common//tools/test:test.bzl", "grab_kt_jvm_test")
      
      grab_kt_jvm_test(
        name = "sample-kotlin-lib-test",
        srcs = glob([
            "src/test/java/**/*.kt",
        ]),
        associates = [
            "//sample-kotlin-lib",
        ],
        visibility = [
            "//visibility:public",
        ],
        deps = [
            "@maven//:junit_junit",
        ],
      )
      

      For android local unit tests, grab_android_local_test will be generated that ports AGP's returnDefaultValues feature to Bazel.

      load("@grab_bazel_common//tools/test:test.bzl", "grab_android_local_test")
      
      grab_android_local_test(
        name = "grab_android_local_test",
        srcs = glob([
            "src/test/java/**/*.kt",
        ]),
        associates = [
            ":grab_android_local_test_lib_kt",
        ],
        deps = [
            "@maven//:junit_junit",
        ],
      )
      

      Both of the macros assumes the test files are in Kotlin, ends with *Test and file name matches the class name. Robolectric is currently not supported.

      Unit test generation is controlled by grazel.rules.test.enableTestMigration flag.

    Contributors

    • Gradle 7.1.1 compatibility, thanks @msfjarvis.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Jul 28, 2021)

    Grazel

    Grazel stands for Gradle to Bazel. It is a Gradle plugin that enables you to migrate Android projects to Bazel build system in an incremental and automated fashion.

    Usage

    Grazel is available on Maven central.

    In root build.gradle file:

    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath "com.grab.grazel:grazel-gradle-plugin:0.1.0"
        }
    }
    apply plugin: "com.grab.grazel"
    
    // Grazel configuration
    grazel {
        // DSL
    }
    

    See configuration for more details.

    Run ./gradlew migrateToBazel to generate Bazel scripts on supported modules in the project.

    Reading

    Talks

    • Grab's migration journey from Gradle to Bazel - Build Meetup 2021. Watch here.
    Source code(tar.gz)
    Source code(zip)
Owner
Grab
Driving South-east Asia forward!
Grab
Gradle plugin to ease Kotlin IR plugin development and usage in multimodule gradle projects

Gradle plugin to ease Kotlin IR plugin development and usage in multimodule gradle projects. Former: kotlin-ir-plugin-adapter-gradle

null 2 Mar 8, 2022
Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes

Gradle Plugin to automatically upgrade your gradle project dependencies and send a GitHub pull request with the changes

Dipien 142 Dec 29, 2022
Gradle Plugin that allows you to decompile bytecode compiled with Jetpack Compose Compiler Plugin into Java and check it

decomposer Gradle Plugin that allows you to decompile bytecode compiled with Jetpack Compose Compiler Plugin into Java and check it How to use Run bui

Takahiro Menju 56 Nov 18, 2022
A Gradle Plugin to determine which modules were affected by a set of files in a commit.

A Gradle Plugin to determine which modules were affected by a set of files in a commit. One use case for this plugin is for developers who would like to only run tests in modules which have changed in a given commit.

Dropbox 491 Dec 23, 2022
A Gradle plugin helps to proxy all the BuildConfig fields in the Android project.

Readme A Gradle plugin helps to proxy all the BuildConfig fields in the Android project. Background In android BuildConfig, We might have different co

Jack Chen 4 Oct 11, 2021
Gradle plugin for updating a project version catalog

Version catalog update plugin This plugin helps to keep the versions in a Gradle version catalog toml file up to date. The version updates are determi

Little Robots 307 Dec 26, 2022
Gradle plugin for adds support for integrating Carthage dependencies into a KMM project

Gradle plugin for adds support for integrating Carthage dependencies into a KMM project

Wire Swiss GmbH 34 Sep 27, 2022
Kmp4free - A Gradle Plugin that allows seamless switching between Kotlin JVM and the Kotlin Multiplatform Plugins

?? kmp4free Allows you to toggle between Kotlin JVM Plugin -> Kotlin Multiplatform with a Gradle Property kmp4free=true. This Gradle Plugin was built

Sam Edwards 61 Oct 14, 2022
Gradle Plugin to enable auto-completion and symbol resolution for all Kotlin/Native platforms.

CompleteKotlin Gradle Plugin to enable auto-completion and symbol resolution for all Kotlin/Native platforms. What this plugin provides This zero-conf

Louis CAD 235 Jan 3, 2023
Gradle plugin that generates a Swift Package Manager manifest and an XCFramework to distribute a Kotlin Multiplatform library for Apple platforms.

Multiplatform Swift Package This is a Gradle plugin for Kotlin Multiplatform projects that generates an XCFramework for your native Apple targets and

Georg Dresler 262 Jan 5, 2023
A Gradle plugin to ease testing in Kotlin Multiplatform projects.

Multiplatform Testing Plugin A Gradle plugin for easy testing of Kotlin Multiplatform projects in your CI pipeline. Support for testing android() targ

DeepMedia 6 Oct 19, 2022
Klinker is a gradle plugin making it possible to link kotlin native executables with custom linkers and options.

Klinker is a gradle plugin making it possible to link kotlin native executables with custom linkers and options. It does this by creating a static library for kotlin compilation, then generates a c+kotlin wrapper that calls into kotlin to start the app, finally using the specified compiler to compile and link the c code and kotlin library into a binary.

Jason Monk 4 Apr 14, 2022
Gradle Plugin that determines if modules are Kotlin Multiplatform (KMP) ready.

Gradle Plugin that determines if modules are Kotlin Multiplatform (KMP) ready. KMP Ready means that the code is Kotlin Multiplatform compatible.

Sam Edwards 58 Dec 22, 2022
KMP Ready is a Gradle Plugin that provides actionable advice to make your code Kotlin Multiplatform compatible.

KMP Ready IS ?? UNDER DEVELOPMENT ?? Decisioning Logic Positive Signals ✅ Only Kotlin .kt Source Files Using Kotlin JVM Plugin Uses the Kotlin Multipl

Sam Edwards 58 Dec 22, 2022
Basic Kotlin project with a Gradle script written in Kotlin.

Mars Rover Problem Basic Kotlin project with a Gradle script written in Kotlin. Definition A squad of robotic rovers are to be landed by NASA on a pla

Erdem Aydın 0 Nov 28, 2021
A Gradle plugin that improves the experience when developing Android apps, especially system tools, that use hidden APIs.

A Gradle plugin that improves the experience when developing Android apps, especially system tools, that use hidden APIs.

Rikka apps 124 Dec 31, 2022
Android Gradle Plugin -- Auto Check big image and compress image in building.

McImage I will continue to update, please rest assured to use 中文文档 Android优雅的打包时自动化获取全部res资源 McImage is a Non-invasive plugin for compress all res in

smallSohoSolo 1.1k Dec 28, 2022
Gradle plugin for running Android tests with emulator.wtf

emulator.wtf Gradle Plugin Emulator.wtf is an Android cloud emulator laser-focused on performance to deliver quick feedback to your PRs. With this Gra

emulator.wtf 3 May 15, 2022
A Gradle Plugin for Android BundleTool.

A Gradle Plugin for Android BundleTool.

El 38 Jan 6, 2023