Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1a30e13

Browse files
committedJan 22, 2020
fix: removed native code should be cleaned from native project
Currently in case you have native source code, it is added to the pbxproject's references. In case you remove the source code's directory, the files relations are not cleaned from the pbxproject, which makes the build fail. To fix this, instead of skipping the native code refrence for this folder, just call the method to add such pbxgroup and the nativescript-dev-xcode will cleanup the required resources. Also fix the warning for modulemaps, it must be shown only when you have `.h` files and you do not have module.modulemap file at the root of the source code directory.
1 parent 7d4d628 commit 1a30e13

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed
 

‎lib/services/ios-project-service.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -643,16 +643,15 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
643643
}
644644

645645
private async prepareNativeSourceCode(groupName: string, sourceFolderPath: string, projectData: IProjectData): Promise<void> {
646-
if (this.$fs.exists(sourceFolderPath)) {
647-
const project = this.createPbxProj(projectData);
648-
const group = this.getRootGroup(groupName, sourceFolderPath);
649-
project.addPbxGroup(group.files, group.name, group.path, null, { isMain: true, filesRelativeToProject: true });
650-
project.addToHeaderSearchPaths(group.path);
651-
if (!this.$fs.exists(path.join(sourceFolderPath, "module.modulemap"))) {
652-
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`);
653-
}
654-
this.savePbxProj(project, projectData);
646+
const project = this.createPbxProj(projectData);
647+
const group = this.getRootGroup(groupName, sourceFolderPath);
648+
project.addPbxGroup(group.files, group.name, group.path, null, { isMain: true, filesRelativeToProject: true });
649+
project.addToHeaderSearchPaths(group.path);
650+
const headerFiles = this.$fs.exists(sourceFolderPath) ? this.$fs.enumerateFilesInDirectorySync(sourceFolderPath, (file, stat) => stat.isDirectory() || path.extname(file) === ".h") : [];
651+
if (headerFiles.length > 0 && !this.$fs.exists(path.join(sourceFolderPath, "module.modulemap"))) {
652+
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`);
655653
}
654+
this.savePbxProj(project, projectData);
656655
}
657656

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

0 commit comments

Comments
 (0)
Please sign in to comment.