Skip to content

Commit

Permalink
Init bootstrap gradle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
glefloch committed Jul 30, 2021
1 parent df3e7a7 commit 190490a
Show file tree
Hide file tree
Showing 111 changed files with 837 additions and 178 deletions.
27 changes: 27 additions & 0 deletions devtools/gradle/application-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
dependencies {
api gradleApi()

implementation "io.quarkus:quarkus-bootstrap-core:${version}"
implementation "io.quarkus:quarkus-devtools-common:${version}"
implementation "io.quarkus:quarkus-core-deployment:${version}"

testImplementation "io.quarkus:quarkus-project-core-extension-codestarts:${version}"
testImplementation 'org.assertj:assertj-core:3.20.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
testImplementation "io.quarkus:quarkus-devmode-test-utils:${version}"
testImplementation "io.quarkus:quarkus-devtools-testing:${version}"
testImplementation gradleTestKit()
}

group = "io.quarkus"

gradlePlugin {
plugins {
quarkusPlugin {
id = 'io.quarkus'
implementationClass = 'io.quarkus.gradle.QuarkusPlugin'
displayName = 'Quarkus Plugin'
description = 'Builds a Quarkus application, and provides helpers to launch dev-mode, the Quarkus CLI, building of native images'
}
}
}
89 changes: 89 additions & 0 deletions devtools/gradle/application-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.quarkus</groupId>
<artifactId>io.quarkus.gradle.plugin.parent</artifactId>
<version>999-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>io.quarkus.gradle.plugin</artifactId>
<packaging>pom</packaging>
<name>Quarkus - Gradle Plugin</name>
<description>Quarkus - Gradle Plugin</description>

<dependencies>
<!-- Compile -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-core</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-project-core-extension-codestarts</artifactId>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devmode-test-utils</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>build/libs/application-plugin-${project.version}.jar</file>
<type>jar</type>
</artifact>
<artifact>
<file>build/libs/application-plugin-${project.version}-javadoc.jar</file>
<type>jar</type>
<classifier>javadoc</classifier>
</artifact>
<artifact>
<file>build/libs/application-plugin-${project.version}-sources.jar</file>
<type>jar</type>
<classifier>sources</classifier>
</artifact>
</artifacts>
<skipAttach>${skip.gradle.build}</skipAttach>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
104 changes: 42 additions & 62 deletions devtools/gradle/build.gradle
Original file line number Diff line number Diff line change
@@ -1,79 +1,59 @@
plugins {
id 'com.gradle.plugin-publish' version '0.15.0'
id 'java-gradle-plugin'
}
if (JavaVersion.current().isJava9Compatible()) {
compileJava.options.compilerArgs.addAll(['--release', '11'])
}
compileJava {
options.encoding = 'UTF-8'
sourceCompatibility = '11'
targetCompatibility = '11'
id 'com.gradle.plugin-publish' version '0.15.0' apply false
}

compileTestJava {
options.encoding = 'UTF-8'
}
subprojects {
apply plugin: 'java-gradle-plugin'
apply plugin: 'com.gradle.plugin-publish'

repositories {
// in case a custom local repo is configured we are going to use that instead of the default mavenLocal()
if (System.properties.containsKey('maven.repo.local')) {
maven {
url System.properties.get('maven.repo.local')
}
} else {
mavenLocal()
if (JavaVersion.current().isJava9Compatible()) {
compileJava.options.compilerArgs.addAll(['--release', '11'])
}
compileJava {
options.encoding = 'UTF-8'
sourceCompatibility = '11'
targetCompatibility = '11'
}
mavenCentral()
}

dependencies {
api gradleApi()

implementation "io.quarkus:quarkus-bootstrap-core:${version}"
implementation "io.quarkus:quarkus-devtools-common:${version}"
implementation "io.quarkus:quarkus-core-deployment:${version}"

testImplementation "io.quarkus:quarkus-project-core-extension-codestarts:${version}"
testImplementation 'org.assertj:assertj-core:3.20.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
testImplementation "io.quarkus:quarkus-devmode-test-utils:${version}"
testImplementation "io.quarkus:quarkus-devtools-testing:${version}"
testImplementation gradleTestKit()
}

test {
// propagate the custom local maven repo, in case it's configured
if (System.properties.containsKey('maven.repo.local')) {
systemProperty 'maven.repo.local', System.properties.get('maven.repo.local')
compileTestJava {
options.encoding = 'UTF-8'
}
testLogging {
events "passed", "skipped", "failed"

repositories {
// in case a custom local repo is configured we are going to use that instead of the default mavenLocal()
if (System.properties.containsKey('maven.repo.local')) {
maven {
url System.properties.get('maven.repo.local')
}
} else {
mavenLocal()
}
mavenCentral()
}
useJUnitPlatform()
}

javadoc {
options.addStringOption('encoding', 'UTF-8')
}
test {
// propagate the custom local maven repo, in case it's configured
if (System.properties.containsKey('maven.repo.local')) {
systemProperty 'maven.repo.local', System.properties.get('maven.repo.local')
}
testLogging {
events "passed", "skipped", "failed"
}
useJUnitPlatform()
}

pluginBundle {
website = 'https://quarkus.io/'
vcsUrl = 'https://github.com/quarkusio/quarkus'
tags = ['quarkus', 'quarkusio', 'graalvm']
}
javadoc {
options.addStringOption('encoding', 'UTF-8')
}

gradlePlugin {
plugins {
quarkusPlugin {
id = 'io.quarkus'
implementationClass = 'io.quarkus.gradle.QuarkusPlugin'
displayName = 'Quarkus Plugin'
description = 'Builds a Quarkus application, and provides helpers to launch dev-mode, the Quarkus CLI, building of native images'
}
pluginBundle {
website = 'https://quarkus.io/'
vcsUrl = 'https://github.com/quarkusio/quarkus'
tags = ['quarkus', 'quarkusio', 'graalvm']
}
}

wrapper {
distributionType = Wrapper.DistributionType.ALL
}

24 changes: 24 additions & 0 deletions devtools/gradle/extension-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
dependencies {
api gradleApi()

implementation "io.quarkus:quarkus-bootstrap-core:${version}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}"

testImplementation gradleTestKit()
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
testImplementation 'org.assertj:assertj-core:3.20.2'
}

group = "io.quarkus.extension"

gradlePlugin {
plugins {
quarkusBootstrapPlugin {
id = 'io.quarkus.extension'
implementationClass = 'io.quarkus.extension.gradle.QuarkusExtensionPlugin'
displayName = 'Quarkus Extension Plugin'
description = 'Builds a Quarkus extension'
}
}
}
1 change: 1 addition & 0 deletions devtools/gradle/extension-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jacksonVersion = 2.12.4
63 changes: 63 additions & 0 deletions devtools/gradle/extension-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.quarkus</groupId>
<artifactId>io.quarkus.gradle.plugin.parent</artifactId>
<version>999-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>io.quarkus.extension</groupId>
<artifactId>io.quarkus.extension.gradle.plugin</artifactId>
<packaging>pom</packaging>
<name>Quarkus - Extension Gradle Plugin</name>
<description>Quarkus - Extension Gradle Plugin</description>

<dependencies>
<!-- Compile -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-core</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>build/libs/extension-plugin-${project.version}.jar</file>
<type>jar</type>
</artifact>
<artifact>
<file>build/libs/extension-plugin-${project.version}-javadoc.jar</file>
<type>jar</type>
<classifier>javadoc</classifier>
</artifact>
<artifact>
<file>build/libs/extension-plugin-${project.version}-sources.jar</file>
<type>jar</type>
<classifier>sources</classifier>
</artifact>
</artifacts>
<skipAttach>${skip.gradle.build}</skipAttach>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.quarkus.extension.gradle;

import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.tasks.TaskContainer;

import io.quarkus.extension.gradle.tasks.ExtensionDescriptorTask;

public class QuarkusExtensionPlugin implements Plugin<Project> {

public static final String EXTENSION_DESCRIPTOR_TASK_NAME = "extensionDescriptor";

@Override
public void apply(Project project) {
registerTasks(project);
}

private void registerTasks(Project project) {
TaskContainer tasks = project.getTasks();
ExtensionDescriptorTask extensionDescriptorTask = tasks.create(EXTENSION_DESCRIPTOR_TASK_NAME,
ExtensionDescriptorTask.class);

project.getPlugins().withType(
JavaPlugin.class,
javaPlugin -> {
Task jarTask = tasks.getByName(JavaPlugin.JAR_TASK_NAME);
jarTask.dependsOn(extensionDescriptorTask);
});
}
}
Loading

0 comments on commit 190490a

Please sign in to comment.