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

Generate externalRefs with PURL #150

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Generate externalRefs with PURL #150

merged 2 commits into from
Jan 19, 2024

Conversation

rogelio-o
Copy link
Contributor

Type of change

  • Added new project
  • Bug fix
  • New features
  • Enhanced documentation

Changes proposed in this pull request

Description

  • Maintain code format
  • Unit test

@@ -478,9 +478,16 @@ public class CreateSpdxMojo extends AbstractMojo
* If true, use ${project.groupId}:${artifactId} as the SPDX package name.
* Otherwise, ${project.name} will be used
*/
@Parameter
@Parameter( property = "spdx.useArtifactID" )
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've included the property here so the parameter can work running the goal via CLI.

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>org.spdx</groupId>
<artifactId>spdx maven plugin test</artifactId>
<artifactId>spdx-maven-plugin-test</artifactId>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the test, a PURL cannot be created with whitespaces. I've changed whitespaces to dashes.

Copy link
Member

Choose a reason for hiding this comment

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

are spaces allowed in artifact IDs? I noticed the naming guidelines suggest "no strange symbols", but nothing specific about spaces.

If spaces are allowed, do we need to change the PURL generator to escape the spaces (e.g. %20)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks to you for the quick review!

Good point here. I've URL encoded the artifactId, which replaces the whitespaces with +. This will also encode any other symbol not valid in a PURL.

Copy link
Member

@goneall goneall left a comment

Choose a reason for hiding this comment

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

One question and one suggested change.

Thanks @rogelio-o for pulling this together!

* If true, adds an external reference to every package with category "PACKAGE-MANAGER", type "purl"
* and locator "pkg:maven/${project.groupId}/${project.artifactId}@${project.version}".
*/
@Parameter( property = "spdx.generatePurls" )
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking we default this to true - it really is something useful and a recommended practice for SPDX document generation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, it can be very handy. Set default value to true in ae2294f.

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>org.spdx</groupId>
<artifactId>spdx maven plugin test</artifactId>
<artifactId>spdx-maven-plugin-test</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

are spaces allowed in artifact IDs? I noticed the naming guidelines suggest "no strange symbols", but nothing specific about spaces.

If spaces are allowed, do we need to change the PURL generator to escape the spaces (e.g. %20)?

Copy link
Member

@goneall goneall left a comment

Choose a reason for hiding this comment

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

LGTM - I did check to see if we needed to URLEncode the group ID, but based on the naming conventions, it should already be URL safe.

Thanks @rogelio-o for implementing this.

@goneall
Copy link
Member

goneall commented Jan 19, 2024

@rogelio-o - It looks like the recent merge of your other pull request caused a merge conflict - if you could resolve, I'll go ahead and merge.

@rogelio-o
Copy link
Contributor Author

rogelio-o commented Jan 19, 2024

Thanks @rogelio-o for implementing this.

Thanks to you for your quick feedback!

It looks like the recent merge of your other pull request caused a merge conflict - if you could resolve, I'll go ahead and merge.

@goneall done!

@goneall
Copy link
Member

goneall commented Jan 19, 2024

@nishakm - you may be interested in this PR

@goneall goneall merged commit ca7a58b into spdx:master Jan 19, 2024
1 check passed
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.

2 participants