...
 
Commits (16)
/target/
.idea/
*.iml
annotation-indexer (1.12-1) unstable; urgency=medium
* Team upload.
* New upstream release
* Build with the DH sequencer instead of CDBS
* Removed the build dependency on libmaven-enforcer-plugin-java
* Standards-Version updated to 4.1.4
* Switch to debhelper level 11
* Use salsa.debian.org Vcs-* URLs
* Removed debian/orig-tar.sh
-- Emmanuel Bourg <ebourg@apache.org> Wed, 06 Jun 2018 15:03:54 +0200
annotation-indexer (1.9-1) unstable; urgency=medium
* Team upload.
......@@ -38,6 +51,6 @@ annotation-indexer (1.2-1) unstable; urgency=low
annotation-indexer (1.2-0ubuntu1) oneiric; urgency=low
* Initial release
* Initial release
-- James Page <james.page@canonical.com> Wed, 08 Jun 2011 15:49:59 +0100
......@@ -3,19 +3,20 @@ Section: java
Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Uploaders: James Page <james.page@ubuntu.com>
Build-Depends: cdbs, debhelper (>= 9), default-jdk, maven-debian-helper
Build-Depends-Indep:
Build-Depends:
debhelper (>= 11),
default-jdk,
default-jdk-doc,
junit4,
libmaven-compiler-plugin-java,
libmaven-enforcer-plugin-java,
libmaven-javadoc-plugin-java,
libmetainf-services-java,
libmetainf-services-java-doc
Standards-Version: 3.9.5
Vcs-Git: git://anonscm.debian.org/pkg-java/annotation-indexer.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-java/annotation-indexer.git
Homepage: http://github.com/jenkinsci/lib-annotation-indexer
libmetainf-services-java-doc,
maven-debian-helper
Standards-Version: 4.1.4
Vcs-Git: https://salsa.debian.org/java-team/annotation-indexer.git
Vcs-Browser: https://salsa.debian.org/java-team/annotation-indexer
Homepage: https://github.com/jenkinsci/lib-annotation-indexer
Package: libannotation-indexer-java
Architecture: all
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0
Upstream-Name: annotation-indexer for jenkins
Source: https://github.com/jenkinsci/lib-annotation-indexer
......
target/apidocs/* usr/share/doc/libannotation-indexer-java/api
#!/bin/sh -e
VERSION=$2
TAR=../annotation-indexer_$VERSION.orig.tar.xz
DIR=annotation-indexer-$VERSION
mkdir -p $DIR
# Expand the upstream tarball
tar -xzf ../$3 -C $DIR --strip-components=1
rm ../$3
# Repack excluding stuff we don't need
XZ_OPT=--best tar -v -c -J -f $TAR \
--exclude '*.jar' \
--exclude '*.class' \
--exclude 'CVS' \
--exclude '.svn' \
$DIR
rm -rf $DIR
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/maven.mk
JAVA_HOME := /usr/lib/jvm/default-java
get-orig-source:
uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename
%:
dh $@
version=3
opts=dversionmangle=s/\.dfsg// \
http://githubredir.debian.net/github/jenkinsci/lib-annotation-indexer/ annotation-indexer-(.+).tar.gz debian debian/orig-tar.sh
version=4
opts="repack,compression=xz,dversionmangle=s/\.dfsg//" \
https://github.com/jenkinsci/lib-annotation-indexer/tags .*/annotation-indexer-(.+).tar.gz
......@@ -4,12 +4,13 @@
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.32</version>
<version>1.37</version>
<relativePath />
</parent>
<artifactId>annotation-indexer</artifactId>
<name>Annotation Indexer</name>
<version>1.9</version>
<version>1.12</version>
<description>
Creates index of annotations.
</description>
......@@ -18,7 +19,7 @@
<dependency>
<groupId>org.kohsuke.metainf-services</groupId>
<artifactId>metainf-services</artifactId>
<version>1.5</version>
<version>1.7</version>
<optional>true</optional>
</dependency>
<dependency>
......@@ -38,6 +39,7 @@
<scm>
<connection>scm:git:git://github.com/jenkinsci/lib-${project.artifactId}.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/lib-${project.artifactId}.git</developerConnection>
<tag>annotation-indexer-1.12</tag>
</scm>
<licenses>
......
......@@ -6,8 +6,7 @@ import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import static javax.lang.model.SourceVersion.RELEASE_6;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
......@@ -35,7 +34,6 @@ import java.util.TreeSet;
*
* @author Kohsuke Kawaguchi
*/
@SupportedSourceVersion(RELEASE_6)
@SupportedAnnotationTypes("*")
@SuppressWarnings({"Since15"})
@MetaInfServices(Processor.class)
......@@ -111,6 +109,8 @@ public class AnnotationProcessorImpl extends AbstractProcessor {
}
} catch (FileNotFoundException x) {
// OK, created for the first time
} catch (java.nio.file.NoSuchFileException x) {
// OK, created for the first time
}
return elements;
}
......@@ -141,12 +141,18 @@ public class AnnotationProcessorImpl extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver() || roundEnv.errorRaised())
// TODO we should not write until processingOver
return false;
execute(annotations, roundEnv);
return false;
}
@Override
public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latest();
}
protected void execute(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
// map from indexable annotation names, to actual uses
Map<String,Use> output = new HashMap<String,Use>();
......
......@@ -107,6 +107,8 @@ public class Index {
LOGGER.log(Level.FINE, "Failed to load: "+name,e);
} catch (LinkageError x) {
LOGGER.log(Level.WARNING, "Failed to load " + name, x);
} catch (RuntimeException x) {
LOGGER.log(Level.WARNING, "Failed to load " + name, x);
}
}
}
......
......@@ -27,8 +27,8 @@ public class AnnotationProcessorImplTest {
addLine("package some.pkg;").
addLine("@some.api.A public class Stuff {}");
compilation.doCompile(null, "-source", "6");
assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/some.api.A"));
assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/annotations/some.api.A"));
}
@Indexed @Retention(RetentionPolicy.RUNTIME) public @interface A {}
......@@ -38,8 +38,8 @@ public class AnnotationProcessorImplTest {
addLine("package some.pkg;").
addLine("@" + A.class.getCanonicalName() + " public class Stuff {}");
compilation.doCompile(null, "-source", "6");
assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
}
@Test public void incremental() {
......@@ -48,15 +48,15 @@ public class AnnotationProcessorImplTest {
addLine("package some.pkg;").
addLine("@" + A.class.getCanonicalName() + " public class Stuff {}");
compilation.doCompile(null, "-source", "6");
assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals("some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
compilation = new Compilation(compilation);
compilation.addSource("some.pkg.MoreStuff").
addLine("package some.pkg;").
addLine("@" + A.class.getCanonicalName() + " public class MoreStuff {}");
compilation.doCompile(null, "-source", "6");
assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals("some.pkg.MoreStuff\nsome.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals("some.pkg.MoreStuff" + System.getProperty("line.separator") + "some.pkg.Stuff" + System.getProperty("line.separator"), Utils.getGeneratedResource(compilation, "META-INF/annotations/" + A.class.getName()));
}
@Indexed @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface B {}
......@@ -67,7 +67,7 @@ public class AnnotationProcessorImplTest {
addLine("package some.pkg;").
addLine("public class Stuff extends " + Super.class.getCanonicalName() + " {}");
compilation.doCompile(null, "-source", "6");
assertEquals(Collections.emptyList(), Utils.filterSupportedSourceVersionWarnings(compilation.getDiagnostics()));
assertEquals(Collections.emptyList(), Utils.filterObsoleteSourceVersionWarnings(compilation.getDiagnostics()));
/* XXX #7188605 currently broken on JDK 6; perhaps need to use a ElementScanner6 on roundEnv.rootElements whose visitType checks for annotations
assertEquals("some.pkg.Stuff\n", Utils.getGeneratedResource(compilation, "META-INF/annotations/" + B.class.getName()));
*/
......
......@@ -5,6 +5,7 @@ import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
......@@ -20,21 +21,30 @@ import net.java.dev.hickory.testing.Compilation;
// XXX partial copy of class from Stapler; should be pushed up into Hickory ASAP
class Utils {
/**
* Filter out warnings about {@link SupportedSourceVersion}.
* {@code metainf-services-1.1.jar} produces {@code warning: No SupportedSourceVersion annotation found on org.kohsuke.metainf_services.AnnotationProcessorImpl, returning RELEASE_6.} which is irrelevant to us.
* (Development versions have already fixed this; when released and used here, delete this method.)
*/
public static List<Diagnostic<? extends JavaFileObject>> filterSupportedSourceVersionWarnings(List<Diagnostic<? extends JavaFileObject>> diagnostics) {
// Filter out warnings about source 1.6 is obsolete in java 9
// This usually appears with other warnings
public static final List<String> IGNORE = Arrays.asList(
"source value 1.6 is obsolete and will be removed in a future release", // Filter out warnings about source 1.6 is obsolete in java 9
"To suppress warnings about obsolete options" // This usually appears with other warnings
);
public static List<Diagnostic<? extends JavaFileObject>> filterObsoleteSourceVersionWarnings(List<Diagnostic<? extends JavaFileObject>> diagnostics) {
List<Diagnostic<? extends JavaFileObject>> r = new ArrayList<Diagnostic<? extends JavaFileObject>>();
for (Diagnostic<? extends JavaFileObject> d : diagnostics) {
if (!d.getMessage(Locale.ENGLISH).contains("SupportedSourceVersion")) {
if (!isIgnored(d.getMessage(Locale.ENGLISH))) {
r.add(d);
}
}
return r;
}
private static boolean isIgnored(String message) {
for (String i : IGNORE) {
if (message.contains(i)) return true;
}
return false;
}
private static JavaFileManager fileManager(Compilation compilation) {
try {
Field f = Compilation.class.getDeclaredField("jfm");
......