From 204b2ccc5307c8fb873b7cd9810b85f8d18245e2 Mon Sep 17 00:00:00 2001 From: Irene Papakonstantinou Date: Wed, 12 Aug 2015 16:27:40 -0100 Subject: [PATCH] Make facebook-clang-plugins a submodule @update-submodule: facebook-clang-plugins --- INSTALL.md | 10 +++--- compile-fcp.sh | 2 +- .../clang-plugin/clang-plugin-version.config | 1 - infer/lib/capture/xcodebuild.py | 2 +- infer/lib/clang/clang_general_wrapper | 4 +-- infer/lib/clang/clang_wrapper | 2 +- infer/src/Makefile | 11 +++---- scripts/create_binaries.sh | 22 ++++++------- update-fcp.sh | 33 ------------------- 9 files changed, 26 insertions(+), 61 deletions(-) delete mode 100644 dependencies/clang-plugin/clang-plugin-version.config delete mode 100755 update-fcp.sh diff --git a/INSTALL.md b/INSTALL.md index bad9aa434..74e182fb4 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -7,7 +7,7 @@ git clone https://github.com/facebook/infer.git ``` To analyse C and Objective-C, Infer requires clang and the -[facebook-clang-plugin](https://github.com/facebook/facebook-clang-plugins). If +[facebook-clang-plugins](https://github.com/facebook/facebook-clang-plugins). If you wish to analyse only Java/Android code, then you could skip these dependencies. Details below. @@ -53,7 +53,9 @@ To compile support for both Java and C/Objective-C, do this instead. ```bash cd infer -./update-fcp.sh && ../facebook-clang-plugin/clang/setup.sh && ./compile-fcp.sh # go have a coffee :) +git submodule update --init --recursive +facebook-clang-plugins/clang/setup.sh # go have a coffee :) +./compile-fcp.sh make -C infer export PATH=`pwd`/infer/bin:$PATH ``` @@ -112,8 +114,8 @@ Then continue with: ```bash cd infer -./update-fcp.sh -../facebook-clang-plugin/clang/setup.sh # go have a coffee :) +git submodule update --init --recursive +facebook-clang-plugins/clang/setup.sh # go have a coffee :) ./compile-fcp.sh make -C infer export PATH=`pwd`/infer/bin:$PATH diff --git a/compile-fcp.sh b/compile-fcp.sh index 002b192bb..b4a383744 100755 --- a/compile-fcp.sh +++ b/compile-fcp.sh @@ -16,7 +16,7 @@ set -x # THE INSTALLATION OF THE PLUGINS. INFER_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -PLUGIN_DIR="$INFER_ROOT/../facebook-clang-plugin" +PLUGIN_DIR="$INFER_ROOT/facebook-clang-plugins" CLANG_EXEC="$PLUGIN_DIR/clang/bin/clang" # check if clang is available diff --git a/dependencies/clang-plugin/clang-plugin-version.config b/dependencies/clang-plugin/clang-plugin-version.config deleted file mode 100644 index b4b7658e2..000000000 --- a/dependencies/clang-plugin/clang-plugin-version.config +++ /dev/null @@ -1 +0,0 @@ -7d01248a6499fbadc1aaa2c98094533527307771 diff --git a/infer/lib/capture/xcodebuild.py b/infer/lib/capture/xcodebuild.py index 3089301e1..3d7fe3f18 100644 --- a/infer/lib/capture/xcodebuild.py +++ b/infer/lib/capture/xcodebuild.py @@ -21,7 +21,7 @@ infer -- xcodebuild -workspace HelloWorld.xcworkspace -scheme HelloWorld''' SCRIPT_DIR = os.path.dirname(__file__) INFER_ROOT = os.path.join(SCRIPT_DIR, '..', '..', '..') -FCP_ROOT = os.path.join(INFER_ROOT, '..', 'facebook-clang-plugin') +FCP_ROOT = os.path.join(INFER_ROOT, 'facebook-clang-plugins') CLANG_WRAPPER = os.path.join( SCRIPT_DIR, 'clang', ) diff --git a/infer/lib/clang/clang_general_wrapper b/infer/lib/clang/clang_general_wrapper index 70eb93e83..db409b2aa 100755 --- a/infer/lib/clang/clang_general_wrapper +++ b/infer/lib/clang/clang_general_wrapper @@ -15,8 +15,8 @@ CMD_FILE_EXT=".sh" # extenion of the file containing the output of the Infer Clang frontend INFERCLANG_LOG_FILE_EXT=".astlog" # path of the plugin to load in clang -CLANG_PLUGIN_REL_PATH="facebook-clang-plugin/libtooling/build/FacebookClangPlugin.dylib" -PLUGIN_PATH="${SCRIPT_DIR}/../../../../${CLANG_PLUGIN_REL_PATH}" +CLANG_PLUGIN_REL_PATH="facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib" +PLUGIN_PATH="${SCRIPT_DIR}/../../../${CLANG_PLUGIN_REL_PATH}" # name of the plugin to use PLUGIN_NAME="YojsonASTExporter" # output directory of the plugin diff --git a/infer/lib/clang/clang_wrapper b/infer/lib/clang/clang_wrapper index 3c1467bef..28d72e828 100755 --- a/infer/lib/clang/clang_wrapper +++ b/infer/lib/clang/clang_wrapper @@ -6,7 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -CLANG_COMPILER="${SCRIPT_DIR}/../../../../facebook-clang-plugin/clang/bin/clang" +CLANG_COMPILER="${SCRIPT_DIR}/../../../facebook-clang-plugins/clang/bin/clang" if [ "${0%++}" != "$0" ]; then XX="++"; else XX=""; fi diff --git a/infer/src/Makefile b/infer/src/Makefile index 44820512a..7027a1bf4 100644 --- a/infer/src/Makefile +++ b/infer/src/Makefile @@ -91,7 +91,7 @@ CLANG_SOURCES = clang INFERCLANG_MAIN = $(CLANG_SOURCES)/cMain INFERCLANG_BINARY = $(BINDIR)/InferClang -CLANG_PLUGIN_ROOT ?= $(ROOT)/../facebook-clang-plugin +CLANG_PLUGIN_ROOT ?= $(ROOT)/facebook-clang-plugins CLANG_PLUGIN_BINARIES = $(addprefix $(CLANG_PLUGIN_ROOT)/clang-ocaml/build/, clang_ast_converter clang_ast_named_decl_printer) CLANG_OCAML_ROOT = $(CLANG_PLUGIN_ROOT)/clang-ocaml @@ -125,9 +125,9 @@ CHECKCOPYRIGHT_MAIN = $(SCRIPT_SOURCES)/checkCopyright # Based on that determine which code should be loaded ifeq ($(wildcard $(ROOT)/.facebook),) EXTRA_DEPS = opensource -else +else EXTRA_DEPS = facebook -endif +endif DEPENDENCIES = $(BACKEND_SOURCES) checkers facebook/checkers facebook/checkers/graphql facebook/scripts harness $(EXTRA_DEPS) @@ -148,7 +148,7 @@ checkCopyright: build_checkCopyright annotations $(CHECKCOPYRIGHT_BINARY) build_java: init $(INFERPRINT_ATDGEN_STUBS) $(OCAMLBUILD) $(TYPEPROP_MAIN).native $(INFERANALYZE_MAIN).native $(INFERPRINT_MAIN).native $(INFERJAVA_MAIN).native -build_clang: init $(INFERPRINT_ATDGEN_STUBS) check_clang_plugin $(CLANG_ATDGEN_STUBS) +build_clang: init $(INFERPRINT_ATDGEN_STUBS) $(CLANG_ATDGEN_STUBS) $(OCAMLBUILD) $(INFERANALYZE_MAIN).native $(INFERPRINT_MAIN).native $(INFERCLANG_MAIN).native build_llvm: @@ -160,9 +160,6 @@ build_checkCopyright: annotations: rsync -r --delete --exclude=*.ml* --exclude=*.o --exclude=*.cm* --exclude=*.native $(BUILDDIR)/* $(ANNOTDIR) -check_clang_plugin: - $(SCRIPTDIR)/check_clang_plugin_version.sh $(CLANG_PLUGIN_ROOT) - $(INFERPRINT_ATDGEN_STUBS): $(INFERPRINT_ATDGEN_STUB_ATD) atdgen -t $(INFERPRINT_ATDGEN_STUB_ATD) -o $(INFERPRINT_ATDGEN_STUB_BASE) atdgen -j $(INFERPRINT_ATDGEN_STUB_ATD) -o $(INFERPRINT_ATDGEN_STUB_BASE) diff --git a/scripts/create_binaries.sh b/scripts/create_binaries.sh index 04e13f812..671d201bb 100755 --- a/scripts/create_binaries.sh +++ b/scripts/create_binaries.sh @@ -12,7 +12,7 @@ set -e SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" INFER_DIR=$SCRIPT_DIR/../infer -CLANG_PLUGIN_DIR=$SCRIPT_DIR/../../facebook-clang-plugin +CLANG_PLUGIN_DIR=$SCRIPT_DIR/../facebook-clang-plugins platform=`uname` # Build Infer @@ -30,20 +30,20 @@ BINARY_TARBALL=$BINARY_DIR.tar.xz PKG_DIR=$SCRIPT_DIR/../$BINARY_DIR # Start with infer -mkdir -p $PKG_DIR/infer/infer/{annotations,bin,lib} -mkdir -p $PKG_DIR/infer/examples -mkdir -p $PKG_DIR/infer/scripts -cp -r $INFER_DIR/annotations/* $PKG_DIR/infer/infer/annotations -cp -r $INFER_DIR/bin/* $PKG_DIR/infer/infer/bin -cp -r $INFER_DIR/lib/* $PKG_DIR/infer/infer/lib -cp -r $INFER_DIR/../examples/* $PKG_DIR/infer/examples -cp $INFER_DIR/../{CONTRIBUTING.md,LICENSE,PATENTS,README.md,INSTALL.md} $PKG_DIR/infer/ -cp -r $INFER_DIR/../scripts/* $PKG_DIR/infer/scripts +mkdir -p $PKG_DIR/infer/{annotations,bin,lib} +mkdir -p $PKG_DIR/examples +mkdir -p $PKG_DIR/scripts +cp -r $INFER_DIR/annotations/* $PKG_DIR/infer/annotations +cp -r $INFER_DIR/bin/* $PKG_DIR/infer/bin +cp -r $INFER_DIR/lib/* $PKG_DIR/infer/lib +cp -r $INFER_DIR/../examples/* $PKG_DIR/examples +cp $INFER_DIR/../{CONTRIBUTING.md,LICENSE,PATENTS,README.md,INSTALL.md} $PKG_DIR/ +cp -r $INFER_DIR/../scripts/* $PKG_DIR/scripts # don't include pyc files into the release find $PKG_DIR -name "*.pyc" | xargs rm # Add facebook-clang-plugin -PKG_PLUGIN_DIR=$PKG_DIR/facebook-clang-plugin +PKG_PLUGIN_DIR=$PKG_DIR/facebook-clang-plugins mkdir -p $PKG_PLUGIN_DIR/clang/{bin,lib,include} mkdir -p $PKG_PLUGIN_DIR/libtooling/build cp $CLANG_PLUGIN_DIR/{CONTRIBUTING.md,LICENSE,LLVM-LICENSE,PATENTS,README.md} $PKG_PLUGIN_DIR diff --git a/update-fcp.sh b/update-fcp.sh deleted file mode 100755 index 156bfa558..000000000 --- a/update-fcp.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2015 - present Facebook, Inc. -# All rights reserved. -# -# This source code is licensed under the BSD style license found in the -# LICENSE file in the root directory of this source tree. An additional grant -# of patent rights can be found in the PATENTS file in the same directory. - -set -x -set -e - -# This script fetches the revision of the 'facebook-clang-plugins' -# required by Infer. - -INFER_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -PLUGIN_REPO=https://github.com/facebook/facebook-clang-plugins -PLUGIN_DIR="$INFER_ROOT/../facebook-clang-plugin" -VERSION_FILE="$INFER_ROOT/dependencies/clang-plugin/clang-plugin-version.config" - -# check if the repo is already in place -if [ ! -e "$PLUGIN_DIR" ]; then - echo "$PLUGIN_DIR not found, cloning..." - git $GIT_OPTIONS clone $PLUGIN_REPO "$PLUGIN_DIR" -fi - -# update revision if needed -echo "Checking out the right version of the clang plugin..." -pushd $PLUGIN_DIR -git checkout master -git $GIT_OPTIONS pull -git checkout $(cat "$VERSION_FILE") -popd