Skip to content

Commit

Permalink
Merge pull request #6741 from geoand/infinispan-embedded
Browse files Browse the repository at this point in the history
Fix GraalVM json resource handling and add infinispan-embedded to native CI
  • Loading branch information
gsmet committed Jan 23, 2020
2 parents da7ae0d + 25f4c38 commit adba14f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
3 changes: 2 additions & 1 deletion ci-templates/stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,11 @@ stages:
parameters:
poolSettings: ${{parameters.poolSettings}}
expectUseVMs: ${{parameters.expectUseVMs}}
timeoutInMinutes: 25
timeoutInMinutes: 30
modules:
- infinispan-cache-jpa
- infinispan-client
- infinispan-embedded
- cache
name: cache

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.io.UncheckedIOException;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitOption;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
Expand Down Expand Up @@ -377,26 +378,28 @@ public NativeImageSourceJarBuildItem buildNativeImageJar(CurateOutcomeBuildItem
*/
private void copyJsonConfigFiles(ApplicationArchivesBuildItem applicationArchivesBuildItem, Path thinJarDirectory)
throws IOException {
// this will contain all the resources in both maven and gradle cases - the latter is true because we copy them in AugmentTask
Path classesLocation = applicationArchivesBuildItem.getRootArchive().getArchiveLocation();
try (Stream<Path> stream = Files.find(classesLocation, 1, new BiPredicate<Path, BasicFileAttributes>() {
@Override
public boolean test(Path path, BasicFileAttributes basicFileAttributes) {
return basicFileAttributes.isRegularFile() && path.toString().endsWith(".json");
}
})) {
stream.forEach(new Consumer<Path>() {
// archiveLocation contains the location of the application jar at this point
Path appJarPath = applicationArchivesBuildItem.getRootArchive().getArchiveLocation();
try (FileSystem jarFileSystem = FileSystems.newFileSystem(appJarPath, null)) {
try (Stream<Path> stream = Files.find(jarFileSystem.getPath("/"), 1, new BiPredicate<Path, BasicFileAttributes>() {
@Override
public void accept(Path jsonPath) {
try {
Files.copy(jsonPath, thinJarDirectory.resolve(jsonPath.getFileName()));
} catch (IOException e) {
throw new UncheckedIOException(
"Unable to copy json config file from " + jsonPath + " to " + thinJarDirectory,
e);
}
public boolean test(Path path, BasicFileAttributes basicFileAttributes) {
return basicFileAttributes.isRegularFile() && path.toString().endsWith(".json");
}
});
})) {
stream.forEach(new Consumer<Path>() {
@Override
public void accept(Path jsonPath) {
try {
Files.copy(jsonPath.getFileName(), thinJarDirectory.resolve(jsonPath.getFileName().toString()));
} catch (IOException e) {
throw new UncheckedIOException(
"Unable to copy json config file from " + jsonPath + " to " + thinJarDirectory,
e);
}
}
});
}
}
}

Expand Down

0 comments on commit adba14f

Please sign in to comment.