Skip to content

Commit bad3470

Browse files
authored
jsp: move to Maven (#41)
* jsp: move to Maven Fixes: #30 * build: github workflow updates for maven Fixes: #20 * build: make sure push to production is also mavenized
1 parent 430e13f commit bad3470

File tree

274 files changed

+336
-367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+336
-367
lines changed

.github/workflows/build-jsp.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,27 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13-
- run: cd UnicodeJsps && docker build .
13+
- name: Set up JDK 1.8
14+
uses: actions/setup-java@v1
15+
with:
16+
java-version: 1.8
17+
- name: Cache local Maven repository
18+
uses: actions/cache@v2
19+
with:
20+
path: ~/.m2/repository
21+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
22+
restore-keys: |
23+
${{ runner.os }}-maven-
24+
- name: Build with Maven
25+
run: >
26+
mvn -s .github/workflows/mvn-settings.xml -B compile install package --file UnicodeJsps/pom.xml
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Upload UnicodeJsps.war
30+
uses: actions/upload-artifact@v2
31+
with:
32+
name: UnicodeJsps
33+
path: UnicodeJsps/target/UnicodeJsps.war
34+
- name: build docker image
35+
run: cd UnicodeJsps && docker build .
1436

.github/workflows/mvn-settings.xml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!--
2+
Copyright © 1991 and later Unicode, Inc.
3+
All rights reserved.
4+
License and terms of use: http://www.unicode.org/copyright.html
5+
6+
This file is used during builds to be able to access a temporary copy
7+
of icu4j.jar and utilities.jar. See CLDR-11585.
8+
TODO: Remove this when ICU-21251 is completed.
9+
-->
10+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
11+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
13+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
14+
<activeProfiles>
15+
<activeProfile>github</activeProfile>
16+
</activeProfiles>
17+
<profiles>
18+
<profile>
19+
<id>github</id>
20+
<repositories>
21+
<!-- the 'central' repository is already defined by default. -->
22+
<repository>
23+
<id>github</id>
24+
<name>GitHub unicode-org/cldr Apache Maven Packages</name>
25+
<url>https://maven.pkg.github.com/unicode-org/cldr</url>
26+
</repository>
27+
</repositories>
28+
</profile>
29+
</profiles>
30+
31+
<servers>
32+
<server>
33+
<id>github</id>
34+
<username>${GITHUB_ACTOR}</username>
35+
<password>${GITHUB_TOKEN}</password>
36+
</server>
37+
<server>
38+
<id>githubicu</id>
39+
<username>${GITHUB_ACTOR}</username>
40+
<password>${GITHUB_TOKEN}</password>
41+
</server>
42+
<server>
43+
<id>githubcldr</id>
44+
<username>${GITHUB_ACTOR}</username>
45+
<password>${GITHUB_TOKEN}</password>
46+
</server>
47+
</servers>
48+
</settings>

.github/workflows/push-jsp-on-tag.yml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,37 @@ jobs:
77
build-and-push-to-gcr:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Get the version
12-
id: get_tag_name
13-
run: echo ::set-output name=GIT_TAG_NAME::${GITHUB_REF/refs\/tags\//}
14-
- uses: RafikFarhad/push-to-gcr-github-action@v3
15-
with:
16-
gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
17-
registry: us.gcr.io
18-
project_id: dev-infra-273822
19-
image_name: unicode-jsps
20-
image_tag: ${{ steps.get_tag_name.outputs.GIT_TAG_NAME}}
21-
dockerfile: ./UnicodeJsps/Dockerfile
22-
context: ./UnicodeJsps/
10+
- uses: actions/checkout@v2
11+
- name: Set up JDK 1.8
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 1.8
15+
- name: Cache local Maven repository
16+
uses: actions/cache@v2
17+
with:
18+
path: ~/.m2/repository
19+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
20+
restore-keys: |
21+
${{ runner.os }}-maven-
22+
- name: Build with Maven
23+
run: >
24+
mvn -s .github/workflows/mvn-settings.xml -B compile install package --file UnicodeJsps/pom.xml
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Upload UnicodeJsps.war
28+
uses: actions/upload-artifact@v2
29+
with:
30+
name: UnicodeJsps
31+
path: UnicodeJsps/target/UnicodeJsps.war
32+
- name: Get the version
33+
id: get_tag_name
34+
run: echo ::set-output name=GIT_TAG_NAME::${GITHUB_REF/refs\/tags\//}
35+
- uses: RafikFarhad/push-to-gcr-github-action@v3
36+
with:
37+
gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
38+
registry: us.gcr.io
39+
project_id: dev-infra-273822
40+
image_name: unicode-jsps
41+
image_tag: ${{ steps.get_tag_name.outputs.GIT_TAG_NAME}}
42+
dockerfile: ./UnicodeJsps/Dockerfile
43+
context: ./UnicodeJsps/

UnicodeJsps/.classpath

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="src"/>
4-
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
5-
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
6-
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/cldr.jar"/>
7-
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/guava.jar"/>
8-
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/icu4j.jar"/>
9-
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/utilities.jar"/>
10-
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/xercesImpl.jar"/>
11-
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANT_LIB"/>
12-
<classpathentry kind="lib" path="/Users/markdavis/apache-tomcat-8.0.9/lib/tomcat-api.jar"/>
13-
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0">
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
144
<attributes>
15-
<attribute name="owner.project.facets" value="jst.web"/>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
167
</attributes>
178
</classpathentry>
18-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 10.0.1 [10.0.1]">
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/webapp">
1910
<attributes>
20-
<attribute name="owner.project.facets" value="java"/>
11+
<attribute name="maven.pomderived" value="true"/>
2112
</attributes>
2213
</classpathentry>
23-
<classpathentry kind="output" path="build/classes"/>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
30+
</attributes>
31+
</classpathentry>
32+
<classpathentry kind="output" path="target/classes"/>
2433
</classpath>

UnicodeJsps/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# parent ignores *.d files.
22

3-
!/jetty.d
3+
!/jetty.d
4+
/target

UnicodeJsps/.project

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,32 @@
66
</projects>
77
<buildSpec>
88
<buildCommand>
9-
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
1010
<arguments>
1111
</arguments>
1212
</buildCommand>
1313
<buildCommand>
14-
<name>org.eclipse.jdt.core.javabuilder</name>
14+
<name>org.eclipse.wst.common.project.facet.core.builder</name>
1515
<arguments>
1616
</arguments>
1717
</buildCommand>
1818
<buildCommand>
19-
<name>org.eclipse.wst.common.project.facet.core.builder</name>
19+
<name>org.eclipse.wst.validation.validationbuilder</name>
2020
<arguments>
2121
</arguments>
2222
</buildCommand>
2323
<buildCommand>
24-
<name>org.eclipse.wst.validation.validationbuilder</name>
24+
<name>org.eclipse.m2e.core.maven2Builder</name>
2525
<arguments>
2626
</arguments>
2727
</buildCommand>
2828
</buildSpec>
2929
<natures>
3030
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
3131
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
32-
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
3332
<nature>org.eclipse.jdt.core.javanature</nature>
33+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
34+
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
3435
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
3536
</natures>
3637
</projectDescription>

UnicodeJsps/.settings/.jsdtscope

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="WebContent"/>
3+
<classpathentry kind="src" path="src/main/webapp"/>
4+
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="target/m2e-wtp/web-resources"/>
45
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
56
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
67
<attributes>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
eclipse.preferences.version=1
2-
encoding//WebContent/footer.jsp=UTF-8
3-
encoding//WebContent/idna.jsp=UTF-8
2+
encoding//src/main/java=UTF-8
3+
encoding//src/main/webapp=UTF-8
44
encoding/<project>=UTF-8
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
33
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4-
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
54
org.eclipse.jdt.core.compiler.compliance=1.8
6-
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7-
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8-
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
95
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
107
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
8+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
9+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
10+
org.eclipse.jdt.core.compiler.release=disabled
1111
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<project-modules id="moduleCoreId" project-version="1.5.0">
1+
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
32
<wb-module deploy-name="UnicodeJsps">
4-
<wb-resource deploy-path="/" source-path="/WebContent"/>
5-
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
3+
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
4+
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
5+
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
66
<property name="context-root" value="UnicodeJsps"/>
7-
<property name="java-output-path" value="/UnicodeJsps/build/classes"/>
7+
<property name="java-output-path" value="/UnicodeJsps/target/classes"/>
88
</wb-module>
99
</project-modules>
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<faceted-project>
3-
<runtime name="Apache Tomcat v8.0"/>
43
<fixed facet="wst.jsdt.web"/>
5-
<fixed facet="jst.web"/>
6-
<fixed facet="java"/>
4+
<installed facet="java" version="1.8"/>
75
<installed facet="jst.web" version="3.0"/>
86
<installed facet="wst.jsdt.web" version="1.0"/>
9-
<installed facet="java" version="1.8"/>
107
</faceted-project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
disabled=06target
2+
eclipse.preferences.version=1

UnicodeJsps/Dockerfile

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,15 @@ RUN apk add --update -q wget make gcc musl-dev
77
RUN wget -np -nv --reject-regex='.*\.(lib|exe)$' --cut-dirs=4 -nH -r ${CPATH}${CVERSION}/
88
RUN cd source && gcc -I ../include/ -static -Os -o3 -o bidiref1 bidiref1.c brutils.c brtest.c brtable.c brrule.c
99
RUN ls -lh /build/source/bidiref1 && (/build/source/bidiref1 || true)
10-
FROM openjdk:16-alpine AS build
11-
# Need ant, add it. Yes, this pulls in JDK8, but it's an easier
12-
# way to manage this.
13-
RUN apk add --update apache-ant
14-
# Some version of tomcat. Just used for API, does not have to match TOMCATVERSION
15-
ARG TOMCAT_API=https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=tomcat/tomcat-9/v9.0.39/bin/apache-tomcat-9.0.39.tar.gz
16-
RUN mkdir -p /usr/local/lib && cd /usr/local/lib/ && wget "${TOMCAT_API}" -O - | tar xfpz - && ln -svf apache-tomcat-* ./tomcat
17-
18-
WORKDIR /home
19-
ADD . /home/
20-
ENV CATALINA_HOME /usr/local/lib/tomcat
21-
RUN ant -DCATALINA_HOME=${CATALINA_HOME} war
22-
23-
# ARG TOMCATVERSION=9
24-
# Was not able to parameterize this
2510
FROM jetty:9-jre11-slim AS run
2611
# FROM tomcat:9-jdk14-openjdk-slim-buster AS run
2712
ADD port-entrypoint.sh /port-entrypoint.sh
2813
ADD ./jetty.d/ROOT /var/lib/jetty/webapps/ROOT/
2914
ENTRYPOINT [ "/port-entrypoint.sh" ]
3015
# copy the .war
31-
COPY --from=build /home/UnicodeJsps.war /var/lib/jetty/webapps/
16+
ADD target/UnicodeJsps.war /var/lib/jetty/webapps/
3217
# copy the UCD for bidiref1
33-
COPY --from=build /home/src/org/unicode/jsp/bidiref1/ucd/ /usr/local/share/ucd/
18+
COPY src/main/resources/org/unicode/jsp/bidiref1/ucd/ /usr/local/share/ucd/
3419
# this is the parent to 'ucd'
3520
ENV BIDIREFHOME /usr/local/share
3621
# copy the bidiref1 bin
-1.89 MB
Binary file not shown.
-14 MB
Binary file not shown.
Binary file not shown.

UnicodeJsps/WebContent/WEB-INF/lib/gson-version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
-235 KB
Binary file not shown.
Binary file not shown.

UnicodeJsps/WebContent/WEB-INF/lib/guava-version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
-2.66 MB
Binary file not shown.
-2.33 MB
Binary file not shown.

UnicodeJsps/WebContent/WEB-INF/lib/icu4j-version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
-12.7 MB
Binary file not shown.
Binary file not shown.
-35.8 KB
Binary file not shown.
-1.17 MB
Binary file not shown.

0 commit comments

Comments
 (0)