Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added constrainTransitivesToThisReleaseExcept #200

Merged
merged 1 commit into from Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
@@ -1,6 +1,8 @@
# Goomph releases

## [Unreleased]
### Added
- New method `constrainTransitivesToThisReleaseExcept('icu4j', 'someotherdep')` to limit which transitives get constrained.

## [3.38.0] - 2022-09-14
### Added
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 DiffPlug
* Copyright (C) 2018-2022 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,8 @@
import com.diffplug.common.swt.os.SwtPlatform;
import com.diffplug.gradle.pde.EclipseRelease;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
Expand Down Expand Up @@ -132,16 +134,22 @@ public void useNativesForRunningPlatform() {
}

public void constrainTransitivesToThisRelease() {
constrainTransitivesToThisReleaseExcept();
}

public void constrainTransitivesToThisReleaseExcept(String... artifactNames) {
List<String> names = Arrays.asList(artifactNames);
project.getConfigurations().forEach(config -> {
config.getResolutionStrategy().eachDependency(dep -> {
ModuleVersionSelector mod = dep.getRequested();
String version = groupIdArtifactIdToVersion.get(mod.getGroup() + ":" + mod.getName());
if (version != null) {
dep.useVersion(version);
if (!names.contains(mod.getName())) {
String version = groupIdArtifactIdToVersion.get(mod.getGroup() + ":" + mod.getName());
if (version != null) {
dep.useVersion(version);
}
}
});
});

}

/////////////
Expand Down