diff --git a/devtools/gradle/build.gradle b/devtools/gradle/build.gradle index 83db38211..3371351d5 100644 --- a/devtools/gradle/build.gradle +++ b/devtools/gradle/build.gradle @@ -18,12 +18,6 @@ repositories { mavenCentral() } -// Add a source set for the functional test suite -sourceSets { - functionalTest { - } -} - dependencies { api gradleApi() implementation "io.quarkus:quarkus-bootstrap-core:${version}" @@ -33,7 +27,7 @@ dependencies { implementation "io.quarkus:quarkus-development-mode:${version}" implementation "io.quarkus:quarkus-creator:${version}" - testImplementation 'org.assertj:assertj-core:3.13.2' + testImplementation 'org.assertj:assertj-core:3.14.0' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2' testImplementation 'org.junit.jupiter:junit-jupiter-params:5.5.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2' @@ -67,5 +61,26 @@ gradlePlugin { } } -buildScan { +// Add a source set for the functional test suite +sourceSets { + functionalTest { + } +} + +gradlePlugin.testSourceSets(sourceSets.functionalTest) +configurations.functionalTestImplementation.extendsFrom(configurations.testImplementation) +configurations.functionalTestRuntime.extendsFrom(configurations.testRuntimeOnly) + +// Add a task to run the functional tests +task functionalTest(type: Test) { + description = "Runs functional tests" + group = "verification" + useJUnitPlatform() + testClassesDirs = sourceSets.functionalTest.output.classesDirs + classpath = sourceSets.functionalTest.runtimeClasspath +} + +check { + // Run the functional tests as part of `check` + dependsOn(tasks.functionalTest) } \ No newline at end of file diff --git a/devtools/gradle/pom.xml b/devtools/gradle/pom.xml index ab68b537e..9233364bb 100644 --- a/devtools/gradle/pom.xml +++ b/devtools/gradle/pom.xml @@ -19,6 +19,8 @@ ./gradlew build false + true + true @@ -77,6 +79,15 @@ + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + + true + + diff --git a/devtools/gradle/src/functionalTest/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java b/devtools/gradle/src/functionalTest/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java new file mode 100644 index 000000000..aa1571997 --- /dev/null +++ b/devtools/gradle/src/functionalTest/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java @@ -0,0 +1,39 @@ +package io.quarkus.gradle; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; + +import io.quarkus.cli.commands.CreateProject; +import io.quarkus.cli.commands.writer.FileProjectWriter; +import io.quarkus.generators.BuildTool; +import org.gradle.testkit.runner.BuildResult; +import org.gradle.testkit.runner.GradleRunner; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import static org.assertj.core.api.Assertions.assertThat; + +public class QuarkusPluginFunctionalTest { + + @Test + public void canRunListExtensions(@TempDir File projectRoot) throws IOException { + assertThat(new CreateProject(new FileProjectWriter(projectRoot)) + .groupId("com.acme.foo") + .artifactId("foo") + .version("1.0.0-SNAPSHOT") + .buildTool(BuildTool.GRADLE) + .doCreateProject(new HashMap<>())) + .withFailMessage("Project was not created") + .isTrue(); + + BuildResult build = GradleRunner.create() + .forwardOutput() + .withPluginClasspath() + .withArguments("listExtensions") + .withProjectDir(projectRoot) + .build(); + + assertThat(build.getOutput()).contains("Quarkus - Core"); + } +}