Skip to content

Commit a483943

Browse files
committed
Merge pull request scijava#16 from scijava/annindex
Use a custom annotation indexer
2 parents f72bd87 + ca36271 commit a483943

37 files changed

+3533
-789
lines changed

.factorypath

-4
This file was deleted.

pom.xml

+149-6
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@
99
</parent>
1010

1111
<artifactId>scijava-common</artifactId>
12-
<version>2.5.1-SNAPSHOT</version>
12+
<version>2.6.0-SNAPSHOT</version>
1313

1414
<name>SciJava Common</name>
1515
<description>SciJava Common is a shared library for SciJava software. It provides a plugin framework, with an extensible mechanism for service discovery, driven by the SezPoz library, so that plugins can be loaded dynamically. It is used by both ImageJ and SCIFIO.</description>
1616

1717
<dependencies>
18-
<dependency>
19-
<groupId>net.java.sezpoz</groupId>
20-
<artifactId>sezpoz</artifactId>
21-
<version>${sezpoz.version}</version>
22-
</dependency>
2318
<dependency>
2419
<groupId>org.bushe</groupId>
2520
<artifactId>eventbus</artifactId>
@@ -75,6 +70,28 @@ Institute of Molecular Cell Biology and Genetics.</organizationName>
7570
<canUpdateCopyright>true</canUpdateCopyright>
7671
</configuration>
7772
</plugin>
73+
<plugin>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-compiler-plugin</artifactId>
76+
<configuration>
77+
<compilerArgument>-proc:none</compilerArgument>
78+
</configuration>
79+
</plugin>
80+
<plugin>
81+
<groupId>org.codehaus.mojo</groupId>
82+
<artifactId>exec-maven-plugin</artifactId>
83+
<executions>
84+
<execution>
85+
<phase>process-classes</phase>
86+
<goals>
87+
<goal>java</goal>
88+
</goals>
89+
</execution>
90+
</executions>
91+
<configuration>
92+
<mainClass>org.scijava.annotations.EclipseHelper</mainClass>
93+
</configuration>
94+
</plugin>
7895
</plugins>
7996
</build>
8097

@@ -88,6 +105,57 @@ Institute of Molecular Cell Biology and Genetics.</organizationName>
88105
</mailingList>
89106
</mailingLists>
90107

108+
<developers>
109+
<developer>
110+
<id>ctrueden</id>
111+
<name>Curtis Rueden</name>
112+
<email>[email protected]</email>
113+
<url>http://loci.wisc.edu/people/curtis-rueden</url>
114+
<organization>UW-Madison LOCI</organization>
115+
<organizationUrl>http://loci.wisc.edu/</organizationUrl>
116+
<roles>
117+
<role>architect</role>
118+
<role>developer</role>
119+
</roles>
120+
<timezone>-6</timezone>
121+
</developer>
122+
<developer>
123+
<id>dscho</id>
124+
<name>Johannes Schindelin</name>
125+
<email>[email protected]</email>
126+
<url>http://loci.wisc.edu/people/johannes-schindelin</url>
127+
<organization>UW-Madison LOCI</organization>
128+
<organizationUrl>http://loci.wisc.edu/</organizationUrl>
129+
<roles>
130+
<role>architect</role>
131+
<role>developer</role>
132+
</roles>
133+
<timezone>-6</timezone>
134+
</developer>
135+
</developers>
136+
137+
<organization>
138+
<name>SciJava</name>
139+
<url>http://scijava.org/</url>
140+
</organization>
141+
142+
<issueManagement>
143+
<system>GitHub issues</system>
144+
<url>https://github.com/scijava/scijava-common/issues</url>
145+
</issueManagement>
146+
147+
<ciManagement>
148+
<system>Jenkins</system>
149+
<url>https://jenkins.imagej.net/job/SciJava-common/</url>
150+
</ciManagement>
151+
152+
<licenses>
153+
<license>
154+
<name>Simplified BSD License</name>
155+
<distribution>repo</distribution>
156+
</license>
157+
</licenses>
158+
91159
<scm>
92160
<connection>scm:git:git://github.com/scijava/scijava-common</connection>
93161
<developerConnection>scm:git:[email protected]:scijava/scijava-common</developerConnection>
@@ -116,6 +184,81 @@ Institute of Molecular Cell Biology and Genetics.</organizationName>
116184
</dependency>
117185
</dependencies>
118186
</profile>
187+
<profile>
188+
<id>run-its</id>
189+
<build>
190+
<defaultGoal>integration-test</defaultGoal>
191+
<plugins>
192+
<plugin>
193+
<artifactId>maven-invoker-plugin</artifactId>
194+
<version>1.8</version>
195+
<configuration>
196+
<debug>${invoker.debug}</debug>
197+
<showErrors>true</showErrors>
198+
<streamLogs>true</streamLogs>
199+
<projectsDirectory>src/it</projectsDirectory>
200+
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
201+
<pomIncludes>
202+
<pomInclude>*/pom.xml</pomInclude>
203+
</pomIncludes>
204+
<settingsFile>src/it/settings.xml</settingsFile>
205+
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
206+
<preBuildHookScript>setup.bsh</preBuildHookScript>
207+
<postBuildHookScript>verify.bsh</postBuildHookScript>
208+
</configuration>
209+
<executions>
210+
<execution>
211+
<id>integration-test</id>
212+
<goals>
213+
<goal>install</goal>
214+
<goal>run</goal>
215+
</goals>
216+
</execution>
217+
</executions>
218+
</plugin>
219+
</plugins>
220+
</build>
221+
</profile>
222+
<profile>
223+
<id>only-eclipse</id>
224+
<activation>
225+
<property>
226+
<name>m2e.version</name>
227+
</property>
228+
</activation>
229+
<build>
230+
<pluginManagement>
231+
<plugins>
232+
<!-- This plugin's configuration is used to store Eclipse m2e settings
233+
only. It has no influence on the Maven build itself. -->
234+
<plugin>
235+
<groupId>org.eclipse.m2e</groupId>
236+
<artifactId>lifecycle-mapping</artifactId>
237+
<version>1.0.0</version>
238+
<configuration>
239+
<lifecycleMappingMetadata>
240+
<pluginExecutions>
241+
<pluginExecution>
242+
<pluginExecutionFilter>
243+
<groupId>org.codehaus.mojo</groupId>
244+
<artifactId>exec-maven-plugin</artifactId>
245+
<versionRange>1.2.1</versionRange>
246+
<goals>
247+
<goal>java</goal>
248+
</goals>
249+
</pluginExecutionFilter>
250+
<action>
251+
<ignore />
252+
</action>
253+
</pluginExecution>
254+
</pluginExecutions>
255+
</lifecycleMappingMetadata>
256+
</configuration>
257+
</plugin>
258+
</plugins>
259+
</pluginManagement>
260+
</build>
261+
</profile>
119262
</profiles>
120263

121264
<!-- NB: for project parent -->

src/it/apt-test/pom.xml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
#%L
4+
Annotation index (processor and index access library).
5+
%%
6+
Copyright (C) 2009 - 2013 Board of Regents of the University of Wisconsin-Madison.
7+
%%
8+
Redistribution and use in source and binary forms, with or without
9+
modification, are permitted provided that the following conditions are met:
10+
11+
1. Redistributions of source code must retain the above copyright notice,
12+
this list of conditions and the following disclaimer.
13+
2. Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
21+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27+
POSSIBILITY OF SUCH DAMAGE.
28+
29+
The views and conclusions contained in the software and documentation are
30+
those of the authors and should not be interpreted as representing official
31+
policies, either expressed or implied, of any organization.
32+
#L%
33+
-->
34+
35+
<project xmlns="http://maven.apache.org/POM/4.0.0"
36+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
37+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
38+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
39+
<modelVersion>4.0.0</modelVersion>
40+
41+
<groupId>@project.groupId@</groupId>
42+
<artifactId>apt-test</artifactId>
43+
<version>@project.version@</version>
44+
45+
<name>An integration test for the annotation processor</name>
46+
<description>This integration makes sure that the annotations are properly processed and indexed at compilation time.</description>
47+
48+
<properties>
49+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
50+
</properties>
51+
52+
<dependencies>
53+
<dependency>
54+
<groupId>@project.groupId@</groupId>
55+
<artifactId>@project.artifactId@</artifactId>
56+
<version>@project.version@</version>
57+
</dependency>
58+
</dependencies>
59+
60+
</project>
61+

src/it/apt-test/setup.bsh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.io.File;
2+
3+
assertTrue(message, condition) {
4+
if (!condition) {
5+
throw new Exception(message);
6+
}
7+
}
8+
9+
rmRF(directory) {
10+
list = directory.listFiles();
11+
for (i = 0; list != null && i < list.length; i++) {
12+
if ((list[i].isFile() && !list[i].delete()) ||
13+
(list[i].isDirectory() && !rmRF(list[i]))) {
14+
print("Could not delete " + list[i]);
15+
return false;
16+
}
17+
}
18+
return directory.delete();
19+
}
20+
21+
metaInf = new File(basedir, "target/classes/META-INF");
22+
23+
assertTrue("Could not delete META-INF/", !metaInf.isDirectory() || rmRF(metaInf));
24+
print("Setup completed");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* #%L
3+
* Annotation index (processor and index access library).
4+
* %%
5+
* Copyright (C) 2009 - 2013 Board of Regents of the University of Wisconsin-Madison.
6+
* %%
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*
28+
* The views and conclusions contained in the software and documentation are
29+
* those of the authors and should not be interpreted as representing official
30+
* policies, either expressed or implied, of any organization.
31+
* #L%
32+
*/
33+
package org.scijava.annotations.its;
34+
35+
/**
36+
* An annotated class, to be indexed in the integration test
37+
*
38+
* @author Johannes Schindelin
39+
*/
40+
@CustomAnnotation(greeting = "Hey, what's up, doc?")
41+
public class Annotated {
42+
@CustomAnnotation(greeting = "Howdy, stranger!")
43+
public class Inner {}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* #%L
3+
* Annotation index (processor and index access library).
4+
* %%
5+
* Copyright (C) 2009 - 2013 Board of Regents of the University of Wisconsin-Madison.
6+
* %%
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*
28+
* The views and conclusions contained in the software and documentation are
29+
* those of the authors and should not be interpreted as representing official
30+
* policies, either expressed or implied, of any organization.
31+
* #L%
32+
*/
33+
package org.scijava.annotations.its;
34+
35+
import java.lang.annotation.ElementType;
36+
import java.lang.annotation.Retention;
37+
import java.lang.annotation.RetentionPolicy;
38+
import java.lang.annotation.Target;
39+
40+
import org.scijava.annotations.Indexable;
41+
42+
/**
43+
* A simple annotation for use in the integration test.
44+
*
45+
* @author Johannes Schindelin
46+
*/
47+
@Retention(RetentionPolicy.RUNTIME)
48+
@Target({ElementType.TYPE})
49+
@Indexable
50+
public @interface CustomAnnotation {
51+
52+
String greeting() default "Hello, World!";
53+
54+
}
55+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"class":"org.scijava.annotations.its.Annotated","values":{"greeting":"Hey, what's up, doc?"}}{"class":"org.scijava.annotations.its.Annotated$Inner","values":{"greeting":"Howdy, stranger!"}}

0 commit comments

Comments
 (0)