diff --git a/.gitignore b/.gitignore index 6fa89cbd3..87eb18cd4 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,8 @@ duplicates.txt /infer/tests/build_systems/codetoanalyze/path with spaces/ /infer/tests/build_systems/clang_compilation_db_escaped/compile_commands.json /infer/tests/build_systems/clang_compilation_db_relpath/compile_commands.json +/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/app_built +/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/build/ # generated by oUnit /oUnit-all.cache diff --git a/Makefile b/Makefile index 2dcdf5fa0..a7ab9b8bf 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,13 @@ endif ifneq ($(PYTHON_lxml),no) BUILD_SYSTEMS_TESTS += results_xml endif +ifneq ($(XCODE_SELECT),no) +BUILD_SYSTEMS_TESTS += xcodebuild_no_xcpretty +ifneq ($(XCPRETTY),no) +BUILD_SYSTEMS_TESTS += xcodebuild endif +endif # XCODE_SELECT +endif # BUILD_C_ANALYZERS ifeq ($(BUILD_JAVA_ANALYZERS),yes) BUILD_SYSTEMS_TESTS += gradle javac diff --git a/Makefile.autoconf.in b/Makefile.autoconf.in index 78bd5e8aa..8b7a725ef 100644 --- a/Makefile.autoconf.in +++ b/Makefile.autoconf.in @@ -47,6 +47,7 @@ prefix = @prefix@ PYTHON_lxml = @PYTHON_lxml@ USER_JAVA_HOME = @USER_JAVA_HOME@ XCODE_SELECT = @XCODE_SELECT@ +XCPRETTY = @XCPRETTY@ ifneq (,$(findstring s,$(MAKEFLAGS))) # quiet mode diff --git a/configure.ac b/configure.ac index 1ca49cc49..f0c0dc9e6 100644 --- a/configure.ac +++ b/configure.ac @@ -287,6 +287,8 @@ fi AC_CHECK_PYTHON_MODULE([$PYTHON27], [lxml]) +AC_CHECK_TOOL([XCPRETTY], [xcpretty], [no]) + BREW=no if which brew > /dev/null; then BREW="$(which brew)" diff --git a/infer/src/integration/CaptureCompilationDatabase.ml b/infer/src/integration/CaptureCompilationDatabase.ml index 12d5de51c..7556e2086 100644 --- a/infer/src/integration/CaptureCompilationDatabase.ml +++ b/infer/src/integration/CaptureCompilationDatabase.ml @@ -131,10 +131,13 @@ let get_compilation_database_files_xcodebuild () = let tmp_file = Filename.temp_file ~in_dir:temp_dir "cdb" ".json" in let xcodebuild_prog, xcodebuild_args = match prog_args with - | prog :: args -> (prog, args) + | prog :: _ -> (prog, prog_args) | [] -> failwith("Build command cannot be empty") in let xcpretty_prog = "xcpretty" in - let xcpretty_args = ["--report"; "json-compilation-database"; "--output"; tmp_file] in + let xcpretty_args = + [xcpretty_prog; "--report"; "json-compilation-database"; "--output"; tmp_file] in + Logging.out "Running %s | %s\n@." (List.to_string ~f:Fn.id xcodebuild_args) + (List.to_string ~f:Fn.id xcpretty_args); let producer_status, consumer_status = Process.pipeline ~producer_prog:xcodebuild_prog ~producer_args:xcodebuild_args diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app.xcodeproj/project.pbxproj b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app.xcodeproj/project.pbxproj new file mode 100644 index 000000000..1b59623d3 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app.xcodeproj/project.pbxproj @@ -0,0 +1,317 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 12F7B08F1E55D859003D899E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 12F7B08E1E55D859003D899E /* main.m */; }; + 12F7B0921E55D859003D899E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 12F7B0911E55D859003D899E /* AppDelegate.m */; }; + 12F7B0951E55D859003D899E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 12F7B0941E55D859003D899E /* ViewController.m */; }; + 12F7B0981E55D859003D899E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12F7B0961E55D859003D899E /* Main.storyboard */; }; + 12F7B09A1E55D859003D899E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 12F7B0991E55D859003D899E /* Assets.xcassets */; }; + 12F7B09D1E55D859003D899E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 12F7B09B1E55D859003D899E /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 12F7B08A1E55D859003D899E /* simple_app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = simple_app.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 12F7B08E1E55D859003D899E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 12F7B0901E55D859003D899E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 12F7B0911E55D859003D899E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 12F7B0931E55D859003D899E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 12F7B0941E55D859003D899E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 12F7B0971E55D859003D899E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 12F7B0991E55D859003D899E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 12F7B09C1E55D859003D899E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 12F7B09E1E55D859003D899E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 12F7B0871E55D858003D899E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 12F7B0811E55D858003D899E = { + isa = PBXGroup; + children = ( + 12F7B08C1E55D859003D899E /* simple_app */, + 12F7B08B1E55D859003D899E /* Products */, + ); + sourceTree = ""; + }; + 12F7B08B1E55D859003D899E /* Products */ = { + isa = PBXGroup; + children = ( + 12F7B08A1E55D859003D899E /* simple_app.app */, + ); + name = Products; + sourceTree = ""; + }; + 12F7B08C1E55D859003D899E /* simple_app */ = { + isa = PBXGroup; + children = ( + 12F7B0901E55D859003D899E /* AppDelegate.h */, + 12F7B0911E55D859003D899E /* AppDelegate.m */, + 12F7B0931E55D859003D899E /* ViewController.h */, + 12F7B0941E55D859003D899E /* ViewController.m */, + 12F7B0961E55D859003D899E /* Main.storyboard */, + 12F7B0991E55D859003D899E /* Assets.xcassets */, + 12F7B09B1E55D859003D899E /* LaunchScreen.storyboard */, + 12F7B09E1E55D859003D899E /* Info.plist */, + 12F7B08D1E55D859003D899E /* Supporting Files */, + ); + path = simple_app; + sourceTree = ""; + }; + 12F7B08D1E55D859003D899E /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 12F7B08E1E55D859003D899E /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 12F7B0891E55D858003D899E /* simple_app */ = { + isa = PBXNativeTarget; + buildConfigurationList = 12F7B0A11E55D859003D899E /* Build configuration list for PBXNativeTarget "simple_app" */; + buildPhases = ( + 12F7B0861E55D858003D899E /* Sources */, + 12F7B0871E55D858003D899E /* Frameworks */, + 12F7B0881E55D858003D899E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = simple_app; + productName = simple_app; + productReference = 12F7B08A1E55D859003D899E /* simple_app.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 12F7B0821E55D858003D899E /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0810; + ORGANIZATIONNAME = "Dulma Churchill"; + TargetAttributes = { + 12F7B0891E55D858003D899E = { + CreatedOnToolsVersion = 8.1; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 12F7B0851E55D858003D899E /* Build configuration list for PBXProject "simple_app" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 12F7B0811E55D858003D899E; + productRefGroup = 12F7B08B1E55D859003D899E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 12F7B0891E55D858003D899E /* simple_app */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 12F7B0881E55D858003D899E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 12F7B09D1E55D859003D899E /* LaunchScreen.storyboard in Resources */, + 12F7B09A1E55D859003D899E /* Assets.xcassets in Resources */, + 12F7B0981E55D859003D899E /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 12F7B0861E55D858003D899E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 12F7B0951E55D859003D899E /* ViewController.m in Sources */, + 12F7B0921E55D859003D899E /* AppDelegate.m in Sources */, + 12F7B08F1E55D859003D899E /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 12F7B0961E55D859003D899E /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 12F7B0971E55D859003D899E /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 12F7B09B1E55D859003D899E /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 12F7B09C1E55D859003D899E /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 12F7B09F1E55D859003D899E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 12F7B0A01E55D859003D899E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 10.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 12F7B0A21E55D859003D899E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = simple_app/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Facebook.simple-app"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 12F7B0A31E55D859003D899E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = simple_app/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Facebook.simple-app"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 12F7B0851E55D858003D899E /* Build configuration list for PBXProject "simple_app" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 12F7B09F1E55D859003D899E /* Debug */, + 12F7B0A01E55D859003D899E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 12F7B0A11E55D859003D899E /* Build configuration list for PBXNativeTarget "simple_app" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 12F7B0A21E55D859003D899E /* Debug */, + 12F7B0A31E55D859003D899E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 12F7B0821E55D858003D899E /* Project object */; +} diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/AppDelegate.h b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/AppDelegate.h new file mode 100644 index 000000000..09e36093f --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/AppDelegate.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2017 - 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. + */ +#import + +@interface AppDelegate : UIResponder + +@property(strong, nonatomic) UIWindow* window; + +@end diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/AppDelegate.m b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/AppDelegate.m new file mode 100644 index 000000000..ae159ca92 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/AppDelegate.m @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2017 - 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. + */ +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +int f() { + int* p = 0; + return *p; +} + +@implementation AppDelegate + +- (BOOL)application:(UIApplication*)application + didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { + f(); + return YES; +} + +- (void)applicationWillResignActive:(UIApplication*)application { +} + +- (void)applicationDidEnterBackground:(UIApplication*)application { +} + +- (void)applicationWillEnterForeground:(UIApplication*)application { +} + +- (void)applicationDidBecomeActive:(UIApplication*)application { +} + +- (void)applicationWillTerminate:(UIApplication*)application { +} + +@end diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Assets.xcassets/AppIcon.appiconset/Contents.json b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..118c98f74 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Base.lproj/LaunchScreen.storyboard b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..fdf3f97d1 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Base.lproj/Main.storyboard b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Base.lproj/Main.storyboard new file mode 100644 index 000000000..4529698c4 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Info.plist b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Info.plist new file mode 100644 index 000000000..38e98af23 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/ViewController.h b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/ViewController.h new file mode 100644 index 000000000..bdd1b3f2f --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/ViewController.h @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2017 - 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. + */ +#import + +@interface ViewController : UIViewController + +@end diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/ViewController.m b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/ViewController.m new file mode 100644 index 000000000..337d281ec --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/ViewController.m @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017 - 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. + */ +#import "ViewController.h" + +#import "AppDelegate.h" + +@interface ViewController () + +@property AppDelegate* delegate; + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; +} + +@end diff --git a/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/main.m b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/main.m new file mode 100644 index 000000000..da884b56c --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/xcodebuild/simple_app/simple_app/main.m @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2017 - 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. + */ +#import +#import "AppDelegate.h" + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain( + argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/infer/tests/build_systems/xcodebuild/Makefile b/infer/tests/build_systems/xcodebuild/Makefile new file mode 100644 index 000000000..6384c1645 --- /dev/null +++ b/infer/tests/build_systems/xcodebuild/Makefile @@ -0,0 +1,34 @@ +# Copyright (c) 2016 - 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. + +TESTS_DIR = ../.. + +ANALYZER = infer +APP_DIR = ../codetoanalyze/xcodebuild/simple_app +SOURCES = $(wildcard $(APP_DIR)/simple_app/*.m) +OBJECTS = $(APP_DIR)/app_built +INFERPRINT_OPTIONS = --issues-tests + +include $(TESTS_DIR)/base.make + +XCODEBUILD = xcodebuild -verbose -target simple_app -configuration Release -sdk iphonesimulator + +$(OBJECTS): $(SOURCES) + cd $(APP_DIR) && \ + $(XCODEBUILD) && \ + touch app_built + +infer-out/report.json: $(CLANG_DEPS) $(SOURCES) + cd $(APP_DIR) && \ + $(XCODEBUILD) clean && \ + $(call silent_on_success,\ + $(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) --project-root $(TESTS_DIR) --results-dir $(CURDIR)/$(@D) -- $(XCODEBUILD)) + +clean: + cd $(APP_DIR) && \ + $(XCODEBUILD) clean + $(REMOVE_DIR) infer-out issues.exp.test diff --git a/infer/tests/build_systems/xcodebuild/issues.exp b/infer/tests/build_systems/xcodebuild/issues.exp new file mode 100644 index 000000000..0d66d8144 --- /dev/null +++ b/infer/tests/build_systems/xcodebuild/issues.exp @@ -0,0 +1 @@ +xcodebuild/simple_app/simple_app/AppDelegate.m, f, 2, NULL_DEREFERENCE, [start of procedure f()] diff --git a/infer/tests/build_systems/xcodebuild_no_xcpretty/Makefile b/infer/tests/build_systems/xcodebuild_no_xcpretty/Makefile new file mode 100644 index 000000000..e5744668f --- /dev/null +++ b/infer/tests/build_systems/xcodebuild_no_xcpretty/Makefile @@ -0,0 +1,11 @@ +# Copyright (c) 2016 - 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. + +include ../xcodebuild/Makefile + +ANALYZER = linters +INFER_OPTIONS = --no-xcpretty diff --git a/infer/tests/build_systems/xcodebuild_no_xcpretty/issues.exp b/infer/tests/build_systems/xcodebuild_no_xcpretty/issues.exp new file mode 100644 index 000000000..a1c6a131b --- /dev/null +++ b/infer/tests/build_systems/xcodebuild_no_xcpretty/issues.exp @@ -0,0 +1 @@ +xcodebuild/simple_app/simple_app/ViewController.m, Linters_dummy_method, 15, STRONG_DELEGATE_WARNING, []