-
-
Save ciscorucinski/c573139ccf15cb8f06458b07025dfd07 to your computer and use it in GitHub Desktop.
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
task ChroMATERIAL_RenameFiles(type: Copy) { | |
String sourceDir = 'src/colors' | |
String XML = '.xml' // Extension to keep | |
String ICLS = '.icls' // Extension to remove | |
// "Copy" files into the same directory. | |
from sourceDir | |
destinationDir file(sourceDir) | |
String fileName | |
rename { String file -> | |
// Only delete the xml file of the associated icls files that are present in the directory | |
if (file.contains(ICLS)) { | |
fileName = file.replace(ICLS, '') | |
delete fileName.concat(XML) | |
} | |
// Rename all icls file extensions to be xml files | |
file.replace(ICLS, XML) | |
} | |
// Lastly, delete all remaining icls files from the directory | |
doLast { | |
delete fileTree(sourceDir) { | |
include('**/*'.concat(ICLS)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment