diff --git a/JSCLegacyProfiler/Makefile b/JSCLegacyProfiler/Makefile index 015030735..921ea75be 100644 --- a/JSCLegacyProfiler/Makefile +++ b/JSCLegacyProfiler/Makefile @@ -1,6 +1,7 @@ HEADER_PATHS := `find download/JavaScriptCore -name '*.h' | xargs -I{} dirname {} | uniq | xargs -I{} echo "-I {}"` -SDK_PATH = /Applications/Xcode.app/Contents/Developer/Platforms/$1.platform/Developer/SDKs/$1.sdk +XCODE_PATH ?= $(shell xcode-select -p) +SDK_PATH = $(XCODE_PATH)/Platforms/$1.platform/Developer/SDKs/$1.sdk SDK_VERSION = $(shell plutil -convert json -o - $(call SDK_PATH,iPhoneOS)/SDKSettings.plist | awk -f parseSDKVersion.awk) @@ -19,13 +20,14 @@ SYSROOT = -isysroot $(call SDK_PATH,$${PLATFORM}) IOS8_LIBS = download/WebCore/WebCore-7600.1.25 download/WTF/WTF-7600.1.24 download/JavaScriptCore/JavaScriptCore-7600.1.17 download/JavaScriptCore/JavaScriptCore-7600.1.17/Bytecodes.h -ios8: RCTJSCProfiler.ios8.dylib /tmp/RCTJSCProfiler ifneq ($(SDK_VERSION), 8) +all: $(error "Expected to be compiled with iOS SDK version 8, found $(SDK_VERSION)") -else - cp $^ endif +ios8: RCTJSCProfiler.ios8.dylib /tmp/RCTJSCProfiler + cp $^ + /tmp/RCTJSCProfiler: mkdir -p $@ diff --git a/packager/packager.js b/packager/packager.js index 9f0fd6c14..fd040595d 100644 --- a/packager/packager.js +++ b/packager/packager.js @@ -233,14 +233,14 @@ function systraceProfileMiddleware(req, res, next) { childProcess.exec(cmd, function(error) { if (error) { if (error.code === 127) { - res.end( - '\n** Failed executing `' + cmd + '` **\n\n' + + var response = '\n** Failed executing `' + cmd + '` **\n\n' + 'Google trace-viewer is required to visualize the data, You can install it with `brew install trace2html`\n\n' + 'NOTE: Your profile data was kept at:\n' + dumpName - ); + console.log(response); + res.end(response); } else { console.error(error); - res.end('Unknown error %s', error.message); + res.end('Unknown error: ' + error.message); } return; } else { @@ -267,16 +267,16 @@ function cpuProfileMiddleware(req, res, next) { var dumpName = '/tmp/cpu-profile_' + Date.now(); fs.writeFileSync(dumpName + '.json', req.rawBody); - var cmd = path.join(__dirname, '..', 'JSCLegacyProfiler', 'json2trace') + ' -cpuprofiler ' + dumpName + '.cpuprofile ' + dumpName + '.json'; + var cmd = path.join(__dirname, '..', 'react-native-github', 'JSCLegacyProfiler', 'json2trace') + ' -cpuprofiler ' + dumpName + '.cpuprofile ' + dumpName + '.json'; childProcess.exec(cmd, function(error) { if (error) { console.error(error); - res.end('Unknown error: %s', error.message); + res.end('Unknown error: ' + error.message); } else { - res.end( - 'Your profile was generated at\n\n' + dumpName + '.cpuprofile\n\n' + - 'Open `Chrome Dev Tools > Profiles > Load` and select the profile to visualize it.' - ); + var response = 'Your profile was generated at\n\n' + dumpName + '.cpuprofile\n\n' + + 'Open `Chrome Dev Tools > Profiles > Load` and select the profile to visualize it.'; + console.log(response); + res.end(response); } }); }