Skip to content

Commit cf37f1c

Browse files
committed
feat(ios): Add native source code to xcode project on prepare
1 parent 9c0112b commit cf37f1c

File tree

4 files changed

+141
-2
lines changed

4 files changed

+141
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// NativeClass.h
3+
// cliapp
4+
//
5+
// Created by Teodor Dermendzhiev on 1/2/19.
6+
// Copyright © 2019 Telerik. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
@interface NativeClass : NSObject
14+
15+
+(void)staticMethod;
16+
17+
@end
18+
19+
NS_ASSUME_NONNULL_END
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// NativeClass.m
3+
// cliapp
4+
//
5+
// Created by Teodor Dermendzhiev on 1/2/19.
6+
// Copyright © 2019 Telerik. All rights reserved.
7+
//
8+
9+
#import "NativeClass.h"
10+
11+
@implementation NativeClass
12+
13+
+(void)staticMethod {
14+
NSLog(@"Static method called");
15+
}
16+
17+
@end
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/services/ios-project-service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,8 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
773773

774774
this.savePbxProj(project, projectData);
775775
}
776+
777+
await this.prepareNativeSourceCode("src", path.join(projectData.appDirectoryPath, constants.APP_RESOURCES_FOLDER_NAME, this.getPlatformData(projectData).normalizedPlatformName, "src"), projectData);
776778
}
777779

778780
public prepareAppResources(appResourcesDirectoryPath: string, projectData: IProjectData): void {
@@ -781,6 +783,9 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
781783

782784
filterFile(this.getPlatformData(projectData).configurationFileName);
783785

786+
// src folder should not be copied as the pbxproject will have references to its files
787+
this.$fs.deleteDirectory(path.join(appResourcesDirectoryPath, this.getPlatformData(projectData).normalizedPlatformName, "src"));
788+
784789
this.$fs.deleteDirectory(this.getAppResourcesDestinationDirectoryPath(projectData));
785790
}
786791

@@ -1094,9 +1099,9 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
10941099
this.$fs.rename(path.join(fileRootLocation, oldFileName), path.join(fileRootLocation, newFileName));
10951100
}
10961101

1097-
private async prepareNativeSourceCode(pluginName: string, pluginPlatformsFolderPath: string, projectData: IProjectData): Promise<void> {
1102+
private async prepareNativeSourceCode(groupName: string, sourceFolderPath: string, projectData: IProjectData): Promise<void> {
10981103
const project = this.createPbxProj(projectData);
1099-
const group = this.getRootGroup(pluginName, pluginPlatformsFolderPath);
1104+
const group = this.getRootGroup(groupName, sourceFolderPath);
11001105
project.addPbxGroup(group.files, group.name, group.path, null, { isMain: true });
11011106
project.addToHeaderSearchPaths(group.path);
11021107
this.savePbxProj(project, projectData);

0 commit comments

Comments
 (0)