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 publishing setup #206

Merged
merged 1 commit into from
Jan 5, 2021
Merged

Conversation

yigit
Copy link
Collaborator

@yigit yigit commented 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: #203

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
@yigit
Copy link
Collaborator Author

yigit commented Dec 22, 2020

FYI i didn't update the README since it is a breaking change. We should remember to update it before shipping a version with this :)

@yigit yigit requested a review from ting-yuan December 22, 2020 06:19
Copy link
Collaborator

@ting-yuan ting-yuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will merge before next release.

@ting-yuan ting-yuan merged commit 8bf72db into google:master Jan 5, 2021
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.

[Gradle Plugin] Publish plugin marker
2 participants