in winegrower-extension/winegrower-build/winegrower-build-common/src/main/java/org/apache/winegrower/extension/build/common/Build.java [115:154]
private void copyProvidedFiles(final File basedir, final File base) {
final File srcConf = new File(basedir, configuration.conf);
if (srcConf.exists() && srcConf.isDirectory()) {
final File targetConf = new File(base, "conf");
targetConf.mkdirs();
for (final File file : srcConf.listFiles()) {
final String fileName = file.getName();
if (fileName.startsWith(".")) {
// hidden file -> ignore
continue;
}
try {
Files.copy(file.toPath(), new File(targetConf, fileName).toPath());
} catch (final IOException e) {
throw new IllegalStateException("Could not copy file " + file.getAbsolutePath(), e);
}
}
}
final File srcBin = new File(basedir, configuration.bin);
if (srcBin.exists() && srcBin.isDirectory()) {
final File targetRoot = new File(base, "bin");
targetRoot.mkdirs();
Stream.of(srcBin.listFiles())
.filter(f -> !f.isDirectory()) // not nested for now
.forEach(f -> {
try {
final File target = new File(targetRoot, f.getName());
Files.copy(f.toPath(), target.toPath());
if (target.getName().endsWith(".sh")) {
target.setExecutable(true);
}
} catch (final IOException e) {
throw new IllegalArgumentException("Could not copy file " + f.getAbsolutePath(), e);
}
});
}
}