Skip to content

Commit

Permalink
[24] Try building the java24 patch on JDT infra
Browse files Browse the repository at this point in the history
Command line approach using pde-build and p2's publishers

Fixes eclipse-jdt/eclipse.jdt.core#3244
  • Loading branch information
stephan-herrmann committed Nov 8, 2024
1 parent c4d81ad commit e49a1ed
Show file tree
Hide file tree
Showing 9 changed files with 636 additions and 0 deletions.
100 changes: 100 additions & 0 deletions org.eclipse.jdt.releng/patchbuild/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash

### BEGIN PARAMS
if [ -z "$Y_BUILD" ]
then
echo "Need to specify the buildId of a Y-Build"
exit 1
fi
if [ -z "$SDKTIMESTAMP" ]
then
echo "Need to specify the timestamp of the SDK to build against"
exit 1
fi
if [ -z "$JDT_VERSION_MAX" ]
then
echo "Need to specify the maximum JDT version to which this patch should be applicable"
exit 1
fi

SDKTAG=${SDKTAG:="I${SDKTIMESTAMP}"}
SDKVERSION=${SDKVERSION:=${SDKTAG}}
SDKFILE=eclipse-SDK-${SDKVERSION}-linux-gtk-x86_64.tar.gz
DROPS_DIR=${DROPS_DIR:=${SDKVERSION}}
SDKURL=https://download.eclipse.org/eclipse/downloads/drops4/${DROPS_DIR}/${SDKFILE}
# range of versions of org.eclipse.jdt.feature.group to which the result should be applicable:
JDT_VERSION_RANGE=${JDT_VERSION_RANGE:="[3.20.0.v${SDKTIMESTAMP},${JDT_VERSION_MAX})"}
### END PARAMS

## Prepare eclipse for running the build:
if [ ! -e ${SDKFILE} ]
then
wget ${SDKURL}
fi
if [ ! -x eclipse/eclipse ]
then
tar xzf ${SDKFILE}
fi

## Locations & Files:
BASE=`pwd`
ECLIPSE=${BASE}/eclipse
LAUNCHER=`ls ${ECLIPSE}/plugins/org.eclipse.equinox.launcher_*.jar`
PDEBUILD=`ls -d ${ECLIPSE}/plugins/org.eclipse.pde.build_*`

TIMESTAMP=`date +"%Y%m%d-%H%M"`


## Prepare work clean area:
if [ -e work ]
then
/bin/rm -r work/*
else
mkdir work
fi

## Substitutions:
cat src/feature.xml.in | sed -e "s|SDKTIMESTAMP|${SDKTIMESTAMP}|" > src/org.eclipse.jdt.java24patch/feature.xml
cat builder/build.properties.in | sed -e "s|BASEDIR|${BASE}|g;s/TIMESTAMP/${TIMESTAMP}/g" > builder/build.properties
cat maps/jdtpatch.map.in | sed -e "s|BASEDIR|${BASE}|g;s|Y_BUILD|${Y_BUILD}|g" > maps/jdtpatch.map
cp maps/jdtpatch.map work/directory.txt

cd work
mkdir buildRepo

java -jar ${LAUNCHER} -nosplash \
-application org.eclipse.ant.core.antRunner \
-buildfile ${PDEBUILD}/scripts/build.xml \
-Dbuilder=${BASE}/builder \
-DbuildDirectory=${BASE}/work \
-Dmap.file.path=${BASE}/maps/jdtpatch.map

echo "Created content:"
ls -lR buildRepo

cd ${BASE}

cd work/features/org.eclipse.jdt.java24patch
unzip -o ${BASE}/work/buildRepo/features/org.eclipse.jdt.java24patch_* feature.xml
cd -

${BASE}/eclipse/eclipse -nosplash -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
-metadataRepository file:${BASE}/work/buildRepo \
-artifactRepository file:${BASE}/work/buildRepo \
-source ${BASE}/work

${BASE}/eclipse/eclipse -nosplash -application org.eclipse.equinox.p2.publisher.CategoryPublisher \
-metadataRepository file:${BASE}/work/buildRepo \
-categoryDefinition file:${BASE}/src/category.xml

cd work/buildRepo
mv content.xml content-ORIG.xml
xsltproc --nonet --nowrite \
--stringparam patchFeatureVersionRange "${JDT_VERSION_RANGE}" \
--stringparam patchFeatureIU org.eclipse.jdt.java24patch.feature.group ${BASE}/patchMatchVersion.xsl \
content-ORIG.xml > content.xml

jar cf content.jar content.xml
jar cf artifacts.jar artifacts.xml
zip -r ${BASE}/work/org.eclipse.jdt.java24patch.zip features plugins *.jar
cd -
16 changes: 16 additions & 0 deletions org.eclipse.jdt.releng/patchbuild/builder/build.properties.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
collectingFolder=.
archivePrefix=.
base=BASEDIR/eclipse
baseLocation=BASEDIR/eclipse

p2.gathering=true
skipMirroring=true
p2.metadata.repo.name="Eclipse JDT support for Java 24 EA"
p2.category.definition=file:BASEDIR/src/category.xml

topLevelElementType=feature
topLevelElementId=org.eclipse.jdt.java24patch

buildLabel=P
buildId=TIMESTAMP

8 changes: 8 additions & 0 deletions org.eclipse.jdt.releng/patchbuild/maps/jdtpatch.map.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugin@org.eclipse.jdt.core.compiler.batch=p2IU,id=org.eclipse.jdt.core.compiler.batch,repository=Y_BUILD
plugin@org.eclipse.jdt.core=p2IU,id=org.eclipse.jdt.core,repository=Y_BUILD
plugin@org.eclipse.jdt.ui=p2IU,id=org.eclipse.jdt.ui,repository=Y_BUILD
plugin@org.eclipse.jdt.core.manipulation=p2IU,id=org.eclipse.jdt.core.manipulation,repository=Y_BUILD
plugin@org.eclipse.jdt.astview=p2IU,id=org.eclipse.jdt.astview,repository=Y_BUILD
plugin@org.eclipse.jdt.launching=p2IU,id=org.eclipse.jdt.launching,repository=Y_BUILD

feature@org.eclipse.jdt.java24patch=COPY,BASEDIR/src
67 changes: 67 additions & 0 deletions org.eclipse.jdt.releng/patchbuild/patchMatchVersion.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
This transform is to work around bug 350088.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=350088
The original idea of using and XSL transform for this work-around,
came from a message list posting in 2009 by Paul Webster,
https://www.eclipse.org/forums/index.php?t=msg&th=40931&start=0&
While was referenced in a 2009 blog post by Andrew Niefer,
http://aniefer.blogspot.com/2009/06/patching-features-part-2.html.
The details here are heavily modified, just wanted to acknowledge those
sources of inspiration. Paul also used XSLT to final form of metadata for
our executable feature, in current builds.
-->

<xsl:param name="patchFeatureVersionRange">
$patchFeatureVersionRange
</xsl:param>
<xsl:param name="patchFeatureIU">
$patchFeatureIU
</xsl:param>
<xsl:variable name="quot">
"
</xsl:variable>
<xsl:variable name="apos">
'
</xsl:variable>

<xsl:template match="processing-instruction('metadataRepository')">
<xsl:text>&#xa;</xsl:text>
<xsl:copy />
<xsl:text>&#xa;</xsl:text>
<xsl:comment>
This content.xml file was transformed to include "specific range match"
for the feature intended to be patched.
Feature (IU) to be patched:
<xsl:value-of select="$patchFeatureIU" />
Version Range:
<xsl:value-of select="$patchFeatureVersionRange" />

XSLT Version = <xsl:copy-of select="system-property('xsl:version')" />
XSLT Vendor = <xsl:copy-of select="system-property('xsl:vendor')" />
XSLT Vendor URL = <xsl:copy-of select="system-property('xsl:vendor-url')" />
<xsl:text>&#xa;</xsl:text>
</xsl:comment>
<xsl:text>&#xa;</xsl:text>
<xsl:apply-templates />
</xsl:template>


<!-- standard copy template -->
<xsl:template match="@*|node()">

<xsl:copy>
<xsl:apply-templates select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>

<xsl:template match="@range[../@name='org.eclipse.jdt.feature.group']">
<xsl:attribute name="range"><xsl:value-of select="$patchFeatureVersionRange" /></xsl:attribute>
</xsl:template>

</xsl:stylesheet>
14 changes: 14 additions & 0 deletions org.eclipse.jdt.releng/patchbuild/src/category.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature id="org.eclipse.jdt.java24patch" version="0.0.0" patch="true">
<category name="Eclipse Java 23 support for 2024-12 development stream"/>
</feature>
<feature id="org.eclipse.jdt.java24patch.source" version="0.0.0" patch="true">
<category name="Eclipse Java 23 support for 2024-12 development stream"/>
</feature>
<category-def name="Eclipse Java 23 support for 2024-12 development stream" label="Eclipse Java 23 support for 2024-12 development stream">
<description>
Eclipse Java 23 support for 2024-12 development stream.
</description>
</category-def>
</site>
48 changes: 48 additions & 0 deletions org.eclipse.jdt.releng/patchbuild/src/feature.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.jdt.java24patch"
label="%featureName"
version="1.2.400.qualifier"
provider-name="%providerName">

<description>
%description
</description>

<copyright>
%copyright
</copyright>

<license url="%licenseURL">
%license
</license>

<requires>
<import feature="org.eclipse.jdt" version="3.20.0.vSDKTIMESTAMP" patch="true"/>
</requires>

<plugin
id="org.eclipse.jdt.core"
version="3.40.50.qualifier"/>

<plugin
id="org.eclipse.jdt.core.compiler.batch"
version="3.40.50.qualifier"/>

<plugin
id="org.eclipse.jdt.ui"
version="3.33.200.qualifier"/>

<plugin
id="org.eclipse.jdt.core.manipulation"
version="1.21.300.qualifier"/>

<plugin
id="org.eclipse.jdt.astview"
version="1.6.250.qualifier"/>

<plugin
id="org.eclipse.jdt.launching"
version="3.23.150.qualifier"/>

</feature>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bin.includes = feature.xml,\
feature.properties \
license.html

Loading

0 comments on commit e49a1ed

Please sign in to comment.