-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable injection when custom extensions are detected (#398)
- Loading branch information
Showing
22 changed files
with
700 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/hudson/plugins/gradle/injection/MavenExtClasspathUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package hudson.plugins.gradle.injection; | ||
|
||
import hudson.FilePath; | ||
import hudson.model.Computer; | ||
import hudson.model.Node; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
final class MavenExtClasspathUtils { | ||
static final String SPACE = " "; | ||
|
||
private MavenExtClasspathUtils() { | ||
} | ||
|
||
static String constructExtClasspath(List<FilePath> extensions, boolean isUnix) { | ||
return extensions | ||
.stream() | ||
.map(FilePath::getRemote) | ||
.collect(Collectors.joining(getDelimiter(isUnix))); | ||
} | ||
|
||
static String getDelimiter(boolean isUnix) { | ||
return isUnix ? ":" : ";"; | ||
} | ||
|
||
static boolean isUnix(Node node) { | ||
Computer computer = node.toComputer(); | ||
return isUnix(computer); | ||
} | ||
|
||
static boolean isUnix(Computer computer) { | ||
return computer == null || Boolean.TRUE.equals(computer.isUnix()); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/hudson/plugins/gradle/injection/MavenExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package hudson.plugins.gradle.injection; | ||
|
||
public enum MavenExtension { | ||
GRADLE_ENTERPRISE("gradle-enterprise-maven-extension", ExtensionsVersions.GE_EXTENSION_VERSION, new MavenCoordinates("com.gradle", "gradle-enterprise-maven-extension")), | ||
CCUD("common-custom-user-data-maven-extension", ExtensionsVersions.CCUD_EXTENSION_VERSION, new MavenCoordinates("com.gradle", "common-custom-user-data-maven-extension")), | ||
CONFIGURATION("configuration-maven-extension", "1.0.0", new MavenCoordinates("com.gradle", "configuration-maven-extension")); | ||
|
||
private static final String JAR_EXTENSION = ".jar"; | ||
|
||
private final String name; | ||
private final String version; | ||
|
||
private final MavenCoordinates coordinates; | ||
|
||
MavenExtension(String name, String version, MavenCoordinates coordinates) { | ||
this.name = name; | ||
this.version = version; | ||
this.coordinates = coordinates; | ||
} | ||
|
||
public String getTargetJarName() { | ||
return name + JAR_EXTENSION; | ||
} | ||
|
||
public String getEmbeddedJarName() { | ||
return name + "-" + version + JAR_EXTENSION; | ||
} | ||
|
||
public MavenCoordinates getCoordinates() { | ||
return coordinates; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.