[build] [mapstructBinding]

This commit is contained in:
Reinier Zwitserloot committed 2020-06-25 23:31:13 +02:00
1 parent 0bbedd092a
commit 0f1c950b77
8 files changed
+25 -170

No files matched your search

+1
View File
@@ -36,4 +36,5 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<import file="buildScripts/create-intellij-project.ant.xml" /> <import file="buildScripts/create-intellij-project.ant.xml" />
<import file="buildScripts/website.ant.xml" /> <import file="buildScripts/website.ant.xml" />
<import file="buildScripts/eclipse-p2.ant.xml" /> <import file="buildScripts/eclipse-p2.ant.xml" />
<import file="buildScripts/mapstructBinding.ant.xml" />
</project> </project>
@@ -36,7 +36,6 @@ This buildfile is part of projectlombok.org. It creates the infrastructure neede
<srcdir dir="src/installer" /> <srcdir dir="src/installer" />
<srcdir dir="src/delombok" /> <srcdir dir="src/delombok" />
<srcdir dir="src/stubs" /> <srcdir dir="src/stubs" />
<srcdir dir="src/testAP" />
<srcdir dir="src/support" /> <srcdir dir="src/support" />
<srcdir dir="experimental/src" /> <srcdir dir="experimental/src" />
<srcdir dir="test/transform/src" /> <srcdir dir="test/transform/src" />
@@ -41,7 +41,6 @@ This buildfile is part of projectlombok.org. It creates the infrastructure neede
<srcdir dir="src/installer" /> <srcdir dir="src/installer" />
<srcdir dir="src/delombok" /> <srcdir dir="src/delombok" />
<srcdir dir="src/stubs" /> <srcdir dir="src/stubs" />
<srcdir dir="src/testAP" />
<srcdir dir="src/support" /> <srcdir dir="src/support" />
<srcdir dir="experimental/src" /> <srcdir dir="experimental/src" />
<srcdir dir="test/transform/src" test="true" /> <srcdir dir="test/transform/src" test="true" />
@@ -19,63 +19,14 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
--> -->
<project name="lombok.mapstruct-old" xmlns:ivy="antlib:com.zwitserloot.ivyplusplus" basedir=".."> <project name="lombok.mapstructBinding" xmlns:ivy="antlib:com.zwitserloot.ivyplusplus" basedir="..">
<description> <description>
This buildfile is part of projectlombok.org. It contains leftover tasks from the previous version This buildfile is part of projectlombok.org. It builds the mapstruct-lombok binding; we think the
of the build that are related to mapstruct. We will clean this up or remove it soon. version on mavencentral is the last version that is ever needed; the code itself is trivial and
exists as a separate dependency solely because it is itself dependent on both lombok and mapstruct.
</description> </description>
<target name="testAp-compile" depends="ensureBuildDeps"> <target name="-mapstructBinding.compile">
<delete file="build/testAP/META-INF/services/javax.annotation.processing.Processor" quiet="true" />
<ivy:compile destdir="build/testAP" source="1.7" target="1.7" ecj="true">
<bootclasspath path="${rt-openjdk8}" />
<src path="src/testAP" />
</ivy:compile>
<mkdir dir="build/testAP/META-INF" />
<mkdir dir="build/testAP/META-INF/services" />
<echo file="build/testAP/META-INF/services/javax.annotation.processing.Processor">org.projectlombok.testAp.TestAp</echo>
</target>
<target name="testAp-dist" depends="testAp-compile">
<mkdir dir="dist" />
<tstamp>
<format property="releaseTimestamp" pattern="yyyy-MM-dd" />
</tstamp>
<zip destfile="dist/testAp-${releaseTimestamp}.jar">
<fileset dir="." includes="LICENSE" />
<fileset dir="build/testAp" />
</zip>
<copy file="dist/testAp-${releaseTimestamp}.jar" tofile="dist/testAp.jar" />
</target>
<target name="testAp" depends="testAp-dist, dist">
<echo>Running in order: First Lombok, Then testAP</echo>
<delete dir="build/useTestAp" quiet="true" />
<mkdir dir="build/useTestAp" />
<javac verbose="false" source="1.7" target="1.7" destdir="build/useTestAp" includeantruntime="false">
<src path="src/useTestAP" />
<classpath location="dist/lombok.jar" />
<classpath location="dist/testAp.jar" />
<compilerarg value="-processor" />
<compilerarg value="lombok.launch.AnnotationProcessorHider$AnnotationProcessor,org.projectlombok.testAp.TestAp" />
</javac>
<echo>Running in order: First TestAP, Then Lombok</echo>
<delete dir="build/useTestAp" quiet="true" />
<mkdir dir="build/useTestAp" />
<javac verbose="false" source="1.7" target="1.7" destdir="build/useTestAp" includeantruntime="false">
<src path="src/useTestAP" />
<classpath location="dist/lombok.jar" />
<classpath location="dist/testAp.jar" />
<compilerarg value="-processor" />
<compilerarg value="org.projectlombok.testAp.TestAp,lombok.launch.AnnotationProcessorHider$AnnotationProcessor" />
</javac>
</target>
<target name="-compileMapstruct">
<mkdir dir="build/mapstruct" /> <mkdir dir="build/mapstruct" />
<javac includeAntRuntime="false" source="1.9" target="1.9" destdir="build/mapstruct"> <javac includeAntRuntime="false" source="1.9" target="1.9" destdir="build/mapstruct">
<src path="src/j9stubs" /> <src path="src/j9stubs" />
@@ -85,7 +36,7 @@ of the build that are related to mapstruct. We will clean this up or remove it s
<move file="build/mapstruct/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.class" tofile="build/lombok/secondaryLoading.SCL.lombok/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.SCL.lombok" /> <move file="build/mapstruct/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.class" tofile="build/lombok/secondaryLoading.SCL.lombok/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.SCL.lombok" />
</target> </target>
<target name="-mapstructBindingPrepare" depends="-compileMapstruct"> <target name="-mapstructBinding.prepare" depends="-mapstructBinding.compile">
<mkdir dir="build/mapstruct-module-path" /> <mkdir dir="build/mapstruct-module-path" />
<copy file="dist/lombok.jar" todir="build/mapstruct-module-path" /> <copy file="dist/lombok.jar" todir="build/mapstruct-module-path" />
<jar destfile="build/mapstruct-module-path/mapstruct-processor.jar" basedir="build/mapstruct" includes="org/**"> <jar destfile="build/mapstruct-module-path/mapstruct-processor.jar" basedir="build/mapstruct" includes="org/**">
@@ -104,7 +55,7 @@ of the build that are related to mapstruct. We will clean this up or remove it s
</copy> </copy>
</target> </target>
<target name="-mapstructBindingDoc" depends="-mapstructBindingPrepare"> <target name="-mapstructBinding.doc" depends="-mapstructBinding.prepare">
<mkdir dir="build/mapstruct-binding/api" /> <mkdir dir="build/mapstruct-binding/api" />
<javadoc <javadoc
Package="true" Package="true"
@@ -125,7 +76,7 @@ of the build that are related to mapstruct. We will clean this up or remove it s
<jar destfile="dist/lombok-mapstruct-binding-${mapstruct-binding.version}-javadoc.jar" basedir="build/mapstruct-binding/api" includes="**" /> <jar destfile="dist/lombok-mapstruct-binding-${mapstruct-binding.version}-javadoc.jar" basedir="build/mapstruct-binding/api" includes="**" />
</target> </target>
<target name="-mapstructBindingJar" depends="dist,-mapstructBindingPrepare"> <target name="-mapstructBinding.jar" depends="dist,-mapstructBinding.prepare">
<mkdir dir="build/mapstruct-binding/classes" /> <mkdir dir="build/mapstruct-binding/classes" />
<echo file="build/mapstruct-binding/classes/META-INF/services/org.mapstruct.ap.spi.AstModifyingAnnotationProcessor">lombok.mapstruct.NotifierHider$AstModificationNotifier</echo> <echo file="build/mapstruct-binding/classes/META-INF/services/org.mapstruct.ap.spi.AstModifyingAnnotationProcessor">lombok.mapstruct.NotifierHider$AstModificationNotifier</echo>
@@ -135,22 +86,25 @@ of the build that are related to mapstruct. We will clean this up or remove it s
<jar destfile="dist/lombok-mapstruct-binding-${mapstruct-binding.version}.jar" basedir="build/mapstruct-binding/classes" includes="**" /> <jar destfile="dist/lombok-mapstruct-binding-${mapstruct-binding.version}.jar" basedir="build/mapstruct-binding/classes" includes="**" />
</target> </target>
<target name="-mapstructBindingSrc" depends="-mapstructBindingJar"> <target name="-mapstructBinding.src" depends="-mapstructBinding.jar">
<jar destfile="dist/lombok-mapstruct-binding-${mapstruct-binding.version}-sources.jar" basedir="src/bindings/mapstruct" includes="**" /> <jar destfile="dist/lombok-mapstruct-binding-${mapstruct-binding.version}-sources.jar" basedir="src/bindings/mapstruct" includes="**" />
</target> </target>
<target name="mapstructBinding" depends="dist,-mapstructBindingJar,-mapstructBindingDoc,-mapstructBindingSrc"> <target name="mapstructBinding.pack" depends="dist,-mapstructBinding.jar,-mapstructBinding.doc,-mapstructBinding.src">
</target> </target>
<target name="mapstructMaven" depends="mapstructBinding,-mvn-ext" description="Create a maven repo for mapstruct binding into a build dir."> <target name="mapstructBinding.maven" depends="mapstructBinding.pack" description="Create a maven repo for mapstruct binding into a build dir.">
<property environment="env" />
<delete quiet="true" dir="build/mapstruct-binding-maven" /> <delete quiet="true" dir="build/mapstruct-binding-maven" />
<mkdir dir="build/mapstruct-binding-maven" /> <mkdir dir="build/mapstruct-binding-maven" />
<condition property="mvn-exe" value="${env.MAVEN_HOME}/bin/mvn${mvn-ext}" else="mvn${mvn-ext}"> <condition property="exe.mvn.base" value="mvn.cmd" else="mvn">
<os family="windows" />
</condition>
<condition property="exe.mvn" value="${env.MAVEN_HOME}/bin/${exe.mvn.base}" else="${exe.mvn.base}">
<isset property="env.MAVEN_HOME" /> <isset property="env.MAVEN_HOME" />
</condition> </condition>
<exec executable="${mvn-exe}" failifexecutionfails="false" resultproperty="mvn-result"> <local name="mvn.result" />
<exec executable="${exe.mvn}" failifexecutionfails="false" resultproperty="mvn.result">
<arg value="deploy:deploy-file" /> <arg value="deploy:deploy-file" />
<arg value="-Dfile=dist/lombok-mapstruct-binding-${mapstruct-binding.version}.jar" /> <arg value="-Dfile=dist/lombok-mapstruct-binding-${mapstruct-binding.version}.jar" />
<arg value="-Dsources=dist/lombok-mapstruct-binding-${mapstruct-binding.version}-sources.jar" /> <arg value="-Dsources=dist/lombok-mapstruct-binding-${mapstruct-binding.version}-sources.jar" />
@@ -161,9 +115,11 @@ of the build that are related to mapstruct. We will clean this up or remove it s
<arg value="-DpomFile=build/mapstruct-binding/maven/pom.xml" /> <arg value="-DpomFile=build/mapstruct-binding/maven/pom.xml" />
<arg value="-Durl=file://${basedir}/build/mapstruct-binding-maven" /> <arg value="-Durl=file://${basedir}/build/mapstruct-binding-maven" />
</exec> </exec>
<condition property="mvn-notfound" value="true"> <fail>
<not><isset property="mvn-result" /></not> mvn is not on your path and/or MAVEN_HOME is not set. Add mvn to your path or set MAVEN_HOME to continue.
</condition> <condition>
<fail message="mvn is not on your path and/or MAVEN_HOME is not set. Add mvn to your path or set MAVEN_HOME to continue." if="mvn-notfound" /> <not><isset property="mvn.result" /></not>
</condition>
</fail>
</target> </target>
</project> </project>
+1 -1
View File
@@ -305,7 +305,7 @@ such as applying the templates to produce the website, converting the changelog
knownHosts="ssh.knownHosts" /> knownHosts="ssh.knownHosts" />
</target> </target>
<target name="release.publish" depends="maven, -release.publish.site, website, eclipsep2.publish, maven.publish" /> <target name="release.publish" depends="maven, -release.publish.site, website.publish, eclipsep2.publish, maven.publish" />
<target name="edge.pack" depends="compile.support, version, dist, maven.edge"> <target name="edge.pack" depends="compile.support, version, dist, maven.edge">
<delete file="build/website/download-edge.html" /> <delete file="build/website/download-edge.html" />
@@ -1,10 +0,0 @@
package org.projectlombok.testAp;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
public @interface ExampleAnnotation {}
@@ -1,77 +0,0 @@
/*
* Copyright (C) 2016 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.projectlombok.testAp;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
@SupportedAnnotationTypes("org.projectlombok.testAp.ExampleAnnotation")
public final class TestAp extends AbstractProcessor {
private int roundCounter = 0;
private static final long START = System.currentTimeMillis();
private void log(String txt) {
System.out.printf("***[%3d]: %s\n", System.currentTimeMillis() - START, txt);
}
@Override public void init(ProcessingEnvironment processingEnv) {
log("TestAP in init");
super.init(processingEnv);
}
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
roundCounter++;
log("TestAP in round " + roundCounter);
boolean foundGetTest = false;
int annotatedElemCount = 0;
for (Element annotated : roundEnv.getElementsAnnotatedWith(ExampleAnnotation.class)) {
annotatedElemCount++;
for (Element child : annotated.getEnclosedElements()) {
if (child.getSimpleName().toString().equals("getTest") && child.getKind() == ElementKind.METHOD) foundGetTest = true;
if (child instanceof ExecutableElement) {
TypeMirror returnType = ((ExecutableElement) child).getReturnType();
System.out.println("RETURN TYPE for " + child.getSimpleName() + ": " + returnType.getClass() + " -- " + returnType.toString());
}
}
}
if (foundGetTest) log("RESULT: POSITIVE -- found the getTest method");
else if (annotatedElemCount > 0) log("RESULT: NEGATIVE -- found the example class but there's no getTest method in it according to the type mirror.");
else log("RESULT: AMBIVALENT -- The example class is not provided by 'getElementsAnnotatedWith' in this round. Not an issue, unless previously you got a NEGATIVE result.");
return false;
}
@Override public SourceVersion getSupportedSourceVersion() {
return SourceVersion.latestSupported();
}
}
-13
View File
@@ -1,13 +0,0 @@
@org.projectlombok.testAp.ExampleAnnotation
//@lombok.experimental.Accessors(chain=true)
public class UseTestAp {
@lombok.Setter @lombok.Getter String test;
public void confirmGetTestExists() {
System.out.println(getTest());
}
public UseTestAp returningSelf() {
return this;
}
}