Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gradle Plugin] Publish plugin marker #203

Closed
yigit opened this issue Dec 21, 2020 · 0 comments · Fixed by #206
Closed

[Gradle Plugin] Publish plugin marker #203

yigit opened this issue Dec 21, 2020 · 0 comments · Fixed by #206
Labels
P1 major features or blocking bugs
Milestone

Comments

@yigit
Copy link
Collaborator

yigit commented Dec 21, 2020

Right now, we don't publish a plugin marker so developers need to update their settings file to specify the artifact.

This also makes it harder to use composite builds for testing the gradle plugin itself. (or I couldn't figure it out :) )

We should probably change the plugin to be an artifact by itself (instead of being embedded into the compiler plugin) and then also publish the marker artifact to avoid the need to change the settings.gradle.kts file.

I briefly tried this but java-gradle-plugin seems to have some classpath conflicts. Need further investigation.

yigit added a commit to yigit/ksp that referenced this issue Dec 22, 2020
This CL updates the build to properly publish the gradle
plugin with an id to avoid the need to modify settings
gradle.

After this change, we'll have the following 4 artifacts:

symbol-processing-api: same as before
symbol-processing: does not include the the gradle-plugin anymore
symbol-processing-gradle-plugin: the gradle plugin
com.google.devtools.ksp.gradle.plugin: gradle plugin marker artifact

After this change, developer can enable KSP by:

id("com.google.devtools.ksp")
* Still needs to have google as a plugin repository.

The gradle plugin publishing model requires publishing a marker artifact
so that Gradle can find the main plugin artifact.
I've added `java-gradle-plugin` plugin to the gradle-plugin module to
enable publishing. Unfortunately, it does have a validation step which
fails while traversing kotlin classes in the classpath so I had to
disable it. We can enable it once gradle depends on kotlin 1.4.

As part of this, I've removed the gradle plugin from the
symbol-processing artifact. Instead, it is now published as
symbol-processing-gradle-plugin artifact (it is consistent with the
project's and androidx's naming scheme but open to changes).

For plugin id, I couldn't use symbol-processing because that would
require us to publish an artifact with symbol-processing group.
Instead, I've picked `com.google.devtools.ksp` which seems close to what
AGP does (com.android.application). This way, we can publish the marker
artifact in the KSP group.

I've made a couple more changes:
* Updated gradle to 6.6.1, which is the version kotlin uses
* Moved publishing setup to the main gradle file to configure common
things (e.g. scm)
* Moved the Jar manifest configuration to the main build file so that
all artifacts have it (was also a necessary change after unbundling the
gradle plugin since it uses that information to find the version).
Had to remove `Implementation-Title` as archiveBaseName is depreacted an
will be removed in 7.
* Added an `outRepo` command line argument to set the repository
location for publication. It is handy when testing with a local build.

Fixes: google#203
yigit added a commit to yigit/ksp that referenced this issue Dec 22, 2020
This CL updates the build to properly publish the gradle
plugin with an id to avoid the need to modify settings
gradle.

After this change, we'll have the following 4 artifacts:

symbol-processing-api: same as before
symbol-processing: does not include the the gradle-plugin anymore
symbol-processing-gradle-plugin: the gradle plugin
com.google.devtools.ksp.gradle.plugin: gradle plugin marker artifact

After this change, developer can enable KSP by:

id("com.google.devtools.ksp")
* Still needs to have google as a plugin repository.

The gradle plugin publishing model requires publishing a marker artifact
so that Gradle can find the main plugin artifact.
I've added `java-gradle-plugin` plugin to the gradle-plugin module to
enable publishing. Unfortunately, it does have a validation step which
fails while traversing kotlin classes in the classpath so I had to
disable it. We can enable it once gradle depends on kotlin 1.4.

As part of this, I've removed the gradle plugin from the
symbol-processing artifact. Instead, it is now published as
symbol-processing-gradle-plugin artifact (it is consistent with the
project's and androidx's naming scheme but open to changes).

For plugin id, I couldn't use symbol-processing because that would
require us to publish an artifact with symbol-processing group.
Instead, I've picked `com.google.devtools.ksp` which seems close to what
AGP does (com.android.application). This way, we can publish the marker
artifact in the KSP group.

I've made a couple more changes:
* Updated gradle to 6.6.1, which is the version kotlin uses
* Moved publishing setup to the main gradle file to configure common
things (pom, version etc)
* Moved the Jar manifest configuration to the main build file so that
all artifacts have it (was also a necessary change after unbundling the
gradle plugin since it uses that information to find the version).
Had to remove `Implementation-Title` as archiveBaseName is depreacted an
will be removed in 7.
* Added an `outRepo` command line argument to set the repository
location for publication. It is handy when testing with a local build.

Fixes: google#203
@ting-yuan ting-yuan added the P1 major features or blocking bugs label Dec 31, 2020
@ting-yuan ting-yuan modified the milestones: 2021Q1, alpha Dec 31, 2020
ting-yuan pushed a commit that referenced this issue Jan 5, 2021
This CL updates the build to properly publish the gradle
plugin with an id to avoid the need to modify settings
gradle.

After this change, we'll have the following 4 artifacts:

symbol-processing-api: same as before
symbol-processing: does not include the the gradle-plugin anymore
symbol-processing-gradle-plugin: the gradle plugin
com.google.devtools.ksp.gradle.plugin: gradle plugin marker artifact

After this change, developer can enable KSP by:

id("com.google.devtools.ksp")
* Still needs to have google as a plugin repository.

The gradle plugin publishing model requires publishing a marker artifact
so that Gradle can find the main plugin artifact.
I've added `java-gradle-plugin` plugin to the gradle-plugin module to
enable publishing. Unfortunately, it does have a validation step which
fails while traversing kotlin classes in the classpath so I had to
disable it. We can enable it once gradle depends on kotlin 1.4.

As part of this, I've removed the gradle plugin from the
symbol-processing artifact. Instead, it is now published as
symbol-processing-gradle-plugin artifact (it is consistent with the
project's and androidx's naming scheme but open to changes).

For plugin id, I couldn't use symbol-processing because that would
require us to publish an artifact with symbol-processing group.
Instead, I've picked `com.google.devtools.ksp` which seems close to what
AGP does (com.android.application). This way, we can publish the marker
artifact in the KSP group.

I've made a couple more changes:
* Updated gradle to 6.6.1, which is the version kotlin uses
* Moved publishing setup to the main gradle file to configure common
things (pom, version etc)
* Moved the Jar manifest configuration to the main build file so that
all artifacts have it (was also a necessary change after unbundling the
gradle plugin since it uses that information to find the version).
Had to remove `Implementation-Title` as archiveBaseName is depreacted an
will be removed in 7.
* Added an `outRepo` command line argument to set the repository
location for publication. It is handy when testing with a local build.

Fixes: #203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 major features or blocking bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants