[SCM] maven-stapler-plugin packaging branch, master, updated. debian/1.16-1-1-g25f1f5d

James Page james.page at ubuntu.com
Tue Jan 24 14:51:00 UTC 2012


The following commit has been merged in the master branch:
commit 25f1f5d234a434eb7c37e3fe8f1653eb44b01cdf
Author: James Page <james.page at ubuntu.com>
Date:   Tue Jan 24 14:17:24 2012 +0000

    d/patches/stapler-compat.patch: Exclude Java 6 annotation processors from  build and jar files to avoid annotation processing conflict with  libstapler-java >= 1.169.

diff --git a/debian/changelog b/debian/changelog
index 61d9fe5..caad145 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+maven-stapler-plugin (1.16-2) unstable; urgency=low
+
+  * d/patches/stapler-compat.patch: Exclude Java 6 annotation processors from 
+    build and jar files to avoid annotation processing conflict with 
+    libstapler-java >= 1.169.
+
+ -- James Page <james.page at ubuntu.com>  Tue, 24 Jan 2012 14:17:15 +0000
+
 maven-stapler-plugin (1.16-1) unstable; urgency=low
 
   * Initial Debian release (Closes: #631961)
diff --git a/debian/maven.properties b/debian/maven.properties
index 6f25d9f..2b7fc00 100644
--- a/debian/maven.properties
+++ b/debian/maven.properties
@@ -3,3 +3,4 @@
 # maven.test.skip=true
 maven.compiler.source=1.5
 maven.compiler.target=1.5
+maven.compiler.excludes=**/*Processor6.java
diff --git a/debian/patches/series b/debian/patches/series
index 4c03f61..250fb7f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 disable-taglibdoc-mojo.patch
+stapler-compat.patch
diff --git a/debian/patches/stapler-compat.patch b/debian/patches/stapler-compat.patch
new file mode 100644
index 0000000..3b78d7c
--- /dev/null
+++ b/debian/patches/stapler-compat.patch
@@ -0,0 +1,315 @@
+Description: Remove Java 6 annotation processors from stapler plugin as these
+ are now provided by stapler core in stapler >= 1.169.
+Author: James Page <james.page at canonical.com>
+Forwared: no
+
+Index: maven-stapler-plugin/pom.xml
+===================================================================
+--- maven-stapler-plugin.orig/pom.xml	2012-01-10 23:43:48.350334158 +0100
++++ maven-stapler-plugin/pom.xml	2012-01-11 00:02:17.087732693 +0100
+@@ -75,7 +75,7 @@
+     <dependency>
+       <groupId>org.kohsuke.stapler</groupId>
+       <artifactId>stapler</artifactId>
+-      <version>1.100</version>
++      <version>1.174</version>
+     </dependency>
+     <dependency>
+       <groupId>org.apache.maven</groupId>
+Index: maven-stapler-plugin/src/main/java/org/kohsuke/stapler/ConstructorProcessor6.java
+===================================================================
+--- maven-stapler-plugin.orig/src/main/java/org/kohsuke/stapler/ConstructorProcessor6.java	2012-01-10 13:03:07.575215255 +0100
++++ /dev/null	1970-01-01 00:00:00.000000000 +0000
+@@ -1,70 +0,0 @@
+-package org.kohsuke.stapler;
+-
+-import org.kohsuke.MetaInfServices;
+-
+-import javax.annotation.processing.Processor;
+-import javax.annotation.processing.RoundEnvironment;
+-import javax.annotation.processing.SupportedAnnotationTypes;
+-import javax.annotation.processing.SupportedSourceVersion;
+-import javax.lang.model.SourceVersion;
+-import javax.lang.model.element.Element;
+-import javax.lang.model.element.ExecutableElement;
+-import javax.lang.model.element.TypeElement;
+-import javax.lang.model.element.VariableElement;
+-import javax.lang.model.util.ElementScanner6;
+-import java.io.IOException;
+-import java.util.Properties;
+-import java.util.Set;
+-
+-/**
+- * @author Kohsuke Kawaguchi
+- */
+- at SuppressWarnings({"Since15"})
+- at SupportedSourceVersion(SourceVersion.RELEASE_6)
+- at SupportedAnnotationTypes("*")
+- at MetaInfServices(Processor.class)
+-public class ConstructorProcessor6 extends AbstractProcessorImpl {
+-    @Override
+-    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+-        ElementScanner6<Void, Void> scanner = new ElementScanner6<Void, Void>() {
+-            @Override
+-            public Void visitExecutable(ExecutableElement e, Void aVoid) {
+-                if(e.getAnnotation(DataBoundConstructor.class)!=null) {
+-                    write(e);
+-                } else {
+-                    String javadoc = getJavadoc(e);
+-                    if(javadoc!=null && javadoc.contains("@stapler-constructor")) {
+-                        write(e);
+-                    }
+-                }
+-
+-                return super.visitExecutable(e, aVoid);
+-            }
+-        };
+-
+-        for( Element e : roundEnv.getRootElements() )
+-            scanner.scan(e,null);
+-
+-        return false;
+-    }
+-
+-    private void write(ExecutableElement c) {
+-        try {
+-            StringBuilder buf = new StringBuilder();
+-            for( VariableElement p : c.getParameters() ) {
+-                if(buf.length()>0)  buf.append(',');
+-                buf.append(p.getSimpleName());
+-            }
+-
+-            TypeElement t = (TypeElement) c.getEnclosingElement();
+-            String name = t.getQualifiedName().toString().replace('.', '/') + ".stapler";
+-            notice("Generating " + name, c);
+-
+-            Properties p = new Properties();
+-            p.put("constructor",buf.toString());
+-            writePropertyFile(p, name);
+-        } catch (IOException x) {
+-            error(x.toString());
+-        }
+-    }
+-}
+Index: maven-stapler-plugin/src/main/java/org/kohsuke/stapler/ExportedBeanAnnotationProcessor6.java
+===================================================================
+--- maven-stapler-plugin.orig/src/main/java/org/kohsuke/stapler/ExportedBeanAnnotationProcessor6.java	2012-01-10 13:03:07.575215255 +0100
++++ /dev/null	1970-01-01 00:00:00.000000000 +0000
+@@ -1,143 +0,0 @@
+-package org.kohsuke.stapler;
+-
+-import com.google.common.collect.LinkedListMultimap;
+-import com.google.common.collect.Multimap;
+-import org.kohsuke.MetaInfServices;
+-import org.kohsuke.stapler.export.Exported;
+-
+-import javax.annotation.processing.Processor;
+-import javax.annotation.processing.RoundEnvironment;
+-import javax.annotation.processing.SupportedAnnotationTypes;
+-import javax.annotation.processing.SupportedSourceVersion;
+-import javax.lang.model.SourceVersion;
+-import javax.lang.model.element.Element;
+-import javax.lang.model.element.TypeElement;
+-import javax.tools.FileObject;
+-import java.io.BufferedReader;
+-import java.io.FileNotFoundException;
+-import java.io.IOException;
+-import java.io.InputStreamReader;
+-import java.io.OutputStreamWriter;
+-import java.io.PrintWriter;
+-import java.util.Collection;
+-import java.util.Map.Entry;
+-import java.util.Properties;
+-import java.util.Set;
+-import java.util.TreeSet;
+-
+-/**
+- * @author Kohsuke Kawaguchi
+- */
+- at SuppressWarnings({"Since15"})
+- at SupportedSourceVersion(SourceVersion.RELEASE_6)
+- at SupportedAnnotationTypes("*")
+- at MetaInfServices(Processor.class)
+-public class ExportedBeanAnnotationProcessor6 extends AbstractProcessorImpl {
+-    @Override
+-    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+-        try {
+-            if (roundEnv.processingOver()) {
+-                return false;
+-            }
+-
+-            // collect all exposed properties
+-            Multimap<TypeElement, Element/*member decls*/> props = LinkedListMultimap.create();
+-
+-            for (Element exported : roundEnv.getElementsAnnotatedWith(Exported.class)) {
+-                props.put((TypeElement)exported.getEnclosingElement(), exported);
+-            }
+-
+-
+-            Set<String> exposedBeanNames = scanExisting();
+-
+-            for (Entry<TypeElement, Collection<Element>> e : props.asMap().entrySet()) {
+-                exposedBeanNames.add(e.getKey().getQualifiedName().toString());
+-
+-                final Properties javadocs = new Properties();
+-                for (Element md : e.getValue()) {
+-                    switch (md.getKind()) {
+-                    case FIELD:
+-                    case METHOD:
+-                       String javadoc = getJavadoc(md);
+-                       if(javadoc!=null)
+-                           javadocs.put(md.getSimpleName().toString(), javadoc);
+-                        break;
+-                    default:
+-                        throw new AssertionError("Unexpected element type: "+md);
+-                    }
+-                        // TODO: possibly a proper method signature generation, but it's too tedious
+-                        // way too tedious.
+-                        //private String getSignature(MethodDeclaration m) {
+-                        //    final StringBuilder buf = new StringBuilder(m.getSimpleName());
+-                        //    buf.append('(');
+-                        //    boolean first=true;
+-                        //    for (ParameterDeclaration p : m.getParameters()) {
+-                        //        if(first)   first = false;
+-                        //        else        buf.append(',');
+-                        //        p.getType().accept(new SimpleTypeVisitor() {
+-                        //            public void visitPrimitiveType(PrimitiveType pt) {
+-                        //                buf.append(pt.getKind().toString().toLowerCase());
+-                        //            }
+-                        //            public void visitDeclaredType(DeclaredType dt) {
+-                        //                buf.append(dt.getDeclaration().getQualifiedName());
+-                        //            }
+-                        //
+-                        //            public void visitArrayType(ArrayType at) {
+-                        //                at.getComponentType().accept(this);
+-                        //                buf.append("[]");
+-                        //            }
+-                        //
+-                        //            public void visitTypeVariable(TypeVariable tv) {
+-                        //
+-                        //                // TODO
+-                        //                super.visitTypeVariable(typeVariable);
+-                        //            }
+-                        //
+-                        //            public void visitVoidType(VoidType voidType) {
+-                        //                // TODO
+-                        //                super.visitVoidType(voidType);
+-                        //            }
+-                        //        });
+-                        //    }
+-                        //    buf.append(')');
+-                        //    // TODO
+-                        //    return null;
+-                        //}
+-                }
+-
+-                String javadocFile = e.getKey().getQualifiedName().toString().replace('.', '/') + ".javadoc";
+-                notice("Generating "+ javadocFile, e.getKey());
+-                writePropertyFile(javadocs, javadocFile);
+-            }
+-
+-            FileObject beans = createResource(STAPLER_BEAN_FILE);
+-            PrintWriter w = new PrintWriter(new OutputStreamWriter(beans.openOutputStream(),"UTF-8"));
+-            for (String beanName : exposedBeanNames)
+-                w.println(beanName);
+-            w.close();
+-
+-        } catch (IOException x) {
+-            error(x.toString());
+-        }
+-        return false;
+-    }
+-
+-    private Set<String> scanExisting() throws IOException {
+-        Set<String> exposedBeanNames = new TreeSet<String>();
+-
+-        FileObject beans = getResource(STAPLER_BEAN_FILE);
+-        try {
+-            BufferedReader in = new BufferedReader(new InputStreamReader(beans.openInputStream(),"UTF-8"));
+-            String line;
+-            while((line=in.readLine())!=null)
+-                exposedBeanNames.add(line.trim());
+-            in.close();
+-        } catch (FileNotFoundException e) {
+-            // no existing file, which is fine
+-        }
+-
+-        return exposedBeanNames;
+-    }
+-
+-    private static final String STAPLER_BEAN_FILE = "META-INF/exposed.stapler-beans";
+-}
+Index: maven-stapler-plugin/src/main/java/org/kohsuke/stapler/QueryParameterAnnotationProcessor6.java
+===================================================================
+--- maven-stapler-plugin.orig/src/main/java/org/kohsuke/stapler/QueryParameterAnnotationProcessor6.java	2012-01-10 13:03:07.575215255 +0100
++++ /dev/null	1970-01-01 00:00:00.000000000 +0000
+@@ -1,69 +0,0 @@
+-package org.kohsuke.stapler;
+-
+-import org.apache.commons.io.IOUtils;
+-import org.kohsuke.MetaInfServices;
+-
+-import javax.annotation.processing.Processor;
+-import javax.annotation.processing.RoundEnvironment;
+-import javax.annotation.processing.SupportedAnnotationTypes;
+-import javax.annotation.processing.SupportedSourceVersion;
+-import javax.lang.model.SourceVersion;
+-import javax.lang.model.element.Element;
+-import javax.lang.model.element.ExecutableElement;
+-import javax.lang.model.element.TypeElement;
+-import javax.lang.model.element.VariableElement;
+-import javax.tools.FileObject;
+-import java.io.IOException;
+-import java.io.OutputStream;
+-import java.util.HashSet;
+-import java.util.Set;
+-
+-/**
+- * @author Kohsuke Kawaguchi
+- */
+- at SuppressWarnings({"Since15"})
+- at SupportedSourceVersion(SourceVersion.RELEASE_6)
+- at SupportedAnnotationTypes("*")
+- at MetaInfServices(Processor.class)
+-public class QueryParameterAnnotationProcessor6 extends AbstractProcessorImpl {
+-    @Override
+-    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+-        try {
+-            Set<? extends Element> params = roundEnv.getElementsAnnotatedWith(QueryParameter.class);
+-            Set<ExecutableElement> methods = new HashSet<ExecutableElement>();
+-
+-            for (Element p : params)
+-                methods.add((ExecutableElement)p.getEnclosingElement());
+-
+-            for (ExecutableElement m : methods) {
+-                write(m);
+-            }
+-        } catch (IOException e) {
+-            error(e.getMessage());
+-        }
+-        return false;
+-    }
+-
+-    /**
+-     * @param m
+-     *      Method whose parameter has {@link QueryParameter}
+-     */
+-    private void write(ExecutableElement m) throws IOException {
+-        StringBuffer buf = new StringBuffer();
+-        for( VariableElement p : m.getParameters() ) {
+-            if(buf.length()>0)  buf.append(',');
+-            buf.append(p.getSimpleName());
+-        }
+-
+-        TypeElement t = (TypeElement)m.getEnclosingElement();
+-        FileObject f = createResource(t.getQualifiedName().toString().replace('.', '/') + "/" + m.getSimpleName() + ".stapler");
+-        notice("Generating " + f, m);
+-
+-        OutputStream os = f.openOutputStream();
+-        try {
+-            IOUtils.write(buf, os, "UTF-8");
+-        } finally {
+-            os.close();
+-        }
+-    }
+-}

-- 
maven-stapler-plugin packaging



More information about the pkg-java-commits mailing list