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

CLM-18313 Builds the artifact ID for InnerSource dependency manually #73

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

guillermo-varela
Copy link
Contributor

@guillermo-varela guillermo-varela commented Apr 22, 2021

A Nexus IQ customer is having troubles having InnerSource working properly. After analyzing the files shared by the customer we see the "artifact ID" has a colon (:) in the version fragment for SNAPSHOT dependencies.

By manually building this ID the idea is to avoid any extra characters that a might be introduce in the display name of a component identifier by Gradle.

cc @bhamail / @DarthHater / @guillermo-varela / @shaikhu

@guillermo-varela guillermo-varela marked this pull request as ready for review April 22, 2021 18:30
Comment on lines +87 to +93
ModuleVersionIdentifier artifactId = resolvedArtifact.getModuleVersion().getId();

Artifact artifact = new Artifact()
.setId(artifactId.getGroup() + ":" + artifactId.getName() + ":" + artifactId.getVersion())
.setPathname(resolvedArtifact.getFile())
.setMonitored(true);

Choose a reason for hiding this comment

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

Should there be a unit test to test this part? that the artifact has the expected outcome?

Copy link
Contributor Author

@guillermo-varela guillermo-varela Apr 22, 2021

Choose a reason for hiding this comment

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

Should there be a unit test to test this part? that the artifact has the expected outcome?

There are already tests checking the output is group:name (artifactId):version
For instance:
https://github.com/sonatype-nexus-community/scan-gradle-plugin/blob/master/src/test/java/org/sonatype/gradle/plugins/scan/common/DependenciesFinderTest.java#L177

The case the customer presents couldn't be reproduced (getting extra info in version for SNAPSHOT components) using the current approach, but concatenating those fields manually proved to provide a proper result as per the output they provided in the latest reply by mail.

Copy link

@mr-zepol mr-zepol left a comment

Choose a reason for hiding this comment

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

+1 LGTM

Copy link

@anna-d anna-d left a comment

Choose a reason for hiding this comment

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

+1

Copy link

@kakumara kakumara left a comment

Choose a reason for hiding this comment

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

+1, LGTM

ModuleVersionIdentifier artifactId = resolvedArtifact.getModuleVersion().getId();

Artifact artifact = new Artifact()
.setId(artifactId.getGroup() + ":" + artifactId.getName() + ":" + artifactId.getVersion())

Choose a reason for hiding this comment

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

Does the ModuleVersionIdentifier has any info on classifier and extension ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the ModuleVersionIdentifier has any info on classifier and extension ?

Nope!
Only group, name and version: https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/ModuleVersionIdentifier.html

Copy link
Contributor

@mealingr mealingr left a comment

Choose a reason for hiding this comment

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

+1

@guillermo-varela guillermo-varela merged commit f136e5a into master Apr 23, 2021
@guillermo-varela guillermo-varela deleted the CLM-18313_fix_component_id_iq_innersource branch April 23, 2021 16:53
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.

5 participants