mirror of
https://github.com/ethauvin/version-processor.git
synced 2025-04-24 23:47:11 -07:00
Update
This commit is contained in:
parent
ebb8c3503a
commit
72ed28c902
7 changed files with 32 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
.idea/tasks.xml
|
.idea/tasks.xml
|
||||||
.kobalt
|
.kobalt
|
||||||
kobaltBuild
|
kobaltBuild
|
||||||
|
out
|
||||||
|
|
7
.idea/compiler.xml
generated
7
.idea/compiler.xml
generated
|
@ -15,7 +15,14 @@
|
||||||
</wildcardResourcePatterns>
|
</wildcardResourcePatterns>
|
||||||
<annotationProcessing>
|
<annotationProcessing>
|
||||||
<profile default="true" name="Default" enabled="false">
|
<profile default="true" name="Default" enabled="false">
|
||||||
|
<processor name="com.beust.apt.processor.MainProcessor" />
|
||||||
|
<processorPath useClasspath="true">
|
||||||
|
<entry name="$PROJECT_DIR$/processor/src/main/java" />
|
||||||
|
</processorPath>
|
||||||
|
</profile>
|
||||||
|
<profile default="false" name="VersionProcessor" enabled="true">
|
||||||
<processorPath useClasspath="true" />
|
<processorPath useClasspath="true" />
|
||||||
|
<module name="example" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
</component>
|
</component>
|
||||||
|
|
12
.idea/libraries/KotlinJavaRuntime.xml
generated
12
.idea/libraries/KotlinJavaRuntime.xml
generated
|
@ -1,12 +0,0 @@
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="KotlinJavaRuntime">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime.jar!/" />
|
|
||||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</component>
|
|
|
@ -7,7 +7,6 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
<orderEntry type="module" module-name="processor" exported="" />
|
||||||
<orderEntry type="module" module-name="processor" />
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -2,14 +2,25 @@ package com.beust.apt.example;
|
||||||
|
|
||||||
import com.beust.apt.processor.Version;
|
import com.beust.apt.processor.Version;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
@Version("1.2")
|
@Version("1.2")
|
||||||
class Example {
|
class Example {
|
||||||
public Example() {
|
public Example() {
|
||||||
System.out.println("Instantiating Example");
|
System.out.println("Instantiating Example");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] argv) {
|
public static void main(String[] argv) throws Exception {
|
||||||
|
String[] args = new String[] {
|
||||||
|
// "-proc:only",
|
||||||
|
"-classpath", "/Users/beust/home/java/java-apt-example/processor/kobaltBuild/libs/processor-0.1.jar",
|
||||||
|
"-processor", "com.beust.apt.processor.MainProcessor",
|
||||||
|
"/Users/beust/java/java-apt-example/example/src/main/java/com/beust/apt/example/Example.java"
|
||||||
|
};
|
||||||
|
com.sun.tools.javac.Main.main(args);
|
||||||
|
|
||||||
|
File file = new File(".");
|
||||||
|
System.out.println("Instantiating Example()");
|
||||||
new Example();
|
new Example();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,6 +8,5 @@
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -2,11 +2,16 @@ package com.beust.apt.processor;
|
||||||
|
|
||||||
import javax.annotation.processing.AbstractProcessor;
|
import javax.annotation.processing.AbstractProcessor;
|
||||||
import javax.annotation.processing.RoundEnvironment;
|
import javax.annotation.processing.RoundEnvironment;
|
||||||
|
import javax.lang.model.SourceVersion;
|
||||||
import javax.lang.model.element.TypeElement;
|
import javax.lang.model.element.TypeElement;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class MainProcessor extends AbstractProcessor {
|
public class MainProcessor extends AbstractProcessor {
|
||||||
|
public MainProcessor() {
|
||||||
|
System.out.println("Instantiating MainProcessor");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||||
System.out.println("Processing annotations $annotations");
|
System.out.println("Processing annotations $annotations");
|
||||||
|
@ -18,4 +23,9 @@ public class MainProcessor extends AbstractProcessor {
|
||||||
result.add("Version");
|
result.add("Version");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SourceVersion getSupportedSourceVersion() {
|
||||||
|
return SourceVersion.RELEASE_7;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue