Skip to content

Allow specifying Gradle plugins from project.xml.#1999

Merged
player-03 merged 1 commit intoopenfl:8.4.0-devfrom
player-03:config_gradle_plugins
Mar 31, 2026
Merged

Allow specifying Gradle plugins from project.xml.#1999
player-03 merged 1 commit intoopenfl:8.4.0-devfrom
player-03:config_gradle_plugins

Conversation

@player-03
Copy link
Copy Markdown
Contributor

This allows including published plugins or custom user-created ones. Since plugins can make arbitrary changes to the build script, this allows multiple extensions to add to app/build.gradle without overwriting each other's changes.

https://docs.gradle.org/current/userguide/plugins.html
https://docs.gradle.org/current/userguide/sharing_build_logic_between_subprojects.html

Sample usage: <config:android gradle-apply-plugin="com.google.gms.google-services" />

From a quick search, there seem to be two ways to include a plugin. apply plugin is the more backwards-compatible option, so I went with that. However, plugin { } could be more future-proof. Maybe at some point we'll switch.

My main concern for now is, is "gradle-apply-plugin" distinctive enough from "gradle-plugin"? Or would another name be clearer?

@IriySoft
Copy link
Copy Markdown

This allows including published plugins or custom user-created ones. Since plugins can make arbitrary changes to the build script, this allows multiple extensions to add to app/build.gradle without overwriting each other's changes.

https://docs.gradle.org/current/userguide/plugins.html https://docs.gradle.org/current/userguide/sharing_build_logic_between_subprojects.html

Sample usage: <config:android gradle-apply-plugin="com.google.gms.google-services" />

There should be a classpath dependency added in the build.gradle too, otherwise Gradle won't be able to apply the plugin with "Plugin with id 'com.google.gms.google-services' not found." exception. That in turn requires adding the repositories paths to the app-level build.gradle (these are currently not present there). Something like this:

import groovy.swing.SwingBuilder
import java.awt.GridBagLayout
import java.awt.GridBagConstraints
import javax.swing.border.EmptyBorder

buildscript {
  repositories {
    google()
    mavenCentral()
  }

  dependencies {
    classpath 'com.google.gms:google-services:4.4.4'
  }
}

apply plugin: 'com.android.application'

. . .

@player-03
Copy link
Copy Markdown
Contributor Author

That's a lot of changes, and I'd rather keep the config options simple. Can't you create your own plugin to do all that?

https://docs.gradle.org/current/userguide/sharing_build_logic_between_subprojects.html

@IriySoft
Copy link
Copy Markdown

That's a lot of changes, and I'd rather keep the config options simple. Can't you create your own plugin to do all that?

https://docs.gradle.org/current/userguide/sharing_build_logic_between_subprojects.html

I can try this indeed, thanks!

@player-03 player-03 merged commit ec6d491 into openfl:8.4.0-dev Mar 31, 2026
31 checks passed
@player-03 player-03 deleted the config_gradle_plugins branch March 31, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants