Skip to content

Commit 16c865e

Browse files
authored
Remove Guava (#114)
1 parent 2576ef3 commit 16c865e

File tree

11 files changed

+56
-41
lines changed

11 files changed

+56
-41
lines changed

.github/workflows/analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
spotbugs:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
with:
2020
ref: ${{ github.event.pull_request.head.sha }}
2121
# Install required tools
2222
- name: Set up Java
23-
uses: actions/setup-java@v3
23+
uses: actions/setup-java@v4
2424
with:
25-
distribution: "temurin"
25+
distribution: "zulu"
2626
java-version: "8"
2727

2828
# Run tests

.github/workflows/frogbot-scan-and-fix.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ jobs:
1515
# The repository scanning will be triggered periodically on the following branches.
1616
branch: [ "main" ]
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
with:
2020
ref: ${{ matrix.branch }}
2121

2222
# Install prerequisites
2323
- name: Set up Java
24-
uses: actions/setup-java@v3
24+
uses: actions/setup-java@v4
2525
with:
2626
java-version: "8"
27-
distribution: "temurin"
27+
distribution: "zulu"
2828

2929
- uses: jfrog/frogbot@v2
3030
env:

.github/workflows/frogbot-scan-pull-request.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ jobs:
1010
runs-on: ubuntu-latest
1111
environment: frogbot
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
with:
1515
ref: ${{ github.event.pull_request.head.sha }}
1616

1717
# Install prerequisites
1818
- name: Set up Java
19-
uses: actions/setup-java@v3
19+
uses: actions/setup-java@v4
2020
with:
2121
java-version: "8"
22-
distribution: "temurin"
22+
distribution: "zulu"
2323

2424
- uses: jfrog/frogbot@v2
2525
env:

.github/workflows/gradle.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ jobs:
3838
- name: "Log if Already Exist"
3939
run: echo "::warning::Version $LATEST_MVN_CENTRAL_VERSION already exist in the Gradle Gallery."
4040
if: ${{ env.SHOULD_NOT_PUBLISH == 'TRUE'}}
41-
- uses: actions/checkout@v3
41+
- uses: actions/checkout@v4
4242
with:
4343
ref: refs/tags/${{ env.LATEST_MVN_CENTRAL_VERSION }}
4444
if: ${{ env.SHOULD_NOT_PUBLISH != 'TRUE'}}
45-
- uses: actions/setup-java@v3
45+
- uses: actions/setup-java@v4
4646
with:
47-
distribution: "temurin"
47+
distribution: "zulu"
4848
java-version: "11"
4949
if: ${{ env.SHOULD_NOT_PUBLISH != 'TRUE'}}
5050
- name: "Publish to Gradle Gallery"

.github/workflows/test.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,23 @@ jobs:
1616
os: [ ubuntu-latest, windows-latest, macOS-latest ]
1717
java-version: [ "8", "11" ]
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
with:
2121
ref: ${{ github.event.pull_request.head.sha }}
2222
# Install required tools
2323
- name: Set up Java
24-
uses: actions/setup-java@v3
24+
uses: actions/setup-java@v4
2525
with:
26-
distribution: "temurin"
26+
distribution: "zulu"
2727
java-version: ${{ matrix.java-version }}
2828

29+
# Install Go for the Artifactory setup in the next step
30+
- name: Setup Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: 1.22.x
34+
cache: false
35+
2936
- name: Setup Artifactory
3037
env:
3138
RTLIC: ${{ secrets.RTLIC }}

build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ repositories {
1515
mavenCentral()
1616
}
1717

18-
val buildInfoVersion = "2.41.12"
18+
val buildInfoVersion = "2.41.18"
1919
val fileSpecsVersion = "1.1.2"
20+
val commonsCollections4Version = "4.4"
2021
val commonsLangVersion = "3.12.0"
2122
val commonsIoVersion = "2.11.0"
2223
val commonsTxtVersion = "1.10.0"
@@ -40,9 +41,9 @@ dependencies {
4041
api("org.jfrog.buildinfo", "build-info-client", buildInfoVersion)
4142
api("org.jfrog.filespecs", "file-specs-java", fileSpecsVersion)
4243

44+
implementation("org.apache.commons", "commons-collections4", commonsCollections4Version)
4345
implementation("org.apache.commons", "commons-lang3", commonsLangVersion)
4446
implementation("org.apache.ivy", "ivy", "2.5.2")
45-
implementation("com.google.guava", "guava", "32.0.1-jre")
4647

4748
// Dependencies that are used by the build-info dependencies and need to be included in the UberJar
4849
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.14.1")
@@ -195,6 +196,6 @@ tasks.register<com.github.spotbugs.snom.SpotBugsTask>("spotBugs") {
195196
}
196197
}
197198
excludeFilter.set(
198-
file("${projectDir}/spotbugs-filter.xml")
199+
file("${projectDir}/spotbugs-filter.xml")
199200
)
200201
}

src/functionalTest/java/org/jfrog/gradle/plugin/artifactory/GradleFunctionalTestBase.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.apache.commons.io.FileUtils;
44
import org.apache.commons.io.IOUtils;
55
import org.apache.commons.lang3.StringUtils;
6+
import org.apache.commons.lang3.SystemUtils;
67
import org.apache.commons.lang3.tuple.Pair;
78
import org.apache.commons.text.StringSubstitutor;
89
import org.gradle.testkit.runner.BuildResult;
@@ -53,7 +54,11 @@ public class GradleFunctionalTestBase {
5354

5455
@DataProvider
5556
public Object[][] gradleVersions() {
56-
return new Object[][]{{"6.8.1"}, {"7.5.1"}, {"7.6"}, {"8.1"}};
57+
if (SystemUtils.IS_OS_MAC && SystemUtils.OS_ARCH.equals("aarch64")) {
58+
// For Apple Silicon (ARM64), exclude Gradle 6 due to a known issue
59+
return new Object[][]{{"7.5.1"}, {"7.6"}, {"8.8"}};
60+
}
61+
return new Object[][]{{"6.8.1"}, {"7.5.1"}, {"7.6"}, {"8.8"}};
5762
}
5863

5964
@BeforeClass

src/main/java/org/jfrog/gradle/plugin/artifactory/extractor/GradleModuleExtractor.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.jfrog.gradle.plugin.artifactory.extractor;
22

3-
import com.google.common.collect.Sets;
43
import org.apache.commons.lang3.StringUtils;
54
import org.gradle.api.Project;
65
import org.gradle.api.artifacts.Configuration;
@@ -33,13 +32,10 @@
3332
import java.io.File;
3433
import java.io.IOException;
3534
import java.security.NoSuchAlgorithmException;
36-
import java.util.List;
37-
import java.util.Map;
38-
import java.util.Set;
35+
import java.util.*;
3936
import java.util.stream.Collectors;
4037
import java.util.stream.StreamSupport;
4138

42-
import static com.google.common.collect.Lists.newArrayList;
4339
import static org.jfrog.build.api.util.FileChecksumCalculator.*;
4440
import static org.jfrog.build.extractor.BuildInfoExtractorUtils.getTypeString;
4541
import static org.jfrog.gradle.plugin.artifactory.utils.PluginUtils.getModuleType;
@@ -62,7 +58,7 @@ public Module extractModule(Project project) {
6258
*/
6359
private Set<GradleDeployDetails> getCollectedDeployDetails(ArtifactoryTask artifactoryTask) {
6460
if (artifactoryTask == null) {
65-
return Sets.newHashSet();
61+
return new HashSet<>();
6662
}
6763
return artifactoryTask.getDeployDetails();
6864
}
@@ -129,7 +125,7 @@ private List<Dependency> calculateDependencies(Project project, String moduleId)
129125
Map<String, String[][]> requestedByMap = artifactoryDependencyResolutionListener.getModulesHierarchyMap().get(moduleId);
130126

131127
Set<Configuration> configurationSet = project.getConfigurations();
132-
List<Dependency> dependencies = newArrayList();
128+
List<Dependency> dependencies = new ArrayList<>();
133129
for (Configuration configuration : configurationSet) {
134130
if (configuration.getState() != Configuration.State.RESOLVED) {
135131
log.info("Artifacts for configuration '{}' were not all resolved, skipping", configuration.getName());
@@ -164,10 +160,12 @@ private Dependency extractDependencyFromResolvedArtifact(Configuration configura
164160
return null;
165161
}
166162
// New dependency to extract
163+
Set<String> scopes = new HashSet<>();
164+
scopes.add(configuration.getName());
167165
DependencyBuilder dependencyBuilder = new DependencyBuilder()
168166
.type(StringUtils.substringAfterLast(file.getName(), "."))
169167
.id(depId)
170-
.scopes(Sets.newHashSet(configuration.getName()));
168+
.scopes(scopes);
171169
if (requestedByMap != null) {
172170
dependencyBuilder.requestedBy(requestedByMap.get(depId));
173171
}

src/main/java/org/jfrog/gradle/plugin/artifactory/task/ArtifactoryTask.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.jfrog.gradle.plugin.artifactory.task;
22

3-
import com.google.common.collect.ArrayListMultimap;
4-
import com.google.common.collect.Multimap;
53
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4+
import org.apache.commons.collections4.MultiMapUtils;
5+
import org.apache.commons.collections4.MultiValuedMap;
66
import org.apache.commons.lang3.StringUtils;
77
import org.gradle.api.*;
88
import org.gradle.api.artifacts.Configuration;
@@ -51,7 +51,7 @@ public class ArtifactoryTask extends DefaultTask {
5151
// Publication containers input
5252
private final Set<Object> publications = new HashSet<>();
5353
// Properties input
54-
private final Multimap<String, CharSequence> properties = ArrayListMultimap.create();
54+
private final MultiValuedMap<String, CharSequence> properties = MultiMapUtils.newSetValuedHashMap();
5555
@Input
5656
public final ArtifactSpecs artifactSpecs = new ArtifactSpecs();
5757

@@ -394,7 +394,7 @@ public Set<Publication> getPublications() {
394394
}
395395

396396
@Input
397-
public Multimap<String, CharSequence> getProperties() {
397+
public MultiValuedMap<String, CharSequence> getProperties() {
398398
return properties;
399399
}
400400

src/main/java/org/jfrog/gradle/plugin/artifactory/utils/ProjectUtils.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.jfrog.gradle.plugin.artifactory.utils;
22

3-
import com.google.common.base.Predicate;
4-
import com.google.common.collect.Iterables;
53
import org.gradle.api.Project;
64
import org.gradle.api.artifacts.ModuleVersionIdentifier;
75
import org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration;
@@ -13,6 +11,8 @@
1311
import java.util.ArrayList;
1412
import java.util.Objects;
1513
import java.util.Set;
14+
import java.util.function.Predicate;
15+
import java.util.stream.Collectors;
1616

1717
public class ProjectUtils {
1818

@@ -77,10 +77,12 @@ public static Iterable<GradleDeployDetails> filterIncludeExcludeDetails(Project
7777
publisher.getIncludePatterns(),
7878
publisher.getExcludePatterns());
7979
if (publisher.isFilterExcludedArtifactsFromBuild()) {
80-
return Iterables.filter(gradleDeployDetails, new IncludeExcludePredicate(project, patterns, isInclude));
81-
} else {
82-
return isInclude ? Iterables.filter(gradleDeployDetails, new ProjectPredicate(project)) : new ArrayList<>();
80+
return gradleDeployDetails.stream().filter(new IncludeExcludePredicate(project, patterns, isInclude)).collect(Collectors.toSet());
8381
}
82+
if (!isInclude) {
83+
return new ArrayList<>();
84+
}
85+
return gradleDeployDetails.stream().filter(new ProjectPredicate(project)).collect(Collectors.toSet());
8486
}
8587

8688
public static class ProjectPredicate implements Predicate<GradleDeployDetails> {
@@ -90,7 +92,8 @@ private ProjectPredicate(Project project) {
9092
this.project = project;
9193
}
9294

93-
public boolean apply(@Nullable GradleDeployDetails input) {
95+
@Override
96+
public boolean test(@Nullable GradleDeployDetails input) {
9497
if (input == null) {
9598
return false;
9699
}
@@ -109,7 +112,8 @@ public IncludeExcludePredicate(Project project, IncludeExcludePatterns patterns,
109112
this.include = include;
110113
}
111114

112-
public boolean apply(@Nullable GradleDeployDetails input) {
115+
@Override
116+
public boolean test(@Nullable GradleDeployDetails input) {
113117
if (input == null || !Objects.equals(input.getProject(), project)) {
114118
return false;
115119
}

0 commit comments

Comments
 (0)