From 428e2107bfa22497561a5d398e7f7e5cf7ad7b8c Mon Sep 17 00:00:00 2001 From: Suman Cherukuri Date: Thu, 25 Jan 2024 11:55:34 -0800 Subject: [PATCH] Fix release variant compile issues and disabled address sanitizer Release build was set build for mac. Changed it to iOS Address sanitizer was giving runtime crashes on iOS app. Disabled it --- ResearchKit.xcodeproj/project.pbxproj | 3 +- .../xcschemes/ResearchKit.xcscheme | 2 - build.sh | 168 ++++++++++++++++++ 3 files changed, 169 insertions(+), 4 deletions(-) create mode 100755 build.sh diff --git a/ResearchKit.xcodeproj/project.pbxproj b/ResearchKit.xcodeproj/project.pbxproj index 7544a7655..e1845ad63 100644 --- a/ResearchKit.xcodeproj/project.pbxproj +++ b/ResearchKit.xcodeproj/project.pbxproj @@ -225,7 +225,6 @@ 511B8AA8293A764900049947 /* ORKTouchAbilityTrial.m in Sources */ = {isa = PBXBuildFile; fileRef = 511B8AA6293A764900049947 /* ORKTouchAbilityTrial.m */; }; 511B8AAA293A766300049947 /* ORKTouchAbilityTrial_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 511B8AA9293A766300049947 /* ORKTouchAbilityTrial_Internal.h */; }; 511B8AAD293A767C00049947 /* ORKTouchAbilityTouchTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 511B8AAB293A767C00049947 /* ORKTouchAbilityTouchTracker.m */; }; - 511B8AAE293A767C00049947 /* ORKTouchAbilityTouchTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 511B8AAC293A767C00049947 /* ORKTouchAbilityTouchTracker.h */; }; 511B8AB1293A76A100049947 /* ORKTouchAbilityTapStep.m in Sources */ = {isa = PBXBuildFile; fileRef = 511B8AAF293A76A100049947 /* ORKTouchAbilityTapStep.m */; }; 511B8AB2293A76A100049947 /* ORKTouchAbilityTapStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 511B8AB0293A76A100049947 /* ORKTouchAbilityTapStep.h */; settings = {ATTRIBUTES = (Private, ); }; }; 511B8AB5293A76B200049947 /* ORKTouchAbilityTapStepViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 511B8AB3293A76B200049947 /* ORKTouchAbilityTapStepViewController.m */; }; @@ -5026,7 +5025,6 @@ 714151D0225C4A23002CA33B /* ORKPasscodeViewControllerTests.swift in Sources */, 0324C1D825439E1800BBE77B /* ORKVideoInstructionStepViewControllerTests.swift in Sources */, 14E79040226A5F72009D8083 /* ORKStepViewControllerHelpers.swift in Sources */, - 0BC803602B1578D500618E4F /* ORKTextChoiceAnswerFormat+FormStepViewControllerAdditions.m in Sources */, 86D348021AC161B0006DB02B /* ORKRecorderTests.m in Sources */, 1490DCFC224D4867003FEEDA /* ORKEnvironmentSPLMeterResultTests.swift in Sources */, 7141EA2222EFBC0C00650145 /* ORKLoggingTests.m in Sources */, @@ -5734,6 +5732,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.researchkit.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = ResearchKit; PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers"; + SDKROOT = iphoneos; SKIP_INSTALL = YES; STRINGS_FILE_OUTPUT_ENCODING = binary; SUPPORTS_MACCATALYST = NO; diff --git a/ResearchKit.xcodeproj/xcshareddata/xcschemes/ResearchKit.xcscheme b/ResearchKit.xcodeproj/xcshareddata/xcschemes/ResearchKit.xcscheme index 973fb3018..fbe0bc3c6 100644 --- a/ResearchKit.xcodeproj/xcshareddata/xcschemes/ResearchKit.xcscheme +++ b/ResearchKit.xcodeproj/xcshareddata/xcschemes/ResearchKit.xcscheme @@ -53,8 +53,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - enableAddressSanitizer = "YES" - enableUBSanitizer = "YES" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..17a028de7 --- /dev/null +++ b/build.sh @@ -0,0 +1,168 @@ +#!/bin/bash +BASE=`pwd` +DEST=out +VERSION=2.5.0 +BUILD="Release" +MACHO="Framework" + +usage() +{ +cat << EOF + +usage: $0 [options] + +This script builds Crony SDK for one or two Xcode versions + +options: + -h Show this message + -m Mach-O Type. [Static | Dynamic | Framework | All]. Defaults to Framework +EOF +exit -1; +} + +while getopts “hm:” OPTION +do + case $OPTION in + h) + usage + ;; + m) + MACHO=$OPTARG + ;; + esac +done + +rm -rf $DEST +rm -rf Build + +mkdir -p $DEST + +if ([[ -z "$EVAL" ]]); then + ZIPNAME=Crony$MACHO.zip +else + ZIPNAME=Crony$MACHO-Eval.zip +fi + +BUILD_OPTIONS="-configuration $BUILD UFW_OPEN_BUILD_DIR=False clean build DEPLOYMENT_POSTPROCESSING=YES" + +echo "Build Options: " $BUILD_OPTIONS + +XCODE_VERSION= +setXcodeVersion() { + XCODE_VERSION=`xcodebuild -version | sed "s/^.*Xcode \([^ ]*\).*/\1/"` + XCODE_VERSION=(${XCODE_VERSION}) + echo "Building with Xcode version: $XCODE_VERSION" +} + +doBuild() { + echo $1, $2 + FOLDER_NAME="" + if [ ! -z $4 ]; then + FOLDER_NAME="-$4" + fi + # echo "Cleaning" + # xcodebuild -target $1 clean + + rm -rf ./Build + + if [ "$2" == "iphonesimulator" ]; then + BUILD_OPTIONS=$BUILD_OPTIONS -destination='generic/platform=iOS\ Simulator' + echo $BUILD_OPTIONS + fi + + GCC="$GCC_PREPROCESSOR_DEFINITIONS $EVAL $APPSTORE_BUILD" + + # GCC=${GCC##*( )} + + echo -e "Build Crony" + echo -e "xcodebuild GCC_PREPROCESSOR_DEFINITIONS='$GCC' -target $1 -sdk $2 $BUILD_OPTIONS CONFIGURATION_BUILD_DIR=$BASE/Build/$3" + + xcodebuild -target $1 -sdk $2 $BUILD_OPTIONS GCC_PREPROCESSOR_DEFINITIONS="${GCC}" CONFIGURATION_BUILD_DIR=$BASE/Build/$3 + + mkdir -p $DEST/$3 + + if [[ "$MACHO" = "Framework" ]]; then + mv Build/$3/Crony.framework $DEST/$3 + fi + + if [[ "$MACHO" = "Dynamic" ]]; then + mv Build/$3/libCrony* $DEST/$3 + mkdir $DEST/$3/js + mkdir $DEST/$3/resources + cp Crony/Interceptor/BSCJSInterceptor.js $DEST/$3/js + cp Crony/Resources/* $DEST/$3/resources + fi + rm -rf ./Build +} + +if [[ -d "$PREV_XCODE_PATH" ]]; then + sudo xcode-select -switch "$PREV_XCODE_PATH" + + setXcodeVersion + + doBuild "CronySim" iphonesimulator CronySim $XCODE_VERSION + doBuild "Crony" iphoneos Crony $XCODE_VERSION + # doBuild "CronySimDylib" iphonesimulator CronySim $XCODE_VERSION + # doBuild "CronyDylib" iphoneos Crony $XCODE_VERSION + sudo xcode-select -switch "$ORG_XCODE_PATH" +fi + +if [[ -d "$XCODE_PATH" ]]; then + sudo xcode-select -switch "$XCODE_PATH" + setXcodeVersion + + doBuild "CronySim" iphonesimulator $XCODE_VERSION + doBuild "Crony" iphoneos $XCODE_VERSION + sudo xcode-select -switch "$ORG_XCODE_PATH" +else + setXcodeVersion + if [[ "$MACHO" = "Static" || "$MACHO" == "All" ]]; then + doBuild "CronySim" iphonesimulator libCronySim.a + doBuild "Crony" iphoneos libCrony.a + xcodebuild -create-xcframework -library $DEST/Crony/libCronySim.a -library $DEST/Crony/libCrony.a -output $DEST/Crony/Crony.xcframework + rm -rf $DEST/Crony/libCronySim.a + rm -rf $DEST/Crony/libCrony.a + fi + + if [[ "$MACHO" = "Dynamic" || "$MACHO" == "All" ]]; then + doBuild "CronySimDylib" iphonesimulator libCronySim.dylib + doBuild "CronyDylib" iphoneos libCrony.dylib + fi + + if [[ "$MACHO" = "Framework" || "$MACHO" == "All" ]]; then + doBuild "CronyFramework" iphonesimulator CronySim + doBuild "CronyFramework" iphoneos Crony + echo "xcodebuild -create-xcframework -framework $DEST/CronySim/Crony.framework -framework $DEST/Crony/Crony.framework -output $DEST/Crony/Crony.xcframework " + xcodebuild -create-xcframework -framework $DEST/CronySim/Crony.framework -framework $DEST/Crony/Crony.framework -output $DEST/Crony.xcframework + + rm -rf $DEST/Crony + rm -rf $DEST/CronySim + + mkdir $DEST/Crony + mv $DEST/Crony.xcframework $DEST/Crony + if [[ "$MACHO" = "Framework" ]]; then + mkdir $DEST/Crony/headers + mkdir $DEST/Crony/js + mkdir $DEST/Crony/resources + cp Crony/Interceptor/BSCJSInterceptor.js $DEST/Crony/js + cp Crony/Resources/* $DEST/Crony/resources + cp Crony/Sources/BSCrony.h $DEST/Crony/headers + fi + fi +fi + +cp LICENSE $DEST +cp README.md $DEST +cp COPYRIGHT.TXT $DEST +cd $BASE + +cd $DEST +touch VERSION-$VERSION +echo "Built with Xcode $XCODE_VERSION" >> VERSION-$VERSION +echo "Built on $(date)" >> VERSION-$VERSION + +zip -r -y $ZIPNAME * + +cd $BASE + +