Skip to content

Commit

Permalink
WIP: External null annotations via zip
Browse files Browse the repository at this point in the history
This PR is similar to eclipse-archived#4217 but instead of creating a project that
contains the annotations in a directory it sets up the IDE to read the
annotations from a zip file.

The reason behind this is that the IDE should be for the every day
developer who will not create external annotations. Nevertheless he
should benefit from them which is why they are provided in a zip file.

This zip file should be hosted externally, maybe together with
lastnpe.org. That is also the place to add new annotations, i.e.
download the project from there, change the IDE to use this project as a
directory, add your annotations and afterwards the project releases a
new zip file.

In this PR I created a setup task for the IDE to download the
annotations file and place it in a "eea" directory in the targetplatform
folder. For maven there is a new dependency to the wagon-maven-plugin
which enables downloading a single file to be placed where the IDE
stores the file too. The compile task uses this zip file as
"annotationpath".

Also I reactivated the "Unchecked conversion from non-annotated type to
@nonnull type" check by setting it to warning level, otherwise (if set
to ignore) external annotations are not needed.

As an example I updated the ".classpath" file of the sonos binding to
use the downloaded zip file.

The parts which are still valid from PR eclipse-archived#4217 are:
* all created external annotations
* all updated .classpath files (IF adjusted to use the zip file instead
of a directory)

The URL where the file will be hosted is still left open, which is why
this PR is WIP.

Signed-off-by: Stefan Triller <stefan.triller@telekom.de>
  • Loading branch information
triller-telekom committed Nov 7, 2017
1 parent ac2b0a3 commit 1a2a191
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
12 changes: 10 additions & 2 deletions extensions/binding/org.eclipse.smarthome.binding.sonos/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<?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-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="annotationpath" value="/targetplatform/eea/jdk.zip"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<attributes>
<attribute name="annotationpath" value="/targetplatform/eea/jdk.zip"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
24 changes: 24 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<build.helper.maven.plugin.version>1.8</build.helper.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sat.version>0.3.0</sat.version>
<eea-url>http://www.TODO.tld</eea-url>
<eea-dir>path/to/file/on/server</eea-dir>
<eea-file>jdk.zip</eea-file>
</properties>

<packaging>pom</packaging>
Expand All @@ -70,6 +73,25 @@

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>download-eea-zip</id>
<phase>initialize</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>${eea-url}</url>
<fromFile>${eea-dir}/${eea-file}</fromFile>
<toDir>${basedirRoot}/targetplatform/eea/</toDir>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
Expand Down Expand Up @@ -184,6 +206,8 @@
<compilerArgs>
<arg>-err:+nullAnnot(org.eclipse.jdt.annotation.Nullable|org.eclipse.jdt.annotation.NonNull|org.eclipse.jdt.annotation.NonNullByDefault),+inheritNullAnnot</arg>
<arg>-warn:+null,+inheritNullAnnot,+nullAnnotConflict,+nullUncheckedConversion,+nullAnnotRedundant,+nullDereference</arg>
<arg>-annotationpath</arg>
<arg>${basedirRoot}/targetplatform/eea/${eea-file}</arg>
</compilerArgs>
</configuration>
</plugin>
Expand Down
6 changes: 5 additions & 1 deletion targetplatform/EclipseSmartHome.setup
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion"
value="ignore"/>
value="warning"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.parameterAssignment"
Expand Down Expand Up @@ -2447,6 +2447,10 @@
content="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>&#xA;&lt;lifecycleMappingMetadata>&#xA; &lt;pluginExecutions>&#xA; &lt;pluginExecution>&#xA; &lt;pluginExecutionFilter>&#xA; &lt;groupId>org.codehaus.mojo&lt;/groupId>&#xA; &lt;artifactId>build-helper-maven-plugin&lt;/artifactId>&#xA; &lt;versionRange>1.8&lt;/versionRange>&#xA; &lt;goals>&#xA; &lt;goal>add-source&lt;/goal>&#xA; &lt;goal>add-test-source&lt;/goal>&#xA; &lt;/goals>&#xA; &lt;/pluginExecutionFilter>&#xA; &lt;action>&#xA; &lt;ignore />&#xA; &lt;/action>&#xA; &lt;/pluginExecution>&#xA; &lt;/pluginExecutions>&#xA;&lt;/lifecycleMappingMetadata>&#xA;"
targetURL="${workspace.location|uri}/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml"
encoding="UTF-8"/>
<setupTask
xsi:type="setup:ResourceCopyTask"
sourceURL="http://www.TODO.tld/path/to/file/on/server/jdk.zip"
targetURL="${git.clone.eclipsesmarthome.location|uri}/targetplatform/eea/jdk.zip"/>
<stream
name="master"/>
</project>
Expand Down

0 comments on commit 1a2a191

Please sign in to comment.