mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-16 02:38:44 +00:00
bug6217: use JAVA8_HOME to run Maven when building AWS SDK wrapper bundle
This commit is contained in:
@@ -88,7 +88,7 @@ echo "Building the wrapper bundle..."
|
||||
cd ..
|
||||
echo "NOT USING ${extra} arguments for Maven to avoid using local target definition already for building local repo"
|
||||
echo "In folder $(pwd) using: mvn clean install"
|
||||
mvn --batch-mode clean install
|
||||
JAVA_HOME=${JAVA8_HOME} mvn --batch-mode clean install
|
||||
mkdir -p ${UPDATE_SITE_PROJECT}/plugins/aws-sdk
|
||||
rm -rf ${UPDATE_SITE_PROJECT}/plugins/aws-sdk/*
|
||||
# Note: the JAR ends up in target/ because the SDK project does not use any parent pom, so
|
||||
@@ -128,7 +128,7 @@ echo "Patching update site's site.xml..."
|
||||
sed -i -e 's/com.amazon.aws.aws-java-api\(\.source\)\?_\([0-9.]*\)\.jar/com.amazon.aws.aws-java-api\1_'${VERSION}'.jar/' -e '/feature url=/s/version="[0-9.]*"/version="'${VERSION}'"/' ${SITE_XML}
|
||||
echo "Building update site..."
|
||||
echo "In folder $(pwd) using: mvn ${extra} clean install"
|
||||
mvn ${extra} clean install
|
||||
JAVA_HOME=${JAVA8_HOME} mvn ${extra} clean install
|
||||
echo "Patching SDK version ${VERSION} in target platform definition ${TARGET_DEFINITION}..."
|
||||
sed -i -e 's/<unit id="com.amazon.aws.aws-java-api.feature.group" version="[0-9.]*"\/>/<unit id="com.amazon.aws.aws-java-api.feature.group" version="'${VERSION}'"\/>/' ${TARGET_DEFINITION}
|
||||
echo "You may test your target platform locally by creating race-analysis-p2-local.target by running the script createLocalTargetDef.sh."
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
# Updating Jetty in the Target Platform
|
||||
|
||||
## Background
|
||||
|
||||
The target platform references Jetty bundles via a p2 repository. Historically
|
||||
this was mirrored from the official Eclipse-hosted site at
|
||||
`https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/` using the
|
||||
`createAndUploadJettyP2Repository.sh` script.
|
||||
|
||||
When a new Jetty release is **not yet published** to that Eclipse p2 site (as
|
||||
happened with 9.4.58), the scripts described below let you build an equivalent
|
||||
p2 repository yourself, directly from the artifacts on **Maven Central**.
|
||||
|
||||
This works because the Jetty jars on Maven Central are already proper OSGi
|
||||
bundles (`Bundle-SymbolicName`, `Bundle-Version`, etc.) and their `-sources.jar`
|
||||
files carry `Eclipse-SourceBundle` headers.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
| Tool | Purpose |
|
||||
|------|---------|
|
||||
| `eclipse` on `PATH` | Provides the p2 publisher (`org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher`). Any Eclipse IDE or Equinox SDK installation will have this. |
|
||||
| `curl` | Downloads jars from Maven Central. |
|
||||
| `wget` | Used by the upload script to fetch JSP bundles into `target-base`. |
|
||||
| `ssh` / `scp` | Uploads the finished p2 repository to `sapsailing.com`. |
|
||||
|
||||
## Step-by-step guide
|
||||
|
||||
### 1. Determine the new version string
|
||||
|
||||
Find the latest 9.4.x release on Maven Central:
|
||||
|
||||
```
|
||||
curl -s https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-server/ \
|
||||
| grep -o '9\.4\.[0-9]*\.v[0-9]*' | sort -V | tail -1
|
||||
```
|
||||
|
||||
The version string looks like `9.4.58.v20250814`.
|
||||
|
||||
### 2. Build the p2 repository
|
||||
|
||||
```bash
|
||||
cd java/com.sap.sailing.targetplatform/scripts
|
||||
./createJettyP2RepoFromMavenCentral.sh 9.4.58.v20250814
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
1. Download all 41 Jetty-versioned bundles + their source jars from Maven
|
||||
Central into a temporary staging directory.
|
||||
2. Download 4 static (non-Jetty-versioned) bundles that also ship with the
|
||||
official Eclipse Jetty p2 repository (see
|
||||
[What's in the p2 repository](#what-s-in-the-p2-repository) below).
|
||||
3. Generate two Eclipse features wrapping these bundles:
|
||||
- `org.eclipse.jetty.bundles.f` — the main feature
|
||||
- `org.eclipse.jetty.bundles.f.source` — the source feature
|
||||
4. Run the Eclipse p2 `FeaturesAndBundlesPublisher` to produce a valid p2
|
||||
repository.
|
||||
|
||||
The result is at `/tmp/jetty-p2-repo-<VERSION>/repository`.
|
||||
|
||||
> **Tip:** You can test with the local repo before uploading. Point the
|
||||
> `<repository location="..."/>` in your `.target` file to
|
||||
> `file:/tmp/jetty-p2-repo-<VERSION>/repository` and reload the target
|
||||
> platform.
|
||||
|
||||
### 3. Upload and activate
|
||||
|
||||
```bash
|
||||
./uploadAndActivateJettyP2Repo.sh 9.4.58.v20250814
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
1. Upload the p2 repository to `trac@sapsailing.com:p2-repositories/jetty-<VERSION>`.
|
||||
2. Update the Jetty version and repository URL in both target definition files
|
||||
(`race-analysis-p2-remote.target`, `race-analysis-p2-local.target`).
|
||||
3. Update the Jetty version in the feature files
|
||||
(`com.sap.sse.feature.runtime/feature.xml`,
|
||||
`com.sap.sailing.targetplatform.base/features/target-base/feature.xml`).
|
||||
4. Replace the `apache-jsp` and `jetty-osgi-boot-jsp` jars (+ sources) in
|
||||
`com.sap.sailing.targetplatform.base/plugins/target-base` with the new
|
||||
version and stage them in git.
|
||||
|
||||
### 4. Rebuild and upload the base p2 repository
|
||||
|
||||
```bash
|
||||
./createLocalBaseP2repository.sh
|
||||
./uploadRepositoryToServer.sh
|
||||
```
|
||||
|
||||
### 5. Reload the target platform
|
||||
|
||||
In Eclipse, open the `.target` file and click **Reload** / **Set as Active
|
||||
Target Platform**.
|
||||
|
||||
## What's in the p2 repository
|
||||
|
||||
The generated p2 repository contains **86 JARs** (bundles + source bundles)
|
||||
and is a **strict superset** of the 81-JAR repository that the official Eclipse
|
||||
Jetty p2 site publishes.
|
||||
|
||||
The bundles fall into two categories:
|
||||
|
||||
### Jetty-versioned bundles (41 bundles, each with a source jar = 82 JARs)
|
||||
|
||||
These are downloaded from Maven Central and versioned with the Jetty release
|
||||
(e.g. `9.4.58.v20250814`). They are defined in the `BUNDLES` variable in the
|
||||
script.
|
||||
|
||||
| Category | Bundles |
|
||||
|----------|---------|
|
||||
| Core | `jetty-server`, `jetty-servlet`, `jetty-servlets`, `jetty-http`, `jetty-io`, `jetty-util`, `jetty-util-ajax`, `jetty-xml`, `jetty-security`, `jetty-webapp`, `jetty-deploy`, `jetty-client`, `jetty-continuation`, `jetty-proxy`, `jetty-rewrite` |
|
||||
| Auth | `jetty-jaas`, `jetty-jaspi` (BSN: `security.jaspi`), `jetty-annotations`, `jetty-jmx`, `jetty-jndi`, `jetty-plus` |
|
||||
| ALPN / HTTP/2 | `jetty-alpn-client`, `jetty-alpn-server`, `http2-client`, `http2-http-client-transport` (BSN: `http2.client.http`), `http2-common`, `http2-hpack`, `http2-server` |
|
||||
| WebSocket | `websocket-api`, `websocket-client`, `websocket-common`, `websocket-server`, `websocket-servlet`, `javax-websocket-client-impl` (BSN: `websocket.javax.websocket`), `javax-websocket-server-impl` (BSN: `websocket.javax.websocket.server`) |
|
||||
| OSGi integration | `jetty-osgi-boot`, `jetty-osgi-boot-warurl`, `jetty-osgi-boot-jsp`, `jetty-httpservice` (BSN: `osgi.httpservice`), `jetty-osgi-alpn` (BSN: `osgi.alpn.fragment`) |
|
||||
| JSP | `apache-jsp` (BSN: `jetty.apache-jsp`) |
|
||||
|
||||
### Static bundles (4 JARs)
|
||||
|
||||
These ship with the official Eclipse Jetty p2 repository but have their own
|
||||
fixed version, independent of the Jetty release. They are defined in the
|
||||
`STATIC_BUNDLES` variable in the script and are downloaded from the previous
|
||||
Jetty p2 repository on `sapsailing.com`.
|
||||
|
||||
| Bundle | Version | Notes |
|
||||
|--------|---------|-------|
|
||||
| `javax.security.auth.message` | `1.0.0.v201108011116` | JASPIC 1.0 API (Eclipse Orbit). Not imported by any project code. |
|
||||
| `javax.security.auth.message.source` | `1.0.0.v201108011116` | Source for the above. |
|
||||
| `org.eclipse.jetty.osgi-servlet-api` | `3.1.0.M3` | Jetty's repackaged Servlet 3.1 API. Also in `target-base/plugins`. |
|
||||
| `org.eclipse.jetty.osgi-servlet-api.source` | `3.1.0.M3` | Source for the above. |
|
||||
|
||||
These bundles are **optional** — if the download fails (e.g. because the old
|
||||
p2 repo URL is no longer available), the script continues with a warning. Both
|
||||
`javax.security.auth.message` and `osgi-servlet-api` are also provided by
|
||||
`target-base/plugins`, so the target platform will still resolve correctly.
|
||||
|
||||
### Comparison with the official Eclipse Jetty p2 repository
|
||||
|
||||
The old Eclipse-hosted repo (e.g. the 9.4.57 version mirrored at
|
||||
`https://p2.sapsailing.com/p2/jetty-9.4.57.v20241219/`) contained **81 JARs**.
|
||||
The new repo contains **86 JARs** — a strict superset. The 5 extras are source
|
||||
or main JARs that the old repo inconsistently omitted:
|
||||
|
||||
| Extra JAR in new repo | Explanation |
|
||||
|-----------------------|-------------|
|
||||
| `org.eclipse.jetty.apache-jsp` | Old repo only shipped the `.source`; the main jar was in `target-base`. |
|
||||
| `org.eclipse.jetty.osgi.boot.jsp` | Same — old repo only had `.source`; main jar was in `target-base`. |
|
||||
| `org.eclipse.jetty.jaas.source` | Old repo shipped `jaas` without its source. |
|
||||
| `org.eclipse.jetty.osgi.alpn.fragment.source` | Old repo shipped the fragment without its source. |
|
||||
| `org.eclipse.jetty.security.jaspi` | Old repo only shipped the `.source`. |
|
||||
|
||||
Having both the main and source jar for every bundle is cleaner and harmless.
|
||||
|
||||
## Applying to future versions
|
||||
|
||||
Replace `9.4.58.v20250814` with the new version string in steps 2 and 3. Both
|
||||
scripts accept the version as their first argument and default to
|
||||
`9.4.58.v20250814` if omitted.
|
||||
|
||||
If the new Jetty release adds or removes bundles, edit the `BUNDLES` list at the
|
||||
top of `createJettyP2RepoFromMavenCentral.sh`. Each line has the format:
|
||||
|
||||
```
|
||||
<maven-group-path>|<artifact-id>|<osgi-bundle-symbolic-name>
|
||||
```
|
||||
|
||||
Note that the Maven artifact ID and the OSGi `Bundle-SymbolicName` often differ.
|
||||
You can verify the OSGi symbolic name of any jar with:
|
||||
|
||||
```bash
|
||||
unzip -p some-jetty-bundle.jar META-INF/MANIFEST.MF | grep Bundle-SymbolicName
|
||||
```
|
||||
|
||||
## Script overview
|
||||
|
||||
| Script | What it does |
|
||||
|--------|--------------|
|
||||
| `createJettyP2RepoFromMavenCentral.sh` | Downloads Jetty bundles from Maven Central and builds a local p2 repository. |
|
||||
| `uploadAndActivateJettyP2Repo.sh` | Uploads the p2 repo and updates all version references in the workspace. |
|
||||
| `createAndUploadJettyP2Repository.sh` | *(legacy)* Mirrors an existing Eclipse-hosted p2 site. Use this when the version **is** available at `download.eclipse.org`. |
|
||||
| `createLocalBaseP2repository.sh` | Builds the local `target-base` p2 repository via Tycho. |
|
||||
| `uploadRepositoryToServer.sh` | Uploads the `target-base` p2 repository to `sapsailing.com`. |
|
||||
@@ -1,339 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Creates a local p2 repository for Jetty 9.4.x from Maven Central artifacts.
|
||||
#
|
||||
# Use this when the official Eclipse Jetty p2 repository at
|
||||
# https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/
|
||||
# does not yet contain the latest security patch release.
|
||||
#
|
||||
# The Jetty jars on Maven Central are already proper OSGi bundles (with
|
||||
# Bundle-SymbolicName, etc.) and their -sources.jar files already carry
|
||||
# Eclipse-SourceBundle headers, so we can publish them directly into a
|
||||
# p2 repository.
|
||||
#
|
||||
# Prerequisites:
|
||||
# - An Eclipse installation accessible via the "eclipse" command on PATH
|
||||
# (needs the p2 publisher: org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher)
|
||||
# Typically any Eclipse IDE or the Equinox SDK will have this.
|
||||
# - curl and a POSIX shell
|
||||
# - a /tmp directory with write permissions and at least 1GB free space
|
||||
#
|
||||
# Usage:
|
||||
# ./createJettyP2RepoFromMavenCentral.sh [VERSION]
|
||||
#
|
||||
# VERSION defaults to 9.4.58.v20250814 if not supplied.
|
||||
#
|
||||
# After running, the p2 repository will be at:
|
||||
# /tmp/jetty-p2-repo-<VERSION>/repository
|
||||
#
|
||||
# You can then either:
|
||||
# a) Point your target platform definition at this local directory, or
|
||||
# b) Upload it to your p2 server (see uploadAndActivateJettyP2Repo.sh)
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="${1:-9.4.58.v20250814}"
|
||||
echo "=== Building Jetty p2 repository for version ${VERSION} ==="
|
||||
|
||||
MAVEN_CENTRAL="https://repo1.maven.org/maven2"
|
||||
WORK_DIR="/tmp/jetty-p2-repo-${VERSION}"
|
||||
REPO_DIR="${WORK_DIR}/repository"
|
||||
STAGING_DIR="${WORK_DIR}/staging"
|
||||
PLUGINS_DIR="${STAGING_DIR}/plugins"
|
||||
FEATURES_DIR="${STAGING_DIR}/features/org.eclipse.jetty.bundles.f_${VERSION}"
|
||||
|
||||
rm -rf "${WORK_DIR}"
|
||||
mkdir -p "${PLUGINS_DIR}" "${FEATURES_DIR}"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Define the bundle list.
|
||||
# Format: "maven-group-path|artifact-id|osgi-bundle-symbolic-name"
|
||||
#
|
||||
# The OSGi symbolic names must match what the existing target platform
|
||||
# definition and feature.xml files reference.
|
||||
#
|
||||
# This list mirrors the contents of the official Eclipse Jetty p2 repo
|
||||
# (e.g. https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.57.v20241219/)
|
||||
# which ships 81 jars. All of these are versioned with the Jetty release
|
||||
# version, except for two static bundles listed in STATIC_BUNDLES below.
|
||||
# ---------------------------------------------------------------------------
|
||||
BUNDLES="\
|
||||
org/eclipse/jetty|jetty-alpn-client|org.eclipse.jetty.alpn.client
|
||||
org/eclipse/jetty|jetty-alpn-server|org.eclipse.jetty.alpn.server
|
||||
org/eclipse/jetty|jetty-annotations|org.eclipse.jetty.annotations
|
||||
org/eclipse/jetty|apache-jsp|org.eclipse.jetty.apache-jsp
|
||||
org/eclipse/jetty|jetty-client|org.eclipse.jetty.client
|
||||
org/eclipse/jetty|jetty-continuation|org.eclipse.jetty.continuation
|
||||
org/eclipse/jetty|jetty-deploy|org.eclipse.jetty.deploy
|
||||
org/eclipse/jetty|jetty-http|org.eclipse.jetty.http
|
||||
org/eclipse/jetty/http2|http2-client|org.eclipse.jetty.http2.client
|
||||
org/eclipse/jetty/http2|http2-http-client-transport|org.eclipse.jetty.http2.client.http
|
||||
org/eclipse/jetty/http2|http2-common|org.eclipse.jetty.http2.common
|
||||
org/eclipse/jetty/http2|http2-hpack|org.eclipse.jetty.http2.hpack
|
||||
org/eclipse/jetty/http2|http2-server|org.eclipse.jetty.http2.server
|
||||
org/eclipse/jetty|jetty-io|org.eclipse.jetty.io
|
||||
org/eclipse/jetty|jetty-jaas|org.eclipse.jetty.jaas
|
||||
org/eclipse/jetty|jetty-jaspi|org.eclipse.jetty.security.jaspi
|
||||
org/eclipse/jetty|jetty-jmx|org.eclipse.jetty.jmx
|
||||
org/eclipse/jetty|jetty-jndi|org.eclipse.jetty.jndi
|
||||
org/eclipse/jetty/osgi|jetty-osgi-alpn|org.eclipse.jetty.osgi.alpn.fragment
|
||||
org/eclipse/jetty/osgi|jetty-osgi-boot|org.eclipse.jetty.osgi.boot
|
||||
org/eclipse/jetty/osgi|jetty-osgi-boot-jsp|org.eclipse.jetty.osgi.boot.jsp
|
||||
org/eclipse/jetty/osgi|jetty-osgi-boot-warurl|org.eclipse.jetty.osgi.boot.warurl
|
||||
org/eclipse/jetty/osgi|jetty-httpservice|org.eclipse.jetty.osgi.httpservice
|
||||
org/eclipse/jetty|jetty-plus|org.eclipse.jetty.plus
|
||||
org/eclipse/jetty|jetty-proxy|org.eclipse.jetty.proxy
|
||||
org/eclipse/jetty|jetty-rewrite|org.eclipse.jetty.rewrite
|
||||
org/eclipse/jetty|jetty-security|org.eclipse.jetty.security
|
||||
org/eclipse/jetty|jetty-server|org.eclipse.jetty.server
|
||||
org/eclipse/jetty|jetty-servlet|org.eclipse.jetty.servlet
|
||||
org/eclipse/jetty|jetty-servlets|org.eclipse.jetty.servlets
|
||||
org/eclipse/jetty|jetty-util|org.eclipse.jetty.util
|
||||
org/eclipse/jetty|jetty-util-ajax|org.eclipse.jetty.util.ajax
|
||||
org/eclipse/jetty|jetty-webapp|org.eclipse.jetty.webapp
|
||||
org/eclipse/jetty/websocket|websocket-api|org.eclipse.jetty.websocket.api
|
||||
org/eclipse/jetty/websocket|websocket-client|org.eclipse.jetty.websocket.client
|
||||
org/eclipse/jetty/websocket|websocket-common|org.eclipse.jetty.websocket.common
|
||||
org/eclipse/jetty/websocket|javax-websocket-client-impl|org.eclipse.jetty.websocket.javax.websocket
|
||||
org/eclipse/jetty/websocket|javax-websocket-server-impl|org.eclipse.jetty.websocket.javax.websocket.server
|
||||
org/eclipse/jetty/websocket|websocket-server|org.eclipse.jetty.websocket.server
|
||||
org/eclipse/jetty/websocket|websocket-servlet|org.eclipse.jetty.websocket.servlet
|
||||
org/eclipse/jetty|jetty-xml|org.eclipse.jetty.xml"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Static bundles — these ship with the official Eclipse Jetty p2 repo but
|
||||
# have their own fixed version, independent of the Jetty release.
|
||||
# Format: "download-url|osgi-bundle-symbolic-name|bundle-version"
|
||||
#
|
||||
# javax.security.auth.message is the JASPIC 1.0 API from Eclipse Orbit.
|
||||
# Neither this project's code nor any Import-Package in our bundles actually
|
||||
# references it, so it is harmless to omit. It is included here for
|
||||
# completeness, mirrored from the previous Jetty p2 repository.
|
||||
# ---------------------------------------------------------------------------
|
||||
STATIC_BUNDLES="\
|
||||
https://p2.sapsailing.com/p2/jetty-9.4.57.v20241219/plugins/javax.security.auth.message_1.0.0.v201108011116.jar|javax.security.auth.message|1.0.0.v201108011116
|
||||
https://p2.sapsailing.com/p2/jetty-9.4.57.v20241219/plugins/javax.security.auth.message.source_1.0.0.v201108011116.jar|javax.security.auth.message.source|1.0.0.v201108011116
|
||||
https://p2.sapsailing.com/p2/jetty-9.4.57.v20241219/plugins/org.eclipse.jetty.osgi-servlet-api_3.1.0.M3.jar|org.eclipse.jetty.osgi-servlet-api|3.1.0.M3
|
||||
https://p2.sapsailing.com/p2/jetty-9.4.57.v20241219/plugins/org.eclipse.jetty.osgi-servlet-api.source_3.1.0.M3.jar|org.eclipse.jetty.osgi-servlet-api.source|3.1.0.M3"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Download bundles and source bundles
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- Downloading bundles from Maven Central ---"
|
||||
DOWNLOAD_ERRORS=0
|
||||
|
||||
while IFS='|' read -r GROUP ARTIFACT BSN; do
|
||||
[ -z "${GROUP}" ] && continue
|
||||
|
||||
JAR_URL="${MAVEN_CENTRAL}/${GROUP}/${ARTIFACT}/${VERSION}/${ARTIFACT}-${VERSION}.jar"
|
||||
SRC_URL="${MAVEN_CENTRAL}/${GROUP}/${ARTIFACT}/${VERSION}/${ARTIFACT}-${VERSION}-sources.jar"
|
||||
|
||||
echo " ${ARTIFACT} ..."
|
||||
# Download main bundle
|
||||
if ! curl -sfL -o "${PLUGINS_DIR}/${BSN}_${VERSION}.jar" "${JAR_URL}"; then
|
||||
echo " ERROR: Failed to download ${JAR_URL}"
|
||||
DOWNLOAD_ERRORS=$((DOWNLOAD_ERRORS + 1))
|
||||
continue
|
||||
fi
|
||||
|
||||
# Download source bundle (non-fatal if missing)
|
||||
if ! curl -sfL -o "${PLUGINS_DIR}/${BSN}.source_${VERSION}.jar" "${SRC_URL}"; then
|
||||
echo " WARNING: No source jar for ${ARTIFACT}"
|
||||
rm -f "${PLUGINS_DIR}/${BSN}.source_${VERSION}.jar"
|
||||
fi
|
||||
done <<EOF
|
||||
${BUNDLES}
|
||||
EOF
|
||||
|
||||
# Download static (non-Jetty-versioned) bundles
|
||||
echo ""
|
||||
echo "--- Downloading static bundles ---"
|
||||
|
||||
while IFS='|' read -r URL BSN BVERSION; do
|
||||
[ -z "${URL}" ] && continue
|
||||
echo " ${BSN} ${BVERSION} ..."
|
||||
if ! curl -sfL -o "${PLUGINS_DIR}/${BSN}_${BVERSION}.jar" "${URL}"; then
|
||||
echo " WARNING: Failed to download ${URL}"
|
||||
echo " This bundle is optional and can be copied manually"
|
||||
echo " from a previous Jetty p2 repo if needed."
|
||||
rm -f "${PLUGINS_DIR}/${BSN}_${BVERSION}.jar"
|
||||
fi
|
||||
done <<EOF
|
||||
${STATIC_BUNDLES}
|
||||
EOF
|
||||
|
||||
if [ ${DOWNLOAD_ERRORS} -gt 0 ]; then
|
||||
echo ""
|
||||
echo "ERROR: ${DOWNLOAD_ERRORS} bundle(s) failed to download. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo " Downloaded $(ls "${PLUGINS_DIR}"/*.jar 2>/dev/null | wc -l) jar files."
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Create the feature.xml
|
||||
# This wraps all the downloaded bundles into a single installable feature
|
||||
# called "org.eclipse.jetty.bundles.f" — matching the existing p2 repo.
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- Generating feature.xml ---"
|
||||
|
||||
cat > "${FEATURES_DIR}/feature.xml" <<FEATURE_HEADER
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feature
|
||||
id="org.eclipse.jetty.bundles.f"
|
||||
label="Jetty Bundles"
|
||||
version="${VERSION}">
|
||||
|
||||
<description>
|
||||
Jetty ${VERSION} bundles for OSGi, built from Maven Central artifacts.
|
||||
</description>
|
||||
|
||||
<license url="http://www.apache.org/licenses/LICENSE-2.0">
|
||||
Apache License 2.0 / Eclipse Public License 1.0
|
||||
</license>
|
||||
|
||||
FEATURE_HEADER
|
||||
|
||||
while IFS='|' read -r GROUP ARTIFACT BSN; do
|
||||
[ -z "${GROUP}" ] && continue
|
||||
cat >> "${FEATURES_DIR}/feature.xml" <<PLUGIN_ENTRY
|
||||
<plugin
|
||||
id="${BSN}"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="${VERSION}"
|
||||
unpack="false"/>
|
||||
|
||||
PLUGIN_ENTRY
|
||||
|
||||
# Also add the source plugin if we downloaded it
|
||||
if [ -f "${PLUGINS_DIR}/${BSN}.source_${VERSION}.jar" ]; then
|
||||
cat >> "${FEATURES_DIR}/feature.xml" <<SOURCE_ENTRY
|
||||
<plugin
|
||||
id="${BSN}.source"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="${VERSION}"
|
||||
unpack="false"/>
|
||||
|
||||
SOURCE_ENTRY
|
||||
fi
|
||||
done <<EOF
|
||||
${BUNDLES}
|
||||
EOF
|
||||
|
||||
# Add static bundles to the feature
|
||||
while IFS='|' read -r URL BSN BVERSION; do
|
||||
[ -z "${URL}" ] && continue
|
||||
if [ -f "${PLUGINS_DIR}/${BSN}_${BVERSION}.jar" ]; then
|
||||
cat >> "${FEATURES_DIR}/feature.xml" <<STATIC_ENTRY
|
||||
<plugin
|
||||
id="${BSN}"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="${BVERSION}"
|
||||
unpack="false"/>
|
||||
|
||||
STATIC_ENTRY
|
||||
fi
|
||||
done <<EOF
|
||||
${STATIC_BUNDLES}
|
||||
EOF
|
||||
|
||||
echo "</feature>" >> "${FEATURES_DIR}/feature.xml"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Also create a source feature (org.eclipse.jetty.bundles.f.source)
|
||||
# that references the source bundles – matching the existing p2 structure.
|
||||
# ---------------------------------------------------------------------------
|
||||
SOURCE_FEATURE_DIR="${STAGING_DIR}/features/org.eclipse.jetty.bundles.f.source_${VERSION}"
|
||||
mkdir -p "${SOURCE_FEATURE_DIR}"
|
||||
|
||||
cat > "${SOURCE_FEATURE_DIR}/feature.xml" <<SOURCE_FEATURE_HEADER
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feature
|
||||
id="org.eclipse.jetty.bundles.f.source"
|
||||
label="Jetty Bundles (Sources)"
|
||||
version="${VERSION}">
|
||||
|
||||
<description>
|
||||
Source bundles for Jetty ${VERSION}, built from Maven Central artifacts.
|
||||
</description>
|
||||
|
||||
<license url="http://www.apache.org/licenses/LICENSE-2.0">
|
||||
Apache License 2.0 / Eclipse Public License 1.0
|
||||
</license>
|
||||
|
||||
SOURCE_FEATURE_HEADER
|
||||
|
||||
while IFS='|' read -r GROUP ARTIFACT BSN; do
|
||||
[ -z "${GROUP}" ] && continue
|
||||
if [ -f "${PLUGINS_DIR}/${BSN}.source_${VERSION}.jar" ]; then
|
||||
cat >> "${SOURCE_FEATURE_DIR}/feature.xml" <<SOURCE_PLUGIN_ENTRY
|
||||
<plugin
|
||||
id="${BSN}.source"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="${VERSION}"
|
||||
unpack="false"/>
|
||||
|
||||
SOURCE_PLUGIN_ENTRY
|
||||
fi
|
||||
done <<EOF
|
||||
${BUNDLES}
|
||||
EOF
|
||||
|
||||
# Add static source bundles to the source feature
|
||||
while IFS='|' read -r URL BSN BVERSION; do
|
||||
[ -z "${URL}" ] && continue
|
||||
# Only include entries whose BSN ends with .source
|
||||
case "${BSN}" in
|
||||
*.source)
|
||||
if [ -f "${PLUGINS_DIR}/${BSN}_${BVERSION}.jar" ]; then
|
||||
cat >> "${SOURCE_FEATURE_DIR}/feature.xml" <<STATIC_SRC_ENTRY
|
||||
<plugin
|
||||
id="${BSN}"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="${BVERSION}"
|
||||
unpack="false"/>
|
||||
|
||||
STATIC_SRC_ENTRY
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done <<EOF
|
||||
${STATIC_BUNDLES}
|
||||
EOF
|
||||
|
||||
echo "</feature>" >> "${SOURCE_FEATURE_DIR}/feature.xml"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Publish the p2 repository using Eclipse's FeaturesAndBundlesPublisher
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- Publishing p2 repository ---"
|
||||
echo " Source: ${STAGING_DIR}"
|
||||
echo " Destination: ${REPO_DIR}"
|
||||
|
||||
eclipse -nosplash -verbose \
|
||||
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
|
||||
-metadataRepository "file:${REPO_DIR}" \
|
||||
-artifactRepository "file:${REPO_DIR}" \
|
||||
-source "${STAGING_DIR}" \
|
||||
-publishArtifacts \
|
||||
-configs gtk.linux.x86_64
|
||||
|
||||
echo ""
|
||||
echo "=== SUCCESS ==="
|
||||
echo ""
|
||||
echo "p2 repository created at: ${REPO_DIR}"
|
||||
echo ""
|
||||
echo "To use it locally, update your target platform definition to point to:"
|
||||
echo " file:${REPO_DIR}"
|
||||
echo ""
|
||||
echo "To upload to sapsailing.com and update all workspace references, run:"
|
||||
echo " ./uploadAndActivateJettyP2Repo.sh ${VERSION}"
|
||||
@@ -1,114 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# After creating the p2 repository with createJettyP2RepoFromMavenCentral.sh,
|
||||
# this script uploads it and updates all references in the workspace.
|
||||
#
|
||||
# Usage:
|
||||
# ./uploadAndActivateJettyP2Repo.sh [VERSION]
|
||||
#
|
||||
# VERSION defaults to 9.4.58.v20250814 if not supplied.
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
VERSION="${1:-9.4.58.v20250814}"
|
||||
REPO_DIR="/tmp/jetty-p2-repo-${VERSION}/repository"
|
||||
|
||||
if [ ! -d "${REPO_DIR}" ]; then
|
||||
echo "ERROR: p2 repository not found at ${REPO_DIR}"
|
||||
echo "Run ./createJettyP2RepoFromMavenCentral.sh ${VERSION} first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Determine the old version from the target definition
|
||||
# ---------------------------------------------------------------------------
|
||||
OLD_VERSION=$(grep '<unit id="org\.eclipse\.jetty\.bundles\.f\.feature\.group" version="' \
|
||||
"${SCRIPT_DIR}/../definitions/race-analysis-p2-remote.target" \
|
||||
| sed -e 's/.*version="\([^"]*\)".*/\1/')
|
||||
|
||||
echo "=== Upgrading Jetty from ${OLD_VERSION} to ${VERSION} ==="
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 1. Upload p2 repo to sapsailing.com
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- Uploading p2 repository to sapsailing.com ---"
|
||||
ssh trac@sapsailing.com "rm -rf p2-repositories/jetty-${VERSION}"
|
||||
scp -rp "${REPO_DIR}" "trac@sapsailing.com:p2-repositories/jetty-${VERSION}"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 2. Update target platform definitions
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- Updating target platform definitions ---"
|
||||
for TARGET_FILE in \
|
||||
"${SCRIPT_DIR}/../definitions/race-analysis-p2-remote.target" \
|
||||
"${SCRIPT_DIR}/../definitions/race-analysis-p2-local.target"
|
||||
do
|
||||
if [ -f "${TARGET_FILE}" ]; then
|
||||
echo " ${TARGET_FILE}"
|
||||
sed -i \
|
||||
-e 's/\(<unit id="org\.eclipse\.jetty\.bundles\.f\.\(source\.\)\?feature\.group" version="\)[^"]*\("\/>\)/\1'"${VERSION}"'\3/' \
|
||||
-e 's|\(<repository location="https://p2\.sapsailing\.com/p2/\)jetty[^"]*\("\/>\)|\1jetty-'"${VERSION}"'\2|' \
|
||||
"${TARGET_FILE}"
|
||||
fi
|
||||
done
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 3. Update feature.xml files with new Jetty version
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- Updating feature.xml files ---"
|
||||
|
||||
RUNTIME_FEATURE="${SCRIPT_DIR}/../../com.sap.sse.feature.runtime/feature.xml"
|
||||
if [ -f "${RUNTIME_FEATURE}" ]; then
|
||||
echo " ${RUNTIME_FEATURE}"
|
||||
sed -i -e 's/version="'"${OLD_VERSION}"'"/version="'"${VERSION}"'"/' "${RUNTIME_FEATURE}"
|
||||
fi
|
||||
|
||||
TARGET_BASE_FEATURE="${SCRIPT_DIR}/../../com.sap.sailing.targetplatform.base/features/target-base/feature.xml"
|
||||
if [ -f "${TARGET_BASE_FEATURE}" ]; then
|
||||
echo " ${TARGET_BASE_FEATURE}"
|
||||
sed -i -e 's/version="'"${OLD_VERSION}"'"/version="'"${VERSION}"'"/' "${TARGET_BASE_FEATURE}"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 4. Update apache-jsp and jetty-osgi-boot-jsp jars in target-base
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "--- Updating JSP bundles in target-base plugins ---"
|
||||
TARGET_BASE_PLUGINS="${SCRIPT_DIR}/../../com.sap.sailing.targetplatform.base/plugins/target-base"
|
||||
|
||||
echo " Removing old versions..."
|
||||
rm -f "${TARGET_BASE_PLUGINS}/apache-jsp-${OLD_VERSION}.jar"
|
||||
rm -f "${TARGET_BASE_PLUGINS}/apache-jsp-${OLD_VERSION}-sources.jar"
|
||||
rm -f "${TARGET_BASE_PLUGINS}/jetty-osgi-boot-jsp-${OLD_VERSION}.jar"
|
||||
rm -f "${TARGET_BASE_PLUGINS}/jetty-osgi-boot-jsp-${OLD_VERSION}-sources.jar"
|
||||
|
||||
MAVEN_CENTRAL="https://repo1.maven.org/maven2"
|
||||
|
||||
echo " Downloading new versions..."
|
||||
wget -q -O "${TARGET_BASE_PLUGINS}/apache-jsp-${VERSION}.jar" \
|
||||
"${MAVEN_CENTRAL}/org/eclipse/jetty/apache-jsp/${VERSION}/apache-jsp-${VERSION}.jar"
|
||||
wget -q -O "${TARGET_BASE_PLUGINS}/apache-jsp-${VERSION}-sources.jar" \
|
||||
"${MAVEN_CENTRAL}/org/eclipse/jetty/apache-jsp/${VERSION}/apache-jsp-${VERSION}-sources.jar"
|
||||
wget -q -O "${TARGET_BASE_PLUGINS}/jetty-osgi-boot-jsp-${VERSION}.jar" \
|
||||
"${MAVEN_CENTRAL}/org/eclipse/jetty/osgi/jetty-osgi-boot-jsp/${VERSION}/jetty-osgi-boot-jsp-${VERSION}.jar"
|
||||
wget -q -O "${TARGET_BASE_PLUGINS}/jetty-osgi-boot-jsp-${VERSION}-sources.jar" \
|
||||
"${MAVEN_CENTRAL}/org/eclipse/jetty/osgi/jetty-osgi-boot-jsp/${VERSION}/jetty-osgi-boot-jsp-${VERSION}-sources.jar"
|
||||
|
||||
echo " Adding to git..."
|
||||
git -C "${TARGET_BASE_PLUGINS}" add "*.jar"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Done
|
||||
# ---------------------------------------------------------------------------
|
||||
echo ""
|
||||
echo "=== DONE ==="
|
||||
echo ""
|
||||
echo "Your target platform now references jetty-${VERSION}."
|
||||
echo "Next steps:"
|
||||
echo " 1. Rebuild the local base p2 repository: ./createLocalBaseP2repository.sh"
|
||||
echo " 2. Upload it: ./uploadRepositoryToServer.sh"
|
||||
echo " 3. Reload the target platform in your IDE"
|
||||
Reference in New Issue
Block a user