From 472d6bffb306285a1b1a8c516a132c4bff8c555c Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Thu, 26 Sep 2024 03:04:02 -0700 Subject: [PATCH] fix: Resolve Xcode stale files warnings Closes GH-1372. --- lib/build.js | 2 +- templates/project/App.xcodeproj/project.pbxproj | 14 ++++++++++++++ tests/spec/unit/build.spec.js | 16 ++++++---------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/lib/build.js b/lib/build.js index 11a6df614..4458db1e2 100644 --- a/lib/build.js +++ b/lib/build.js @@ -376,7 +376,7 @@ function getXcodeBuildArgs (projectPath, configuration, emulatorTarget, buildCon } buildActions = ['build']; - settings = [`SYMROOT=${path.join(projectPath, 'build')}`]; + settings = []; if (customArgs.configuration_build_dir) { settings.push(customArgs.configuration_build_dir); diff --git a/templates/project/App.xcodeproj/project.pbxproj b/templates/project/App.xcodeproj/project.pbxproj index 13c3d643c..3dc0e9bc4 100755 --- a/templates/project/App.xcodeproj/project.pbxproj +++ b/templates/project/App.xcodeproj/project.pbxproj @@ -316,6 +316,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; + "DEPLOYMENT_LOCATION[sdk=iphonesimulator*]" = YES; + "DEPLOYMENT_LOCATION[sdk=xrsimulator*]" = YES; + "DEPLOYMENT_LOCATION[sdk=macosx*]" = YES; + DSTROOT = "$(SRCROOT)/build"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; @@ -333,6 +337,9 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + "INSTALL_PATH[sdk=iphonesimulator*]" = "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; + "INSTALL_PATH[sdk=xrsimulator*]" = "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; + "INSTALL_PATH[sdk=macosx*]" = "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; @@ -383,6 +390,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + "DEPLOYMENT_LOCATION[sdk=iphonesimulator*]" = YES; + "DEPLOYMENT_LOCATION[sdk=xrsimulator*]" = YES; + "DEPLOYMENT_LOCATION[sdk=macosx*]" = YES; + DSTROOT = "$(SRCROOT)/build"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; @@ -394,6 +405,9 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + "INSTALL_PATH[sdk=iphonesimulator*]" = "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; + "INSTALL_PATH[sdk=xrsimulator*]" = "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; + "INSTALL_PATH[sdk=macosx*]" = "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = NO; diff --git a/tests/spec/unit/build.spec.js b/tests/spec/unit/build.spec.js index 25dbbccf7..21fd9f61d 100644 --- a/tests/spec/unit/build.spec.js +++ b/tests/spec/unit/build.spec.js @@ -109,10 +109,9 @@ describe('build', () => { 'iphonesimulator', '-destination', 'platform=iOS Simulator,name=iPhone 5s', - 'build', - `SYMROOT=${path.join(testProjectPath, 'build')}` + 'build' ]); - expect(args.length).toEqual(12); + expect(args.length).toEqual(11); }); it('should generate appropriate args for simulator if buildFlags are passed in', () => { @@ -139,13 +138,12 @@ describe('build', () => { '-destination', 'TestDestinationFlag', 'build', - `SYMROOT=${path.join(testProjectPath, 'build')}`, 'CONFIGURATION_BUILD_DIR=TestConfigBuildDirFlag', 'SHARED_PRECOMPS_DIR=TestSharedPrecompsDirFlag', '-archivePath', 'TestArchivePathFlag' ]); - expect(args.length).toEqual(16); + expect(args.length).toEqual(15); }); it('should add matched flags that are not overriding for device', () => { @@ -186,11 +184,10 @@ describe('build', () => { '-destination', 'platform=iOS Simulator,name=iPhone 5s', 'build', - `SYMROOT=${path.join(testProjectPath, 'build')}`, '-archivePath', 'TestArchivePathFlag' ]); - expect(args.length).toEqual(14); + expect(args.length).toEqual(13); }); it('should generate appropriate args for automatic provisioning', () => { @@ -241,10 +238,9 @@ describe('build', () => { 'TestConfiguration', '-destination', 'generic/platform=macOS,variant=Mac Catalyst', - 'build', - `SYMROOT=${path.join(testProjectPath, 'build')}` + 'build' ]); - expect(args.length).toEqual(10); + expect(args.length).toEqual(9); }); });