Skip to content

Commit

Permalink
Introduce Codestarts
Browse files Browse the repository at this point in the history
Part of quarkusio#8134 and quarkusio#8178

Copying a few lines of code from `ClassPathUtils.processAsPath`

Various tidy ups

Add qute-example codestart and change naming convention

Improve integration tests

Use descriptive processors for codestarts
  • Loading branch information
ia3andy committed Jul 30, 2020
1 parent f886139 commit 51650ad
Show file tree
Hide file tree
Showing 191 changed files with 4,384 additions and 925 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public class CreateProjectMojo extends AbstractMojo {
@Parameter(property = "projectVersion")
private String projectVersion;

@Parameter(property = "codestartsEnabled")
private Boolean codestartsEnabled;

@Parameter(property = "withExampleCode")
private Boolean withExampleCode;

/**
* Group ID of the target platform BOM
*/
Expand Down Expand Up @@ -190,7 +196,9 @@ public void execute() throws MojoExecutionException {
.version(projectVersion)
.sourceType(sourceType)
.className(className)
.extensions(extensions);
.extensions(extensions)
.codestartsEnabled(codestartsEnabled)
.withExampleCode(withExampleCode);
if (path != null) {
createProject.setValue("path", path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.quarkus.dependencies.Extension;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.ResourceInputStreamConsumer;
import io.quarkus.platform.descriptor.ResourcePathConsumer;
import io.quarkus.platform.descriptor.loader.json.ResourceLoader;
import io.quarkus.platform.tools.DefaultMessageWriter;
import io.quarkus.platform.tools.MessageWriter;
Expand Down Expand Up @@ -126,6 +127,15 @@ public <T> T loadResource(String name, ResourceInputStreamConsumer<T> consumer)
return resourceLoader.loadResource(name, consumer);
}

@Override
public <T> T loadResourceAsPath(String name, ResourcePathConsumer<T> consumer) throws IOException {
getLog().debug("Loading Quarkus platform resource %s", name);
if (resourceLoader == null) {
throw new IllegalStateException("Resource loader has not been provided");
}
return resourceLoader.loadResourceAsPath(name, consumer);
}

@Override
public List<Category> getCategories() {
return categories;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Gradle
.gradle/
build/
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{#insert plugins}
plugins {
id '{quarkus.plugin.id}'
}
{/}

{#insert repositories}
repositories {
mavenLocal()
mavenCentral()
}
{/}

{#insert dependencies}
dependencies {
implementation enforcedPlatform("$\{quarkusPlatformGroupId}:$\{quarkusPlatformArtifactId}:$\{quarkusPlatformVersion}")
{#for dep in dependencies}
implementation '{dep}'
{/for}
testImplementation 'io.quarkus:quarkus-junit5'
{#for dep in test-dependencies}
testImplementation '{dep}'
{/for}
}
{/}

{#insert project}
group '{project.group-id}'
version '{project.version}'
{/}

{#insert java}
java {
{#if java.version == "11"}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
{#else}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
{/if}
}
{/}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Gradle properties
#Tue Jun 16 08:41:21 UTC 2020
quarkusPluginVersion={quarkus.plugin.version}
quarkusPlatformGroupId={quarkus.platform.group-id}
quarkusPlatformArtifactId={quarkus.platform.artifact-id}
quarkusPlatformVersion={quarkus.platform.version}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
plugins {
id '{quarkus.plugin.id}' version "$\{quarkusPluginVersion}"
}
}
rootProject.name='{project.artifact-id}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: gradle
type: buildtool
language:
base:
data:
quarkus:
plugin:
id: io.quarkus
version:
kotlin: 1.3.72
scala: 2.12.8
shared-data:
buildtool:
build-dir: build
guide: https://quarkus.io/guides/gradle-tooling
guide-native: https://quarkus.io/guides/gradle-tooling#building-a-native-executable
cmd:
dev: ./gradlew quarkusDev
package: ./gradlew quarkusBuild
package-uberjar: ./gradlew quarkusBuild --uber-jar
package-native: ./gradlew build -Dquarkus.package.type=native
package-native-container: ./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true
kotlin:
dependencies:
- org.jetbrains.kotlin:kotlin-stdlib-jdk8
scala:
dependencies:
- org.scala-lang:scala-library:${version.scala}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{#include build-layout}
{#plugins}
plugins {
id 'java'
id '{quarkus.plugin.id}'
}
{/plugins}
{/include}

compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-parameters'
}

compileTestJava {
options.encoding = 'UTF-8'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{#include build-layout}
{#plugins}
plugins {
id 'org.jetbrains.kotlin.jvm' version "{version.kotlin}"
id "org.jetbrains.kotlin.plugin.allopen" version "{version.kotlin}"
id '{quarkus.plugin.id}'
}
{/plugins}
{/include}

quarkus {
setOutputDirectory("$projectDir/build/classes/kotlin/main")
}

quarkusDev {
setSourceDir("$projectDir/src/main/kotlin")
}

allOpen {
annotation("javax.ws.rs.Path")
annotation("javax.enterprise.context.ApplicationScoped")
annotation("io.quarkus.test.junit.QuarkusTest")
}

compileKotlin {
{#if java.version == "11"}
kotlinOptions.jvmTarget = JavaVersion.VERSION_11
{#else}
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8
{/if}
kotlinOptions.javaParameters = true
}

compileTestKotlin {
{#if java.version == "11"}
kotlinOptions.jvmTarget = JavaVersion.VERSION_11
{#else}
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8
{/if}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{#include build-layout}
{#plugins}
plugins {
id 'scala'
id '{quarkus.plugin.id}'
}
{/plugins}
{/include}

compileScala {
scalaCompileOptions.encoding = 'UTF-8'
{#if java.version == "11"}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
{#else}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
{/if}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
Original file line number Diff line number Diff line change
@@ -1,63 +1,73 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${project_groupId}</groupId>
<artifactId>${project_artifactId}</artifactId>
<version>${project_version}</version>
<groupId>{project.group-id}</groupId>
<artifactId>{project.artifact-id}</artifactId>
<version>{project.version}</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>{java.version}</maven.compiler.source>
<maven.compiler.target>{java.version}</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>

<quarkus.platform.artifact-id>${bom_artifactId}</quarkus.platform.artifact-id>
<quarkus.platform.group-id>${bom_groupId}</quarkus.platform.group-id>
<quarkus.platform.version>${bom_version}</quarkus.platform.version>
<quarkus-plugin.version>${plugin_version}</quarkus-plugin.version>
<compiler-plugin.version>${compiler_plugin_version}</compiler-plugin.version>
<surefire-plugin.version>${surefire_plugin_version}</surefire-plugin.version>
<quarkus.platform.group-id>{quarkus.platform.group-id}</quarkus.platform.group-id>
<quarkus.platform.artifact-id>{quarkus.platform.artifact-id}</quarkus.platform.artifact-id>
<quarkus.platform.version>{quarkus.platform.version}</quarkus.platform.version>
<quarkus-plugin.version>{quarkus.plugin.version}</quarkus-plugin.version>
<compiler-plugin.version>{maven.version.maven-compiler-plugin}</compiler-plugin.version>
<surefire-plugin.version>{maven.version.maven-surefire-plugin}</surefire-plugin.version>
</properties>
${maven_repositories}${maven_plugin_repositories}

<dependencyManagement>
<dependencies>
<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>${quarkus.platform.artifact-id}</artifactId>
<version>${quarkus.platform.version}</version>
<groupId>$\{quarkus.platform.group-id}</groupId>
<artifactId>$\{quarkus.platform.artifact-id}</artifactId>
<version>$\{quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
{#each dependencies}
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
<groupId>{it.groupId}</groupId>
<artifactId>{it.artifactId}</artifactId>
{#if it.version}
<version>{it.version}</version>
{/if}
</dependency>
{/each}

<!-- Test dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
{#each test-dependencies}
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<groupId>{it.groupId}</groupId>
<artifactId>{it.artifactId}</artifactId>
{#if it.version}
<version>{it.version}</version>
{/if}
<scope>test</scope>
</dependency>
{/each}
</dependencies>

<build>
<plugins>
<!-- Quarkus build plugin - also provides the quarkus:dev live-reload feature -->
<plugin>
<groupId>${plugin_groupId}</groupId>
<artifactId>${plugin_artifactId}</artifactId>
<version>${quarkus-plugin.version}</version>
<groupId>{quarkus.plugin.group-id}</groupId>
<artifactId>{quarkus.plugin.artifact-id}</artifactId>
<version>$\{quarkus-plugin.version}</version>
<executions>
<execution>
<goals>
Expand All @@ -70,17 +80,17 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<version>$\{compiler-plugin.version}</version>
</plugin>
<!-- Run the tests in JVM mode -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>$\{surefire-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.home>$\{maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</plugin>
Expand All @@ -105,7 +115,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<version>$\{surefire-plugin.version}</version>
<executions>
<execution>
<goals>
Expand All @@ -114,9 +124,9 @@
</goals>
<configuration>
<systemPropertyVariables>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
<native.image.path>$\{project.build.directory}/$\{project.build.finalName}-runner</native.image.path>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.home>$\{maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: maven
type: buildtool
fallback: true
language:
base:
data:
maven:
version:
kotlin: 1.3.72
scala: 2.12.8
scala-maven-plugin: 4.1.1
maven-compiler-plugin: 3.8.1
maven-surefire-plugin: 2.22.1
shared-data:
buildtool:
build-dir: target
guide: https://quarkus.io/guides/maven-tooling.html
guide-native: https://quarkus.io/guides/building-native-image
cmd:
dev: ./mvnw compile quarkus:dev
package: ./mvnw package
package-uberjar: ./mvnw package -PuberJar
package-native: ./mvnw package -Pnative
package-native-container: ./mvnw package -Pnative -Dquarkus.native.container-build=true
Loading

0 comments on commit 51650ad

Please sign in to comment.