Skip to content

Commit

Permalink
initial synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
Open Source Synchronization committed Jun 9, 2015
0 parents commit b898227
Show file tree
Hide file tree
Showing 1,017 changed files with 108,226 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

[alias]
endtoend_test_objc = //infer/tests/endtoend:objc_endtoend_tests
frontend_test_objc = //infer/tests/frontend:objc_frontend_tests

endtoend_test_java = //infer/tests/endtoend:java_endtoend_tests
endtoend_test_c = //infer/tests/endtoend:edgc_endtoend_tests

integration_tests = //infer/tests:integration_tests
objc = //infer/tests:objc_tests
c = //infer/tests:c_tests
cpp = //infer/tests:cpp_tests
objcpp = //infer/tests:objcpp_tests
clang = //infer/tests:clang_tests
java = //infer/tests/endtoend:java_endtoend_tests

java_libraries = //dependencies/java:java_libraries

infer = //infer/tests/endtoend/java/infer:infer
eradicate = //infer/tests/endtoend/java/eradicate:eradicate
checkers = //infer/tests/endtoend/java/checkers:checkers
tracing = //infer/tests/endtoend/java/tracing:tracing

[project]
ignore = .git, .ml, .mli
89 changes: 89 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Generated files #
###################
*.pyc
*.specs
*.cm*
*.o
*~
*.swp
*.annot
*.class
*.log
*.orig
*.rej

# Directories generated by Ocamlbuild
_build

# IntelliJ files
scripts/.idea/
infer/tests/.idea/dictionaries
infer/tests/.idea/inspectionProfiles
infer/tests/.idea/tasks.xml
infer/tests/.idea/uiDesigner.xml
infer/tests/.idea/workspace.xml
infer/tests/.idea/misc.xml
infer/tests/.idea/runConfigurations
infer/tests/.idea/copyright/profiles_settings.xml

# Eclipse settings file
.project
.cproject
.paths
.pydevproject
.settings/
.classpath

# Arcanist
/arcanist/.phutil_module_cache

# MacOS generated files
.DS_Store

# Directories and files generated by Infer
infer-out/
*.o.astlog
*.o.sh

# Directories generated by buck
buck-out/
.buckd/

#other
/infer/bin/InferAnalyze
/infer/bin/InferClang
/infer/bin/InferJava
/infer/bin/InferPrint
/infer/bin/Typeprop
/infer/src/backend/version.ml
infer/models/java/models/
infer/lib/java/models.jar
infer/models/java/bootclasspath
infer/lib/specs/c_models
infer/lib/specs/cpp_models
infer/lib/specs/objc_models
infer/lib/specs/clean_models
dependencies/clang-plugin/clang-plugin-version.done
include/
share/

#atdgen stubs
infer/src/backend/jsonbug_*

# intelliJ files
.idea
*.iml

/infer/src/backend/.projectSettings
infer/models/out/

/infer/_build-infer/

/infer/src/clang/clang_ast_j.ml
/infer/src/clang/clang_ast_j.mli
/infer/src/clang/clang_ast_proj.ml
/infer/src/clang/clang_ast_proj.mli
/infer/src/clang/clang_ast_t.ml
/infer/src/clang/clang_ast_t.mli

/infer/annotations/annotations.jar
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you have any questions, please drop us a line at [email protected]. Thanks!
134 changes: 134 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#Install Infer

We provide pre-built Infer binaries for Linux and MacOS.
If you just wish to use Infer, and are not interested in making contributions to it, then these binaries are all you need.
Otherwise, if you wish to compile Infer, here are also instructions to do so, depending on your operating system.

- [Install the Infer binaries](INSTALL.md#Install-the-Infer-binaries)
- [Mac OS X](INSTALL.md#Mac-OS-X)
- [Linux](INSTALL.md#Linux)
- [Install Infer from source](INSTALL.md#Install-Infer-from-source)
- [Download Infer](INSTALL.md#Download-Infer)
- [Mac OS X](INSTALL.md#Mac-OS-X)
- [Linux](INSTALL.md#Linux)

##Install the Infer binaries

###Mac OS X

Get the latest `infer-osx-vXX.tar.xz` from [infer releases](https://github.com/facebook/infer/releases) and run the commands below in your terminal to install Infer.

```bash
tar xf infer-osx-vXX.tar.xz
# this assumes you use bash, adapt to your needs in case you use
# another shell
echo "export PATH=$PATH:`pwd`/infer-osx/infer/infer/bin" \
>> ~/.bashrc && source ~/.bashrc
```

###Linux (64 bit)

Get the latest `infer-linux64-vXX.tar.xz` from [infer releases](https://github.com/facebook/infer/releases) and run the commands below in your terminal to install Infer.

```bash
tar xf infer-linux64-vXX.tar.xz
# this assumes you use bash, adapt to your needs in case you use
# another shell
echo "export PATH=$PATH:`pwd`/infer-0.1-x64-linux/infer/infer/bin" \
>> ~/.bashrc && source ~/.bashrc
```


##Install Infer from source

The following instructions describe how to compile Infer on different platforms.

###<a name="download"></a> Download the Infer repository

git clone https://github.com/facebook/infer.git

To analyse C and ObjC, Infer requires clang and the [facebook-clang-plugin](https://github.com/facebook/facebook-clang-plugins). If you wish to analyse only Java/Android code, then you could skip these dependencies. Details below.

###MacOS X

####Requirements

- `opam` (Instructions [here](https://opam.ocaml.org/doc/Install.html#OSX))

##### Requirements for Java analysis
- `Java <= 1.7`
- Android dev setup for analysis of Android apps.


##### Requirements for C/ObjC analysis
- `XCode <= 6.3, >= 6.1`
- `clang` (XCode command line tools. You can install them with the command `xcode-select --install`)


###Installation instructions

Install OCaml dependencies:
```bash
opam init --comp=4.01.0 # (answer 'y' to the question)
opam install sawja.1.5 atdgen.1.5.0 javalib.2.3 extlib.1.5.4
```

If you do not require support for the C/Objective C analysis in Infer, and only wish to analyse Java files, continue with these instructions. By the way, Java 1.8 is not supported.

```bash
cd infer
make -C infer java
export PATH=`pwd`/infer/bin:$PATH
```
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 :)
make -C infer
export PATH=`pwd`/infer/bin:$PATH
```

###Linux

These instructions were tested on Linux (64 Bit), on the following distributions: Debian 7, Ubuntu 14.04 and Ubuntu 12.04.4 LTS.

Install OCaml dependencies:
```bash
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git openjdk-7-jdk m4 zlib1g-dev python-software-properties build-essential libgmp-dev libmpfr-dev libmpc-dev unzip
wget https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux -O opam
chmod +x opam
./opam init --comp=4.01.0 #(then say 'y' to the final question)
eval `./opam config env`
./opam install sawja.1.5 atdgen.1.5.0 javalib.2.3 extlib.1.5.4 #(then say 'y' to the question)
```
​If you do not require support for the C/Objective C analysis in Infer, and only wish to analyse Java files, continue with these instructions. By the way, Java 1.8 is not supported.

```bash
cd infer
make -C infer java
export PATH=`pwd`/infer/bin:$PATH
```

To compile support for both Java and C/Objective C, do this instead. If your distribution is Ubuntu 12.04.4 LTS, you need to install `gcc 4.8` and `g++ 4.8` as well. Follow the following instructions to do that. You may skip this step in other distributions.

```bash
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
```

Then continue with:

```bash
cd infer
./update-fcp.sh
../facebook-clang-plugin/clang/setup.sh # go have a coffee :)
./compile-fcp.sh
make -C infer
export PATH=`pwd`/infer/bin:$PATH
```
30 changes: 30 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
BSD License

For Infer software

Copyright (c) 2013-, Facebook, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 changes: 33 additions & 0 deletions PATENTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Additional Grant of Patent Rights Version 2

"Software" means the Infer software distributed by Facebook, Inc.

Facebook, Inc. (“Facebook”) hereby grants to each recipient of the Software
(“you”) a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
(subject to the termination provision below) license under any Necessary
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
transfer the Software. For avoidance of doubt, no license is granted under
Facebook's rights in any patent claims that are infringed by (i) modifications
to the Software made by you or any third party or (ii) the Software in
combination with any software or other technology.

The license granted hereunder will terminate, automatically and without notice,
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
directly or indirectly, or take a direct financial interest in, any Patent
Assertion: (i) against Facebook or any of its subsidiaries or corporate
affiliates, (ii) against any party if such Patent Assertion arises in whole or
in part from any software, technology, product or service of Facebook or any of
its subsidiaries or corporate affiliates, or (iii) against any party relating
to the Software. Notwithstanding the foregoing, if Facebook or any of its
subsidiaries or corporate affiliates files a lawsuit alleging patent
infringement against you in the first instance, and you respond by filing a
patent infringement counterclaim in that lawsuit against that party that is
unrelated to the Software, the license granted hereunder will not terminate
under section (i) of this paragraph due to such counterclaim.

A "Necessary Claim" is a claim of a patent owned by Facebook that is
necessarily infringed by the Software standing alone.

A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
or contributory infringement or inducement to infringe any patent, including a
cross-claim or counterclaim.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Infer
=====

Infer is a static analysis tool for Java and C / Objective C.
To see what it can do for you, check out the documentation at <http://facebook.github.io/infer/>.

Installation
------------

Read the [INSTALL.md](INSTALL.md) file for details on installing Infer.

License
-------
Infer is BSD-licensed. We also provide an additional patent grant.

48 changes: 48 additions & 0 deletions compile-fcp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
set -e
set -x

# This script installs the facebook-clang-plugins
#
# TODO (t5939566): ADD INSTRUCTIONS ON HOW TO CUSTOMIZE THE ENVVARS FOR
# THE INSTALLATION OF THE PLUGINS.

INFER_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PLUGIN_DIR="$INFER_ROOT/../facebook-clang-plugin"
CLANG_EXEC="$PLUGIN_DIR/clang/bin/clang"

# check if clang is available
if ! $CLANG_EXEC --version 2>&1 | grep -q '3\.6'; then
echo "The required version of clang has not been found in $CLANG_EXEC" && exit 1
fi

# install facebook-clang-plugins
pushd "$PLUGIN_DIR"
# prepare flags for the compilation on the Linux platform
platform="$(uname)"
if [ "$platform" == 'Linux' ]; then
export SDKPATH=""
export PATH="$PLUGIN_DIR/clang/bin:$PATH"
[ -z "$CC" ] && export CC="$PLUGIN_DIR/clang/bin/clang"
[ -z "$CXX" ] && export CXX="$PLUGIN_DIR/clang/bin/clang++"
[ -z "$CFLAGS" ] && export CFLAGS="-std=c++11 -fPIC"
[ -z "$LDFLAGS" ] && export LDFLAGS="-shared"
[ -z "$CLANG_PREFIX" ] && export CLANG_PREFIX="$PLUGIN_DIR/clang"
[ -z "$LLVM_INCLUDES" ] && export LLVM_INCLUDES="$PLUGIN_DIR/clang/include"
[ -z "$CLANG_INCLUDES" ] && export CLANG_INCLUDES="$LLVM_INCLUDES $CLANG_PREFIX/include"
fi

# compile
make clean
make -C clang-ocaml clean
make
make -C clang-ocaml all build/clang_ast_proj.ml build/clang_ast_proj.mli
popd

# check YojsonASTExporter works with clang
echo "int main() { return 0; }" | \
$CLANG_EXEC -o /dev/null -x c \
-Xclang -load -Xclang $PLUGIN_DIR/libtooling/build/FacebookClangPlugin.dylib \
-Xclang -plugin -Xclang YojsonASTExporter -c - > /dev/null \
|| { echo "$CLANG_EXEC and the facebook-clang-plugins are not working.";
echo "Check you're using the right revision of clang, then retry"; exit 1; }
1 change: 1 addition & 0 deletions dependencies/clang-plugin/clang-plugin-version.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ab60f2578bf51a8b58afa63de7cee65d7ad891c9
Loading

0 comments on commit b898227

Please sign in to comment.