Linkage Monitor to run 2-phase model building#855
Merged
Conversation
suztomo
commented
Aug 28, 2019
| RepositoryUtility.newRepositorySystem(), | ||
| new Bom( | ||
| "com.google.cloud.tools:test-bom:0.0.1", | ||
| "com.google.guava:guava-bom:27.1-android", |
Contributor
Author
There was a problem hiding this comment.
Because this change involves Maven's model building, we cannot use dummy artifact here.
| Version highestGuava = versionScheme.parseVersion(guavaHighestVersion); | ||
| Version guava28 = versionScheme.parseVersion("28.0"); | ||
| // The logic should work for both jar and pom artifacts | ||
| for (String artifactId : ImmutableList.of("guava", "guava-bom")) { |
Contributor
Author
There was a problem hiding this comment.
This test is to ensure findHighestVersion works for BOM (extension: pom) too.
Contributor
There was a problem hiding this comment.
make that a comment in the code
| ArtifactResult googleCloudBomResult = | ||
| system.resolveArtifact( | ||
| session, new ArtifactRequest(googleCloudBom0_106, ImmutableList.of(CENTRAL), null)); | ||
| doReturn(googleCloudBomResult) |
Contributor
Author
There was a problem hiding this comment.
doReturn for spy object
https://static.javadoc.io/org.mockito/mockito-core/3.0.0/org/mockito/Mockito.html#spy-T-
(If possible, spy object should be avoided. but Maven is tightly coupled with RepositorySystem and thus normal mock object would make the test even complicated. )
elharo
approved these changes
Aug 28, 2019
| RepositorySystem repositorySystem, RepositorySystemSession session, String bomCoordinates) | ||
| throws ModelBuildingException, ArtifactResolutionException, MavenRepositoryException { | ||
|
|
||
| // BOM Coordinates may not have extension. |
| Version highestGuava = versionScheme.parseVersion(guavaHighestVersion); | ||
| Version guava28 = versionScheme.parseVersion("28.0"); | ||
| // The logic should work for both jar and pom artifacts | ||
| for (String artifactId : ImmutableList.of("guava", "guava-bom")) { |
Contributor
There was a problem hiding this comment.
make that a comment in the code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #853
Linkage Monitor to run 2-phase model building. It swaps BOM version between the phases.
As per https://maven.apache.org/ref/3.6.1/maven-model-builder/
This change updates the content of the BOM after Phase 1.