Skip to content

Commit

Permalink
Allow user-providers-directory outside the output dir
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroigor committed Jul 7, 2020
1 parent 3b43b3b commit 552ca56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,7 @@ private static void writeNullableString(DataOutputStream out, String string) thr
}

private static String relativize(Path applicationRoot, Path jar) {
Path relative = applicationRoot.relativize(jar);
if (relative.getName(0).toString().equals("..")) {
throw new RuntimeException(jar + " was not present in application " + applicationRoot);
}
return relative.toString();
return applicationRoot.relativize(jar).toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,21 @@ public void testThatFastJarCustomOutputDirFormatWorks() throws Exception {

@Test
public void testThatMutableFastJarWorks() throws Exception {
assertThatMutableFastJarWorks("providers");
}

@Test
public void testThatMutableFastJarWorksProvidersDirOutsideOutputDir() throws Exception {
assertThatMutableFastJarWorks("../providers");
}

private void assertThatMutableFastJarWorks(String providersDir) throws Exception {
File testDir = initProject("projects/classic", "projects/project-classic-console-output-mutable-fast-jar");
RunningInvoker running = new RunningInvoker(testDir, false);

MavenProcessInvocationResult result = running
.execute(Arrays.asList("package", "-DskipTests", "-Dquarkus.package.type=mutable-jar",
"-Dquarkus.package.user-providers-directory=providers"), Collections.emptyMap());
"-Dquarkus.package.user-providers-directory=" + providersDir), Collections.emptyMap());

await().atMost(1, TimeUnit.MINUTES).until(() -> result.getProcess() != null && !result.getProcess().isAlive());
assertThat(running.log()).containsIgnoringCase("BUILD SUCCESS");
Expand All @@ -113,7 +122,7 @@ public void testThatMutableFastJarWorks() throws Exception {
Assertions.assertTrue(Files.exists(jar));

Path providers = testDir.toPath().toAbsolutePath()
.resolve(Paths.get("target/quarkus-app/providers"));
.resolve(Paths.get("target/quarkus-app/" + providersDir));
Assertions.assertTrue(Files.exists(providers));

File output = new File(testDir, "target/output.log");
Expand Down

0 comments on commit 552ca56

Please sign in to comment.