Skip to content

Commit

Permalink
Refactor Ivy artifact processing
Browse files Browse the repository at this point in the history
This fixes for example the publication of Gradle Module Metadata,
stable since Gradle 5.3 and produced by default with Gradle 6.0.

Issue jfrog#247
  • Loading branch information
ljacomet committed Oct 9, 2019
1 parent 83ba30e commit c1a1e5a
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.gradle.api.publish.Publication;
import org.gradle.api.publish.PublicationArtifact;
import org.gradle.api.publish.PublishingExtension;
import org.gradle.api.publish.internal.PublicationArtifactSet;
import org.gradle.api.publish.internal.PublicationInternal;
import org.gradle.api.publish.ivy.IvyArtifact;
import org.gradle.api.publish.ivy.IvyArtifactSet;
Expand Down Expand Up @@ -202,19 +203,22 @@ public Set<GradleDeployDetails> getArtifactDeployDetails() {
Map<QName, String> extraInfo = ivyPublication.getDescriptor().getExtraInfo().asMap();

// First adding the Ivy descriptor (if the build is configured to add it):
File ivyFile = getIvyDescriptorFile(ivyNormalizedPublication);
if (isPublishIvy()) {
File file = getIvyDescriptorFile(ivyNormalizedPublication);
DeployDetails.Builder builder = createBuilder(file, publicationName);
DeployDetails.Builder builder = createBuilder(ivyFile, publicationName);
if (builder != null) {
PublishArtifactInfo artifactInfo = new PublishArtifactInfo(
projectIdentity.getModule(), "xml", "ivy", null, extraInfo, file);
projectIdentity.getModule(), "xml", "ivy", null, extraInfo, ivyFile);
addIvyArtifactToDeployDetails(deployDetails, publicationName, projectIdentity, builder, artifactInfo);
}
}

IvyArtifactSet artifacts = ivyPublication.getArtifacts();
// Second adding all artifacts, skipping the ivy file
PublicationArtifactSet<IvyArtifact> artifacts = ivyPublicationInternal.getPublishableArtifacts();
for (IvyArtifact artifact : artifacts) {
File file = artifact.getFile();
// Skip the ivy file
if (file.equals(ivyFile)) continue;
DeployDetails.Builder builder = createBuilder(file, publicationName);
if (builder == null) continue;
PublishArtifactInfo artifactInfo = new PublishArtifactInfo(
Expand Down

0 comments on commit c1a1e5a

Please sign in to comment.