From d8b299226780f2703afca8c423a55a959d3d496b Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Sun, 27 Mar 2022 17:53:47 +0200 Subject: [PATCH 1/7] Remove quarkus-jsonp-deployment dependency from test-framework/common --- extensions/reactive-routes/deployment/pom.xml | 5 +++++ .../hibernate-orm-rest-data-panache/pom.xml | 18 ++++++++++++++++++ integration-tests/spring-data-rest/pom.xml | 18 ++++++++++++++++++ test-framework/common/pom.xml | 4 ---- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/extensions/reactive-routes/deployment/pom.xml b/extensions/reactive-routes/deployment/pom.xml index 8cbfb0878fc99..4177dcd50cf4f 100644 --- a/extensions/reactive-routes/deployment/pom.xml +++ b/extensions/reactive-routes/deployment/pom.xml @@ -34,6 +34,11 @@ quarkus-hibernate-validator-spi + + io.quarkus + quarkus-jsonp-deployment + test + io.quarkus quarkus-security-deployment diff --git a/integration-tests/hibernate-orm-rest-data-panache/pom.xml b/integration-tests/hibernate-orm-rest-data-panache/pom.xml index 6811ac56be68d..7d46ca2e522f0 100644 --- a/integration-tests/hibernate-orm-rest-data-panache/pom.xml +++ b/integration-tests/hibernate-orm-rest-data-panache/pom.xml @@ -39,6 +39,11 @@ quarkus-test-h2 test + + io.quarkus + quarkus-jsonp + test + org.assertj assertj-core @@ -64,6 +69,19 @@ + + io.quarkus + quarkus-jsonp-deployment + ${project.version} + pom + test + + + * + * + + + io.quarkus quarkus-jdbc-h2-deployment diff --git a/integration-tests/spring-data-rest/pom.xml b/integration-tests/spring-data-rest/pom.xml index 918a7937951ba..0bbaf7037c91c 100644 --- a/integration-tests/spring-data-rest/pom.xml +++ b/integration-tests/spring-data-rest/pom.xml @@ -39,6 +39,11 @@ quarkus-test-h2 test + + io.quarkus + quarkus-jsonp + test + org.assertj assertj-core @@ -77,6 +82,19 @@ + + io.quarkus + quarkus-jsonp-deployment + ${project.version} + pom + test + + + * + * + + + io.quarkus quarkus-resteasy-jackson-deployment diff --git a/test-framework/common/pom.xml b/test-framework/common/pom.xml index f88c88f89a4c3..f4c2e5ee101f1 100644 --- a/test-framework/common/pom.xml +++ b/test-framework/common/pom.xml @@ -18,10 +18,6 @@ io.quarkus quarkus-core-deployment - - io.quarkus - quarkus-jsonp-deployment - org.jboss jandex From 562dbcca28ed9a2ea322f8c5385b5e121b46ee08 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Sun, 27 Mar 2022 23:03:27 +0200 Subject: [PATCH 2/7] Move unpack-dependencies to prepare-package in core/launcher --- core/launcher/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/launcher/pom.xml b/core/launcher/pom.xml index dad544a5ec63c..72c41caefcddd 100644 --- a/core/launcher/pom.xml +++ b/core/launcher/pom.xml @@ -35,7 +35,7 @@ unpack-dependencies - process-classes + prepare-package unpack-dependencies From dc713e3601c0698a19dfd147e9f36a6dee15b9ef Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Thu, 24 Mar 2022 11:38:58 +0100 Subject: [PATCH 3/7] Add OpenRewrite infrastructure and rewrite the bootstrap module --- bom/application/pom.xml | 34 ++ extensions/arc/deployment/pom.xml | 9 + independent-projects/arc/pom.xml | 11 + independent-projects/bootstrap/bom/pom.xml | 14 + independent-projects/bootstrap/pom.xml | 23 ++ .../resteasy-reactive/pom.xml | 23 ++ .../tools/devtools-common/pom.xml | 11 + independent-projects/tools/pom.xml | 26 ++ .../test-extension/extension/runtime/pom.xml | 9 + jakarta/rewrite.yml | 297 ++++++++++++++++++ jakarta/transform.sh | 214 +++++++++++-- pom.xml | 11 + 12 files changed, 652 insertions(+), 30 deletions(-) create mode 100644 jakarta/rewrite.yml diff --git a/bom/application/pom.xml b/bom/application/pom.xml index b16c5f3dd884b..5d88b7515ebfe 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -5743,6 +5743,40 @@ + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.maven.javax.managed + io.quarkus.maven.javax.versions + io.quarkus.jakarta-versions + io.quarkus.jakarta-jaxrs-jaxb + io.quarkus.jakarta-security + io.quarkus.smallrye + + + + + + + rewrite-cleanup + + + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.jakarta-jaxrs-jaxb-cleanup + io.quarkus.jakarta-security-cleanup + + + + + + + diff --git a/extensions/arc/deployment/pom.xml b/extensions/arc/deployment/pom.xml index 954e712e52ae3..415a447ba3b90 100644 --- a/extensions/arc/deployment/pom.xml +++ b/extensions/arc/deployment/pom.xml @@ -64,6 +64,15 @@ + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.extensions.arc + + + diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 05f841b6eb804..7e0aca2618b62 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -300,6 +300,17 @@ ${format.skip} + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + io.quarkus.jakarta-versions + + + diff --git a/independent-projects/bootstrap/bom/pom.xml b/independent-projects/bootstrap/bom/pom.xml index 0229407f6482e..b6e615acbb1da 100644 --- a/independent-projects/bootstrap/bom/pom.xml +++ b/independent-projects/bootstrap/bom/pom.xml @@ -353,4 +353,18 @@ + + + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.maven.javax.allow + io.quarkus.maven.javax.managed + + + + + diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index b30ecd7564e2d..0066dc4234c39 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -220,8 +220,31 @@ ${format.skip} + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + + + + + + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.jakarta-versions + io.quarkus.maven.javax.versions + + + + diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 60dc9e02ac589..388ab830aea7b 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -481,8 +481,31 @@ ${format.skip} + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + + + + + + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.jakarta-versions + io.quarkus.jakarta-jaxrs-jaxb + + + + diff --git a/independent-projects/tools/devtools-common/pom.xml b/independent-projects/tools/devtools-common/pom.xml index 6e21e827b25d1..6c316b1104fbe 100644 --- a/independent-projects/tools/devtools-common/pom.xml +++ b/independent-projects/tools/devtools-common/pom.xml @@ -23,6 +23,17 @@ true + + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.maven.javax.allow + + + + diff --git a/independent-projects/tools/pom.xml b/independent-projects/tools/pom.xml index ef5f587255919..a83e07e5ca08f 100644 --- a/independent-projects/tools/pom.xml +++ b/independent-projects/tools/pom.xml @@ -240,6 +240,21 @@ + + + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + + + + + + org.apache.maven.plugins @@ -368,6 +383,17 @@ ${format.skip} + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.maven.javax.managed + io.quarkus.maven.javax.versions + io.quarkus.jakarta-versions + + + diff --git a/integration-tests/test-extension/extension/runtime/pom.xml b/integration-tests/test-extension/extension/runtime/pom.xml index 3b5c92e244a8f..6f45cbadc0229 100644 --- a/integration-tests/test-extension/extension/runtime/pom.xml +++ b/integration-tests/test-extension/extension/runtime/pom.xml @@ -128,6 +128,15 @@ + + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.jakarta-jaxb-switch + + + diff --git a/jakarta/rewrite.yml b/jakarta/rewrite.yml new file mode 100644 index 0000000000000..9036e917a814c --- /dev/null +++ b/jakarta/rewrite.yml @@ -0,0 +1,297 @@ +--- +type: specs.openrewrite.org/v1beta/style +name: io.quarkus.style.maven +styleConfigs: + - org.openrewrite.xml.style.TabsAndIndentsStyle: + useTabCharacter: false + tabSize: 1 + indentSize: 4 +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.jakarta-versions +displayName: Adjust Jakarta versions +recipeList: + # Activation + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.activation.version + newValue: 2.0.1 + # Annotation + - org.openrewrite.maven.ChangePropertyValue: + key: version.jakarta-annotation + newValue: 2.0.0 + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.annotation-api.version + newValue: 2.0.0 + # EL + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.el-impl.version + newValue: 4.0.1 + # CDI + - org.openrewrite.maven.ChangePropertyValue: + key: version.cdi + newValue: 3.0.0 + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.enterprise.cdi-api.version + newValue: 3.0.0 + # Inject + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.inject-api.version + newValue: 2.0.0 + # Interceptor + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.interceptor-api.version + newValue: 2.0.0 + # JAX-RS - See below + # JAXB - See below + # JSON + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.json.version + newValue: 2.0.0 + # JSON Bind + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.json.bind-api.version + newValue: 2.0.0 + - org.openrewrite.maven.ChangePropertyValue: + key: yasson.version + newValue: 2.0.4 + # JPA + - org.openrewrite.maven.ChangePropertyValue: + key: version.jpa + newValue: 3.0.0 + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.persistence-api.version + newValue: 3.0.0 + # Security - See below + # Servlet + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.servlet-api.version + newValue: 5.0.0 + # Transaction + - org.openrewrite.maven.ChangePropertyValue: + key: version.jta + newValue: 2.0.0 + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.transaction-api.version + newValue: 2.0.0 + # Validation + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.validation-api.version + newValue: 3.0.1 + # Websockets + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.websocket-api.version + newValue: 2.0.0 + # XML Bind + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.xml.bind-api.version + newValue: 3.0.1 + - org.openrewrite.maven.ChangePropertyValue: + key: jaxb-runtime.version + newValue: 3.0.2 +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.jakarta-jaxrs-jaxb +displayName: Adjust JAX-RS/JAXB dependencies +recipeList: + - org.openrewrite.maven.AddManagedDependency: + groupId: jakarta.xml.bind + artifactId: jakarta.xml.bind-api + version: "${jakarta.xml.bind-api.version}" + - org.openrewrite.maven.AddManagedDependency: + groupId: org.jboss.spec.javax.ws.rs + artifactId: jboss-jaxrs-api_3.0_spec + version: "${jboss-jaxrs-api_3.0_spec.version}" + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.xml.bind-api.version + newValue: 3.0.1 + addIfMissing: true + - org.openrewrite.maven.ChangePropertyValue: + key: jboss-jaxrs-api_3.0_spec.version + newValue: 1.0.1.Final + addIfMissing: true +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.jakarta-jaxrs-jaxb-cleanup +displayName: Adjust JAX-RS/JAXB dependencies +recipeList: + - org.openrewrite.maven.RemoveManagedDependency: + groupId: org.jboss.spec.javax.xml.bind + artifactId: jboss-jaxb-api_2.3_spec + - org.openrewrite.maven.RemoveManagedDependency: + groupId: org.jboss.spec.javax.ws.rs + artifactId: jboss-jaxrs-api_2.1_spec + - org.openrewrite.maven.RemoveProperty: + propertyName: jboss-jaxrs-api_2.1_spec.version + - org.openrewrite.maven.RemoveProperty: + propertyName: jboss-jaxb-api_2.3_spec.version +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.jakarta-jaxb-switch +displayName: Switch JAXB version +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + oldGroupId: org.jboss.spec.javax.xml.bind + oldArtifactId: jboss-jaxb-api_2.3_spec + newGroupId: jakarta.xml.bind + newArtifactId: jakarta.xml.bind-api + - org.openrewrite.maven.RemoveExclusion: + groupId: jakarta.xml.bind + artifactId: jakarta.xml.bind-api +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.jakarta-security +displayName: Adjust Javax security dependencies +recipeList: + - org.openrewrite.maven.AddManagedDependency: + groupId: jakarta.authorization + artifactId: jakarta.authorization-api + version: "${jakarta.authorization-api.version}" + - org.openrewrite.maven.AddManagedDependency: + groupId: jakarta.authentication + artifactId: jakarta.authentication-api + version: "${jakarta.authentication-api}" + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.authorization-api.version + newValue: 2.0.0 + addIfMissing: true + - org.openrewrite.maven.ChangePropertyValue: + key: jakarta.authentication-api + newValue: 2.0.0 + addIfMissing: true +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.jakarta-security-cleanup +displayName: Adjust Javax security dependencies +recipeList: + - org.openrewrite.maven.RemoveManagedDependency: + groupId: jakarta.security.jacc + artifactId: jakarta.security.jacc-api + - org.openrewrite.maven.RemoveManagedDependency: + groupId: jakarta.security.auth.message + artifactId: jakarta.security.auth.message-api + - org.openrewrite.maven.RemoveProperty: + propertyName: jakarta.security.jacc-api.version + - org.openrewrite.maven.RemoveProperty: + propertyName: jakarta.security.auth.message-api.version +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.smallrye +displayName: Adjust SmallRye dependencies +recipeList: + - org.openrewrite.maven.ChangePropertyValue: + key: smallrye-common.version + newValue: 2.0.0-RC2 + - org.openrewrite.maven.ChangePropertyValue: + key: microprofile-context-propagation.version + newValue: 1.3 + - org.openrewrite.maven.ChangePropertyValue: + key: smallrye-context-propagation.version + newValue: 2.0.0-RC1 + - org.openrewrite.maven.ChangePropertyValue: + key: microprofile-config-api.version + newValue: 3.0 + - org.openrewrite.maven.ChangePropertyValue: + key: smallrye-config.version + newValue: 3.0.0-SNAPSHOT + - org.openrewrite.maven.ChangePropertyValue: + key: smallrye-health.version + newValue: 4.0.0-RC1 + - org.openrewrite.maven.ChangePropertyValue: + key: microprofile-metrics-api.version + newValue: 4.0.1 + - org.openrewrite.maven.ChangePropertyValue: + key: smallrye-metrics.version + newValue: 4.0.0-RC1 +# In progress, these ones need a change: +# 2.0 +# 1.0.1 +# 2.0 +# 1.2 +# 1.0 +# 2.1.22 +# 1.4.3 +# 2.1.0 +# 5.3.1 +# 3.3.3 +# 1.0.13 +# 2.6.0 +# 2.19.0 +# 3.15.0 +# 1.1.0 +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.maven.javax.managed +displayName: Adjust inject dependencies for Maven +recipeList: + - org.openrewrite.maven.AddManagedDependency: + groupId: javax.inject + artifactId: javax.inject + version: "${javax.inject.version}" + - org.openrewrite.maven.AddManagedDependency: + groupId: javax.annotation + artifactId: javax.annotation-api + version: "${javax.annotation-api.version}" +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.maven.javax.allow +displayName: Adjust inject dependencies for Maven +recipeList: + - org.openrewrite.maven.RemoveExclusion: + groupId: org.apache.maven + artifactId: maven-plugin-api + exclusionGroupId: javax.inject + exclusionArtifactId: javax.inject + - org.openrewrite.maven.RemoveExclusion: + groupId: org.apache.maven + artifactId: maven-plugin-api + exclusionGroupId: javax.annotation + exclusionArtifactId: javax.annotation-api + - org.openrewrite.maven.RemoveExclusion: + groupId: org.apache.maven + artifactId: maven-core + exclusionGroupId: javax.inject + exclusionArtifactId: javax.inject + - org.openrewrite.maven.RemoveExclusion: + groupId: org.apache.maven + artifactId: maven-embedder + exclusionGroupId: javax.inject + exclusionArtifactId: javax.inject + - org.openrewrite.maven.RemoveExclusion: + groupId: org.apache.maven + artifactId: maven-embedder + exclusionGroupId: javax.annotation + exclusionArtifactId: javax.annotation-api + - org.openrewrite.maven.RemoveExclusion: + groupId: org.apache.maven + artifactId: maven-resolver-provider + exclusionGroupId: javax.inject + exclusionArtifactId: javax.inject + - org.openrewrite.maven.RemoveExclusion: + groupId: org.apache.maven + artifactId: maven-settings-builder + exclusionGroupId: javax.inject + exclusionArtifactId: javax.inject +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.maven.javax.versions +displayName: Adjust bootstrap +recipeList: + - org.openrewrite.maven.ChangePropertyValue: + key: javax.inject.version + newValue: 1 + addIfMissing: true + - org.openrewrite.maven.ChangePropertyValue: + key: javax.annotation-api.version + newValue: 1.3.2 + addIfMissing: true +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.extensions.arc +displayName: Adjust ArC extension +recipeList: + - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + oldGroupId: org.jboss.spec.javax.ejb + oldArtifactId: jboss-ejb-api_3.1_spec + newGroupId: jakarta.ejb + newArtifactId: jakarta.ejb-api + newVersion: 4.0.0 diff --git a/jakarta/transform.sh b/jakarta/transform.sh index 6810db52bf56c..21aae9ef3c76b 100755 --- a/jakarta/transform.sh +++ b/jakarta/transform.sh @@ -1,5 +1,8 @@ #!/bin/bash +set -e -u -o pipefail +shopt -s failglob + # This script is used to gradually transform Quarkus bits from javax to jakarta namespaces and update dependencies # Each transformed module/project is expected to: @@ -7,37 +10,107 @@ # b) update dependencies to their respective EE 9 versions # c) add a build and test command that will verify the functionality -quarkusPath="$(pwd)" -echo "Path to quarkus repo is: $quarkusPath" - -BOM="$quarkusPath/bom/application/pom.xml" +if [ ! -f dco.txt ]; then + echo "ERROR: This script has to be run from the root of the Quarkus project" + exit 1 +fi + +# Prepare OpenRewrite - we temporarily build a local version as we need a patch +rm -rf target/rewrite +git clone git@github.com:gsmet/rewrite.git target/rewrite +pushd target/rewrite +git checkout jakarta +./gradlew -x test -x javadoc publishToMavenLocal +popd + +rm -rf target/rewrite-maven-plugin +git clone git@github.com:gsmet/rewrite-maven-plugin.git target/rewrite-maven-plugin +pushd target/rewrite-maven-plugin +git checkout jakarta +./mvnw clean install -DskipTests -DskipITs +popd + +# Build SmallRye Config (temporary) +rm -rf target/smallrye-config +git clone git@github.com:smallrye/smallrye-config.git target/smallrye-config +pushd target/smallrye-config +git checkout jakarta +mvn clean install -DskipTests -DskipITs +popd # Set up jbang alias, we are using latest released transformer version jbang alias add --name transform org.eclipse.transformer:org.eclipse.transformer.cli:0.2.0 +start_module () { + echo "# $1" +} + # Function to help transform a particular Maven module using Eclipse Transformer transform_module () { - local modulePath="$quarkusPath/$1" - local transformationTemp="$quarkusPath/JAKARTA_TEMP" + local modulePath="$1" + local transformationTemp="JAKARTA_TEMP" rm -Rf $transformationTemp mkdir $transformationTemp - echo "Transforming $modulePath" + echo " - Transforming $modulePath" jbang transform -o $modulePath $transformationTemp rm -Rf "$modulePath" mv "$transformationTemp" "$modulePath" - echo "Transformation done" + echo " > Transformation done" +} + +# Rewrite a module with OpenRewrite +rewrite_module () { + local modulePath="$1" + echo " - Rewriting $modulePath" + ./mvnw -B rewrite:run -f "${modulePath}/pom.xml" -N + echo " > Rewriting done" +} + +# Rewrite a module with OpenRewrite but with the rewrite-cleanup profile +rewrite_module_cleanup () { + local modulePath="$1" + echo " - Rewriting $modulePath" + ./mvnw -B rewrite:run -f "${modulePath}/pom.xml" -N -Prewrite-cleanup + echo " > Rewriting done" +} + +# Remove a banned dependency +remove_banned_dependency () { + sed -i "s@$2@@g" $1/pom.xml +} + +# Update a banned dependency +update_banned_dependency () { + sed -i "s@$2@$3@g" $1/pom.xml +} + +update_banned_dependency_advanced () { + sed -i "s@$2@$3@g" $1/pom.xml } # Build, test and install a particular maven module (chosen by relative path) build_module () { - local pomPath="$quarkusPath/$1/pom.xml" + local pomPath="$1/pom.xml" ./mvnw -B clean install -f "$pomPath" - echo "Installed newly built $pomPath" + echo " - Installed newly built $pomPath" +} + +# Build module without testing it +build_module_no_tests () { + local pomPath="$1/pom.xml" + ./mvnw -B clean install -f "$pomPath" -DskipTests -DskipITs + echo " - Installed newly built $pomPath" +} + +build_module_only_no_tests () { + local pomPath="$1/pom.xml" + ./mvnw -B clean install -f "$pomPath" -DskipTests -DskipITs -N + echo " - Installed newly built $pomPath" } # Sets the EDITING variable to the file being edited by set_property edit_begin () { - EDITING="$quarkusPath/$1" + EDITING="$1" } # Finds a particular property and replaces its value @@ -50,30 +123,111 @@ set_property () { sed -i "s/<$propName>.*<\/$propName>/<$propName>$propValue<\/$propName>/g" "$EDITING" } -# Arc project transformation -transform_module "independent-projects/arc" +# Install root parent +./mvnw clean install -N -# Now we need to update CDI, JTA, JPA and common annotations artifacts -edit_begin "independent-projects/arc/pom.xml" -set_property "version.cdi" "3.0.0" -set_property "version.jta" "2.0.0" -set_property "version.jakarta-annotation" "2.0.0" -set_property "version.jpa" "3.0.0" +# Install utility projects +build_module_no_tests "independent-projects/ide-config" +build_module_no_tests "independent-projects/enforcer-rules" +build_module_no_tests "independent-projects/revapi" -# Test & install modified Arc +# ArC +start_module "ArC" +transform_module "independent-projects/arc" +rewrite_module "independent-projects/arc" build_module "independent-projects/arc" -# Switch parent BOM to Jakarta artifacts -edit_begin "bom/application/pom.xml" -set_property "jakarta.inject-api.version" "2.0.0" -set_property "jakarta.interceptor-api.version" "2.0.0" -set_property "jakarta.transaction-api.version" "2.0.0" -set_property "jakarta.enterprise.cdi-api.version" "3.0.0" -set_property "jakarta.annotation-api.version" "2.0.0" -set_property "jakarta.persistence-api.version" "3.0.0" - -# Install the modified BOM: +# Bootstrap +start_module "Bootstrap" +rewrite_module "independent-projects/bootstrap/bom" +rewrite_module "independent-projects/bootstrap" +remove_banned_dependency "independent-projects/bootstrap" 'javax.inject:javax.inject' 'we allow javax.inject for Maven' +remove_banned_dependency "independent-projects/bootstrap" 'javax.annotation:javax.annotation-api' 'we allow javax.annotation-api for Maven' +build_module "independent-projects/bootstrap" + +# Qute +build_module_no_tests "independent-projects/qute" + +# Tools +remove_banned_dependency "independent-projects/tools" 'javax.inject:javax.inject' 'we allow javax.inject for Maven' +remove_banned_dependency "independent-projects/tools" 'javax.annotation:javax.annotation-api' 'we allow javax.annotation-api for Maven' +build_module_no_tests "independent-projects/tools" +rewrite_module "independent-projects/tools/devtools-common" +rewrite_module "independent-projects/tools" +build_module "independent-projects/tools" + +## Starting here, we don't run the tests until post cleanup phase, use build_module_no_tests +## and then add another build of your module after the Clean up phase + +# BOM +start_module "BOM" +rewrite_module "bom/application" +build_module_no_tests "bom/application" +build_module_only_no_tests "bom/test" + +# Build parent +start_module "Build parent" +remove_banned_dependency "build-parent" 'javax.inject:javax.inject' 'we allow javax.inject for Maven' +remove_banned_dependency "build-parent" 'javax.annotation:javax.annotation-api' 'we allow javax.annotation-api for Maven' +update_banned_dependency "build-parent" 'jakarta.xml.bind:jakarta.xml.bind-api' 'org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec' +update_banned_dependency_advanced "build-parent" 'jakarta.ws.rs:jakarta.ws.rs-api' "jakarta.ws.rs:jakarta.ws.rs-api\n org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec" +build_module_no_tests "build-parent" + +# Needed for core +build_module_only_no_tests devtools +build_module_no_tests "devtools/platform-descriptor-json-plugin" +build_module_no_tests "devtools/platform-properties" + +# Core +transform_module "core" +build_module_no_tests "core" +build_module_no_tests "core" + +# Test framework +transform_module "test-framework" + +## Clean up phase +## This removes the dependencies that shouldn't be there anymore - we need to do that once everything has been rewritten +rewrite_module_cleanup "bom/application" + +# Build build_module "bom/application" +build_module "bom/test" +build_module "build-parent" +build_module "core" +build_module_only_no_tests "test-framework" +build_module "test-framework/common" +build_module "test-framework/devmode-test-utils" +build_module "test-framework/junit5-properties" +build_module "test-framework/junit5" +build_module "test-framework/junit5-internal" +build_module "test-framework/maven" + +# Extensions +transform_module "extensions" +build_module_only_no_tests "extensions" +build_module_only_no_tests "extensions/vertx-http" +build_module "extensions/vertx-http/dev-console-runtime-spi" +build_module "extensions/vertx-http/dev-console-spi" +# couldn't find a way to apply a rewrite here because we can't build the runtime module without the deployment module around :/ +# I'm working on a different approach but let's live with it for now as I'm not sure my approach will fly and I want to unblock other people +sed -i 's@org.jboss.spec.javax.ejb@jakarta.ejb@' extensions/arc/deployment/pom.xml +sed -i 's@jboss-ejb-api_3.1_spec@jakarta.ejb-api@' extensions/arc/deployment/pom.xml +sed -i 's@1.0.2.Final@4.0.0@' extensions/arc/deployment/pom.xml +build_module "extensions/arc" + +exit 1 + +# These ones require ArC and Munity extensions +#build_module "test-framework/junit5-mockito-config" +#build_module "test-framework/junit5-mockito" + +# Dev Tools - needs to be done after all the extensions have been built and before we run the ITs +#transform_module "devtools" +#build_module_no_tests "devtools" + +# For later, now that I moved it out of core +#rewrite_module "core/test-extension/runtime" ## Arc Extension [Incomplete: other modules need to go first] diff --git a/pom.xml b/pom.xml index 2405e6b442062..72b2e6cc22f08 100644 --- a/pom.xml +++ b/pom.xml @@ -143,6 +143,17 @@ quarkus-platform-bom-maven-plugin ${quarkus-platform-bom-plugin.version} + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + + + + From 340ac5fdc6b13bfc50439adf645a985e582e9dc6 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Sun, 27 Mar 2022 22:40:35 +0200 Subject: [PATCH 4/7] Use a new approach by running OpenRewrite globally This simplifies things a lot but requires a few adjustments to be able to skip compilation during the run. --- independent-projects/arc/pom.xml | 15 ++- independent-projects/bootstrap/pom.xml | 1 + independent-projects/enforcer-rules/pom.xml | 15 +++ independent-projects/ide-config/pom.xml | 11 ++ independent-projects/qute/pom.xml | 11 ++ .../resteasy-reactive/pom.xml | 1 + independent-projects/revapi/pom.xml | 15 +++ independent-projects/tools/pom.xml | 1 + jakarta/transform.sh | 125 ++++++++++-------- 9 files changed, 135 insertions(+), 60 deletions(-) diff --git a/independent-projects/arc/pom.xml b/independent-projects/arc/pom.xml index 7e0aca2618b62..054cf98d31143 100644 --- a/independent-projects/arc/pom.xml +++ b/independent-projects/arc/pom.xml @@ -306,13 +306,22 @@ 4.21.0-SNAPSHOT ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml - - io.quarkus.jakarta-versions - + + + false + org.openrewrite.maven + rewrite-maven-plugin + + + io.quarkus.jakarta-versions + + + + diff --git a/independent-projects/bootstrap/pom.xml b/independent-projects/bootstrap/pom.xml index 0066dc4234c39..778c20f622c88 100644 --- a/independent-projects/bootstrap/pom.xml +++ b/independent-projects/bootstrap/pom.xml @@ -235,6 +235,7 @@ + false org.openrewrite.maven rewrite-maven-plugin diff --git a/independent-projects/enforcer-rules/pom.xml b/independent-projects/enforcer-rules/pom.xml index ba8e40eaf92a2..5ee2f1a502e0f 100644 --- a/independent-projects/enforcer-rules/pom.xml +++ b/independent-projects/enforcer-rules/pom.xml @@ -72,6 +72,21 @@ + + + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + + + + + + maven-invoker-plugin diff --git a/independent-projects/ide-config/pom.xml b/independent-projects/ide-config/pom.xml index 91d76a990b33c..60b010fa20eeb 100644 --- a/independent-projects/ide-config/pom.xml +++ b/independent-projects/ide-config/pom.xml @@ -64,6 +64,17 @@ ${jacoco.agent.argLine} + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + + + + diff --git a/independent-projects/qute/pom.xml b/independent-projects/qute/pom.xml index 3f9e4425b31e4..79b8ed89242d6 100644 --- a/independent-projects/qute/pom.xml +++ b/independent-projects/qute/pom.xml @@ -234,6 +234,17 @@ ${format.skip} + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + + + + diff --git a/independent-projects/resteasy-reactive/pom.xml b/independent-projects/resteasy-reactive/pom.xml index 388ab830aea7b..c7b7d9b0082ab 100644 --- a/independent-projects/resteasy-reactive/pom.xml +++ b/independent-projects/resteasy-reactive/pom.xml @@ -496,6 +496,7 @@ + false org.openrewrite.maven rewrite-maven-plugin diff --git a/independent-projects/revapi/pom.xml b/independent-projects/revapi/pom.xml index 6f07560044ef6..81e35f11c0f9e 100644 --- a/independent-projects/revapi/pom.xml +++ b/independent-projects/revapi/pom.xml @@ -35,6 +35,21 @@ + + + + org.openrewrite.maven + rewrite-maven-plugin + 4.21.0-SNAPSHOT + + ${maven.multiModuleProjectDirectory}/jakarta/rewrite.yml + + + + + + +