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

Add build.gradle to support Gradle Plugin Portal publishing. #36

Merged
merged 2 commits into from
Nov 20, 2019

Conversation

llamahunter
Copy link
Contributor

@llamahunter llamahunter commented Nov 18, 2019

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.

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.
@llamahunter
Copy link
Contributor Author

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
*~
Copy link
Contributor Author

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/
Copy link
Contributor Author

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/
Copy link
Contributor Author

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'
Copy link
Contributor Author

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'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the gradle plugin helper

Comment on lines +1 to +5
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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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'
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@llamahunter
Copy link
Contributor Author

@stevespringett unsure how to assign you as a reviewer, but wanted to make sure you saw this.

Copy link
Member

@stevespringett stevespringett left a 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.

@lock
Copy link

lock bot commented Dec 20, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants