fix: Cleanup config plugin JS
This commit is contained in:
parent
17a3430c98
commit
ca41133dc0
@ -10,23 +10,18 @@ export const withDisableFrameProcessorsIOS: ConfigPlugin = (c) => {
|
|||||||
const xcodeProject: XcodeProject = config.modResults;
|
const xcodeProject: XcodeProject = config.modResults;
|
||||||
|
|
||||||
const configurations = xcodeProject.pbxXCBuildConfigurationSection();
|
const configurations = xcodeProject.pbxXCBuildConfigurationSection();
|
||||||
let key;
|
|
||||||
let buildSettings;
|
|
||||||
|
|
||||||
const inheritKey = '"$(inherited)"';
|
const inheritKey = '"$(inherited)"';
|
||||||
const valueKey = '"VISION_CAMERA_DISABLE_FRAME_PROCESSORS=1"';
|
const valueKey = '"VISION_CAMERA_DISABLE_FRAME_PROCESSORS=1"';
|
||||||
|
|
||||||
for (key in configurations) {
|
for (const key in configurations) {
|
||||||
buildSettings = configurations[key].buildSettings;
|
const buildSettings = configurations[key].buildSettings;
|
||||||
if (typeof buildSettings?.GCC_PREPROCESSOR_DEFINITIONS !== 'undefined') {
|
if (buildSettings == null) continue;
|
||||||
// alright, this is the DEBUG config, push our setting to it
|
|
||||||
if (buildSettings.GCC_PREPROCESSOR_DEFINITIONS.includes(valueKey) === false)
|
const preprocessorDefinitions = (buildSettings.GCC_PREPROCESSOR_DEFINITIONS ?? [inheritKey]) as string[];
|
||||||
buildSettings.GCC_PREPROCESSOR_DEFINITIONS.push(valueKey);
|
|
||||||
} else if (typeof buildSettings !== 'undefined') {
|
if (!preprocessorDefinitions.includes(valueKey)) preprocessorDefinitions.push(valueKey);
|
||||||
// new projects do not have GCC_PREPROCESSOR_DEFINITIONS for "Release", lets create it
|
buildSettings.GCC_PREPROCESSOR_DEFINITIONS = preprocessorDefinitions;
|
||||||
// we need to add the inheritKey or it will break the release build.
|
|
||||||
buildSettings.GCC_PREPROCESSOR_DEFINITIONS = [inheritKey, valueKey];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user