Skip to content

Commit b8b031e

Browse files
committed
chore: Unify behavior for plugin Podfile and base Podfile
1 parent 3284ed5 commit b8b031e

File tree

6 files changed

+110
-12
lines changed

6 files changed

+110
-12
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"images" : [
3+
{
4+
"size" : "29x29",
5+
"idiom" : "iphone",
6+
"filename" : "icon-29.png",
7+
"scale" : "1x"
8+
},
9+
{
10+
"size" : "29x29",
11+
"idiom" : "iphone",
12+
"filename" : "[email protected]",
13+
"scale" : "2x"
14+
},
15+
{
16+
"size" : "29x29",
17+
"idiom" : "iphone",
18+
"filename" : "[email protected]",
19+
"scale" : "3x"
20+
},
21+
{
22+
"size" : "40x40",
23+
"idiom" : "iphone",
24+
"filename" : "[email protected]",
25+
"scale" : "2x"
26+
},
27+
{
28+
"size" : "40x40",
29+
"idiom" : "iphone",
30+
"filename" : "[email protected]",
31+
"scale" : "3x"
32+
},
33+
{
34+
"size" : "60x60",
35+
"idiom" : "iphone",
36+
"filename" : "[email protected]",
37+
"scale" : "2x"
38+
},
39+
{
40+
"size" : "60x60",
41+
"idiom" : "iphone",
42+
"filename" : "[email protected]",
43+
"scale" : "3x"
44+
},
45+
{
46+
"size" : "29x29",
47+
"idiom" : "ipad",
48+
"filename" : "icon-29.png",
49+
"scale" : "1x"
50+
},
51+
{
52+
"size" : "29x29",
53+
"idiom" : "ipad",
54+
"filename" : "[email protected]",
55+
"scale" : "2x"
56+
},
57+
{
58+
"size" : "40x40",
59+
"idiom" : "ipad",
60+
"filename" : "icon-40.png",
61+
"scale" : "1x"
62+
},
63+
{
64+
"size" : "40x40",
65+
"idiom" : "ipad",
66+
"filename" : "[email protected]",
67+
"scale" : "2x"
68+
},
69+
{
70+
"size" : "76x76",
71+
"idiom" : "ipad",
72+
"filename" : "icon-76.png",
73+
"scale" : "1x"
74+
},
75+
{
76+
"size" : "76x76",
77+
"idiom" : "ipad",
78+
"filename" : "[email protected]",
79+
"scale" : "2x"
80+
},
81+
{
82+
"size" : "83.5x83.5",
83+
"idiom" : "ipad",
84+
"filename" : "[email protected]",
85+
"scale" : "2x"
86+
},
87+
{
88+
"size" : "1024x1024",
89+
"idiom" : "ios-marketing",
90+
"filename" : "icon-1024.png",
91+
"scale" : "1x"
92+
}
93+
],
94+
"info" : {
95+
"version" : 1,
96+
"author" : "xcode"
97+
}
98+
}

lib/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export const DEPENDENCIES_JSON_NAME = "dependencies.json";
4444
export const APK_EXTENSION_NAME = ".apk";
4545
export const AAB_EXTENSION_NAME = ".aab";
4646
export const HASHES_FILE_NAME = ".nshashes";
47+
export const TNS_NATIVE_SOURCE_GROUP_NAME = "TNSNativeSource";
48+
export const NATIVE_SOURCE_FOLDER = "src";
4749

4850
export class PackageVersion {
4951
static NEXT = "next";

lib/definitions/project.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ interface IPlatformProjectService extends NodeJS.EventEmitter, IPlatformProjectS
410410
getAppResourcesDestinationDirectoryPath(projectData: IProjectData): string;
411411

412412
cleanDeviceTempFolder(deviceIdentifier: string, projectData: IProjectData): Promise<void>;
413-
processConfigurationFilesFromAppResources(release: boolean, projectData: IProjectData, installPods: boolean): Promise<void>;
413+
processConfigurationFilesFromAppResources(projectData: IProjectData, opts: { release: boolean, installPods: boolean }): Promise<void>;
414414

415415
/**
416416
* Ensures there is configuration file (AndroidManifest.xml, Info.plist) in app/App_Resources.

lib/services/cocoapods-service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ export class CocoaPodsService implements ICocoaPodsService {
5454

5555
public async applyPodfileToProject(moduleName: string, podfilePath: string, projectData: IProjectData, nativeProjectPath: string): Promise<void> {
5656
if (!this.$fs.exists(podfilePath)) {
57-
if (podfilePath === projectData.podfilePath) {
58-
this.removePodfileFromProject(moduleName, podfilePath, projectData, nativeProjectPath);
59-
}
57+
this.removePodfileFromProject(moduleName, podfilePath, projectData, nativeProjectPath);
6058
return;
6159
}
6260

@@ -80,7 +78,7 @@ export class CocoaPodsService implements ICocoaPodsService {
8078

8179
public removePodfileFromProject(moduleName: string, podfilePath: string, projectData: IProjectData, projectRoot: string): void {
8280

83-
if ((this.$fs.exists(podfilePath) || podfilePath === projectData.podfilePath) && this.$fs.exists(this.getProjectPodfilePath(projectRoot))) {
81+
if (this.$fs.exists(this.getProjectPodfilePath(projectRoot))) {
8482
let projectPodFileContent = this.$fs.readText(this.getProjectPodfilePath(projectRoot));
8583
// Remove the data between #Begin Podfile and #EndPodfile
8684
const regExpToRemove = new RegExp(`${this.getPluginPodfileHeader(podfilePath)}[\\s\\S]*?${this.getPluginPodfileEnd()}`, "mg");

lib/services/ios-project-service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
771771
this.$logger.trace(`Images to remove from xcode project: ${imagesToRemove.join(", ")}`);
772772
_.each(imagesToRemove, image => project.removeResourceFile(path.join(this.getAppResourcesDestinationDirectoryPath(projectData), image)));
773773

774-
await this.prepareNativeSourceCode("src", path.join(projectData.appDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME, this.getPlatformData(projectData).normalizedPlatformName, "src"), projectData);
774+
await this.prepareNativeSourceCode(constants.TNS_NATIVE_SOURCE_GROUP_NAME, path.join(projectData.getAppResourcesDirectoryPath(), constants.APP_RESOURCES_FOLDER_NAME, this.getPlatformData(projectData).normalizedPlatformName, constants.NATIVE_SOURCE_FOLDER), projectData);
775775

776776
this.savePbxProj(project, projectData);
777777
}
@@ -786,22 +786,22 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
786786
filterFile(constants.PODFILE_NAME);
787787

788788
// src folder should not be copied as the pbxproject will have references to its files
789-
this.$fs.deleteDirectory(path.join(appResourcesDirectoryPath, this.getPlatformData(projectData).normalizedPlatformName, "src"));
789+
this.$fs.deleteDirectory(path.join(appResourcesDirectoryPath, this.getPlatformData(projectData).normalizedPlatformName, constants.NATIVE_SOURCE_FOLDER));
790790

791791
this.$fs.deleteDirectory(this.getAppResourcesDestinationDirectoryPath(projectData));
792792
}
793793

794-
public async processConfigurationFilesFromAppResources(release: boolean, projectData: IProjectData, installPods: boolean): Promise<void> {
795-
await this.mergeInfoPlists({ release }, projectData);
794+
public async processConfigurationFilesFromAppResources(projectData: IProjectData, opts: { release: boolean, installPods: boolean }): Promise<void> {
795+
await this.mergeInfoPlists({ release: opts.release }, projectData);
796796
await this.$iOSEntitlementsService.merge(projectData);
797-
await this.mergeProjectXcconfigFiles(release, projectData);
797+
await this.mergeProjectXcconfigFiles(opts.release, projectData);
798798
for (const pluginData of await this.getAllInstalledPlugins(projectData)) {
799799
await this.$pluginVariablesService.interpolatePluginVariables(pluginData, this.getPlatformData(projectData).configurationFilePath, projectData.projectDir);
800800
}
801801

802802
this.$pluginVariablesService.interpolateAppIdentifier(this.getPlatformData(projectData).configurationFilePath, projectData.projectIdentifiers.ios);
803803

804-
if (installPods) {
804+
if (opts.installPods) {
805805
await this.installPodsIfAny(projectData);
806806
}
807807
}

lib/services/prepare-platform-native-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class PreparePlatformNativeService extends PreparePlatformService impleme
6363

6464
if (!config.changesInfo || config.changesInfo.configChanged || config.changesInfo.modulesChanged) {
6565
// Passing !shouldPrepareModules` we assume that if the node modules are prepared base Podfile content is added and `pod install` is executed.
66-
await config.platformData.platformProjectService.processConfigurationFilesFromAppResources(config.appFilesUpdaterOptions.release, config.projectData, !shouldPrepareModules);
66+
await config.platformData.platformProjectService.processConfigurationFilesFromAppResources(config.projectData, {release:config.appFilesUpdaterOptions.release, installPods: !shouldPrepareModules});
6767
}
6868

6969
config.platformData.platformProjectService.interpolateConfigurationFile(config.projectData, config.platformSpecificData);

0 commit comments

Comments
 (0)