private File prepareChangedFilesArchivePath(File archiveDir, File destFile, File assemblyDir) throws IOException { // Replace build target dir from destfile and add changed-files build dir instead String relativePath = PathTool.getRelativeFilePath(assemblyDir.getCanonicalPath(),destFile.getCanonicalPath()); return new File(archiveDir,relativePath); }
protected String getCommandAsString() { return StringUtils.join(getArgs(), " "); }
/** * <p>Strip whitespace from the front and back of every String * in the array.</p> * * @param strs the Strings to remove whitespace from * @return the stripped Strings */ public static String[] stripAll( String... strs ) { return stripAll( strs, null ); }
/** * Returns a string array of the includes to be used when adding dependent WARs as an overlay onto this WAR. * * @return an array of tokens to include */ protected String[] getDependentWarIncludes() { return StringUtils.split( StringUtils.defaultString( dependentWarIncludes ), "," ); }
/** * Sets the file encoding of the hook scripts. * * @param encoding The file encoding of the hook scripts, may be <code>null</code> or empty to use the platform's * default encoding. */ public void setScriptEncoding( String encoding ) { this.encoding = StringUtils.isNotEmpty( encoding ) ? encoding : null; }
private static String tryBlank( String s ) { if ( s == null ) { return null; } else { String trimmed = s.trim(); return StringUtils.isEmpty( trimmed ) ? null : trimmed; } }
/** * Determines if the OS on which Ant is executing matches the * given OS architecture. * * @param arch the OS architecture to check for * @return true if the OS matches * */ public static boolean isArch( String arch ) { return isOs( null, null, arch, null ); }
/** * Actually perform the unpacking of the source archive * into the destination directory. * * @throws Exception */ public void execute() throws Exception { expandFile( source, dest ); }
/** * <p>Remove whitespace from the front and back of a String.</p> * * @param str the String to remove whitespace from * @return the stripped String */ public static String strip( String str ) { return strip( str, null ); }
/** * Constructor that sets the family attribute * * @param family a String value */ public Os( String family ) { setFamily( family ); }
/** * <p>Remove the last newline, and everything after it from a String.</p> * * @param str String to chomp the newline from * @return String without chomped newline * @throws NullPointerException if str is <code>null</code> */ @Nonnull public static String chomp( @Nonnull String str ) { return chomp( str, "\n" ); }
/** * Returns a string array of the includes to be used when assembling/copying the WAR. * * @return an array of tokens to include */ protected String[] getIncludes() { return StringUtils.split( StringUtils.defaultString( warSourceIncludes ), "," ); }
private String extractCheckerLog(List<WaitChecker> checkers) { List<String> logOut = new ArrayList<>(); for (WaitChecker checker : checkers) { logOut.add(checker.getLogLabel()); } return StringUtils.join(logOut.toArray(), " and "); }
/** * Determines if the OS on which Ant is executing matches the * given OS name. * * @param name the OS name to check for * @return true if the OS matches * */ public static boolean isName( String name ) { return isOs( null, name, null, null ); }
/** * Returns a string array of the excludes to be used when adding dependent WAR as an overlay onto this WAR. * * @return an array of tokens to exclude */ protected String[] getDependentWarExcludes() { return StringUtils.split( StringUtils.defaultString( dependentWarExcludes ), "," ); }
/** * Resolve image with an external image resolver * * @param images the original image config list (can be null) * @param imageResolver the resolver used to extend on an image configuration * @param imageNameFilter filter to select only certain image configurations with the given name * @param imageCustomizer final customization hook for mangling the configuration * @return a list of resolved and customized image configuration. */ public static List<ImageConfiguration> resolveImages(Logger logger, List<ImageConfiguration> images, Resolver imageResolver, String imageNameFilter, Customizer imageCustomizer) { List<ImageConfiguration> ret = resolveConfiguration(imageResolver, images); ret = imageCustomizer.customizeConfig(ret); List<ImageConfiguration> filtered = filterImages(imageNameFilter,ret); if (ret.size() > 0 && filtered.size() == 0 && imageNameFilter != null) { List<String> imageNames = new ArrayList<>(); for (ImageConfiguration image : ret) { imageNames.add(image.getName()); } logger.warn("None of the resolved images [%s] match the configured filter '%s'", StringUtils.join(imageNames.iterator(), ","), imageNameFilter); } return filtered; }
/** * Determines if the OS on which Ant is executing matches the * given OS version. * * @param version the OS version to check for * @return true if the OS matches * */ public static boolean isVersion( String version ) { return isOs( null, null, null, version ); }
/** * @return the default excludes pattern as comma separated string. * @see DirectoryScanner#DEFAULTEXCLUDES * @see StringUtils#join(Object[], String) */ @Nonnull public static String getDefaultExcludesAsString() { return StringUtils.join( DirectoryScanner.DEFAULTEXCLUDES, "," ); }
/** * Determines if the OS on which Ant is executing matches the type of * that set in setFamily. * * @return true if the os matches. * @see Os#setFamily(String) */ boolean eval() { return isOs( family, null, null, null ); }
/** * Determines if the OS on which Ant is executing matches the * given OS family. * * @param family the family to check for * @return true if the OS matches * */ public static boolean isFamily( String family ) { return isOs( family, null, null, null ); }