Skip to content

Commit

Permalink
Add a new release artifact for jakarta.servlet support (#9845)
Browse files Browse the repository at this point in the history
Introduces a new release artifact for jakarta-based servlet
containers, for both gwt-servlet and requestfactory-server. These
jars contain only minor changes in packaging for the servlet-specific
classes that differ. Generated javadocs continue to reflect the
combined contents of all jars, with specific notes about
jakarta.servlet usage in their respective packages.

Fixes #9727
Co-authored-by: Sandra Parsick <[email protected]>
  • Loading branch information
niloc132 authored Dec 6, 2023
1 parent f9028fe commit f439c5e
Show file tree
Hide file tree
Showing 19 changed files with 443 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class FindPackages {
*/
private static final String[] SOURCE_DIRS = {
"user/src", "user/javadoc", "user/super", "dev/core/src",
"dev/core/super"};
"dev/core/super", "build/out/user/jakarta-src"};

/**
* Individual user classes to include, even if the rest of their packages
Expand Down
1 change: 1 addition & 0 deletions distro-source/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<zipfileset file="${gwt.build.lib}/gwt-dev.jar" prefix="${project.distname}" />
<zipfileset file="${gwt.build.lib}/gwt-user.jar" prefix="${project.distname}" />
<zipfileset file="${gwt.build.lib}/gwt-servlet.jar" prefix="${project.distname}" />
<zipfileset file="${gwt.build.lib}/gwt-servlet-jakarta.jar" prefix="${project.distname}" />
<zipfileset file="${gwt.build.lib}/gwt-codeserver.jar" prefix="${project.distname}" />
<zipfileset file="${gwt.build.lib}/gwt-servlet-deps.jar" prefix="${project.distname}" />
<zipfileset file="${gwt.build.lib}/gwt-api-checker.jar" prefix="${project.distname}" />
Expand Down
21 changes: 20 additions & 1 deletion doc/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<pathelement location="${gwt.root}/user/super" />
<pathelement location="${gwt.root}/dev/core/src" />
<pathelement location="${gwt.root}/dev/core/super" />
<pathelement location="${project.build}/../user/jakarta-src" />
<pathelement location="${project.build}/jakarta-src" />
</path>

<path id="USER_CLASS_PATH">
Expand All @@ -27,6 +29,7 @@
<pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar" />
<pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
<pathelement location="${gwt.tools.lib}/jakarta-servlet/jakarta.servlet-api-5.0.0/jakarta.servlet-api-5.0.0.jar" />
</path>

<path id="DOC_PATH">
Expand All @@ -35,11 +38,27 @@
<path refid="USER_SOURCE_PATH" />
</path>

<!-- Make an extra copy of this example just for javadocs, so that it can be modified to use jakarta, and the rewriting of the RPC class can point at it -->
<target name="jakartaJavadocSources">
<copy file="${gwt.root}/user/javadoc/com/google/gwt/examples/rpc/server/AdvancedExample.java" todir="${project.build}/jakarta-src/com/google/gwt/examples/rpc/server/jakarta/" encoding="${javac.encoding}">
<filterchain>
<tokenfilter>
<replacestring from="package com.google.gwt.examples.rpc.server" to="package com.google.gwt.examples.rpc.server.jakarta"/>
<replacestring from="com.google.gwt.user.server.rpc.RPC" to="com.google.gwt.user.server.rpc.jakarta.RPC"/>
<replacestring from="javax.servlet" to="jakarta.servlet"/>
</tokenfilter>
</filterchain>
</copy>
</target>

<!-- Rebuild the javadoc if a source file is newer than the index-->
<target name="javadoc">
<target name="javadoc" depends="jakartaJavadocSources">
<outofdate>
<sourcefiles>
<fileset file="./src/gwt-user.html" />
<fileset dir="${project.build}/../user/jakarta-src">
<include name="**/*.java" />
</fileset>
<fileset dir="${gwt.root}/user/src">
<include name="**/*.java" />
</fileset>
Expand Down
9 changes: 5 additions & 4 deletions maven/lib-gwt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function maven-gwt() {
popd > /dev/null
done

gwtLibs='dev user servlet codeserver'
gwtLibs='dev user servlet servlet-jakarta codeserver'

echo "Removing bundled third-parties from gwt-dev"
zip -q $GWT_EXTRACT_DIR/gwt-dev.jar --copy --out $GWT_EXTRACT_DIR/gwt-dev-trimmed.jar \
Expand Down Expand Up @@ -118,8 +118,9 @@ function maven-gwt() {
# If there are no sources, use gwt-user sources.
# This is a bit hacky but Sonatype requires a
# source jar for Central, and lack of sources
# should only happen for gwt-servlet which is
# basically a subset of gwt-user.
# should only happen for gwt-servlet and
# gwt-servlet-jakarta, which are basically a
# subset of gwt-user.
if [ ! -f $SOURCES_PATH_FILE ]; then
SOURCES_PATH_FILE=$GWT_EXTRACT_DIR/gwt-user-sources.jar
fi
Expand All @@ -130,7 +131,7 @@ function maven-gwt() {
# Deploy RequestFactory jars
maven-deploy-file $mavenRepoUrl $mavenRepoId $pomDir/requestfactory/pom.xml $pomDir/requestfactory/pom.xml || die

for i in client server apt
for i in client server apt server-jakarta
do
maven-deploy-file $mavenRepoUrl $mavenRepoId $GWT_EXTRACT_DIR/requestfactory-${i}.jar $pomDir/requestfactory/${i}/pom.xml \
$JAVADOC_FILE_PATH $GWT_EXTRACT_DIR/requestfactory-${i}-src.jar \
Expand Down
29 changes: 29 additions & 0 deletions maven/poms/gwt/gwt-servlet-jakarta/pom-template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.gwtproject</groupId>
<artifactId>gwt</artifactId>
<version>${gwtVersion}</version>
</parent>
<groupId>org.gwtproject</groupId>
<artifactId>gwt-servlet-jakarta</artifactId>
<packaging>jar</packaging>
<version>${gwtVersion}</version>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<!-- needed by RequestFactory -->
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<!-- Used for source-mapping in stacktrace deobfuscation for logging -->
<optional>true</optional>
</dependency>
</dependencies>
</project>
5 changes: 5 additions & 0 deletions maven/poms/gwt/pom-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<artifactId>gwt-servlet</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.gwtproject</groupId>
<artifactId>gwt-servlet-jakarta</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.gwtproject.web.bindery</groupId>
<artifactId>requestfactory</artifactId>
Expand Down
27 changes: 27 additions & 0 deletions maven/poms/requestfactory/server-jakarta/pom-template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.gwtproject.web.bindery</groupId>
<artifactId>requestfactory</artifactId>
<version>${gwtVersion}</version>
</parent>
<groupId>org.gwtproject.web.bindery</groupId>
<artifactId>requestfactory-server-jakarta</artifactId>
<packaging>jar</packaging>
<version>${gwtVersion}</version>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<!-- Used for source-mapping in stacktrace deobfuscation for logging -->
<optional>true</optional>
</dependency>
</dependencies>
</project>
27 changes: 23 additions & 4 deletions requestfactory/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@
<!-- Build a jar file containing a subset of requestfactory -->
<macrodef name="requestfactory-jar">
<!--
"target" should be one of {client,server,all}[(+|-)src] or test[-src].
"target" should be one of {client,server,all,apt}[(+|-)src] or test[-src].
-src includes .java files only, +src includes .java and .class files
-->
<attribute name="target" default="client"/>
<!--
"main" defaults to the javax.servlet extractor type, but should be set to
the jakarta variant to correctly package jakarta server .class and .java
files.
-->
<attribute name="main" default="com.google.web.bindery.requestfactory.server.RequestFactoryJarExtractor" />
<sequential>
<java failonerror="true" fork="true"
classname="com.google.web.bindery.requestfactory.server.RequestFactoryJarExtractor">
<java failonerror="true" fork="true" classname="@{main}">
<classpath>
<fileset dir="${gwt.build.lib}" includes="gwt-user.jar,gwt-dev.jar" />
<pathelement location="${gwt.tools.lib}/jakarta-servlet/jakarta.servlet-api-5.0.0/jakarta.servlet-api-5.0.0.jar" />
<pathelement location="${gwt.tools.lib}/junit/junit-4.8.2.jar" />
<pathelement path="${gwt.build.out}/user/bin" />
<pathelement path="${gwt.build.out}/user/bin-jakarta" />
<pathelement path="${gwt.build.out}/dev/bin-test" />
<pathelement path="${gwt.build.out}/user/bin-test" />
</classpath>
Expand Down Expand Up @@ -81,6 +88,18 @@
<requestfactory-jar target="server+src"/>
</target>

<target name="requestfactory-server-jakarta" description="Build RequestFactory server jar for jakarta.servlet">
<requestfactory-jar target="server-jakarta" main="com.google.web.bindery.requestfactory.server.jakarta.RequestFactoryJarExtractor"/>
</target>

<target name="requestfactory-server-jakarta-src" description="Build RequestFactory server source jar for jakarta.servlet">
<requestfactory-jar target="server-jakarta-src" main="com.google.web.bindery.requestfactory.server.jakarta.RequestFactoryJarExtractor"/>
</target>

<target name="requestfactory-server-jakarta+src" description="Build RequestFactory server source/class jar for jakarta.servlet">
<requestfactory-jar target="server-jakarta+src" main="com.google.web.bindery.requestfactory.server.jakarta.RequestFactoryJarExtractor"/>
</target>

<!-- This target requires classes from ../build/{dev,user}/bin-test -->
<target name="requestfactory-test"
unless="test.requestfactory.disable"
Expand All @@ -93,7 +112,7 @@
<target name="clientjars" depends="requestfactory-apt,requestfactory-apt-src,requestfactory-client,requestfactory-client-src,requestfactory-client+src" description="Build requestfactory client jars" />

<!-- Build all server jars -->
<target name="serverjars" depends="requestfactory-server,requestfactory-server-src,requestfactory-server+src" description="Build requestfactory server jars" />
<target name="serverjars" depends="requestfactory-server,requestfactory-server-src,requestfactory-server+src,requestfactory-server-jakarta,requestfactory-server-jakarta-src,requestfactory-server-jakarta+src" description="Build requestfactory server jars" />

<!-- Default target, build client and server jars.
Assumes the 'user' target has been built in the trunk directory
Expand Down
35 changes: 33 additions & 2 deletions servlet/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<property.ensure name="gwt.user.build" location="${gwt.build.out}/user" />
<property.ensure name="gwt.dev.bin" location="${gwt.dev.build}/bin" />
<property.ensure name="gwt.user.bin" location="${gwt.user.build}/bin" />

<property.ensure name="gwt.user-jakarta.bin" location="${gwt.user.build}/bin-jakarta" />
<property name="project.lib.deps"
location="${gwt.build.lib}/gwt-${ant.project.name}-deps.jar" />

<target name="build" description="Packages this project into a jar"
depends="-servlet, -deps" />
depends="-servlet, -servlet-jakarta, -deps" />

<target name="clean" description="Cleans this project's intermediate and output files">
<delete file="${project.lib}" />
Expand Down Expand Up @@ -52,6 +52,37 @@
<!-- additional dependencies (used by scripts). -->
</gwt.jar>
</target>
<target name="-servlet-jakarta" description="Packages this project into a jar for use with modern jakarta apis">
<mkdir dir="${gwt.build.lib}" />
<gwt.jar destfile="${gwt.build.lib}/gwt-servlet-jakarta.jar">
<!-- Rebased dependencies go in gwt-servlet too -->
<zipfileset src="${gwt.tools.lib}/guava/guava-19.0/guava-19.0-rebased.jar" />
<zipfileset src="${gwt.tools.lib}/jscomp/20160315/sourcemap-rebased.jar" />
<zipfileset src="${gwt.tools.lib}/json/android-sdk-19.1/json-android-rebased.jar" />
<zipfileset src="${gwt.tools.lib}/streamhtmlparser/streamhtmlparser-jsilver-r10/streamhtmlparser-jsilver-r10-1.5-rebased.jar" />
<zipfileset src="${gwt.tools.lib}/protobuf/protobuf-2.5.0/protobuf-java-rebased-2.5.0.jar" />
<fileset dir="${gwt.dev.bin}">
<include name="com/google/gwt/dev/asm/**" />
<include name="com/google/gwt/dev/util/Name*.class" />
<include name="com/google/gwt/dev/util/StringKey.class" />
<include name="com/google/gwt/util/tools/shared/**" />
<include name="com/google/gwt/core/shared/**" />
</fileset>
<fileset dir="${gwt.user-jakarta.bin}">
<exclude name="**/rebind/**" />
<exclude name="**/tools/**" />
<exclude name="**/super/**" />
<exclude name="com/google/gwt/json/**" />
<exclude name="com/google/gwt/junit/*" />
<exclude name="com/google/gwt/junit/client/GWTTestCase.*" />
<exclude name="com/google/gwt/junit/remote/**" />
<exclude name="com/google/gwt/junit/server/**" />
<exclude name="com/google/gwt/benchmarks/*" />
<exclude name="**/*.gwtar" />
</fileset>
<!-- additional dependencies (used by scripts). -->
</gwt.jar>
</target>

<target name="-deps" description="Packages this project's dependencies into a jar">
<mkdir dir="${gwt.build.lib}" />
Expand Down
Loading

0 comments on commit f439c5e

Please sign in to comment.