Skip to content

Commit

Permalink
Move scm information to metadata from top-level, and remove nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Nov 21, 2022
1 parent 39d966b commit 1a7563f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ private void computeArtifactCoords(ObjectNode extObject) {
private void computeSourceLocation(ObjectNode extObject) {
Map<String, String> repo = ScmInfoProvider.getSourceRepo();
if (repo != null) {
ObjectNode scm = extObject.putObject("scm");
ObjectNode metadata = getMetadataNode(extObject);

for (Map.Entry<String, String> e : repo.entrySet()) {
scm.put(e.getKey(), e.getValue());
metadata.put("scm-" + e.getKey(), e.getValue());

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ public void shouldGenerateScmInformation() throws IOException {
File extensionDescriptorFile = new File(testProjectDir, "build/resources/main/META-INF/quarkus-extension.yaml");
assertThat(extensionDescriptorFile).exists();
ObjectNode extensionDescriptor = TestUtils.readExtensionFile(extensionDescriptorFile.toPath());
assertThat(extensionDescriptor.get("scm")).isNotNull();
assertThat(extensionDescriptor.get("scm").get("url")).isNotNull();
assertThat(extensionDescriptor.get("scm").get("url").asText())
.as("Check source location %s", extensionDescriptor.get("scm"))
assertThat(extensionDescriptor.get("metadata").get("scm-url")).isNotNull();
assertThat(extensionDescriptor.get("metadata").get("scm-url").asText())
.as("Check source location %s", extensionDescriptor.get("scm-url"))
.isEqualTo("https://github.com/some/repo");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,9 @@ public boolean visitLeave(DependencyNode node) {
private void addSource(ObjectNode extObject) throws MojoExecutionException {
Map<String, String> repo = getSourceRepo();
if (repo != null) {
ObjectNode scm = extObject.putObject("scm");
ObjectNode metadata = getMetadataNode(extObject);
for (Map.Entry<String, String> e : repo.entrySet()) {
scm.put(e.getKey(), e.getValue());

metadata.put("scm-" + e.getKey(), e.getValue());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,10 @@ public boolean visitLeave(DependencyNode node) {
private void addSource(ObjectNode extObject) throws MojoExecutionException {
Map<String, String> repo = ScmInfoProvider.getSourceRepo();
if (repo != null) {
ObjectNode scm = extObject.putObject("scm");
ObjectNode metadata = getMetadataNode(extObject);
for (Map.Entry<String, String> e : repo.entrySet()) {
scm.put(e.getKey(), e.getValue());
// Tools may not be able to handle nesting in metadata, so do fake-nesting
metadata.put("scm-" + e.getKey(), e.getValue());

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ public void shouldCreateMetadata()
// From maven this property should be set, running in an IDE it won't be unless specially configured
if (System.getenv("GITHUB_REPOSITORY") != null) {
// Lazily test that the scm is there but is an object
assertYamlContainsObject(fileContents, "scm");
assertYamlContains(fileContents, "url", "https://github.com/some/repo");
assertYamlContains(fileContents, "scm-url", "https://github.com/some/repo");
}

}
Expand Down

0 comments on commit 1a7563f

Please sign in to comment.