Closed Aarbel closed 5 years ago
I don't know how Xcode internally stores that setting when you change it in the Xcode UI, but the fact it comes under "workspace settings" suggest to me that it's stored in the .xcworkspace
and not the .xcodeproj/project.pbxproj
file. This plugin currently can only operate on the project file, not the workspace.
You can confirm this by changing the setting in "Per-user workspace settings" and diffing the .xcworkspace
for changes.
Thank you @dpa99c, so no solutions for the moment ?
Not by using this plugin
Thanks a lot, do you know other plugins that could help in this ?
Cheers
@Aarbel After saving "Legacy buiuld system settings", Xcode creates new file: platforms/ios/EverBee.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
with content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
checked with Xcode Version 11.4.1 (11E503a)
.
One could create a hook file hooks/after_platform_add/create-ios-workspaceSettings.js
:
const fs = require('fs'),
path = require("path");
const workspaceSettings = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
\t<key>BuildSystemType</key>
\t<string>Original</string>
</dict>
</plist>
`;
// Returns the project name
function getProjectName(protoPath) {
const
cordovaConfigPath = path.join(protoPath, 'config.xml'),
content = fs.readFileSync(cordovaConfigPath, 'utf-8');
return /<name>([\s\S]*)<\/name>/mi.exec(content)[1].trim();
}
module.exports = function (context) {
const
projectRoot = context.opts.projectRoot,
projectName = getProjectName(projectRoot),
workspaceSettingsPath = path.join(projectRoot, `/platforms/ios/${projectName}.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings`);
fs.writeFileSync(workspaceSettingsPath, workspaceSettings);
}
and register it at config.xml
to be called:
<platform name="ios">
...
<hook src="hooks/after_platform_add/create-ios-workspaceSettings.js" type="after_platform_add" />
</platform>
Setting
"buildFlag": ["-UseModernBuildSystem=0"]
in build.json file is not enough to set this configuration directly inside Xcode.Do you know the key to set it thru this plugin and config.xml ?
<custom-preference name="ios-XCBuildConfiguration-SWIFT_VERSION" value="2.3" />
is good for swift version, but i just want to put the build system as Legacy one.Thanks a lot for your help !