-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add build.gradle to support Gradle Plugin Portal publishing. #36
Conversation
A simple build.gradle that support building the plugin with the gradle plugin helper (performing extra validation checks), and publishing to the Gradle Plugin Portal (GPP), as well as local maven for testing. Needs manual maintenance of the 'version' field to keep it in sync with the master pom.xml file. GPP publishing requires an account on the plugins.gradle.org website.
See the README-GradlePluginPortal.md for use of the build.gradle for doing publishing to the GPP. Note that it requires setting up an account on plugins.gradle.com to get API keys. I did a test publish using the 'name.richardlee.cyclonedx.bom' id, so hopefully you won't have any ownership collision problems when eventually publishing it to the correct 'org.cyclonedx.bom' id. If there are ownership issues of some sort, there's a process to sort that out at https://github.com/gradle/plugin-portal-requests |
@@ -1,3 +1,6 @@ | |||
/target/ | |||
/.idea/ | |||
/*.iml | |||
*~ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use emacs. These file kept getting flagged as changes by git
@@ -1,3 +1,6 @@ | |||
/target/ | |||
/.idea/ | |||
/*.iml | |||
*~ | |||
/build/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gradle build is output to /build directory, rather than maven's /target
@@ -1,3 +1,6 @@ | |||
/target/ | |||
/.idea/ | |||
/*.iml | |||
*~ | |||
/build/ | |||
/.gradle/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gradle maintains some sort of local cache for the project
plugins { | ||
id 'java-gradle-plugin' | ||
id 'com.gradle.plugin-publish' version '0.10.1' | ||
id 'maven-publish' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 'maven-publish' is just for doing publishToMavenLocal for testing.
@@ -0,0 +1,47 @@ | |||
|
|||
plugins { | |||
id 'java-gradle-plugin' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the gradle plugin helper
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gradle wrapper configuration
@@ -0,0 +1,188 @@ | |||
#!/usr/bin/env sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this whole thing is gradle wrapper boilerplate
@@ -0,0 +1,100 @@ | |||
@rem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also all gradle wrapper boilerplate (for windoze)
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
rootProject.name = 'cyclonedx-gradle-plugin' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, gradle will use the directory name as the project name. Sometimes this causes weird things to happen if people map the directory name to something custom. This sets the project name explicitly to avoid such problems.
@@ -76,6 +77,7 @@ | |||
private boolean skip; | |||
private final List<String> skipConfigs = new ArrayList<>(); | |||
|
|||
@Input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gradle plugin helper did not like that this field did not declare it was an input for the plugin. There are other fields that could be also specified as inputs (i.e. buildDir), but they need getters to be treated as such.
@stevespringett unsure how to assign you as a reviewer, but wanted to make sure you saw this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and for all of the explanations. Very much appreciated.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
A simple build.gradle that supports building the plugin with the gradle
plugin helper (performing extra validation checks), and publishing to
the Gradle Plugin Portal (GPP), as well as local maven for testing.
Needs manual maintenance of the 'version' field to keep it in sync with
the master pom.xml file. GPP publishing requires an account on the
plugins.gradle.org website.