Android Annotations not compiled with Ant
-
11-12-2019 - |
Question
After following all of the steps listed here, I found that my (Class)_ was still not being generated.
custom-rules:
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile">
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
<!-- merge the project's own classpath and the tested project's classpath -->
<path id="project.javac.classpath">
<path refid="project.all.jars.path" />
<path refid="tested.project.classpath" />
</path>
<javac encoding="${java.encoding}"
source="${java.source}" target="${java.target}"
debug="true" extdirs="" includeantruntime="false"
destdir="${out.classes.absolute.dir}"
bootclasspathref="project.target.class.path"
verbose="${verbose}"
classpathref="project.javac.classpath"
fork="${need.javac.fork}">
<classpath>
<fileset dir="compile-libs" includes="*.jar"/>
</classpath>
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<compilerarg line="${java.compilerargs}" />
</javac>
<!-- bunch of if conditions here -->
</target>
</project>
Log:
C:{path}{Class}.java (8:34) cannot find symbol class Activity_
Note: Starting AndroidAnnotations annotation processing
: Unclosed files for the types '[dummy1343240015623]'; these types will not undergo annotation processing
It appears that the processing begins after it cannot find Activity_. Error or as intended?
All of the files are in the correct location ( api.jar in \libs, .jar in \compile-libs ), and cannot for the life of me figure out anything.
Edited: Went poking around a little bit. Added in a new property
for the AndroidAnnotations generated source folder, added that into the javac
src
pathing during -compile
and still no luck. This first time I run the ant script, it tells me that it cannot find any of the generated classes, the second time, it tells me that I have duplicates of them all ( still gives me the unclsed files for types...
error message ).
Solution
So, possible solution here. I needed to add a couple of edits to the javac compile itself, as well as have delete and mkdir above, so that it would constantly re-generate all of the files it needs and not barf on itself due to overwrite permissions.
<target name="-compile"
depends="-build-setup, -pre-build, -code-gen, -pre-compile">
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
<!-- merge the project's own classpath and the tested project's classpath -->
<path id="project.javac.classpath">
<path refid="project.all.jars.path"/>
<path refid="tested.project.classpath"/>
</path>
<delete dir="${out.aagen}"/>
<mkdir dir="${out.aagen}"/>
<javac encoding="${java.encoding}"
source="${java.source}"
target="${java.target}"
debug="true"
extdirs=""
includeantruntime="false"
destdir="${out.classes.absolute.dir}"
bootclasspathref="project.target.class.path"
verbose="${verbose}"
classpathref="project.javac.classpath"
fork="${need.javac.fork}">
<src path="${source.absolute.dir}"/>
<src path="${gen.absolute.dir}"/>
<src path="${out.aagen}"/>
<compilerarg line="${java.compilerargs}"/>
<compilerarg line="-processorpath ${processorpath}"/>
<compilerarg line="-processor ${processor}"/>
<compilerarg line="-s ${out.aagen}"/>
</javac>
<!-- a bunch of other crap that is unimportant -->
</target>