-
Notifications
You must be signed in to change notification settings - Fork 1
Locally publish and use `org.jcryptool.thirdparty.libraries.p2` changes
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
- (1) Build the modifications; as an example, we assume these lines as added: https://github.com/jcryptool/org.jcryptool.thirdparty/blob/a7c975ac1be978713b51a89db323834ba76d68e2/releng/org.jcryptool.thirdparty.libraries.p2/pom.xml#L29-L34 -- this introduces the google guava library from maven central.
- (2) Publish the new state locally
- (3) modify the target platform of JCrypTool to recognize the now locally hosted artifacts.
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.thirdpartyNow, do your modifications, e.g. the aforementioned changes w.r.t. Google guava.
# assumed: cd org.jcryptool.thirdparty
./bin/build-allThe 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.
# assumed: cd org.jcryptool.thirdparty
./bin/publish-p2local-libraries-miscThere 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.
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.