Skip to content

Commit 9a33b41

Browse files
committed
feat: Add support for platforms/ios/Resources directory
* Implement support for adding resources * Write unit tests for `Resources` and `src` * TODO: fix node-xcode reference in package.json after merging Teo's PR
1 parent dc10658 commit 9a33b41

File tree

6 files changed

+517
-7
lines changed

6 files changed

+517
-7
lines changed

lib/node/xcode.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ declare global {
88
}
99
}
1010

11+
export { xcode };
12+
1113
$injector.register("xcode", xcode);

lib/services/ios-project-service.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
940940
await this.prepareNativeSourceCode(pluginData.name, sourcePath, projectData);
941941
}
942942

943+
await this.prepareResources(pluginPlatformsFolderPath, pluginData, projectData);
943944
await this.prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData);
944945
await this.prepareStaticLibs(pluginPlatformsFolderPath, pluginData, projectData);
945946
await this.prepareCocoapods(pluginPlatformsFolderPath, projectData);
@@ -1120,7 +1121,6 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
11201121
}
11211122

11221123
private async prepareNativeSourceCode(pluginName: string, pluginPlatformsFolderPath: string, projectData: IProjectData): Promise<void> {
1123-
11241124
const project = this.createPbxProj(projectData);
11251125
const group = this.getRootGroup(pluginName, pluginPlatformsFolderPath);
11261126
project.addPbxGroup(group.files.map(f => f.path), group.name, group.path, null, {isMain:true});
@@ -1143,6 +1143,18 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
11431143
return rootGroup;
11441144
}
11451145

1146+
private async prepareResources(pluginPlatformsFolderPath: string, pluginData: IPluginData, projectData: IProjectData): Promise<void> {
1147+
const project = this.createPbxProj(projectData);
1148+
const resourcesPath = path.join(pluginPlatformsFolderPath, "Resources");
1149+
if (this.$fs.exists(resourcesPath) && !this.$fs.isEmptyDir(resourcesPath)) {
1150+
for (const fileName of this.$fs.readDirectory(resourcesPath)) {
1151+
const filePath = path.join(resourcesPath, fileName);
1152+
1153+
project.addResourceFile(filePath);
1154+
}
1155+
}
1156+
this.savePbxProj(project, projectData);
1157+
}
11461158
private async prepareFrameworks(pluginPlatformsFolderPath: string, pluginData: IPluginData, projectData: IProjectData): Promise<void> {
11471159
for (const fileName of this.getAllLibsForPluginWithFileExtension(pluginData, ".framework")) {
11481160
await this.addFramework(path.join(pluginPlatformsFolderPath, fileName), projectData);

npm-shrinkwrap.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"uuid": "3.0.1",
7474
"winreg": "0.0.17",
7575
"ws": "5.1.0",
76-
"xcode": "https://github.com/NativeScript/node-xcode/archive/1.4.0.tar.gz",
76+
"xcode": "https://github.com/NativeScript/node-xcode/archive/tdermendzhiev/fix-addpbxgroup.tar.gz",
7777
"xml2js": "0.4.19",
7878
"xmldom": "0.1.21",
7979
"xmlhttprequest": "https://github.com/telerik/node-XMLHttpRequest/tarball/master",

0 commit comments

Comments
 (0)