Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use main.java for JBang projects #17610

Merged
merged 1 commit into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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