Skip to content

Commit

Permalink
Merge pull request quarkusio#17610 from ebullient/jbang-main
Browse files Browse the repository at this point in the history
Use main.java for JBang projects
  • Loading branch information
ebullient authored Jun 3, 2021
2 parents 50241ee + 2f8cc95 commit 5f7622e
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ Path valdiateJBangSourcePackage(Path project, String name) {
Assertions.assertTrue(packagePath.toFile().isDirectory(),
"Package directory should be a directory: " + packagePath.toAbsolutePath().toString());

return packagePath.resolve("GreetingResource.java");
return packagePath.resolve("main.java");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ language:
base:
data:
command:
class-name: GreetingCommand
class-name: main
name: Greeting
dependencies:
- io.quarkus:quarkus-picocli
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ language:
base:
data:
resource:
class-name: GreetingResource
class-name: main
path: "/hello-resteasy"
response: "Hello RESTEasy"
dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void generateDefaultProject(TestInfo testInfo) throws Throwable {
final Path projectDir = testDirPath.resolve("default");
getCatalog().createProject(input).generate(projectDir);
assertThatDirectoryTreeMatchSnapshots(testInfo, projectDir);
assertThatMatchSnapshot(testInfo, projectDir, "src/GreetingResource.java");
assertThatMatchSnapshot(testInfo, projectDir, "src/main.java");
}

@Test
Expand All @@ -47,7 +47,7 @@ void generatePicocliProject(TestInfo testInfo) throws Throwable {
final Path projectDir = testDirPath.resolve("picocli");
getCatalog().createProject(input).generate(projectDir);
assertThatDirectoryTreeMatchSnapshots(testInfo, projectDir);
assertThatMatchSnapshot(testInfo, projectDir, "src/GreetingCommand.java");
assertThatMatchSnapshot(testInfo, projectDir, "src/main.java");
}

private QuarkusJBangCodestartCatalog getCatalog() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ README.md
jbang
jbang.cmd
src/
src/GreetingResource.java
src/main.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@Path("/hello-resteasy")
@ApplicationScoped
public class GreetingResource {
public class main {

@GET
public String sayHello() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ README.md
jbang
jbang.cmd
src/
src/GreetingCommand.java
src/main.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import picocli.CommandLine.Parameters;

@Command(name = "Greeting", mixinStandardHelpOptions = true)
public class GreetingCommand {
public class main {

@Parameters(paramLabel = "<name>", defaultValue = "picocli",
description = "Your name.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void createRESTEasy() throws Exception {

assertThat(projectDir.resolve("jbang")).exists();

assertThat(projectDir.resolve("src/GreetingResource.java"))
assertThat(projectDir.resolve("src/main.java"))
.exists()
.satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?"))
.satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy"));
Expand All @@ -45,7 +45,7 @@ public void createRESTEasyWithNoJBangWrapper() throws Exception {

assertThat(projectDir.resolve("jbang")).doesNotExist();

assertThat(projectDir.resolve("src/GreetingResource.java"))
assertThat(projectDir.resolve("src/main.java"))
.exists()
.satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?"))
.satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy"));
Expand All @@ -65,7 +65,7 @@ public void createRESTEasyWithExtensions() throws Exception {

assertThat(projectDir.resolve("jbang")).exists();

assertThat(projectDir.resolve("src/GreetingResource.java"))
assertThat(projectDir.resolve("src/main.java"))
.exists()
.satisfies(checkContains("//usr/bin/env jbang \"$0\" \"$@\" ; exit $?"))
.satisfies(checkContains("//DEPS io.quarkus:quarkus-resteasy"))
Expand Down

0 comments on commit 5f7622e

Please sign in to comment.