Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.13k stars 341 forks source link

Make PlayPublisherPlugin Class public #1061

Closed dgmartin closed 2 years ago

dgmartin commented 2 years ago

The Scenario:

I'm working on an internal plugin that among other things manually adds multiple plugins to a single project and configures them without the need for any extra code in the build.gradle script. This internal plugin is then applied to multiple internal projects reducing the need for duplicate build code. I'm trying to add the Gradle Publisher Plugin via the PluginManager as follows:

val childProject = project.childProjects[extension.module.get()]?.let { childProject ->  // gets the child project/module by name
  childProject.pluginManager.apply(PlayPublisherPlugin::class.java)
  // Create, edit, and apply extension data here ...
}

The Problem:

It seems the PlayPublisherPlugin class has been marked as "internal" (see below). This makes it impossible to reference outside of the project. The code above will fail because it cannot even see PlayPublisherPlugin as available. https://github.com/Triple-T/gradle-play-publisher/blob/22a13750ce46c2d0a250a28fa4cd0b8d586f7cce/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/PlayPublisherPlugin.kt#L65

The Solution:

While I understand the need to lock down internal code from being altered I would argue that this Class is meant to be public facing. If you look at other industry leaders you can see that their "Plugin" class extensions are not set to private or internal:

The request here is to set the PlayPublisherPlugin class from "internal" to "public" in order to allow for access by an external source. Any critical code should be moved to a separate internal class if deemed necessary but I believe the Plugin extension should be public to allow for manual usage as described above.

If you disagree I'd love to better understand your reasoning as a different solution may arise.

SUPERCILEX commented 2 years ago

That's intentional, use the plugin id (com.github.triplet.play) to apply it.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.