diff --git a/.github/workflows/p2-site.yml b/.github/workflows/p2-site.yml index fb60e75..de96036 100644 --- a/.github/workflows/p2-site.yml +++ b/.github/workflows/p2-site.yml @@ -30,6 +30,17 @@ jobs: cache: maven - name: Build and verify p2 repository run: ./mvnw --batch-mode clean verify + - name: Assert p2 repository metadata + run: | + test -f "$P2_REPO/p2.index" + test -f "$P2_REPO/content.jar" + test -f "$P2_REPO/artifacts.jar" + test -f "$P2_REPO/content.xml" + test -f "$P2_REPO/artifacts.xml" + test -f "$P2_REPO/site.xml" + grep -q 'org.eclipse.egit.pullrequest.feature' "$P2_REPO/content.xml" + test -n "$(find "$P2_REPO/features" -name 'org.eclipse.egit.pullrequest.feature_*.jar')" + test -n "$(find "$P2_REPO/plugins" -name 'org.eclipse.egit.pullrequest_*.jar')" - name: Resolve feature installation run: >- ./mvnw --batch-mode --non-recursive @@ -78,9 +89,12 @@ jobs: rm -rf p2 mkdir p2 cp -a "$SITE"/. p2/ + org.eclipse.egit.pullrequest.repository/finalize-p2-repository.sh p2 # Browsers get install instructions; p2 clients ignore index.html - # because they request content.jar and artifacts.jar by name. - cp site/p2-index.html p2/index.html + # because they request content.xml / content.jar by name. + test -f p2/p2.index + test -f p2/content.xml + test -f p2/artifacts.xml - name: Commit the published update site run: | git config user.name 'github-actions[bot]' diff --git a/AGENTS.md b/AGENTS.md index ee49c66..61e5720 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -150,22 +150,24 @@ ALL source files must include EPL-2.0 header: eclipse-pullrequest-plugin/ ├── pom.xml # Parent POM ├── org.eclipse.egit.pullrequest.target/ # Target platform -├── org.eclipse.egit.pullrequest/ # Main plugin (37 Java files) +├── org.eclipse.egit.pullrequest/ # Main plugin │ ├── src/org/eclipse/egit/pullrequest/ │ │ ├── Activator.java # Bundle activator │ │ └── internal/ -│ │ ├── model/ # Data models (4 files) -│ │ ├── client/ # Abstraction layer (4 files) -│ │ ├── bitbucket/ # Bitbucket provider (2 files) -│ │ ├── github/ # GitHub provider (3 files) +│ │ ├── model/ # Data models +│ │ ├── client/ # Abstraction layer +│ │ ├── bitbucket/ # Bitbucket provider +│ │ ├── github/ # GitHub provider │ │ └── ui/ # Synchronize/compare integration │ ├── META-INF/MANIFEST.MF # OSGi bundle manifest │ ├── plugin.xml # Extension points │ └── plugin.properties # Externalized strings -└── org.eclipse.egit.pullrequest.test/ # Test fragment (2 test files) - └── src/org/eclipse/egit/pullrequest/internal/ - ├── bitbucket/BitbucketClientTest.java - └── github/GitHubJsonParserTest.java +├── org.eclipse.egit.pullrequest.test/ # Test fragment +├── org.eclipse.egit.pullrequest.feature/ # Installable feature +└── org.eclipse.egit.pullrequest.repository/ # Update site / p2 repository + ├── category.xml # p2 categories (Tycho) + ├── site.xml # Classic Eclipse update site + └── finalize-p2-repository.sh # p2.index + uncompressed XML ``` ### Key Packages diff --git a/README.md b/README.md index b8bd319..7854b77 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,11 @@ Before building this plugin, you must build JGit and EGit to create their p2 rep ``` The p2 update site is written to -`org.eclipse.egit.pullrequest.repository/target/repository/`. Add that -folder in Eclipse as a local repository to test a build before publishing. +`org.eclipse.egit.pullrequest.repository/target/repository/`. That +folder is a complete Equinox p2 repository (`p2.index`, `content.xml`, +`artifacts.xml`, and the compressed `.jar` / `.xz` variants) plus a +classic `site.xml`. Add the folder in Eclipse as a local repository to +test a build before publishing. #### Build without tests: ```bash diff --git a/org.eclipse.egit.pullrequest.repository/build.properties b/org.eclipse.egit.pullrequest.repository/build.properties index 432ad98..74f8d12 100644 --- a/org.eclipse.egit.pullrequest.repository/build.properties +++ b/org.eclipse.egit.pullrequest.repository/build.properties @@ -1 +1,2 @@ -bin.includes = category.xml +bin.includes = category.xml,\ + site.xml diff --git a/org.eclipse.egit.pullrequest.repository/category.xml b/org.eclipse.egit.pullrequest.repository/category.xml index e12fbbb..ea896bf 100644 --- a/org.eclipse.egit.pullrequest.repository/category.xml +++ b/org.eclipse.egit.pullrequest.repository/category.xml @@ -1,9 +1,9 @@ - + + Pull Request Review update site. + + diff --git a/org.eclipse.egit.pullrequest.repository/finalize-p2-repository.sh b/org.eclipse.egit.pullrequest.repository/finalize-p2-repository.sh new file mode 100755 index 0000000..f7ced63 --- /dev/null +++ b/org.eclipse.egit.pullrequest.repository/finalize-p2-repository.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +#******************************************************************************* +# Copyright (C) 2026, Philipp Hoenisch and others +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +#******************************************************************************* +# +# Finish a Tycho eclipse-repository so it is a complete p2 update site: +# uncompressed XML (GitHub Pages friendly), p2.index covering every +# metadata format that is present, plus site.xml and a browser landing page. + +set -euo pipefail + +if [ "$#" -ne 1 ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +REPO=$1 +if [ ! -d "$REPO" ]; then + echo "not a directory: $REPO" >&2 + exit 1 +fi + +SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) + +unzip_jar() { + jar=$1 + xml=$2 + if [ -f "$REPO/$jar" ] && [ ! -f "$REPO/$xml" ]; then + unzip -o -d "$REPO" "$REPO/$jar" + fi +} + +unzip_jar content.jar content.xml +unzip_jar artifacts.jar artifacts.xml + +append_if_present() { + var_name=$1 + file=$2 + if [ -f "$REPO/$file" ]; then + eval "$var_name=\${$var_name}${file}," + fi +} + +meta_order= +art_order= +append_if_present meta_order content.xml.xz +append_if_present meta_order content.xml +append_if_present meta_order content.jar +append_if_present art_order artifacts.xml.xz +append_if_present art_order artifacts.xml +append_if_present art_order artifacts.jar + +cat > "$REPO/p2.index" <eclipse-repository Pull Request Review Update Site + + Tycho p2 repository and Eclipse update site for the Pull Request + Review feature. + @@ -36,8 +40,31 @@ false true true + true + Pull Request Review + + org.codehaus.mojo + exec-maven-plugin + 3.5.0 + + + finalize-p2-repository + verify + + exec + + + bash + + ${project.basedir}/finalize-p2-repository.sh + ${project.build.directory}/repository + + + + + diff --git a/org.eclipse.egit.pullrequest.repository/site.xml b/org.eclipse.egit.pullrequest.repository/site.xml new file mode 100644 index 0000000..67872e5 --- /dev/null +++ b/org.eclipse.egit.pullrequest.repository/site.xml @@ -0,0 +1,17 @@ + + + + Pull Request Review update site. + + + + + + + Review GitHub and Bitbucket pull requests from inside Eclipse. + + +