Skip to content

fix: incorrect warning is shown when building for iOS #5222

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

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
platformData.normalizedPlatformName,
constants.NATIVE_SOURCE_FOLDER
);

await this.prepareNativeSourceCode(constants.TNS_NATIVE_SOURCE_GROUP_NAME, resourcesNativeCodePath, projectData);
}

Expand Down Expand Up @@ -498,9 +499,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);

const sourcePath = path.join(pluginPlatformsFolderPath, "src");
if (this.$fs.exists(pluginPlatformsFolderPath) && this.$fs.exists(sourcePath)) {
await this.prepareNativeSourceCode(pluginData.name, sourcePath, projectData);
}
await this.prepareNativeSourceCode(pluginData.name, sourcePath, projectData);

await this.prepareResources(pluginPlatformsFolderPath, pluginData, projectData);
await this.prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData);
Expand Down Expand Up @@ -644,14 +643,16 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
}

private async prepareNativeSourceCode(groupName: string, sourceFolderPath: string, projectData: IProjectData): Promise<void> {
const project = this.createPbxProj(projectData);
const group = this.getRootGroup(groupName, sourceFolderPath);
project.addPbxGroup(group.files, group.name, group.path, null, { isMain: true, filesRelativeToProject: true });
project.addToHeaderSearchPaths(group.path);
if (!this.$fs.exists(path.join(sourceFolderPath, "module.modulemap"))) {
this.$logger.warn(`warning: Directory ${sourceFolderPath} with native iOS source code doesn't contain a modulemap file. Metadata for it will not be generated and it will not be accessible from JavaScript. To learn more see https://docs.nativescript.org/guides/ios-source-code`);
if (this.$fs.exists(sourceFolderPath)) {
const project = this.createPbxProj(projectData);
const group = this.getRootGroup(groupName, sourceFolderPath);
project.addPbxGroup(group.files, group.name, group.path, null, { isMain: true, filesRelativeToProject: true });
project.addToHeaderSearchPaths(group.path);
if (!this.$fs.exists(path.join(sourceFolderPath, "module.modulemap"))) {
this.$logger.warn(`warning: Directory ${sourceFolderPath} with native iOS source code doesn't contain a modulemap file. Metadata for it will not be generated and it will not be accessible from JavaScript. To learn more see https://docs.nativescript.org/guides/ios-source-code`);
}
this.savePbxProj(project, projectData);
}
this.savePbxProj(project, projectData);
}

private async addExtensions(projectData: IProjectData, pluginsData: IPluginData[]): Promise<void> {
Expand Down