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

WIP Reintroduces Gradle ITs in main tree #4579

Closed
wants to merge 4 commits into from
Closed
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: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ stages:
- tika
- hibernate-validator
- test-extension
- gradle
name: misc_2

- template: ci-templates/native-build-steps.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -245,12 +246,17 @@ public void execute() throws MojoExecutionException {

private void createGradleWrapper(File projectDirectory) {
try {
String gradleName = IS_WINDOWS ? "gradle.bat" : "gradle";
ProcessBuilder pb = new ProcessBuilder(gradleName, "wrapper",
"--gradle-version=" + MojoUtils.getGradleWrapperVersion()).directory(projectDirectory)
.inheritIO();
List<String> arguments = new ArrayList<>();
arguments.add(IS_WINDOWS ? "gradle.bat" : "gradle");
arguments.add("wrapper");
arguments.add("--gradle-version=" + MojoUtils.getGradleWrapperVersion());
// CI sets a different maven.repo.local
if (System.getenv("MAVEN_OPTS") != null) {
arguments.add(System.getenv("MAVEN_OPTS"));
}
ProcessBuilder pb = new ProcessBuilder(arguments).directory(projectDirectory)
.inheritIO();
Process x = pb.start();

x.waitFor();

if (x.exitValue() != 0) {
Expand Down
160 changes: 160 additions & 0 deletions integration-tests/gradle/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-build-parent</artifactId>
<version>999-SNAPSHOT</version>
<relativePath>../../build-parent/pom.xml</relativePath>
</parent>

<artifactId>quarkus-integration-test-gradle-plugin</artifactId>
<packaging>pom</packaging>
<name>Quarkus - Integration Tests - Gradle Plugin</name>
<description>Module that contains Gradle plugin related tests</description>

<properties>
<gradle.project.directory>${project.build.directory}/foo</gradle.project.directory>
<gradle.executable>${gradle.project.directory}/gradlew</gradle.executable>
<skip.gradle.build>${skipTests}</skip.gradle.build>
</properties>

<dependencies>
<!-- Ensures that the quarkus-gradle-plugin is built before this project-->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-gradle-plugin</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- Ensures that the quarkus-resteasy is built before this project-->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-deployment</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Always clean target/ before building -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-temp-project</id>
<phase>generate-sources</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Create the gradle project -->
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-gradle-project</id>
<goals>
<goal>create</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<projectGroupId>org.acme</projectGroupId>
<projectArtifactId>foo</projectArtifactId>
<className>org.acme.quickstart.GreetingResource</className>
<path>/hello</path>
<extensions>resteasy</extensions>
<buildTool>gradle</buildTool>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-gradle-plugin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>gradle-test</id>
<phase>test</phase>
<configuration>
<executable>${gradle.executable}</executable>
<basedir>${gradle.project.directory}</basedir>
<arguments>
<argument>test</argument>
<argument>-S</argument>
<argument>${env.MAVEN_OPTS}</argument>
</arguments>
<skip>${skip.gradle.build}</skip>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<gradle.executable>${gradle.project.directory}\gradlew.bat</gradle.executable>
</properties>
</profile>
<profile>
<id>native-image</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>run-native-integration-test</id>
<phase>integration-test</phase>
<configuration>
<executable>${gradle.executable}</executable>
<basedir>${gradle.project.directory}</basedir>
<arguments>
<argument>buildNative</argument>
<argument>--docker-build=true</argument>
<argument>testNative</argument>
<argument>-S</argument>
<argument>${env.MAVEN_OPTS}</argument>
</arguments>
<skip>${skip.gradle.build}</skip>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
1 change: 1 addition & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<module>elytron-resteasy</module>
<module>elytron-undertow</module>
<module>flyway</module>
<module>gradle</module>
<module>oidc</module>
<module>oidc-code-flow</module>
<module>keycloak-authorization</module>
Expand Down