Skip to content

Commit

Permalink
Remove commons-collections and use Multimap from build-info (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi authored Jun 17, 2024
1 parent 82ebdc2 commit db28096
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ repositories {
mavenCentral()
}

val buildInfoVersion = "2.41.18"
val buildInfoVersion = "2.41.21"
val fileSpecsVersion = "1.1.2"
val commonsCollections4Version = "4.4"
val commonsLangVersion = "3.12.0"
val commonsIoVersion = "2.11.0"
val commonsTxtVersion = "1.10.0"
Expand All @@ -41,7 +40,6 @@ dependencies {
api("org.jfrog.buildinfo", "build-info-client", buildInfoVersion)
api("org.jfrog.filespecs", "file-specs-java", fileSpecsVersion)

implementation("org.apache.commons", "commons-collections4", commonsCollections4Version)
implementation("org.apache.commons", "commons-lang3", commonsLangVersion)
implementation("org.apache.ivy", "ivy", "2.5.2")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.jfrog.gradle.plugin.artifactory.task;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.collections4.MultiMapUtils;
import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.lang3.StringUtils;
import org.gradle.api.*;
import org.gradle.api.artifacts.Configuration;
Expand All @@ -20,6 +18,8 @@
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.*;
import org.jfrog.build.api.builder.ModuleType;
import org.jfrog.build.api.multiMap.Multimap;
import org.jfrog.build.api.multiMap.SetMultimap;
import org.jfrog.build.extractor.clientConfiguration.ArtifactSpecs;
import org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration;
import org.jfrog.gradle.plugin.artifactory.Constant;
Expand Down Expand Up @@ -51,7 +51,7 @@ public class ArtifactoryTask extends DefaultTask {
// Publication containers input
private final Set<Object> publications = new HashSet<>();
// Properties input
private final MultiValuedMap<String, CharSequence> properties = MultiMapUtils.newSetValuedHashMap();
private final Multimap<String, CharSequence> properties = new SetMultimap<>();
@Input
public final ArtifactSpecs artifactSpecs = new ArtifactSpecs();

Expand Down Expand Up @@ -394,7 +394,7 @@ public Set<Publication> getPublications() {
}

@Input
public MultiValuedMap<String, CharSequence> getProperties() {
public Multimap<String, CharSequence> getProperties() {
return properties;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jfrog.gradle.plugin.artifactory.utils;

import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.ivy.core.IvyPatternHelper;
import org.gradle.api.GradleException;
Expand All @@ -14,6 +13,7 @@
import org.gradle.api.publish.ivy.plugins.IvyPublishPlugin;
import org.gradle.api.publish.maven.MavenPublication;
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
import org.jfrog.build.api.multiMap.Multimap;
import org.jfrog.build.api.util.FileChecksumCalculator;
import org.jfrog.build.extractor.clientConfiguration.ArtifactSpec;
import org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration;
Expand Down Expand Up @@ -201,12 +201,12 @@ private static Map<String, String> getPropsToAdd(ArtifactoryTask destination, Pu
.name(project.getName()).version(project.getVersion().toString())
.classifier(artifact.getClassifier())
.type(artifact.getType()).build();
MultiValuedMap<String, CharSequence> artifactSpecsProperties = destination.artifactSpecs.getProperties(spec);
Multimap<String, CharSequence> artifactSpecsProperties = destination.artifactSpecs.getProperties(spec);
addProps(propsToAdd, artifactSpecsProperties);
return propsToAdd;
}

public static void addProps(Map<String, String> target, MultiValuedMap<String, CharSequence> props) {
public static void addProps(Map<String, String> target, Multimap<String, CharSequence> props) {
for (Map.Entry<String, CharSequence> entry : props.entries()) {
// Make sure all GString are now Java Strings
String key = entry.getKey();
Expand Down

0 comments on commit db28096

Please sign in to comment.