Skip to content

Locally publish and use `org.jcryptool.thirdparty.libraries.p2` changes

Simon Leischnig edited this page Apr 13, 2021 · 3 revisions

On the example of an update to releng/org.jcryptool.thirdparty.libraries.p2, we demonstrate how to directly use updates made to the pom.xml from that project. To that end, we need to

0) Setup

For completeness, these are the commands to get the thirdparty project from github:

git clone https://github.com/simlei/org.jcryptool.thirdparty
cd org.jcryptool.thirdparty

Now, do your modifications, e.g. the aforementioned changes w.r.t. Google guava.

1) Build

# assumed: cd org.jcryptool.thirdparty
./bin/build-all

The build-all program is a bash script. If you don't have bash (you are probably under Windows), you need to run the maven commands from that file manually.

2) Publish

# assumed: cd org.jcryptool.thirdparty
./bin/publish-p2local-libraries-misc

There are many publish-scripts in that folder; for now, stick to this one. Notice the p2local part -- it indicates, that a p2 repository for the artifacts is created, and then hosted locally via a light-weight web server listening on localhost. This contains your libraries; the URL is by default http://localhost:8080/site/libraries/. The command will continue running until you stop it via e.g. Ctrl+C in the terminal. When stopped, the localhost URL is no longer available.

Adapting the target platform

The JCrypTool target platform is located at <JCT-core-repository>/org.jcryptool.target/org.jcryptool.target.target. You may copy this target definition file, change the copy and set the copy as your Eclipse workspace's main target.

In the target platform, replace the cryptool.org/jct/libraries[...] update site definition with the new local url http://localhost:8080/site/libraries/. If you're not also hosting thirdparty-p2/jre and thirdparty-p2/m2bundle, you should leave these entries alone. If you use the Eclipse GUI to edit the target platform to add a software site, it will let you select packages to include from there. Just select them all. For me, this results in:

<!-- ... other locations -->
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
	<repository location="http://localhost:8080/site/libraries"/>
	<unit id="com.google.guava" version="26.0.0.jre"/>
	<unit id="com.google.guava.source" version="26.0.0.jre"/>
</location>

Eclipse needs to be made aware of that; Be sure you "Set as active target" / "Refresh Target" or even "Edit..."->"Manage"->(select your localhost site)->"Reload" (all from the GUI of your .target file.).

Then of course, add references to these libraries in your META-INF/MANIFEST.MF file in the plug-in that needs the new libraries -- e.g. guava. The "Contents" tab of your .target file shows you available ids. A full workspace rebuild afterwards should make everything work neat from then on.

Later

After testing this and developing your code on these libraries, you have to make an actual update to the thirdparty repository and get the libraries published to cryptool.org, so that our builds get these libraries, too. Do a pull request of the update against org.jcryptool.thirdparty repository, or contact us by mail or via gitter to get a new library in the central target definition.

Clone this wiki locally