diff options
author | Ivan Dubrov <idubrov@guidewire.com> | 2014-04-28 09:21:47 -0700 |
---|---|---|
committer | Ivan Dubrov <idubrov@guidewire.com> | 2014-04-28 09:21:47 -0700 |
commit | 23e82f9bc83bdf3f30b44354d3096c02a8473abc (patch) | |
tree | 0d6ae93600da728cef31f47ca554178c77336f5d /installer/build.gradle | |
parent | b558a45203fb1cd3778086b24858dde84572c7ac (diff) | |
download | dcevm-23e82f9bc83bdf3f30b44354d3096c02a8473abc.tar.gz dcevm-23e82f9bc83bdf3f30b44354d3096c02a8473abc.zip |
Moving installer from the separate branchlight-jdk8u5+36
Diffstat (limited to 'installer/build.gradle')
-rw-r--r-- | installer/build.gradle | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/installer/build.gradle b/installer/build.gradle new file mode 100644 index 00000000..f49ba255 --- /dev/null +++ b/installer/build.gradle @@ -0,0 +1,68 @@ +import java.nio.file.FileVisitResult +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.Paths +import java.nio.file.SimpleFileVisitor +import java.nio.file.StandardCopyOption +import java.nio.file.attribute.BasicFileAttributes + +apply plugin: 'java' +apply plugin: 'idea' + +jar { + manifest { + attributes("Main-Class": "com.github.dcevm.installer.Main") + } +} + +project.ext { + processedData = Paths.get("$buildDir/data") + // Should be populated by build server from the DCEVM upstream job + dataSource = Paths.get("$buildDir/rawdata") +} + +sourceSets { + main { + output.dir(processedData.toFile(), builtBy: 'copyData') + } +} + +task copyData << { + Files.createDirectories(processedData) + Files.walkFileTree(dataSource, new CopyDataVisitor(project)); +} + +class CopyDataVisitor extends SimpleFileVisitor<Path> { + def project + + CopyDataVisitor(prj) { + project = prj + } + + @Override + public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { + Path rel = project.dataSource.relativize(dir) + if (rel.nameCount > 4) { + rel = rel.subpath(4, rel.nameCount); + if (rel.fileName.toString() == 'fastdebug') { + // Do not copy fastdebug versions + return FileVisitResult.SKIP_SUBTREE; + } + def targetPath = project.processedData.resolve(rel); + if(!Files.exists(targetPath)){ + Files.createDirectory(targetPath); + } + } + return FileVisitResult.CONTINUE; + } + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Path rel = project.dataSource.relativize(file) + if (rel.nameCount > 4) { + rel = rel.subpath(4, rel.nameCount); + def targetPath = project.processedData.resolve(rel); + Files.copy(file, targetPath, StandardCopyOption.REPLACE_EXISTING); + } + return FileVisitResult.CONTINUE; + } +} |