Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior when project has multiple targets (e.g. today extension) #63

Open
l3ender opened this issue Jun 11, 2019 · 2 comments · May be fixed by #64
Open

Unexpected behavior when project has multiple targets (e.g. today extension) #63

l3ender opened this issue Jun 11, 2019 · 2 comments · May be fixed by #64

Comments

@l3ender
Copy link

l3ender commented Jun 11, 2019

I am integrating a "today extension" into our app, and I noticed some funky behavior with the Swift version not being set correctly by this plugin.

I believe this is because this plugin is treating build names (e.g. Debug, Release) as unique. However, in the scenario where a project has multiple targets, there can be multiple Debug/Release sections in the build target section. This plugin uses xcodeProject.getBuildProperty which will use the last reference found for a given build name.

The result is that Swift version will not get set properly on all targets if the last build section already has it set. Example section below shows the last 2 sections already have SWIFT_VERSION set (these are for the today extension). When this plugin runs it will not add SWIFT_VERSION for the other build sections (they are initially unset and remain unset).

/* Begin XCBuildConfiguration section */
		1D6058940D05DD3E006BFB54 /* Debug */ = {
			isa = XCBuildConfiguration;
			baseConfigurationReference = 3047A50F1AB8059700498E2A /* build-debug.xcconfig */;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				COPY_PHASE_STRIP = NO;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PRECOMPILE_PREFIX_HEADER = YES;
				GCC_PREFIX_HEADER = "myapp/myapp-Prefix.pch";
				GCC_THUMB_SUPPORT = NO;
				GCC_VERSION = "";
				INFOPLIST_FILE = "myapp/myapp-Info.plist";
				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
				LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = org.myapp.olbmobile;
				PRODUCT_NAME = "$(TARGET_NAME)";
				TARGETED_DEVICE_FAMILY = "1,2";
				FRAMEWORK_SEARCH_PATHS = (
					"$(inherited)",
					"\"myapp/Plugins/cordova-plugin-myapp-native\"",
					"\"myapp/Plugins/cordova-plugin-myapp-native\"",
					"\"myapp/Plugins/cordova-plugin-myapp-native\"",
					"\"/Users/ross/repos/olb-mobile/projects/native/src/ios\"",
					"\"/Users/ross/repos/olb-mobile/projects/native/src/ios\"",
				);
				SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h";
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
			};
			name = Debug;
		};
		1D6058950D05DD3E006BFB54 /* Release */ = {
			isa = XCBuildConfiguration;
			baseConfigurationReference = 3047A5101AB8059700498E2A /* build-release.xcconfig */;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				COPY_PHASE_STRIP = YES;
				GCC_PRECOMPILE_PREFIX_HEADER = YES;
				GCC_PREFIX_HEADER = "myapp/myapp-Prefix.pch";
				GCC_THUMB_SUPPORT = NO;
				GCC_VERSION = "";
				INFOPLIST_FILE = "myapp/myapp-Info.plist";
				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
				LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
				PRODUCT_BUNDLE_IDENTIFIER = org.myapp.olbmobile;
				PRODUCT_NAME = "$(TARGET_NAME)";
				TARGETED_DEVICE_FAMILY = "1,2";
				FRAMEWORK_SEARCH_PATHS = (
					"$(inherited)",
					"\"myapp/Plugins/cordova-plugin-myapp-native\"",
					"\"myapp/Plugins/cordova-plugin-myapp-native\"",
					"\"myapp/Plugins/cordova-plugin-myapp-native\"",
					"\"/Users/ross/repos/olb-mobile/projects/native/src/ios\"",
					"\"/Users/ross/repos/olb-mobile/projects/native/src/ios\"",
				);
				SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h";
			};
			name = Release;
		};
		C01FCF4F08A954540054247B /* Debug */ = {
			isa = XCBuildConfiguration;
			baseConfigurationReference = 3047A5111AB8059700498E2A /* build.xcconfig */;
			buildSettings = {
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_COMMA = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
				CLANG_WARN_STRICT_PROTOTYPES = YES;
				CLANG_WARN_SUSPICIOUS_MOVE = YES;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				ENABLE_TESTABILITY = YES;
				GCC_C_LANGUAGE_STANDARD = c99;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_THUMB_SUPPORT = NO;
				GCC_VERSION = "";
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = iphoneos;
				SKIP_INSTALL = NO;
				PRODUCT_BUNDLE_IDENTIFIER = org.myapp.olbmobile;
				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
				SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h";
				LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
			};
			name = Debug;
		};
		C01FCF5008A954540054247B /* Release */ = {
			isa = XCBuildConfiguration;
			baseConfigurationReference = 3047A5111AB8059700498E2A /* build.xcconfig */;
			buildSettings = {
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_COMMA = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
				CLANG_WARN_STRICT_PROTOTYPES = YES;
				CLANG_WARN_SUSPICIOUS_MOVE = YES;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = c99;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_THUMB_SUPPORT = NO;
				GCC_VERSION = "";
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				SDKROOT = iphoneos;
				SKIP_INSTALL = NO;
				PRODUCT_BUNDLE_IDENTIFIER = org.myapp.olbmobile;
				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
				SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h";
				LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
			};
			name = Release;
		};
		839C5745AB5944A89304F2BB /* Debug */ = {
			name = Debug;
			isa = XCBuildConfiguration;
			buildSettings = {
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				INFOPLIST_FILE = "todayextension/todayextension-Info.plist";
				LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
				PRODUCT_NAME = "todayextension";
				SKIP_INSTALL = YES;
				CODE_SIGN_ENTITLEMENTS = "/Users/ross/repos/olb-mobile/platforms/ios/todayextension/Entitlements/OLBTodayExtension.entitlements";
				SWIFT_VERSION = 5.0;
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h";
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
			};
		};
		5D66FE42698A44DA975E98D6 /* Release */ = {
			name = Release;
			isa = XCBuildConfiguration;
			buildSettings = {
				INFOPLIST_FILE = "todayextension/todayextension-Info.plist";
				LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
				PRODUCT_NAME = "todayextension";
				SKIP_INSTALL = YES;
				CODE_SIGN_ENTITLEMENTS = "/Users/ross/repos/olb-mobile/platforms/ios/todayextension/Entitlements/OLBTodayExtension.entitlements";
				SWIFT_VERSION = 5.0;
				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
				SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h";
			};
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "myapp" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				1D6058940D05DD3E006BFB54 /* Debug */,
				1D6058950D05DD3E006BFB54 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		C01FCF4E08A954540054247B /* Build configuration list for PBXProject "myapp" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				C01FCF4F08A954540054247B /* Debug */,
				C01FCF5008A954540054247B /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		33208F251A454587BAC9A9BD /* Build configuration list for PBXNativeTarget "todayextension" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				839C5745AB5944A89304F2BB /* Debug */,
				5D66FE42698A44DA975E98D6 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
/* End XCConfigurationList section */
@l3ender
Copy link
Author

l3ender commented Jun 11, 2019

I'm willing to submit a PR for this; would the repo owner(s) be able to comment to let me know the plugin is still being monitored/maintained?

Thanks!

@akofman
Copy link
Owner

akofman commented Jun 11, 2019

Of course ;)

@l3ender l3ender linked a pull request Jun 12, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@akofman @l3ender and others