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 Codestarts as default project generation tool #12473

Merged
merged 1 commit into from
Oct 12, 2020
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
1 change: 0 additions & 1 deletion devtools/cli/src/main/java/io/quarkus/cli/Create.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ else if (targetBuildTool.gradleKotlinDsl)
.version(version)
.sourceType(sourceType)
.extensions(extensions)
.codestartsEnabled(true)
.noExamples(noExamples)
.execute().isSuccess();

Expand Down
16 changes: 9 additions & 7 deletions devtools/cli/src/test/java/io/quarkus/cli/CliTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testAddListRemove() throws Exception {
Assertions.assertEquals(CommandLine.ExitCode.USAGE, exitCode);

// test not project dir
execute("add", "resteasy");
execute("add", "qute");
Assertions.assertEquals(CommandLine.ExitCode.SOFTWARE, exitCode);

execute("list");
Expand All @@ -77,17 +77,18 @@ public void testAddListRemove() throws Exception {
// test empty list
execute("list");
Assertions.assertEquals(CommandLine.ExitCode.OK, exitCode);
Assertions.assertEquals("", screen.trim());
Assertions.assertEquals("quarkus-resteasy", screen.trim());

// test add
execute("add", "resteasy");
execute("add", "qute");
Assertions.assertEquals(CommandLine.ExitCode.OK, exitCode);

// test list

execute("list");
Assertions.assertEquals(CommandLine.ExitCode.OK, exitCode);
Assertions.assertEquals("quarkus-resteasy", screen.trim());
Assertions.assertTrue(screen.contains("quarkus-resteasy"));
Assertions.assertTrue(screen.contains("quarkus-qute"));

// test add multiple
execute("add", "amazon-lambda-http", "jackson");
Expand All @@ -98,6 +99,7 @@ public void testAddListRemove() throws Exception {
execute("list");
Assertions.assertEquals(CommandLine.ExitCode.OK, exitCode);
Assertions.assertTrue(screen.contains("quarkus-resteasy"));
Assertions.assertTrue(screen.contains("quarkus-qute"));
Assertions.assertTrue(screen.contains("quarkus-amazon-lambda-http"));
Assertions.assertTrue(screen.contains("quarkus-jackson"));

Expand All @@ -122,16 +124,16 @@ public void testAddListRemove() throws Exception {
Assertions.assertEquals(CommandLine.ExitCode.SOFTWARE, exitCode);

// test remove
execute("remove", "resteasy");
execute("remove", "qute");
Assertions.assertEquals(CommandLine.ExitCode.OK, exitCode);
execute("list");
Assertions.assertEquals(CommandLine.ExitCode.OK, exitCode);
Assertions.assertFalse(screen.contains("quarkus-resteasy"));
Assertions.assertFalse(screen.contains("quarkus-qute"));
Assertions.assertTrue(screen.contains("quarkus-amazon-lambda-http"));
Assertions.assertTrue(screen.contains("quarkus-jackson"));

// test remove many
execute("rm", "amazon-lambda-http", "jackson");
execute("rm", "amazon-lambda-http", "jackson", "resteasy");
Assertions.assertEquals(CommandLine.ExitCode.OK, exitCode);
execute("list");
Assertions.assertEquals(CommandLine.ExitCode.OK, exitCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public class CreateProjectMojo extends AbstractMojo {
@Parameter(property = "projectVersion")
private String projectVersion;

@Parameter(property = "codestartsEnabled", defaultValue = "false")
private boolean codestartsEnabled;
@Parameter(property = "legacyCodegen", defaultValue = "false")
private boolean legacyCodegen;

@Parameter(property = "noExamples", defaultValue = "false")
private boolean noExamples;
Expand Down Expand Up @@ -195,15 +195,15 @@ public void execute() throws MojoExecutionException {
.sourceType(sourceType)
.className(className)
.extensions(extensions)
.codestartsEnabled(codestartsEnabled)
.legacyCodegen(legacyCodegen)
.noExamples(noExamples);
if (path != null) {
createProject.setValue("path", path);
}

success = createProject.execute().isSuccess();

if (!codestartsEnabled) {
if (legacyCodegen) {
File createdDependenciesBuildFile = new File(projectRoot, buildToolEnum.getDependenciesFile());
if (BuildTool.MAVEN.equals(buildToolEnum)) {
createMavenWrapper(createdDependenciesBuildFile, ToolsUtils.readQuarkusProperties(platform));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Gradle
.gradle/
build/
build/
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Gradle
.gradle/
build/
build/
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ quarkusPluginId={quarkus.gradle-plugin.id}
quarkusPluginVersion={quarkus.gradle-plugin.version}
quarkusPlatformGroupId={quarkus.platform.group-id}
quarkusPlatformArtifactId={quarkus.platform.artifact-id}
quarkusPlatformVersion={quarkus.platform.version}
quarkusPlatformVersion={quarkus.platform.version}

org.gradle.logging.level=INFO
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
release.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ nb-configuration.xml
# patch
*.orig
*.rej

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
== Funqy HTTP Binding
# Funqy HTTP Binding

Guide: https://quarkus.io/guides/funqy-http
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ref: amazon-lambda
type: code
tags:
- example
- compatibility-issues
- singleton-example
language:
base:
shared-data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ref: azure-functions-http
type: code
tags:
- example
- compatibility-issues
- singleton-example
- maven-only
language:
base:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ref: funqy-amazon-lambda
type: code
tags:
- example
- compatibility-issues
- singleton-example
language:
base:
shared-data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ref: funqy-knative-events
type: code
tags:
- example
- compatibility-issues
- singleton-example
language:
base:
data:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/building-my-first-extension.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ $mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=greeting-app \
-DprojectVersion=1.0-SNAPSHOT \
-DclassName=HelloResource
-DnoExamples
----

`cd` into `greeting-app` and add the dependency on `quarkus-greeting` extension we created above.
Expand Down
2 changes: 2 additions & 0 deletions docs/src/main/asciidoc/kafka-streams.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=kafka-streams-quickstart-producer \
-Dextensions="kafka" \
-DnoExamples \
&& mv kafka-streams-quickstart-producer producer
----

Expand Down Expand Up @@ -241,6 +242,7 @@ mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=kafka-streams-quickstart-aggregator \
-Dextensions="kafka-streams,resteasy-jsonb" \
-DnoExamples \
&& mv kafka-streams-quickstart-aggregator aggregator
----

Expand Down
1 change: 1 addition & 0 deletions docs/src/main/asciidoc/neo4j.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ First, we need a new project. Create a new project with the following command:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=neo4j-quickstart \
-DclassName="org.acme.datasource.GreetingResource" \
-Dextensions="neo4j,resteasy-jsonb"
cd neo4j-quickstart
----
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/optaplanner.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Alternatively, generate it from the command line with Maven:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=optaplanner-quickstart \
-Dextensions="resteasy, resteasy-jackson, optaplanner-quarkus, optaplanner-quarkus-jackson"
-Dextensions="resteasy,resteasy-jackson,optaplanner-quarkus,optaplanner-quarkus-jackson"
cd optaplanner-quickstart
----

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/quartz.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectArtifactId=quartz-quickstart \
-DclassName="org.acme.quartz.TaskResource" \
-Dpath="/tasks" \
-Dextensions="quartz, hibernate-orm-panache, flyway, resteasy-jsonb, jdbc-postgresql"
-Dextensions="quartz,hibernate-orm-panache,flyway,resteasy-jsonb,jdbc-postgresql"
cd quartz-quickstart
----

Expand Down
6 changes: 4 additions & 2 deletions docs/src/main/asciidoc/reactive-event-bus.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ If you are creating a new project, set the `extensions` parameter are follows:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=vertx-quickstart \
-Dextensions="vertx,resteasy-mutiny"
-Dextensions="vertx,resteasy-mutiny" \
-DnoExamples
cd vertx-quickstart
----

Expand Down Expand Up @@ -267,7 +268,8 @@ First create a new project using:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=vertx-http-quickstart \
-Dextensions="vertx"
-Dextensions="vertx" \
-DnoExamples
cd vertx-http-quickstart
----

Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/redis.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ First, we need a new project. Create a new project with the following command:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=redis-quickstart \
-Dextensions="redis-client, resteasy-jsonb, resteasy-mutiny"
-Dextensions="redis-client,resteasy-jsonb,resteasy-mutiny" \
-DnoExamples
cd redis-quickstart
----

Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/security-jdbc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ First, we need a new project. Create a new project with the following command:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=security-jdbc-quickstart \
-Dextensions="elytron-security-jdbc, jdbc-postgresql, resteasy"
-Dextensions="elytron-security-jdbc,jdbc-postgresql,resteasy" \
-DnoExamples
cd security-jdbc-quickstart
----

Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/security-jpa.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ First, we need a new project. Create a new project with the following command:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=security-jpa-quickstart \
-Dextensions="security-jpa, jdbc-postgresql, resteasy, hibernate-orm-panache"
-Dextensions="security-jpa,jdbc-postgresql,resteasy,hibernate-orm-panache" \
-DnoExamples
cd security-jpa-quickstart
----

Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/security-keycloak-authorization.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ Create a new project with the following command:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=security-keycloak-authorization-quickstart \
-Dextensions="oidc, keycloak-authorization, resteasy-jsonb"
-Dextensions="oidc,keycloak-authorization,resteasy-jsonb" \
-DnoExamples
cd security-keycloak-authorization-quickstart
----

Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/security-ldap.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ First, we need a new project. Create a new project with the following command:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=security-ldap-quickstart \
-Dextensions="elytron-security-ldap, resteasy"
-Dextensions="elytron-security-ldap,resteasy" \
-DnoExamples
cd security-ldap-quickstart
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ First, we need a new project. Create a new project with the following command:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=security-openid-connect-multi-tenancy \
-Dextensions="oidc, resteasy-jsonb"
-Dextensions="oidc,resteasy-jsonb" \
-DnoExamples
cd security-openid-connect-multi-tenancy
----

Expand Down
3 changes: 2 additions & 1 deletion docs/src/main/asciidoc/security-openid-connect.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ First, we need a new project. Create a new project with the following command:
mvn io.quarkus:quarkus-maven-plugin:{quarkus-version}:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=security-openid-connect-quickstart \
-Dextensions="oidc, resteasy-jsonb"
-Dextensions="resteasy,oidc,resteasy-jsonb" \
-DnoExamples
cd security-openid-connect-quickstart
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import static java.util.Objects.requireNonNull;

import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.devtools.codestarts.utils.NestedMaps;
import io.quarkus.devtools.messagewriter.MessageWriter;
import java.util.Collection;
import java.util.Map;

public class CodestartProjectInput {
private final Collection<AppArtifactKey> dependencies;
private final Collection<String> dependencies;
ia3andy marked this conversation as resolved.
Show resolved Hide resolved
private final Map<String, Object> data;
private final CodestartsSelection selection;
private final MessageWriter messageWriter;
Expand All @@ -33,7 +32,7 @@ public CodestartsSelection getSelection() {
return selection;
}

public Collection<AppArtifactKey> getDependencies() {
public Collection<String> getDependencies() {
return dependencies;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.devtools.codestarts;

import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.devtools.messagewriter.MessageWriter;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -9,7 +8,7 @@
import java.util.Map;

public class CodestartProjectInputBuilder {
Collection<AppArtifactKey> dependencies = new ArrayList<>();
Collection<String> dependencies = new ArrayList<>();
CodestartsSelection selection = new CodestartsSelection();
Map<String, Object> data = new HashMap<>();
MessageWriter messageWriter = MessageWriter.info();
Expand All @@ -18,12 +17,12 @@ public class CodestartProjectInputBuilder {

}

public CodestartProjectInputBuilder addDependencies(Collection<AppArtifactKey> dependencies) {
public CodestartProjectInputBuilder addDependencies(Collection<String> dependencies) {
this.dependencies.addAll(dependencies);
return this;
}

public CodestartProjectInputBuilder addDependency(AppArtifactKey dependency) {
public CodestartProjectInputBuilder addDependency(String dependency) {
return this.addDependencies(Collections.singletonList(dependency));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.devtools.codestarts.core;

import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.devtools.codestarts.Codestart;
import io.quarkus.devtools.codestarts.core.CodestartSpec.CodestartDep;
import io.quarkus.devtools.codestarts.utils.NestedMaps;
Expand Down Expand Up @@ -43,12 +42,11 @@ public static Map<String, Object> buildCodestartProjectData(Collection<Codestart
}

public static Map<String, Object> buildDependenciesData(Stream<Codestart> codestartsStream, String languageName,
Collection<AppArtifactKey> extensions) {
Collection<String> extensions) {
final Map<String, Set<CodestartDep>> depsData = new HashMap<>();
final Set<CodestartDep> extensionsAsDeps = extensions.stream()
.map(k -> k.getGroupId() + ":" + k.getArtifactId()).map(CodestartDep::new)
final Set<CodestartDep> dependencies = extensions.stream()
.map(CodestartDep::new)
.collect(Collectors.toCollection(LinkedHashSet::new));
final Set<CodestartDep> dependencies = new LinkedHashSet<>(extensionsAsDeps);
final Set<CodestartDep> testDependencies = new LinkedHashSet<>();
codestartsStream
.flatMap(s -> Stream.of(s.getBaseLanguageSpec(), s.getLanguageSpec(languageName)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public CodestartDep() {
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public CodestartDep(final String expression) {
final String[] split = expression.split(":");
if (split.length < 2 || split.length > 3) {
if (split.length < 2) {
throw new IllegalArgumentException("Invalid CodestartDep expression: " + expression);
}
this.put(GROUP_ID, split[0]);
Expand Down
Loading