Move the annotation processor into lib

Reviewed By: @cristianoc

Differential Revision: D2511918

fb-gh-sync-id: feb838b
master
jrm 9 years ago committed by facebook-github-bot-7
parent b277d8164c
commit 4f7a56d470

2
.gitignore vendored

@ -97,4 +97,4 @@ buck-out/
/infer/annotations/annot_classes/
/infer/annotations/annotations.jar
/infer/annotations/processor_classes/
/infer/annotations/processor.jar
/infer/lib/java/processor.jar

@ -12,8 +12,8 @@ all: clang java llvm checkCopyright
java:
make -C $(SRCDIR) java
make -C $(MODELS) java
make -C $(ANNOTATIONS)
make -C $(MODELS) java
clang:
make -C $(SRCDIR) clang
@ -27,5 +27,5 @@ checkCopyright:
clean:
make -C $(SRCDIR) clean
make -C $(MODELS) clean
make -C $(ANNOTATIONS) clean
make -C $(MODELS) clean

@ -5,11 +5,3 @@ prebuilt_jar(
'PUBLIC',
]
)
prebuilt_jar(
name = 'processor',
binary_jar = 'processor.jar',
visibility = [
'PUBLIC',
]
)

@ -1,24 +1,30 @@
DEPENDENCIES = ../../dependencies
CWD = $(shell pwd)
DEPENDENCIES = $(CWD)/../../dependencies
LIB = $(CWD)/../lib/java
JSR_JAR = $(DEPENDENCIES)/java/jsr-305/jsr305.jar
ANNOT_SOURCES = `find com/facebook/infer/annotation -name "*.java"`
PROCESSOR_SOURCES = `find com/facebook/infer/annotprocess -name "*.java"`
ANNOT_SOURCES = $(shell find com/facebook/infer/annotation -name "*.java")
PROCESSOR_SOURCES = $(shell find com/facebook/infer/annotprocess -name "*.java")
ANNOT_CLASSES = 'annot_classes'
PROCESSOR_CLASSES = 'processor_classes'
all: annotations processor
ANNOTATIONS_JAR = $(CWD)/annotations.jar
PROCESSOR_JAR = $(LIB)/processor.jar
annotations:
all: $(ANNOTATIONS_JAR) $(PROCESSOR_JAR)
$(ANNOTATIONS_JAR): $(ANNOT_SOURCES)
mkdir -p $(ANNOT_CLASSES)
javac -cp $(JSR_JAR) $(ANNOT_SOURCES) -d $(ANNOT_CLASSES)
cd $(ANNOT_CLASSES) && jar cvf annotations.jar com && cp annotations.jar ../
cd $(ANNOT_CLASSES) && jar cvf $(ANNOTATIONS_JAR) com
processor:
$(PROCESSOR_JAR): $(PROCESSOR_SOURCES)
mkdir -p $(PROCESSOR_CLASSES)
javac $(PROCESSOR_SOURCES) -d $(PROCESSOR_CLASSES)
cd $(PROCESSOR_CLASSES) && cp -r ../resources/META-INF . && jar cvMf processor.jar com META-INF && cp processor.jar ../
jar cvMf processor.jar -C resources META-INF -C $(PROCESSOR_CLASSES) com
mv processor.jar $(PROCESSOR_JAR)
clean:
rm -rf $(ANNOT_CLASSES)
rm -f annotations.jar
rm -f $(ANNOTATIONS_JAR)
rm -rf $(PROCESSOR_CLASSES)
rm -f processor.jar
rm -f $(PROCESSOR_JAR)

@ -26,6 +26,15 @@ parser.add_argument('-bootclasspath', type=str)
parser.add_argument('-d', dest='classes_out', default=current_directory)
class AnnotationProcessorNotFound(Exception):
def __init__(self, path):
self.path = path
def __str__(self):
return repr(self.path + ' not found')
class CompilerCall:
def __init__(self, arguments):
@ -44,6 +53,9 @@ class CompilerCall:
if self.args.bootclasspath is not None:
javac_cmd += ['-bootclasspath', self.args.bootclasspath]
if not os.path.isfile(utils.ANNOT_PROCESSOR_JAR):
raise AnnotationProcessorNotFound(utils.ANNOT_PROCESSOR_JAR)
if self.args.classpath is None:
classpath = utils.ANNOT_PROCESSOR_JAR
else:

@ -28,10 +28,7 @@ BIN_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
LIB_DIRECTORY = os.path.join(BIN_DIRECTORY, '..', 'lib', 'java')
TMP_DIRECTORY = tempfile.gettempdir()
MODELS_JAR = os.path.join(LIB_DIRECTORY, 'models.jar')
ANNOT_PROCESSOR_JAR = os.path.join(
BIN_DIRECTORY, '..', 'annotations', 'processor.jar')
ANNOT_PROCESSOR_JAR = os.path.join(LIB_DIRECTORY, 'processor.jar')
DEFAULT_INFER_OUT = os.path.join(os.getcwd(), 'infer-out')
CSV_PERF_FILENAME = 'performances.csv'

Loading…
Cancel
Save