Skip to content

Commit 99874c2

Browse files
committed
infra: convert nested libs to wrapped OSGi bundles
EclipseCS uses several external libraries, which are copied manually into the libs folder. Since everything else comes from the Eclipse target platform, those 3 libraries are easier to maintain by fetching them directly from maven and letting Eclipse PDE automatically wrap them into OSGi bundles. With that change in place, updating the external libraries is as easy as changing the version number in the .target file. Also improve the documentation how to maintain the target platform, required plugins etc.
1 parent 538e4a7 commit 99874c2

File tree

10 files changed

+103
-48
lines changed

10 files changed

+103
-48
lines changed

net.sf.eclipsecs.core/.classpath

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
4+
<attributes>
5+
<attribute name="module" value="true"/>
6+
</attributes>
7+
</classpathentry>
48
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
59
<accessrules>
610
<accessrule kind="accessible" pattern="com/puppycrawl/tools/checkstyle/meta/**"/>
711
</accessrules>
812
</classpathentry>
913
<classpathentry kind="src" path="src"/>
10-
<classpathentry exported="true" kind="lib" path="lib/dom4j-2.1.3.jar"/>
11-
<classpathentry exported="true" kind="lib" path="lib/snakeyaml-1.33.jar"/>
12-
<classpathentry exported="true" kind="lib" path="lib/javassist-3.28.0-GA.jar"/>
1314
<classpathentry kind="lib" path="lib/checkstyle-10.4-all.jar"/>
1415
<classpathentry kind="output" path="target/classes"/>
1516
</classpath>

net.sf.eclipsecs.core/META-INF/MANIFEST.MF

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ Bundle-SymbolicName: net.sf.eclipsecs.core;singleton:=true
55
Bundle-Version: 10.4.0.qualifier
66
Bundle-RequiredExecutionEnvironment: JavaSE-11
77
Bundle-ClassPath: .,
8-
lib/dom4j-2.1.3.jar,
9-
lib/snakeyaml-1.33.jar,
10-
lib/javassist-3.28.0-GA.jar,
118
lib/checkstyle-10.4-all.jar
129
Bundle-Activator: net.sf.eclipsecs.core.CheckstylePlugin
1310
Bundle-ActivationPolicy: lazy
@@ -25,7 +22,9 @@ Export-Package: net.sf.eclipsecs.core,
2522
net.sf.eclipsecs.core.projectconfig,
2623
net.sf.eclipsecs.core.projectconfig.filters,
2724
net.sf.eclipsecs.core.util
28-
Import-Package: org.eclipse.core.filebuffers,
25+
Import-Package: org.dom4j;version="2.1.3",
26+
org.dom4j.io;version="2.1.3",
27+
org.eclipse.core.filebuffers,
2928
org.eclipse.core.resources,
3029
org.eclipse.core.runtime,
3130
org.eclipse.core.runtime.jobs,
@@ -42,6 +41,7 @@ Import-Package: org.eclipse.core.filebuffers,
4241
org.eclipse.team.core.subscribers;resolution:=optional,
4342
org.eclipse.team.core.synchronize;resolution:=optional,
4443
org.osgi.framework,
45-
org.osgi.service.prefs
44+
org.osgi.service.prefs,
45+
org.yaml.snakeyaml;version="1.33.0"
4646
Automatic-Module-Name: net.sf.eclipsecs.core
4747

net.sf.eclipsecs.core/build.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ bin.includes = .,\
77
plugin.xml,\
88
schema/,\
99
core.properties,\
10-
lib/dom4j-2.1.3.jar,\
11-
lib/snakeyaml-1.33.jar,\
1210
lib/checkstyle-10.4-all.jar
1311

14-
source.. = src/
1512
javacDefaultEncoding.. = UTF-8
1613

-316 KB
Binary file not shown.
-832 KB
Binary file not shown.
-324 KB
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?pde?>
3+
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
4+
<target name="Eclipse Checkstyle (Eclipse Plugins)" sequenceNumber="1668583180">
5+
<locations>
6+
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
7+
<unit id="org.eclipse.jdt.feature.group" version="3.18.500.v20200902-1800"/>
8+
<unit id="org.eclipse.sdk.ide" version="4.17.0.I20200902-1800"/>
9+
<unit id="org.eclipse.emf.feature.group" version="2.23.0.v20200822-0801"/>
10+
<repository location="https://download.eclipse.org/releases/2020-09/202009161000/"/>
11+
</location>
12+
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
13+
<unit id="org.junit.jupiter.api" version="5.6.0.v20200203-2009"/>
14+
<unit id="org.junit.jupiter.engine" version="5.6.0.v20200203-2009"/>
15+
<unit id="org.junit.jupiter.params" version="5.6.0.v20200203-2009"/>
16+
<unit id="org.junit.platform.commons" version="1.6.0.v20200203-2009"/>
17+
<unit id="org.junit.platform.engine" version="1.6.0.v20200203-2009"/>
18+
<unit id="org.junit.platform.launcher" version="1.6.0.v20200203-2009"/>
19+
<unit id="org.junit.platform.runner" version="1.6.0.v20200203-2009"/>
20+
<unit id="org.junit.platform.suite.api" version="1.6.0.v20200203-2009"/>
21+
<repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20200831200620/repository"/>
22+
</location>
23+
</locations>
24+
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
25+
</target>

net.sf.eclipsecs.target/net.sf.eclipsecs.target.tpd renamed to net.sf.eclipsecs.target/net.sf.eclipsecs.partial.tpd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Install https://download.eclipse.org/cbi/tpd/3.0.0-SNAPSHOT/ to use this target definition.
22
// Read https://github.com/eclipse-cbi/targetplatform-dsl for more details.
3-
target "Eclipse Checkstyle"
3+
target "Eclipse Checkstyle (Eclipse Plugins)"
44
with source configurePhase
55
environment JavaSE-11
66

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde?>
3-
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
43
<target name="Eclipse Checkstyle" sequenceNumber="1653761205">
5-
<locations>
6-
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
7-
<unit id="org.eclipse.jdt.feature.group" version="3.18.500.v20200902-1800"/>
8-
<unit id="org.eclipse.sdk.ide" version="4.17.0.I20200902-1800"/>
9-
<unit id="org.eclipse.emf.feature.group" version="2.23.0.v20200822-0801"/>
10-
<repository location="https://download.eclipse.org/releases/2020-09/202009161000/"/>
11-
</location>
12-
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
13-
<unit id="org.junit.jupiter.api" version="5.6.0.v20200203-2009"/>
14-
<unit id="org.junit.jupiter.engine" version="5.6.0.v20200203-2009"/>
15-
<unit id="org.junit.jupiter.params" version="5.6.0.v20200203-2009"/>
16-
<unit id="org.junit.platform.commons" version="1.6.0.v20200203-2009"/>
17-
<unit id="org.junit.platform.engine" version="1.6.0.v20200203-2009"/>
18-
<unit id="org.junit.platform.launcher" version="1.6.0.v20200203-2009"/>
19-
<unit id="org.junit.platform.runner" version="1.6.0.v20200203-2009"/>
20-
<unit id="org.junit.platform.suite.api" version="1.6.0.v20200203-2009"/>
21-
<repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20200831200620/repository"/>
22-
</location>
23-
</locations>
24-
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
25-
</target>
4+
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
5+
<locations>
6+
<location type="Target" uri="file:${project_loc:/net.sf.eclipsecs.core}/../net.sf.eclipsecs.target/net.sf.eclipsecs.partial.target"/>
7+
<location includeDependencyDepth="none" includeDependencyScopes="compile" includeSource="true" missingManifest="generate" type="Maven">
8+
<dependencies>
9+
<dependency>
10+
<groupId>org.dom4j</groupId>
11+
<artifactId>dom4j</artifactId>
12+
<version>2.1.3</version>
13+
<type>jar</type>
14+
</dependency>
15+
<dependency>
16+
<groupId>org.javassist</groupId>
17+
<artifactId>javassist</artifactId>
18+
<version>3.29.2-GA</version>
19+
<type>jar</type>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.yaml</groupId>
23+
<artifactId>snakeyaml</artifactId>
24+
<version>1.33</version>
25+
<type>jar</type>
26+
</dependency>
27+
</dependencies>
28+
</location>
29+
</locations>
30+
</target>

net.sf.eclipsecs.target/readme.md

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,54 @@
11
## What's this?
22

3-
The .target file describes the minimum eclipse environment that eclipse-cs runs in.
3+
The `.target` file describes the minimum Eclipse environment that eclipse-cs runs in.
4+
Right now that is 2020-09 (since that is the first version officially running on Java 11).
5+
6+
7+
## Preconditions for development
8+
9+
To use the target platform, these plugins must be installed in your Eclipse IDE:
10+
* [Eclipse M2E](https://marketplace.eclipse.org/content/eclipse-m2e-maven-support-eclipse-ide)
11+
* [Target Platform DSL](https://github.com/eclipse-cbi/targetplatform-dsl)
12+
413

514
## How to use the target platform
615

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

10-
For development in Eclipse you have to load it manually, but only one time:
11-
Open the .target file and use the "Set As Active Target" hyperlink. This may take
12-
a while the first time, since plugins are loaded from the Internet.
19+
For development in Eclipse you have to load it manually, but only after it has been modified.
20+
Open the `net.sf.eclipsecs.target.target` file and use the "Set As Active Target" hyperlink.
21+
This may take a while the first time, since plugins are loaded from the Internet.
22+
23+
If you don't do that, the compilation happens against the Eclipse plugins of your IDE
24+
and you may call methods that don't exist in earlier versions,
25+
which will lead to runtime errors for end users that are still on an old Eclipse version.
1326

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

1828
## How to update the target platform
1929

20-
Target files are hard to maintain manually. Therefore we use a custom DSL to
21-
maintain the target platform, and to derive the .target file.
30+
Target files are hard to maintain manually.
31+
Therefore we use a custom DSL to maintain most of the target platform, and to derive the `.target` file.
32+
However, that DSL based generation is not possible for the part of the target platform that shall include Maven coordinates.
33+
That's why the target platform is split over 2 files.
34+
The root target platform contains only the Maven coordinates and can be edited manually.
35+
It also includes a nested target file, which is generated from the target platform DSL.
36+
While that structure may look confusing at first glance, it simplifies the actual editing a lot,
37+
because you either only edit Maven coordinates or entries in the `.tpd`file.
38+
39+
### Eclipse plugins
40+
41+
Edit the `net.sf.eclipsecs.partial.tpd` file (note the _partial_ in the name).
42+
After saving use the context menu of the .tpd file to create a new version of the `net.sf.eclipsecs.partial.target` file.
43+
44+
### Maven libraries
45+
46+
Meanwhile Eclipse PDE and Tycho can also use Maven libraries directly in the target platform
47+
(by automatically wrapping them into a generated OSGi bundle).
48+
Those libraries are contained in `net.sf.eclipsecs.target.target`.
49+
You can open that with a text editor and edit the Maven coordinates like in a `pom.xml`.
50+
2251

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

27-
Both the .target and .tpd files must be checked in after changes.
54+
Both the `.target` and `.tpd` files must be checked in after changes.

0 commit comments

Comments
 (0)