Skip to content
Browse files

xctool's build products should have a bin, lib, libexec dir structure.

This will give us something that looks like --

../xctool/bin/xctool
../xctool/lib/otest-shim-ios.dylib
../xctool/lib/otest-shim-osx.dylib
../xctool/lib/xcodebuild-fastsettings-shim.dylib
../xctool/lib/xcodebuild-shim.dylib
../xctool/libexec/mobile-installation-helper.app
../xctool/libexec/otest-query-ios
../xctool/libexec/otest-query-osx

This will make xctool play nicer with Homebrew.
  • Loading branch information...
1 parent 752da73 commit d6592a70196138805986e3dd883492303a0c4267 @fpotter fpotter committed
View
17 Configurations/Install.xcconfig
@@ -0,0 +1,17 @@
+// Command-line builds can override this to change the install path. By
+// default, we install to the same place Xcode would normally store build
+// products.
+XT_INSTALL_ROOT = $(BUILT_PRODUCTS_DIR)
+
+// The default DSTROOT is something like /tmp/blah.dst.
+DSTROOT = /
+
+// Final install path will be...
+// $(DSTROOT)$(XT_INSTALL_ROOT)/$(XT_INSTALL_DIR)
+INSTALL_PATH = $(XT_INSTALL_ROOT)/$(XT_INSTALL_DIR)
+
+// Setting to YES will cause every build to install.
+DEPLOYMENT_LOCATION = YES
+
+// We don't care to strip debug symbols in installed builds.
+COPY_PHASE_STRIP = NO
View
2 build_needed.sh
@@ -20,7 +20,7 @@ else
fi
BUILD_OUTPUT_DIR="$XCTOOL_DIR"/build/$REVISION
-XCTOOL_PATH="$BUILD_OUTPUT_DIR"/Products/Release/xctool
+XCTOOL_PATH="$BUILD_OUTPUT_DIR"/Products/Release/bin/xctool
if [[ -e "$XCTOOL_PATH" && $REVISION != "." && $HAS_GIT_CHANGES == "NO" && \
"$1" != "TEST_AFTER_BUILD=YES" ]];
View
3 mobile-installation-helper/mobile-installation-helper.xcconfig
@@ -16,6 +16,9 @@
#include "../Configurations/Project.xcconfig"
+#include "../Configurations/Install.xcconfig"
+XT_INSTALL_DIR = libexec
+
OTHER_LDFLAGS = -F$(SDKROOT)/System/Library/PrivateFrameworks -framework MobileInstallation
// Make sure the build products go to 'Debug' rather than 'Debug-iphonesimulator'
View
2 mobile-installation-helper/mobile-installation-helper.xcodeproj/project.pbxproj
@@ -159,7 +159,6 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -187,7 +186,6 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
View
4 otest-query/otest-query-ios.xcconfig
@@ -14,7 +14,11 @@
// limitations under the License.
//
+#include "../Configurations/Project.xcconfig"
#include "../Configurations/iOS-Simulator-Dylib.xcconfig"
+#include "../Configurations/Install.xcconfig"
+XT_INSTALL_DIR = libexec
+
OTHER_LDFLAGS = $(_IOS_SIMULATOR_LDFLAGS) -weak_framework SenTestingKit
View
5 otest-query/otest-query-osx.xcconfig
@@ -14,6 +14,11 @@
// limitations under the License.
//
+#include "../Configurations/Project.xcconfig"
+
+#include "../Configurations/Install.xcconfig"
+XT_INSTALL_DIR = libexec
+
MACOSX_DEPLOYMENT_TARGET = 10.7
// Needed so we can #import from SenTestingKit.
View
3 otest-query/otest-query.xcodeproj/project.pbxproj
@@ -239,7 +239,6 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -272,7 +271,6 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -323,6 +321,7 @@
CD666136175D1A890057DF4D /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
CD9048F91756C5B1006CF16D /* Build configuration list for PBXProject "otest-query" */ = {
isa = XCConfigurationList;
View
6 otest-shim/otest-shim-ios.xcconfig
@@ -14,4 +14,8 @@
// limitations under the License.
//
-#include "../Configurations/iOS-Simulator-Dylib.xcconfig"
+#include "../Configurations/Project.xcconfig"
+#include "../Configurations/iOS-Simulator-Dylib.xcconfig"
+
+#include "../Configurations/Install.xcconfig"
+XT_INSTALL_DIR = lib
View
5 otest-shim/otest-shim-osx.xcconfig
@@ -14,6 +14,11 @@
// limitations under the License.
//
+#include "../Configurations/Project.xcconfig"
+
+#include "../Configurations/Install.xcconfig"
+XT_INSTALL_DIR = lib
+
MACOSX_DEPLOYMENT_TARGET = 10.7
// Needed so we can #import from SenTestingKit.
View
2 otest-shim/otest-shim.xcodeproj/project.pbxproj
@@ -281,7 +281,6 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -309,7 +308,6 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
View
7 xcodebuild-shim/xcodebuild-shim.xcconfig
@@ -14,10 +14,15 @@
// limitations under the License.
//
+#include "../Configurations/Project.xcconfig"
+
+#include "../Configurations/Install.xcconfig"
+XT_INSTALL_DIR = lib
+
// xcodebuild uses GC, so we need this or we won't be able to insert the lib into xcodebuild.
// By setting the main value to 'unsupported' and then setting the arch-specific setting to
// 'supported', we're able to suppress Xcode's "Target Integrity" warning about GC being deprecated.
GCC_ENABLE_OBJC_GC = unsupported
GCC_ENABLE_OBJC_GC[arch=x86_64] = supported
-MACOSX_DEPLOYMENT_TARGET = 10.7
+MACOSX_DEPLOYMENT_TARGET = 10.7
View
2 xctool.sh
@@ -51,4 +51,4 @@ if [ "$TRAVIS" = "true" ]; then
stty columns 60
fi
-"$XCTOOL_DIR"/build/$REVISION/Products/Release/xctool "$@"
+"$XCTOOL_DIR"/build/$REVISION/Products/Release/bin/xctool "$@"
View
3 xctool.xcworkspace/contents.xcworkspacedata
@@ -35,5 +35,8 @@
<FileRef
location = "group:Project.xcconfig">
</FileRef>
+ <FileRef
+ location = "group:Install.xcconfig">
+ </FileRef>
</Group>
</Workspace>
View
3 xctool/xctool.xcconfig
@@ -16,6 +16,9 @@
#include "../Configurations/Project.xcconfig"
+#include "../Configurations/Install.xcconfig"
+XT_INSTALL_DIR = bin
+
DEVELOPER_PRIVATE_FRAMEWORK_DIR = "$(DEVELOPER_DIR)"/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks
OTHER_LDFLAGS = -framework AppKit -F$(DEVELOPER_PRIVATE_FRAMEWORK_DIR) -framework iPhoneSimulatorRemoteClient -Wl,-rpath -Wl,$(DEVELOPER_PRIVATE_FRAMEWORK_DIR) -Wl,-rpath -Wl,"$(DEVELOPER_DIR)"/../OtherFrameworks
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks" "$(SRCROOT)/../Vendor"
View
5 xctool/xctool.xcodeproj/project.pbxproj
@@ -761,7 +761,7 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -793,7 +793,6 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -835,6 +834,7 @@
GCC_PREFIX_HEADER = "xctool-tests/xctool-tests-Prefix.pch";
INFOPLIST_FILE = "xctool-tests/xctool-tests-Info.plist";
PRODUCT_NAME = "xctool-tests";
+ SKIP_INSTALL = YES;
WRAPPER_EXTENSION = octest;
};
name = Debug;
@@ -851,6 +851,7 @@
GCC_PREFIX_HEADER = "xctool-tests/xctool-tests-Prefix.pch";
INFOPLIST_FILE = "xctool-tests/xctool-tests-Info.plist";
PRODUCT_NAME = "xctool-tests";
+ SKIP_INSTALL = YES;
WRAPPER_EXTENSION = octest;
};
name = Release;
View
9 xctool/xctool.xcodeproj/xcshareddata/xcschemes/xctool.xcscheme
@@ -161,6 +161,15 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "283CCA4116C2EA3700F2E343"
+ BuildableName = "xctool"
+ BlueprintName = "xctool"
+ ReferencedContainer = "container:xctool.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
View
4 xctool/xctool/OCUnitIOSAppTestRunner.m
@@ -132,7 +132,7 @@ - (DTiPhoneSimulatorSessionConfig *)sessionConfigForRunningTestsWithEnvironment:
@"DYLD_FRAMEWORK_PATH" : _buildSettings[@"TARGET_BUILD_DIR"],
@"DYLD_LIBRARY_PATH" : _buildSettings[@"TARGET_BUILD_DIR"],
@"DYLD_INSERT_LIBRARIES" : [@[
- [PathToXCToolBinaries() stringByAppendingPathComponent:@"otest-shim-ios.dylib"],
+ [XCToolLibPath() stringByAppendingPathComponent:@"otest-shim-ios.dylib"],
ideBundleInjectionLibPath,
] componentsJoinedByString:@":"],
@"DYLD_ROOT_PATH" : _buildSettings[@"SDKROOT"],
@@ -158,7 +158,7 @@ - (BOOL)runMobileInstallationHelperWithArguments:(NSArray *)arguments
withString:@""];
DTiPhoneSimulatorSystemRoot *systemRoot = [DTiPhoneSimulatorSystemRoot rootWithSDKVersion:sdkVersion];
DTiPhoneSimulatorApplicationSpecifier *appSpec = [DTiPhoneSimulatorApplicationSpecifier specifierWithApplicationPath:
- [PathToXCToolBinaries() stringByAppendingPathComponent:@"mobile-installation-helper.app"]];
+ [XCToolLibExecPath() stringByAppendingPathComponent:@"mobile-installation-helper.app"]];
DTiPhoneSimulatorSessionConfig *sessionConfig = [[[DTiPhoneSimulatorSessionConfig alloc] init] autorelease];
[sessionConfig setApplicationToSimulateOnStart:appSpec];
[sessionConfig setSimulatedSystemRoot:systemRoot];
View
4 xctool/xctool/OCUnitIOSLogicTestRunner.m
@@ -44,7 +44,7 @@ - (NSTask *)otestTaskWithTestBundle:(NSString *)testBundlePath
[task setLaunchPath:[NSString stringWithFormat:@"%@/Developer/usr/bin/otest", _buildSettings[@"SDKROOT"]]];
[task setArguments:[[self otestArguments] arrayByAddingObject:testBundlePath]];
NSMutableDictionary *env = [[self.environmentOverrides mutableCopy] autorelease];
- env[@"DYLD_INSERT_LIBRARIES"] = [PathToXCToolBinaries() stringByAppendingPathComponent:@"otest-shim-ios.dylib"];
+ env[@"DYLD_INSERT_LIBRARIES"] = [XCToolLibPath() stringByAppendingPathComponent:@"otest-shim-ios.dylib"];
[task setEnvironment:[self otestEnvironmentWithOverrides:env]];
return task;
}
@@ -82,7 +82,7 @@ - (BOOL)runTestsAndFeedOutputTo:(void (^)(NSString *))outputLineBlock
- (NSArray *)runTestClassListQuery
{
NSTask *task = [[NSTask alloc] init];
- [task setLaunchPath:[PathToXCToolBinaries() stringByAppendingPathComponent:@"otest-query-ios"]];
+ [task setLaunchPath:[XCToolLibExecPath() stringByAppendingPathComponent:@"otest-query-ios"]];
[task setArguments:@[self.testBundlePath]];
[task setEnvironment:[self otestEnvironmentWithOverrides:self.environmentOverrides]];
NSDictionary *output = LaunchTaskAndCaptureOutput(task);
View
2 xctool/xctool/OCUnitOSXAppTestRunner.m
@@ -32,7 +32,7 @@ - (BOOL)runTestsAndFeedOutputTo:(void (^)(NSString *))outputLineBlock
NSString *testHostPath = _buildSettings[@"TEST_HOST"];
- NSArray *libraries = @[[PathToXCToolBinaries() stringByAppendingPathComponent:@"otest-shim-osx.dylib"],
+ NSArray *libraries = @[[XCToolLibPath() stringByAppendingPathComponent:@"otest-shim-osx.dylib"],
[XcodeDeveloperDirPath() stringByAppendingPathComponent:@"Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection"],
];
View
4 xctool/xctool/OCUnitOSXLogicTestRunner.m
@@ -39,7 +39,7 @@ - (NSTask *)otestTaskWithTestBundle:(NSString *)testBundlePath
// When invoking otest directly, the last arg needs to be the the test bundle.
[task setArguments:[[self otestArguments] arrayByAddingObject:testBundlePath]];
NSMutableDictionary *env = [[self.environmentOverrides mutableCopy] autorelease];
- env[@"DYLD_INSERT_LIBRARIES"] = [PathToXCToolBinaries() stringByAppendingPathComponent:@"otest-shim-osx.dylib"];
+ env[@"DYLD_INSERT_LIBRARIES"] = [XCToolLibPath() stringByAppendingPathComponent:@"otest-shim-osx.dylib"];
[task setEnvironment:[self otestEnvironmentWithOverrides:env]];
return task;
}
@@ -79,7 +79,7 @@ - (BOOL)runTestsAndFeedOutputTo:(void (^)(NSString *))outputLineBlock
- (NSArray *)runTestClassListQuery
{
NSTask *task = [[NSTask alloc] init];
- [task setLaunchPath:[PathToXCToolBinaries() stringByAppendingPathComponent:@"otest-query-osx"]];
+ [task setLaunchPath:[XCToolLibExecPath() stringByAppendingPathComponent:@"otest-query-osx"]];
[task setArguments:@[self.testBundlePath]];
[task setEnvironment:[self otestEnvironmentWithOverrides:self.environmentOverrides]];
NSDictionary *output = LaunchTaskAndCaptureOutput(task);
View
2 xctool/xctool/RunTestsAction.m
@@ -341,7 +341,7 @@ - (NSArray *)executionsForTestable:(NSDictionary *)testable
]]];
[settingsTask setEnvironment:@{
- @"DYLD_INSERT_LIBRARIES" : [PathToXCToolBinaries() stringByAppendingPathComponent:@"xcodebuild-fastsettings-shim.dylib"],
+ @"DYLD_INSERT_LIBRARIES" : [XCToolLibPath() stringByAppendingPathComponent:@"xcodebuild-fastsettings-shim.dylib"],
@"SHOW_ONLY_BUILD_SETTINGS_FOR_TARGET" : testableTarget,
}];
View
4 xctool/xctool/XCToolUtil.h
@@ -17,8 +17,8 @@
#import <Foundation/Foundation.h>
NSDictionary *BuildSettingsFromOutput(NSString *output);
-NSString *AbsoluteExecutablePath(void);
-NSString *PathToXCToolBinaries(void);
+NSString *XCToolLibPath(void);
+NSString *XCToolLibExecPath(void);
NSString *XcodeDeveloperDirPath(void);
NSString *MakeTempFileWithPrefix(NSString *prefix);
NSDictionary *GetAvailableSDKsAndAliases();
View
30 xctool/xctool/XCToolUtil.m
@@ -88,28 +88,22 @@
return settings;
}
-NSString *AbsoluteExecutablePath(void)
-{
- char execRelativePath[1024] = {0};
- uint32_t execRelativePathSize = sizeof(execRelativePath);
-
- _NSGetExecutablePath(execRelativePath, &execRelativePathSize);
+const char *_CFProcessPath(void);
- char execAbsolutePath[1024] = {0};
- assert(realpath((const char *)execRelativePath, execAbsolutePath) != NULL);
+NSString *XCToolBasePath(void)
+{
+ return [[[NSString stringWithUTF8String:_CFProcessPath()]
+ stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
+}
- return [NSString stringWithUTF8String:execAbsolutePath];
+NSString *XCToolLibPath(void)
+{
+ return [XCToolBasePath() stringByAppendingPathComponent:@"lib"];
}
-NSString *PathToXCToolBinaries(void)
+NSString *XCToolLibExecPath(void)
{
- if (IsRunningUnderTest()) {
- // We're running in the test harness. Turns out DYLD_LIBRARY_PATH contains the path our
- // build products.
- return [NSProcessInfo processInfo].environment[@"DYLD_LIBRARY_PATH"];
- } else {
- return [AbsoluteExecutablePath() stringByDeletingLastPathComponent];
- }
+ return [XCToolBasePath() stringByAppendingPathComponent:@"libexec"];
}
NSString *XcodeDeveloperDirPath(void)
@@ -279,7 +273,7 @@ BOOL RunXcodebuildAndFeedEventsToReporters(NSArray *arguments,
[NSMutableDictionary dictionaryWithDictionary:
[[NSProcessInfo processInfo] environment]];
[environment addEntriesFromDictionary:@{
- @"DYLD_INSERT_LIBRARIES" : [PathToXCToolBinaries()
+ @"DYLD_INSERT_LIBRARIES" : [XCToolLibPath()
stringByAppendingPathComponent:@"xcodebuild-shim.dylib"],
@"PATH": @"/usr/bin:/bin:/usr/sbin:/sbin",
}];
View
2 xctool/xctool/XcodeSubjectInfo.m
@@ -756,7 +756,7 @@ - (NSDictionary *)buildSettingsForFirstBuildable
[self.subjectXcodeBuildArguments arrayByAddingObject:@"-showBuildSettings"]];
[task setEnvironment:@{
@"DYLD_INSERT_LIBRARIES" :
- [PathToXCToolBinaries() stringByAppendingPathComponent:
+ [XCToolLibPath() stringByAppendingPathComponent:
@"xcodebuild-fastsettings-shim.dylib"],
@"SHOW_ONLY_BUILD_SETTINGS_FOR_FIRST_BUILDABLE" : @"YES"
}];

0 comments on commit d6592a7

Please sign in to comment.
Something went wrong with that request. Please try again.