Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "JUnit5 Update Process"

m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
The following is a guide through the process of updating the JUnit 5 stack in Orbit, based off of https://bugs.eclipse.org/bugs/show_bug.cgi?id=567358#c2 .
+
Platform/JDT now use Maven Central version of JUnit 5, which has all the OSGi information to be directly usable.
This guide assumes a locally cloned git repository of [https://git.eclipse.org/c/orbit/orbit-recipes.git/ orbit-recipes] and some basic understanding of the Maven build system and OSGi metadata.<br/>
+
  
* For most JUnit 5 minor version bumps, the change almost entirely involves a simple search and replace. For example, for the update [https://git.eclipse.org/r/c/orbit/orbit-recipes/+/156762 from 5.5.1 to 5.6.0], the following needed to be done :
+
To upgrade JUnit 5 version, then submit a PR to https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/master/eclipse.platform.releng.prereqs.sdk/eclipse-sdk-prereqs.target that changes version for the <code>junit-jupiter-...</code> and <code>junit-platform-...</code> Maven artifacts to the desired version as available on Maven Central.
 
+
cd junit/junit5
+
find . -type f | xargs sed -i 's/5.5.1/5.6.0/g'
+
find . -type f | xargs sed -i 's/1.5.1/1.6.0/g'
+
for m in `ls -1 | grep 1.5.1`; do git mv $m ${m/1.5.1/1.6.0/} ; done;
+
for m in `ls -1 | grep 5.5.1`; do git mv $m ${m/5.5.1/5.6.0/} ; done;
+
 
+
* The JUnit 5 bundles in <code>releng/aggregationfeature/feature.xml</code> (from the root of the project) must also be updated.
+
 
+
org.apiguardian, and org.opentest4j did not need to be updated but the org.junit dependence went from 4.12 to 4.13. So, how was it known this was required ?
+
 
+
* Discover dependency changes by running the script from below
+
 
+
In this example we use JUnit 5.6.0 -> 5.7.0 as this is the script needed to be run more recently. As modules are added/removed, the script can evolve accordingly.
+
(Ideal to run in an empty directory)
+
 
+
for art in junit-platform-{commons,engine,launcher,runner,suite-api}; do
+
  for v in "1.6.0" "1.7.0"; do
+
    curl -L -s -O https://search.maven.org/remotecontent?filepath=org/junit/platform/${art}/${v}/${art}-${v}.pom
+
  done
+
  diff -u ${art}*
+
done
+
+
art=junit-vintage-engine
+
for v in "5.6.0" "5.7.0"; do
+
  curl -L -s -O https://search.maven.org/remotecontent?filepath=org/junit/vintage/${art}/${v}/${art}-${v}.pom
+
done
+
diff -u ${art}*
+
+
for art in junit-jupiter-{api,engine,migrationsupport,params}; do
+
  for v in "5.6.0" "5.7.0"; do
+
    curl -L -s -O https://search.maven.org/remotecontent?filepath=org/junit/jupiter/${art}/${v}/${art}-${v}.pom
+
  done
+
  diff -u ${art}*
+
done
+
 
+
This compares the pom files of the old and new artifacts and is a good way to determine what may have changed. Changes may need to be reflected in the corresponding bundle's <code>osgi.bnd</code> file.
+
 
+
There may be a few false positives, like pom dependencies being modified around, but generally, you're looking for version numbers of dependency artifacts that are changed/added/removed . Obviously ignore the version numbers of the poms themselves (eg. 5.5.1 -> 5.6.0).
+
 
+
* The final step is to update the CQs for the bundles, although usually this would have been filed beforehand. [https://dev.eclipse.org/ipzilla/show_bug.cgi?id=21545 CQ 21545] is an example of how the CQ should appear.
+
 
+
Once a change gets pushed for review, (and CQs get updated acccordingly in <code>ip_log.xml</code>), [https://ci.eclipse.org/orbit/job/gerrit-orbit-recipes/ gerrit-orbit-recipes] should trigger a build and response on the review with a temporary generated p2 repository that can be used to verify things work as expected. After the change is merged it should be available as an I-build shortly or until a milestone release.
+

Latest revision as of 08:17, 15 July 2022

Platform/JDT now use Maven Central version of JUnit 5, which has all the OSGi information to be directly usable.

To upgrade JUnit 5 version, then submit a PR to https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/master/eclipse.platform.releng.prereqs.sdk/eclipse-sdk-prereqs.target that changes version for the junit-jupiter-... and junit-platform-... Maven artifacts to the desired version as available on Maven Central.

Back to the top