Class ExecutablePathUtils
java.lang.Object
com.atlassian.bamboo.v2.build.agent.capability.ExecutablePathUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable FiledetectExecutableOnPath(@NotNull String executableName) Detects the executable home directory and validates that it matches the required pattern usingexistsInHomeBinExePattern(String, String)static booleanexistsInHomeBinExePattern(@Nullable String homePath, @NotNull String executableName) Validates that the executable exists at the path ${homePath}/bin/${executableName} Appends ".bat" to the executable name if the platform is Windowsstatic @Nullable FilefindExecutable(@NotNull String executableName, @Nullable Predicate<File> validityPredicate, @Nullable String envHomeDir, @NotNull List<String> fhsHomes) This method will return the executable home path, searching first in environment home, then on PATH, finally in a FHS - compliant directory.static @Nullable FilefindExecutable(@NotNull String executableName, @Nullable Predicate<File> validityPredicate, @Nullable String envHomeDir, @Nullable String fhsHome) This method will return the executable home path, searching first in environment home, then on PATH, finally in a FHS - compliant directory.static @Nullable StringfindExecutablePath(@NotNull String executableName) Finds the path of the executable given its name.getExistingExecutable(@Nullable String basePath, @NotNull String executableName) static @Nullable FilegetHomeFromExecutableInHomeBin(@NotNull File executable) Gets the home directory for an executable if its parent directory is 'bin'static @NotNull StringmakeBatchIfOnWindows(String builder)
-
Method Details
-
existsInHomeBinExePattern
public static boolean existsInHomeBinExePattern(@Nullable @Nullable String homePath, @NotNull @NotNull String executableName) Validates that the executable exists at the path ${homePath}/bin/${executableName} Appends ".bat" to the executable name if the platform is Windows- Parameters:
homePath-executableName-- Returns:
- matches
-
getExistingExecutable
-
makeBatchIfOnWindows
-
detectExecutableOnPath
@Nullable public static @Nullable File detectExecutableOnPath(@NotNull @NotNull String executableName) Detects the executable home directory and validates that it matches the required pattern usingexistsInHomeBinExePattern(String, String)- Parameters:
executableName- of the builder executable- Returns:
- home
-
getHomeFromExecutableInHomeBin
@Nullable public static @Nullable File getHomeFromExecutableInHomeBin(@NotNull @NotNull File executable) Gets the home directory for an executable if its parent directory is 'bin'- Parameters:
executable- the executable file used to detect the home directory- Returns:
- homeDir
-
findExecutable
@Nullable public static @Nullable File findExecutable(@NotNull @NotNull String executableName, @Nullable @Nullable Predicate<File> validityPredicate, @Nullable @Nullable String envHomeDir, @Nullable @Nullable String fhsHome) This method will return the executable home path, searching first in environment home, then on PATH, finally in a FHS - compliant directory.- Parameters:
executableName- executable name to search forvalidityPredicate- predicate used to validate the executable pathenvHomeDir- home directory from environmentfhsHome- FHS-compliant home directory- Returns:
- file to executable
-
findExecutable
@Nullable public static @Nullable File findExecutable(@NotNull @NotNull String executableName, @Nullable @Nullable Predicate<File> validityPredicate, @Nullable @Nullable String envHomeDir, @NotNull @NotNull List<String> fhsHomes) This method will return the executable home path, searching first in environment home, then on PATH, finally in a FHS - compliant directory.- Parameters:
executableName- executable name to search forvalidityPredicate- predicate used to validate the executable pathenvHomeDir- home directory from environmentfhsHomes- FHS-compliant home directory- Returns:
- file to executable
-
findExecutablePath
@Nullable public static @Nullable String findExecutablePath(@NotNull @NotNull String executableName) Finds the path of the executable given its name.- Parameters:
executableName- of the executable- Returns:
- path
-