Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra: convert nested libs to wrapped OSGi bundles #406

Merged
merged 2 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions net.sf.eclipsecs.core/.classpath
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
<accessrule kind="accessible" pattern="com/puppycrawl/tools/checkstyle/meta/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/dom4j-2.1.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/snakeyaml-1.33.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javassist-3.28.0-GA.jar"/>
<classpathentry kind="lib" path="lib/checkstyle-10.4-all.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
10 changes: 5 additions & 5 deletions net.sf.eclipsecs.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Bundle-SymbolicName: net.sf.eclipsecs.core;singleton:=true
Bundle-Version: 10.4.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ClassPath: .,
lib/dom4j-2.1.3.jar,
lib/snakeyaml-1.33.jar,
lib/javassist-3.28.0-GA.jar,
lib/checkstyle-10.4-all.jar
Bundle-Activator: net.sf.eclipsecs.core.CheckstylePlugin
Bundle-ActivationPolicy: lazy
Expand All @@ -25,7 +22,9 @@ Export-Package: net.sf.eclipsecs.core,
net.sf.eclipsecs.core.projectconfig,
net.sf.eclipsecs.core.projectconfig.filters,
net.sf.eclipsecs.core.util
Import-Package: org.eclipse.core.filebuffers,
Import-Package: org.dom4j;version="2.1.3",
org.dom4j.io;version="2.1.3",
org.eclipse.core.filebuffers,
org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.core.runtime.jobs,
Expand All @@ -42,6 +41,7 @@ Import-Package: org.eclipse.core.filebuffers,
org.eclipse.team.core.subscribers;resolution:=optional,
org.eclipse.team.core.synchronize;resolution:=optional,
org.osgi.framework,
org.osgi.service.prefs
org.osgi.service.prefs,
org.yaml.snakeyaml;version="1.33.0"
Automatic-Module-Name: net.sf.eclipsecs.core

3 changes: 0 additions & 3 deletions net.sf.eclipsecs.core/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ bin.includes = .,\
plugin.xml,\
schema/,\
core.properties,\
lib/dom4j-2.1.3.jar,\
lib/snakeyaml-1.33.jar,\
lib/checkstyle-10.4-all.jar

source.. = src/
javacDefaultEncoding.. = UTF-8

Binary file removed net.sf.eclipsecs.core/lib/dom4j-2.1.3.jar
Binary file not shown.
Binary file removed net.sf.eclipsecs.core/lib/javassist-3.28.0-GA.jar
Binary file not shown.
Binary file removed net.sf.eclipsecs.core/lib/snakeyaml-1.33.jar
Binary file not shown.
25 changes: 25 additions & 0 deletions net.sf.eclipsecs.target/net.sf.eclipsecs.partial.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="Eclipse Checkstyle (Eclipse Plugins)" sequenceNumber="1668583180">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jdt.feature.group" version="3.18.500.v20200902-1800"/>
<unit id="org.eclipse.sdk.ide" version="4.17.0.I20200902-1800"/>
<unit id="org.eclipse.emf.feature.group" version="2.23.0.v20200822-0801"/>
<repository location="https://download.eclipse.org/releases/2020-09/202009161000/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.junit.jupiter.api" version="5.6.0.v20200203-2009"/>
<unit id="org.junit.jupiter.engine" version="5.6.0.v20200203-2009"/>
<unit id="org.junit.jupiter.params" version="5.6.0.v20200203-2009"/>
<unit id="org.junit.platform.commons" version="1.6.0.v20200203-2009"/>
<unit id="org.junit.platform.engine" version="1.6.0.v20200203-2009"/>
<unit id="org.junit.platform.launcher" version="1.6.0.v20200203-2009"/>
<unit id="org.junit.platform.runner" version="1.6.0.v20200203-2009"/>
<unit id="org.junit.platform.suite.api" version="1.6.0.v20200203-2009"/>
<repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20200831200620/repository"/>
</location>
</locations>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
</target>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Install https://download.eclipse.org/cbi/tpd/3.0.0-SNAPSHOT/ to use this target definition.
// Read https://github.com/eclipse-cbi/targetplatform-dsl for more details.
target "Eclipse Checkstyle"
target "Eclipse Checkstyle (Eclipse Plugins)"
with source configurePhase
environment JavaSE-11

Expand Down
49 changes: 27 additions & 22 deletions net.sf.eclipsecs.target/net.sf.eclipsecs.target.target
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="Eclipse Checkstyle" sequenceNumber="1653761205">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jdt.feature.group" version="3.18.500.v20200902-1800"/>
<unit id="org.eclipse.sdk.ide" version="4.17.0.I20200902-1800"/>
<unit id="org.eclipse.emf.feature.group" version="2.23.0.v20200822-0801"/>
<repository location="https://download.eclipse.org/releases/2020-09/202009161000/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.junit.jupiter.api" version="5.6.0.v20200203-2009"/>
<unit id="org.junit.jupiter.engine" version="5.6.0.v20200203-2009"/>
<unit id="org.junit.jupiter.params" version="5.6.0.v20200203-2009"/>
<unit id="org.junit.platform.commons" version="1.6.0.v20200203-2009"/>
<unit id="org.junit.platform.engine" version="1.6.0.v20200203-2009"/>
<unit id="org.junit.platform.launcher" version="1.6.0.v20200203-2009"/>
<unit id="org.junit.platform.runner" version="1.6.0.v20200203-2009"/>
<unit id="org.junit.platform.suite.api" version="1.6.0.v20200203-2009"/>
<repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20200831200620/repository"/>
</location>
</locations>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
</target>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<locations>
<location type="Target" uri="file:${project_loc:/net.sf.eclipsecs.core}/../net.sf.eclipsecs.target/net.sf.eclipsecs.partial.target"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use a "partial" target file here just for code organization / clarity?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The Maven part of the target must be edited manually, and the remaining Eclipse part can be generated. However, you cannot have the generation and the manual editing in one target file, therefore the generated part is included as "partial". If you think there is a better name for more clarity ("generated" instead?), I'll happily accept every suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, partial sounds good to me. I'm just trying to make sure I understand.
We could take this a step further and make another partial for the maven libs, and the main target file would just be an aggregate of partials.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be fine with that, too. At work, I use exactly such a 3 target files setup. I wasn't sure if I confuse people even more if I go from 1 to 3 here. :)

<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.29.2-GA</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.33</version>
<type>jar</type>
</dependency>
</dependencies>
</location>
</locations>
</target>
53 changes: 40 additions & 13 deletions net.sf.eclipsecs.target/readme.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,54 @@
## What's this?

The .target file describes the minimum eclipse environment that eclipse-cs runs in.
The `.target` file describes the minimum Eclipse environment that eclipse-cs runs in.
Right now that is 2020-09 (since that is the first version officially running on Java 11).


## Preconditions for development

To use the target platform, these plugins must be installed in your Eclipse IDE:
* [Eclipse M2E](https://marketplace.eclipse.org/content/eclipse-m2e-maven-support-eclipse-ide)
* [Target Platform DSL](https://github.com/eclipse-cbi/targetplatform-dsl)


## How to use the target platform

In the Maven build it is used automatically for compilation
(see target-platform-configuration section in the parent POM).

For development in Eclipse you have to load it manually, but only one time:
Open the .target file and use the "Set As Active Target" hyperlink. This may take
a while the first time, since plugins are loaded from the Internet.
For development in Eclipse you have to load it manually, but only after it has been modified.
Open the `net.sf.eclipsecs.target.target` file and use the "Set As Active Target" hyperlink.
This may take a while the first time, since plugins are loaded from the Internet.

If you don't do that, the compilation happens against the Eclipse plugins of your IDE
and you may call methods that don't exist in earlier versions,
which will lead to runtime errors for end users that are still on an old Eclipse version.

If you don't do that, the compilation happens against the eclipse plugins of
your IDE and you may call methods that don't exist in earlier versions, which
will lead to runtime errors for end users.

## How to update the target platform

Target files are hard to maintain manually. Therefore we use a custom DSL to
maintain the target platform, and to derive the .target file.
Target files are hard to maintain manually.
Therefore we use a custom DSL to maintain most of the target platform, and to derive the `.target` file.
However, that DSL based generation is not possible for the part of the target platform that shall include Maven coordinates.
That's why the target platform is split over 2 files.
The root target platform contains only the Maven coordinates and can be edited manually.
It also includes a nested target file, which is generated from the target platform DSL.
While that structure may look confusing at first glance, it simplifies the actual editing a lot,
because you either only edit Maven coordinates or entries in the `.tpd`file.
Bananeweizen marked this conversation as resolved.
Show resolved Hide resolved

### Eclipse plugins

Edit the `net.sf.eclipsecs.partial.tpd` file (note the _partial_ in the name).
After saving use the context menu of the .tpd file to create a new version of the `net.sf.eclipsecs.partial.target` file.

### Maven libraries

Meanwhile Eclipse PDE and Tycho can also use Maven libraries directly in the target platform
(by automatically wrapping them into a generated OSGi bundle).
Those libraries are contained in `net.sf.eclipsecs.target.target`.
You can open that with a text editor and edit the Maven coordinates like in a `pom.xml`.


Install https://github.com/eclipse-cbi/targetplatform-dsl to edit the .tpd
file. After saving use the context menu of the .tpd file to create a new
version of the .target file.
## Committing changes

Both the .target and .tpd files must be checked in after changes.
Both the `.target` and `.tpd` files must be checked in after changes.