Skip to content

Commit

Permalink
Merge pull request quarkusio#24511 from Sanne/JakartaWIP
Browse files Browse the repository at this point in the history
Jakarta transformation WIP
  • Loading branch information
gsmet authored Mar 24, 2022
2 parents 03741c1 + 734bde7 commit f919dcd
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@
<configuration>
<!-- store outside of target to speed up formatting when mvn clean is used -->
<cachedir>.cache/impsort-maven-plugin-${impsort-maven-plugin.version}</cachedir>
<groups>java.,javax.,org.,com.</groups>
<groups>java.,javax.,jakarta.,org.,com.</groups>
<staticGroups>*</staticGroups>
<skip>${format.skip}</skip>
<removeUnused>true</removeUnused>
Expand Down
6 changes: 6 additions & 0 deletions extensions/hibernate-orm/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>quarkus-local-cache</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Technically the quarkus-caffeine-runtime belongs as a dependency to the Quarkus Caching layer,
but since this is currently shaped as a non-quarkus external project I'd rather not have it depend on
Expand Down
73 changes: 62 additions & 11 deletions jakarta/transform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,74 @@
quarkusPath="$(pwd)"
echo "Path to quarkus repo is: $quarkusPath"

BOM="$quarkusPath/bom/application/pom.xml"

# 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

# Arc project transformation
jbang transform "$quarkusPath/independent-projects/arc"
# Function to help transform a particular Maven module using Eclipse Transformer
transform_module () {
local modulePath="$quarkusPath/$1"
local transformationTemp="$quarkusPath/JAKARTA_TEMP"
rm -Rf $transformationTemp
mkdir $transformationTemp
echo "Transforming $modulePath"
jbang transform -o $modulePath $transformationTemp
rm -Rf "$modulePath"
mv "$transformationTemp" "$modulePath"
echo "Transformation done"
}

# Build, test and install a particular maven module (chosen by relative path)
build_module () {
local pomPath="$quarkusPath/$1/pom.xml"
./mvnw -B clean install -f "$pomPath"
echo "Installed newly built $pomPath"
}

# Sets the EDITING variable to the file being edited by set_property
edit_begin () {
EDITING="$quarkusPath/$1"
}

# Replace old sources with newly generated ones
rm -rf "$quarkusPath/independent-projects/arc"
mv "$quarkusPath/independent-projects/output_arc" "$quarkusPath/independent-projects/arc"
# Finds a particular property and replaces its value
set_property () {
if [ "$#" -ne 2 ]; then
echo "Requires two parameters"
fi
local propName=$1
local propValue=$2
sed -i "s/<$propName>.*<\/$propName>/<$propName>$propValue<\/$propName>/g" "$EDITING"
}

# Arc project transformation
transform_module "independent-projects/arc"

# Now we need to update CDI, JTA, JPA and common annotations artifacts
sed -i 's/<version.cdi>2.0.2<\/version.cdi>/<version.cdi>3.0.0<\/version.cdi>/g' "$quarkusPath/independent-projects/arc/pom.xml"
sed -i 's/<version.jta>1.3.3<\/version.jta>/<version.jta>2.0.0<\/version.jta>/g' "$quarkusPath/independent-projects/arc/pom.xml"
sed -i 's/<version.jakarta-annotation>1.3.5<\/version.jakarta-annotation>/<version.jakarta-annotation>2.0.0<\/version.jakarta-annotation>/g' "$quarkusPath/independent-projects/arc/pom.xml"
sed -i 's/<version.jpa>2.2.3<\/version.jpa>/<version.jpa>3.0.0<\/version.jpa>/g' "$quarkusPath/independent-projects/arc/pom.xml"
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"

# Test & install modified 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"

# Execute build and tests to verify functionality
./mvnw -B clean install -f "$quarkusPath/independent-projects/arc/pom.xml"
# Install the modified BOM:
build_module "bom/application"

## Arc Extension [Incomplete: other modules need to go first]

# transform_module "extensions/arc/runtime"
# transform_module "extensions/arc/deployment"
# build_module "extensions/arc/runtime"
# build_module "extensions/arc/deployment"

0 comments on commit f919dcd

Please sign in to comment.