-
-
Notifications
You must be signed in to change notification settings - Fork 197
Fix failed ios build after second info-plist merge #1083
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
Changes from 1 commit
e010223
aae1c98
bca245a
2daee31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ | |
targetedOS: ['darwin'], | ||
configurationFileName: "Info.plist", | ||
configurationFilePath: path.join(projectRoot, this.$projectData.projectName, this.$projectData.projectName+"-Info.plist"), | ||
relativeToFrameworkConfigurationFilePath: path.join("__PROJECT_NAME__", "__PROJECT_NAME__-Info.plist"), | ||
mergeXmlConfig: [{ "nodename": "plist", "attrname": "*" }, {"nodename": "dict", "attrname": "*"}] | ||
}; | ||
} | ||
|
@@ -118,20 +119,26 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ | |
}).future<void>()(); | ||
} | ||
|
||
public interpolateData(projectRoot: string): IFuture<void> { | ||
public interpolateData(): IFuture<void> { | ||
return (() => { | ||
let infoPlistFilePath = path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, util.format("%s-%s", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, "Info.plist")); | ||
shell.sed('-i', "__CFBUNDLEIDENTIFIER__", this.$projectData.projectId, infoPlistFilePath); | ||
let infoPlistFilePath = path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, util.format("%s-%s", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, "Info.plist")); | ||
this.interpolateConfigurationFile(infoPlistFilePath).wait(); | ||
|
||
this.replaceFileName("-Info.plist", path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)).wait(); | ||
this.replaceFileName("-Prefix.pch", path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)).wait(); | ||
this.replaceFileName(IOSProjectService.XCODE_PROJECT_EXT_NAME, projectRoot).wait(); | ||
this.replaceFileName("-Info.plist", path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)).wait(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can extract this long path into a dedicated variable - it is used on more than one place |
||
this.replaceFileName("-Prefix.pch", path.join(this.platformData.projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)).wait(); | ||
this.replaceFileName(IOSProjectService.XCODE_PROJECT_EXT_NAME, this.platformData.projectRoot).wait(); | ||
|
||
let pbxprojFilePath = path.join(projectRoot, this.$projectData.projectName + IOSProjectService.XCODE_PROJECT_EXT_NAME, "project.pbxproj"); | ||
let pbxprojFilePath = path.join(this.platformData.projectRoot, this.$projectData.projectName + IOSProjectService.XCODE_PROJECT_EXT_NAME, "project.pbxproj"); | ||
this.replaceFileContent(pbxprojFilePath).wait(); | ||
}).future<void>()(); | ||
} | ||
|
||
public interpolateConfigurationFile(configurationFilePath?: string): IFuture<void> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason for this function to return a future? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return (() => { | ||
shell.sed('-i', "__CFBUNDLEIDENTIFIER__", this.$projectData.projectId, configurationFilePath || this.platformData.configurationFilePath); | ||
}).future<void>()(); | ||
} | ||
|
||
public afterCreateProject(projectRoot: string): IFuture<void> { | ||
return (() => { | ||
this.$fs.rename(path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,25 +86,7 @@ export class PluginsService implements IPluginsService { | |
// Remove the plugin and call merge for another plugins that have configuration file | ||
let pluginConfigurationFilePath = this.getPluginConfigurationFilePath(pluginData, platformData); | ||
if(this.$fs.exists(pluginConfigurationFilePath).wait()) { | ||
let tnsModulesDestinationPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME, constants.TNS_MODULES_FOLDER_NAME); | ||
let nodeModules = this.$broccoliBuilder.getChangedNodeModules(tnsModulesDestinationPath, platform).wait(); | ||
|
||
_(nodeModules) | ||
.map(nodeModule => this.getNodeModuleData(pluginName).wait()) | ||
.map(nodeModuleData => this.convertToPluginData(nodeModuleData)) | ||
.filter(data => data.isPlugin && this.$fs.exists(this.getPluginConfigurationFilePath(data, platformData)).wait()) | ||
.forEach((data, index) => { | ||
executeUninstallCommand().wait(); | ||
|
||
if(index === 0) { | ||
this.initializeConfigurationFileFromCache(platformData).wait(); | ||
} | ||
|
||
if(data.name !== pluginName) { | ||
this.merge(data, platformData).wait(); | ||
} | ||
}) | ||
.value(); | ||
this.merge(pluginData, platformData).wait(); | ||
} | ||
|
||
if(pluginData.pluginVariables) { | ||
|
@@ -139,13 +121,14 @@ export class PluginsService implements IPluginsService { | |
let frameworkVersion = this.$projectDataService.getValue(platformData.frameworkPackageName).wait().version; | ||
this.$npm.cache(platformData.frameworkPackageName, frameworkVersion).wait(); | ||
|
||
let relativeConfigurationFilePath = path.relative(platformData.projectRoot, platformData.configurationFilePath); | ||
// We need to resolve this manager here due to some restrictions from npm api and in order to load PluginsService.NPM_CONFIG config | ||
let npmInstallationManager: INpmInstallationManager = this.$injector.resolve("npmInstallationManager"); | ||
let cachedPackagePath = npmInstallationManager.getCachedPackagePath(platformData.frameworkPackageName, frameworkVersion); | ||
let cachedConfigurationFilePath = path.join(cachedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, relativeConfigurationFilePath); | ||
let cachedConfigurationFilePath = path.join(cachedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, platformData.relativeToFrameworkConfigurationFilePath); | ||
let cachedConfigurationFileContent = this.$fs.readText(cachedConfigurationFilePath).wait(); | ||
this.$fs.writeFile(platformData.configurationFilePath, cachedConfigurationFileContent).wait(); | ||
|
||
shelljs.cp("-f", cachedConfigurationFilePath, path.dirname(platformData.configurationFilePath)); | ||
platformData.platformProjectService.interpolateConfigurationFile().wait(); | ||
}).future<void>()(); | ||
} | ||
|
||
|
@@ -347,7 +330,7 @@ export class PluginsService implements IPluginsService { | |
doc.parseFromString(xml, 'text/xml'); | ||
} | ||
|
||
private merge(pluginData: IPluginData, platformData: IPlatformData): IFuture<void> { | ||
private mergeCore(pluginData: IPluginData, platformData: IPlatformData): IFuture<void> { | ||
return (() => { | ||
let pluginConfigurationFilePath = this.getPluginConfigurationFilePath(pluginData, platformData); | ||
let configurationFilePath = platformData.configurationFilePath; | ||
|
@@ -368,6 +351,27 @@ export class PluginsService implements IPluginsService { | |
}).future<void>()(); | ||
} | ||
|
||
private merge(pluginData: IPluginData, platformData: IPlatformData): IFuture<void> { | ||
return (() => { | ||
let tnsModulesDestinationPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME, constants.TNS_MODULES_FOLDER_NAME); | ||
let nodeModules = this.$broccoliBuilder.getChangedNodeModules(tnsModulesDestinationPath, platformData.normalizedPlatformName.toLowerCase()).wait(); | ||
|
||
_(_.keys(nodeModules)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not
|
||
.map(nodeModule => this.getNodeModuleData(path.join(nodeModule, "package.json")).wait()) | ||
.map(nodeModuleData => this.convertToPluginData(nodeModuleData)) | ||
.filter(data => data.isPlugin && this.$fs.exists(this.getPluginConfigurationFilePath(data, platformData)).wait()) | ||
.forEach((data, index) => { | ||
if(index === 0) { | ||
this.initializeConfigurationFileFromCache(platformData).wait(); | ||
} | ||
|
||
this.mergeCore(data, platformData).wait(); | ||
}) | ||
.value(); | ||
|
||
}).future<void>()(); | ||
} | ||
|
||
private getPluginConfigurationFilePath(pluginData: IPluginData, platformData: IPlatformData): string { | ||
let pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(platformData.normalizedPlatformName.toLowerCase()); | ||
let pluginConfigurationFilePath = path.join(pluginPlatformsFolderPath, platformData.configurationFileName); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need these console.logs