Compare commits
12 Commits
aptIn16-0.
...
master
Author | SHA1 | Date |
---|---|---|
Travis Burtrum | 174eda3bde | |
Travis Burtrum | 78b4a488fc | |
Travis Burtrum | 3588ba6ac2 | |
Travis Burtrum | de38f7add0 | |
Travis Burtrum | 78f73bf494 | |
Travis Burtrum | b02e035344 | |
moparisthebest | c3e22f44cf | |
moparisthebest | 57443ef9bd | |
moparisthebest | b4adf37744 | |
moparisthebest | fe5d6e8469 | |
moparisthebest | 7a02261fc5 | |
Travis Burtrum | 800e8350da |
|
@ -0,0 +1,42 @@
|
|||
properties(
|
||||
[
|
||||
disableConcurrentBuilds()
|
||||
]
|
||||
)
|
||||
|
||||
node('linux && docker') {
|
||||
try {
|
||||
stage('Checkout') {
|
||||
//branch name from Jenkins environment variables
|
||||
echo "My branch is: ${env.BRANCH_NAME}"
|
||||
|
||||
// this doesn't grab tags pointing to this branch
|
||||
//checkout scm
|
||||
// this hack does... https://issues.jenkins.io/browse/JENKINS-45164
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],
|
||||
extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']],
|
||||
userRemoteConfigs: scm.userRemoteConfigs,
|
||||
])
|
||||
sh '''
|
||||
set -euxo pipefail
|
||||
git checkout "$BRANCH_NAME" --
|
||||
git reset --hard "origin/$BRANCH_NAME"
|
||||
'''
|
||||
}
|
||||
|
||||
stage('Build + Deploy') {
|
||||
sh 'curl --compressed -sL https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/build-ci.sh | bash'
|
||||
}
|
||||
|
||||
currentBuild.result = 'SUCCESS'
|
||||
} catch (Exception err) {
|
||||
currentBuild.result = 'FAILURE'
|
||||
} finally {
|
||||
stage('Email') {
|
||||
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'admin.jenkins@moparisthebest.com', sendToIndividuals: true])
|
||||
}
|
||||
deleteDir()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
[ $JAVA_VERSION -lt 6 -o $JAVA_VERSION -gt 8 ] && echo "build does not support JAVA_VERSION: $JAVA_VERSION" && exit 0
|
||||
|
||||
echo "starting build for JAVA_VERSION: $JAVA_VERSION"
|
||||
|
||||
# grab all deps with java 8
|
||||
run-java 8 mvn dependency:go-offline
|
||||
|
||||
# install deps
|
||||
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
||||
|
||||
# clean and test
|
||||
mvn clean test -B
|
||||
|
||||
# publish only from java 6 and master branch
|
||||
if [ "$BRANCH_NAME" == "master" -a $JAVA_VERSION -eq 6 ]
|
||||
then
|
||||
echo 'deploying to maven'
|
||||
# java 6 cannot do modern SSL, use java 8 to deploy
|
||||
run-java 8 mvn deploy -Dmaven.test.skip=true -B
|
||||
|
||||
mkdir -p release
|
||||
find -type f -name '*.jar' -print0 | xargs -0n1 -I {} mv '{}' 'release/'
|
||||
fi
|
||||
|
||||
echo 'build success!'
|
||||
exit 0
|
|
@ -21,7 +21,7 @@
|
|||
<parent>
|
||||
<groupId>com.moparisthebest.aptIn16</groupId>
|
||||
<artifactId>aptIn16</artifactId>
|
||||
<version>0.1</version>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apt-mirror-api</artifactId>
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>default-tools.jar</id>
|
||||
<id>default-tools.jar-sun</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>java.vendor</name>
|
||||
|
@ -46,6 +46,24 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>default-tools.jar-oracle</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>java.vendor</name>
|
||||
<value>Oracle Corporation</value>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sun</groupId>
|
||||
<artifactId>tools</artifactId>
|
||||
<version>1.6</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${java.home}/../lib/tools.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
|
@ -21,7 +21,7 @@
|
|||
<parent>
|
||||
<groupId>com.moparisthebest.aptIn16</groupId>
|
||||
<artifactId>aptIn16</artifactId>
|
||||
<version>0.1</version>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>apt-processor</artifactId>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<parent>
|
||||
<groupId>com.moparisthebest.aptIn16</groupId>
|
||||
<artifactId>aptIn16</artifactId>
|
||||
<version>0.1</version>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>core</artifactId>
|
||||
|
@ -30,7 +30,7 @@
|
|||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>apt-mirror-api</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -70,6 +70,7 @@ public class ConvertAnnotationProcessorEnvironment implements AnnotationProcesso
|
|||
elements = internal.getElementUtils();
|
||||
ConvertDeclaration.elements = elements;
|
||||
ConvertTypeMirror.types = internal.getTypeUtils();
|
||||
ConvertDeclaration.messager = ConvertTypeMirror.messager = internal.getMessager();
|
||||
|
||||
// now calculate options once, since they are sort-of expensive
|
||||
// real apt passes them back like so:
|
||||
|
|
|
@ -81,16 +81,15 @@ public class ConvertAnnotationProcessorFactory implements Processor {
|
|||
internal = (AnnotationProcessorFactory) Class.forName(annotationProcessorFactoryName).newInstance();
|
||||
System.out.println("ConvertAnnotationProcessorFactory running " + internal.getClass().getName());
|
||||
} catch (Throwable e) {
|
||||
System.out.printf("Not running AnnotationProcessorFactory '%s' because of error!\n", annotationProcessorFactoryName);
|
||||
e.printStackTrace();
|
||||
System.out.printf("Not running AnnotationProcessorFactory '%s' because of error! Not on classpath?\n", annotationProcessorFactoryName);
|
||||
if(Debug.debug)
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
public ConvertAnnotationProcessorFactory(AnnotationProcessorFactory internal) {
|
||||
if (internal == null)
|
||||
throw new NullPointerException("AnnotationProcessorFactory cannot be null!");
|
||||
System.out.println("ConvertAnnotationProcessorFactory running " + internal.getClass().getName());
|
||||
System.out.println("ConvertAnnotationProcessorFactory running " + (internal == null ? "null" : internal.getClass().getName()));
|
||||
this.internal = internal;
|
||||
}
|
||||
|
||||
|
@ -105,11 +104,15 @@ public class ConvertAnnotationProcessorFactory implements Processor {
|
|||
|
||||
@Override
|
||||
public Set<String> getSupportedOptions() {
|
||||
if(internal == null)
|
||||
return Collections.emptySet();
|
||||
return cleanOptions(internal.supportedOptions());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getSupportedAnnotationTypes() {
|
||||
if(internal == null)
|
||||
return Collections.emptySet();
|
||||
if (Debug.debug)
|
||||
System.out.printf("factory: '%s' supportedAnnotationTypes: '%s'\n", internal.getClass().getName(), internal.supportedAnnotationTypes());
|
||||
return Convertable.toSet(internal.supportedAnnotationTypes());
|
||||
|
@ -173,6 +176,8 @@ public class ConvertAnnotationProcessorFactory implements Processor {
|
|||
*/
|
||||
@Override
|
||||
public synchronized boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||
if(internal == null)
|
||||
return false;
|
||||
env.getFiler().setModified(false);
|
||||
env.setRoundEnv(roundEnv);
|
||||
internal.getProcessorFor(ConvertDeclaration.getConvertable().convertToSet(annotations, AnnotationTypeDeclaration.class), env).process();
|
||||
|
@ -194,21 +199,21 @@ public class ConvertAnnotationProcessorFactory implements Processor {
|
|||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o instanceof AnnotationProcessorFactory) return internal.equals(o);
|
||||
if (o instanceof AnnotationProcessorFactory) return o.equals(internal);
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
ConvertAnnotationProcessorFactory that = (ConvertAnnotationProcessorFactory) o;
|
||||
|
||||
return internal.equals(that.internal);
|
||||
return internal == that.internal || (internal != null && internal.equals(that.internal));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return internal.hashCode();
|
||||
return internal == null ? 0 : internal.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return internal.toString();
|
||||
return internal == null ? "null" : internal.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,13 +26,28 @@ import com.sun.mirror.util.DeclarationVisitor;
|
|||
import com.sun.mirror.util.SourcePosition;
|
||||
import com.moparisthebest.mirror.log.Debug;
|
||||
|
||||
import javax.annotation.processing.Messager;
|
||||
import javax.lang.model.element.*;
|
||||
import javax.lang.model.util.Elements;
|
||||
import javax.tools.Diagnostic;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.*;
|
||||
|
||||
public class ConvertDeclaration extends Convertable<Element, Declaration> implements com.sun.mirror.declaration.Declaration {
|
||||
|
||||
private static final Modifier MODIFIER_DEFAULT;
|
||||
|
||||
static {
|
||||
Modifier defaultModifier = null;
|
||||
try {
|
||||
defaultModifier = Modifier.valueOf("DEFAULT");
|
||||
} catch (Throwable e) {
|
||||
// ignore this, must not be running in 1.8+
|
||||
}
|
||||
MODIFIER_DEFAULT = defaultModifier;
|
||||
}
|
||||
|
||||
public static Messager messager = null;
|
||||
public static Elements elements = null;
|
||||
protected final javax.lang.model.element.Element internalElement;
|
||||
|
||||
|
@ -106,12 +121,9 @@ public class ConvertDeclaration extends Convertable<Element, Declaration> implem
|
|||
return (T) new ConvertParameterDeclaration((VariableElement) from);
|
||||
case FIELD:
|
||||
return (T) new ConvertFieldDeclaration((VariableElement) from);
|
||||
default:
|
||||
System.err.println("FATAL ERROR, REACHED DEFAULT!");
|
||||
System.exit(1);
|
||||
//throw new RuntimeException("FATAL ERROR, REACHED DEFAULT!");
|
||||
}
|
||||
// shouldn't ever get here
|
||||
messager.printMessage(Diagnostic.Kind.ERROR, "ConvertDeclaration reached default for kind: " + from.getKind(), from);
|
||||
return (T) new ConvertDeclaration(from);
|
||||
|
||||
}
|
||||
|
@ -138,7 +150,14 @@ public class ConvertDeclaration extends Convertable<Element, Declaration> implem
|
|||
|
||||
@Override
|
||||
public Collection<com.sun.mirror.declaration.Modifier> getModifiers() {
|
||||
return Convertable.convertEnums(internalElement.getModifiers(), com.sun.mirror.declaration.Modifier.class);
|
||||
Set<Modifier> modifiers = internalElement.getModifiers();
|
||||
// handle 1.8 DEFAULT here carefully, should just be like PUBLIC for 1.5 code...
|
||||
if (MODIFIER_DEFAULT != null && modifiers.contains(MODIFIER_DEFAULT)) {
|
||||
modifiers = new HashSet<Modifier>(modifiers); // copy
|
||||
modifiers.remove(MODIFIER_DEFAULT);
|
||||
modifiers.add(Modifier.PUBLIC);
|
||||
}
|
||||
return Convertable.convertEnums(modifiers, com.sun.mirror.declaration.Modifier.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,12 +22,15 @@ import com.moparisthebest.mirror.convert.Convertable;
|
|||
import com.sun.mirror.util.TypeVisitor;
|
||||
import com.moparisthebest.mirror.log.Debug;
|
||||
|
||||
import javax.annotation.processing.Messager;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.Types;
|
||||
import javax.tools.Diagnostic;
|
||||
|
||||
public class ConvertTypeMirror extends Convertable<TypeMirror, com.sun.mirror.type.TypeMirror> implements com.sun.mirror.type.TypeMirror {
|
||||
protected final javax.lang.model.type.TypeMirror internalTypeMirror;
|
||||
|
||||
public static Messager messager = null;
|
||||
public static Types types = null;
|
||||
|
||||
protected ConvertTypeMirror(javax.lang.model.type.TypeMirror internalTypeMirror) {
|
||||
|
@ -100,17 +103,15 @@ public class ConvertTypeMirror extends Convertable<TypeMirror, com.sun.mirror.ty
|
|||
case ANNOTATION_TYPE:
|
||||
return (T) new ConvertAnnotationType(dt);
|
||||
}
|
||||
case ERROR:
|
||||
return (T) new ConvertDeclaredType((javax.lang.model.type.ErrorType)from);
|
||||
case NONE:
|
||||
case NULL:
|
||||
return null;
|
||||
default:
|
||||
System.err.println("FATAL ERROR, REACHED DEFAULT!");
|
||||
System.exit(1);
|
||||
//throw new RuntimeException("FATAL ERROR, REACHED DEFAULT!");
|
||||
}
|
||||
// shouldn't ever get here
|
||||
messager.printMessage(Diagnostic.Kind.ERROR, "ConvertTypeMirror reached default for kind: " + from.getKind(), types.asElement(from));
|
||||
return (T) new ConvertTypeMirror(from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<parent>
|
||||
<groupId>com.moparisthebest.aptIn16</groupId>
|
||||
<artifactId>aptIn16</artifactId>
|
||||
<version>0.1</version>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>netui-compiler</artifactId>
|
||||
|
@ -34,18 +34,6 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.beehive</groupId>
|
||||
<artifactId>beehive-controls</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.beehive</groupId>
|
||||
<artifactId>beehive-netui-compiler</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -21,12 +21,12 @@
|
|||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>7</version>
|
||||
<version>9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.moparisthebest.aptIn16</groupId>
|
||||
<artifactId>aptIn16</artifactId>
|
||||
<version>0.1</version>
|
||||
<version>0.3-SNAPSHOT</version>
|
||||
<name>aptIn16</name>
|
||||
<description>
|
||||
aptIn16 is an implementation of the com.sun.mirror.* classes allowing classes implementing them to run as
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# aptIn16
|
||||
|
||||
[![Build Status](https://ci.moparisthe.best/job/moparisthebest/job/aptIn16/job/master/badge/icon%3Fstyle=plastic)](https://ci.moparisthe.best/job/moparisthebest/job/aptIn16/job/master/)
|
||||
|
||||
aptIn16 is an implementation of the [Annotation Processing Tool (apt)][6] [com.sun.mirror.*][1] classes allowing classes implementing them to run as [Java 1.6 annotation processors][2] inside of javac ([JSR 269][3]). This is orders of magnitude faster than [apt][6]. It can be used by anyone who currently relies on apt but would like to switch to the newer/faster javac.
|
||||
|
||||
In short, it implements [com.sun.mirror][1] using [javax.annotation.processing][4] and [javax.lang.model][5] in the background.
|
||||
|
|
Loading…
Reference in New Issue