Skip to content

Commit 25a4046

Browse files
Merge pull request #5225 from NativeScript/vladimirov/fix-prepare-native-sources
fix: removed native code should be cleaned from native project
2 parents 7d4d628 + 1a30e13 commit 25a4046

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/services/ios-project-service.ts

+8-9
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)