How to apply a local plugin to Android's build.gradle?

There’s this gradle plugin from Mozilla: GitHub - mozilla/rust-android-gradle

I want to download it, unzip and apply to my Android’s build.gradle. So no getting it from the internet.

I found build.gradle - Applying Gradle plugin from local file - Stack Overflow but it talks about buildSrc firectory and I don’t know where it is.

I also found some answers on java - Adding local plugin to a Gradle project - Stack Overflow but one requires a local maven repo (too much for something simple) and the other requires a custom command passed like gradlew assembleDebug --include-build which would break some things.

How do I simply point to the plugin folder on my build.gradle?

So, how to apply a local plugin?

Even if you don’t want to download the binary directly from the Internet, the binary is still what you need to apply to the project. The question is just how you’re going to build that binary.

You have to create the buildSrc directory. It’s just a directory in the root directory of your project that is built first and automatically added to the classpath of the rest of the build (like a plugin needs to be). You would need to do some modification of what you downloaded as it’s really the plugin directory that would need to be buildSrc, with some of the build.gradle files combined.

If you also don’t want the dependencies of the rust-android-gradle plugin to be downloaded from the Internet, you already have a non-simple scenario. However, you can just put the plugin JAR and dependencies in a directory and reference them the way that is shown for the publisher, not the consumer, without needing a “Maven repo”, but that’s just the JARs and some XML metadata in the correct folder structure.

This is a composite build. This is the most automatic way to take the plugin build and to combine it with the project build that uses it. What specifically do you expect to break?

You don’t really have a local plugin. You can simply apply a plugin that’s truly local and contained in the build scripts (script plugin), but you really have a standalone plugin that’s not designed to be consumed in this way. You can absolutely still make it work, but you lose the simple options because you need to do more work to fight that design.

all of that seems pretty complicated. How people develop plugins in the first place?

I’d like to make a PR to this plugin, why isn’t it simply a matter of pointing to a folder with the plugin locally? How do people develop and test these plugins?

ps: why I wouldn’t want the dependencies of this plugin to be downloaded from the internet? it looks they are just

    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

which are already downloaded for my android project

thanks my issue has been fixed.