Skip to content

Commit

Permalink
jsp: move to Maven (#41)
Browse files Browse the repository at this point in the history
* jsp: move to Maven

Fixes: #30

* build: github workflow updates for maven

Fixes: #20

* build: make sure push to production is also mavenized
  • Loading branch information
srl295 authored Feb 22, 2021
1 parent 430e13f commit bad3470
Show file tree
Hide file tree
Showing 274 changed files with 336 additions and 367 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/build-jsp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cd UnicodeJsps && docker build .
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: >
mvn -s .github/workflows/mvn-settings.xml -B compile install package --file UnicodeJsps/pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload UnicodeJsps.war
uses: actions/upload-artifact@v2
with:
name: UnicodeJsps
path: UnicodeJsps/target/UnicodeJsps.war
- name: build docker image
run: cd UnicodeJsps && docker build .

48 changes: 48 additions & 0 deletions .github/workflows/mvn-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
Copyright © 1991 and later Unicode, Inc.
All rights reserved.
License and terms of use: http://www.unicode.org/copyright.html
This file is used during builds to be able to access a temporary copy
of icu4j.jar and utilities.jar. See CLDR-11585.
TODO: Remove this when ICU-21251 is completed.
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>github</id>
<repositories>
<!-- the 'central' repository is already defined by default. -->
<repository>
<id>github</id>
<name>GitHub unicode-org/cldr Apache Maven Packages</name>
<url>https://maven.pkg.github.com/unicode-org/cldr</url>
</repository>
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>github</id>
<username>${GITHUB_ACTOR}</username>
<password>${GITHUB_TOKEN}</password>
</server>
<server>
<id>githubicu</id>
<username>${GITHUB_ACTOR}</username>
<password>${GITHUB_TOKEN}</password>
</server>
<server>
<id>githubcldr</id>
<username>${GITHUB_ACTOR}</username>
<password>${GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
47 changes: 34 additions & 13 deletions .github/workflows/push-jsp-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,37 @@ jobs:
build-and-push-to-gcr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get the version
id: get_tag_name
run: echo ::set-output name=GIT_TAG_NAME::${GITHUB_REF/refs\/tags\//}
- uses: RafikFarhad/push-to-gcr-github-action@v3
with:
gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
registry: us.gcr.io
project_id: dev-infra-273822
image_name: unicode-jsps
image_tag: ${{ steps.get_tag_name.outputs.GIT_TAG_NAME}}
dockerfile: ./UnicodeJsps/Dockerfile
context: ./UnicodeJsps/
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: >
mvn -s .github/workflows/mvn-settings.xml -B compile install package --file UnicodeJsps/pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload UnicodeJsps.war
uses: actions/upload-artifact@v2
with:
name: UnicodeJsps
path: UnicodeJsps/target/UnicodeJsps.war
- name: Get the version
id: get_tag_name
run: echo ::set-output name=GIT_TAG_NAME::${GITHUB_REF/refs\/tags\//}
- uses: RafikFarhad/push-to-gcr-github-action@v3
with:
gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
registry: us.gcr.io
project_id: dev-infra-273822
image_name: unicode-jsps
image_tag: ${{ steps.get_tag_name.outputs.GIT_TAG_NAME}}
dockerfile: ./UnicodeJsps/Dockerfile
context: ./UnicodeJsps/
39 changes: 24 additions & 15 deletions UnicodeJsps/.classpath
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/cldr.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/guava.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/icu4j.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/utilities.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/xercesImpl.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANT_LIB"/>
<classpathentry kind="lib" path="/Users/markdavis/apache-tomcat-8.0.9/lib/tomcat-api.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0">
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<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]">
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/webapp">
<attributes>
<attribute name="owner.project.facets" value="java"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
3 changes: 2 additions & 1 deletion UnicodeJsps/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# parent ignores *.d files.

!/jetty.d
!/jetty.d
/target
11 changes: 6 additions & 5 deletions UnicodeJsps/.project
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,32 @@
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
3 changes: 2 additions & 1 deletion UnicodeJsps/.settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebContent"/>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
Expand Down
4 changes: 2 additions & 2 deletions UnicodeJsps/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
eclipse.preferences.version=1
encoding//WebContent/footer.jsp=UTF-8
encoding//WebContent/idna.jsp=UTF-8
encoding//src/main/java=UTF-8
encoding//src/main/webapp=UTF-8
encoding/<project>=UTF-8
8 changes: 4 additions & 4 deletions UnicodeJsps/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
4 changes: 4 additions & 0 deletions UnicodeJsps/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
10 changes: 5 additions & 5 deletions UnicodeJsps/.settings/org.eclipse.wst.common.component
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="UnicodeJsps">
<wb-resource deploy-path="/" source-path="/WebContent"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<property name="context-root" value="UnicodeJsps"/>
<property name="java-output-path" value="/UnicodeJsps/build/classes"/>
<property name="java-output-path" value="/UnicodeJsps/target/classes"/>
</wb-module>
</project-modules>
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v8.0"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<fixed facet="java"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>
2 changes: 2 additions & 0 deletions UnicodeJsps/.settings/org.eclipse.wst.validation.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1
19 changes: 2 additions & 17 deletions UnicodeJsps/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,15 @@ RUN apk add --update -q wget make gcc musl-dev
RUN wget -np -nv --reject-regex='.*\.(lib|exe)$' --cut-dirs=4 -nH -r ${CPATH}${CVERSION}/
RUN cd source && gcc -I ../include/ -static -Os -o3 -o bidiref1 bidiref1.c brutils.c brtest.c brtable.c brrule.c
RUN ls -lh /build/source/bidiref1 && (/build/source/bidiref1 || true)
FROM openjdk:16-alpine AS build
# Need ant, add it. Yes, this pulls in JDK8, but it's an easier
# way to manage this.
RUN apk add --update apache-ant
# Some version of tomcat. Just used for API, does not have to match TOMCATVERSION
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
RUN mkdir -p /usr/local/lib && cd /usr/local/lib/ && wget "${TOMCAT_API}" -O - | tar xfpz - && ln -svf apache-tomcat-* ./tomcat

WORKDIR /home
ADD . /home/
ENV CATALINA_HOME /usr/local/lib/tomcat
RUN ant -DCATALINA_HOME=${CATALINA_HOME} war

# ARG TOMCATVERSION=9
# Was not able to parameterize this
FROM jetty:9-jre11-slim AS run
# FROM tomcat:9-jdk14-openjdk-slim-buster AS run
ADD port-entrypoint.sh /port-entrypoint.sh
ADD ./jetty.d/ROOT /var/lib/jetty/webapps/ROOT/
ENTRYPOINT [ "/port-entrypoint.sh" ]
# copy the .war
COPY --from=build /home/UnicodeJsps.war /var/lib/jetty/webapps/
ADD target/UnicodeJsps.war /var/lib/jetty/webapps/
# copy the UCD for bidiref1
COPY --from=build /home/src/org/unicode/jsp/bidiref1/ucd/ /usr/local/share/ucd/
COPY src/main/resources/org/unicode/jsp/bidiref1/ucd/ /usr/local/share/ucd/
# this is the parent to 'ucd'
ENV BIDIREFHOME /usr/local/share
# copy the bidiref1 bin
Expand Down
Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/cldr-src.jar
Binary file not shown.
Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/cldr.jar
Binary file not shown.
Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/gson-sources.jar
Binary file not shown.
1 change: 0 additions & 1 deletion UnicodeJsps/WebContent/WEB-INF/lib/gson-version.txt

This file was deleted.

Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/gson.jar
Binary file not shown.
Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/guava-sources.jar
Binary file not shown.
1 change: 0 additions & 1 deletion UnicodeJsps/WebContent/WEB-INF/lib/guava-version.txt

This file was deleted.

Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/guava.jar
Binary file not shown.
Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/icu4j-src.jar
Binary file not shown.
1 change: 0 additions & 1 deletion UnicodeJsps/WebContent/WEB-INF/lib/icu4j-version.txt

This file was deleted.

Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/icu4j.jar
Binary file not shown.
Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/utilities-src.jar
Binary file not shown.
Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/utilities.jar
Binary file not shown.
Binary file removed UnicodeJsps/WebContent/WEB-INF/lib/xercesImpl.jar
Binary file not shown.
Loading

0 comments on commit bad3470

Please sign in to comment.