forked from keysight-eggplant/libs-xcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PBXShellScriptBuildPhase.m
74 lines (61 loc) · 1.63 KB
/
PBXShellScriptBuildPhase.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#import "PBXCommon.h"
#import "PBXShellScriptBuildPhase.h"
@implementation PBXShellScriptBuildPhase
// Methods....
- (NSString *) shellPath // getter
{
return shellPath;
}
- (void) setShellPath: (NSString *)object; // setter
{
ASSIGN(shellPath,object);
}
- (NSString *) shellScript // getter
{
return shellScript;
}
- (void) setShellScript: (NSString *)object; // setter
{
ASSIGN(shellScript,object);
}
- (NSMutableArray *) inputPaths // getter
{
return inputPaths;
}
- (void) setInputPaths: (NSMutableArray *)object; // setter
{
ASSIGN(inputPaths,object);
}
- (NSMutableArray *) outputPaths // getter
{
return outputPaths;
}
- (void) setOutputPaths: (NSMutableArray *)object; // setter
{
ASSIGN(outputPaths,object);
}
- (NSString *) name // getter
{
return name;
}
- (void) setName: (NSString *)object; // setter
{
ASSIGN(name,object);
}
- (BOOL) build
{
NSError *error = nil;
NSString *fileName = [NSString stringWithFormat: @"script_%lu",[shellScript hash]];
NSString *command = [NSString stringWithFormat: @"%@ %@",shellPath,fileName];
puts([[NSString stringWithFormat: @"=== Executing Script Build Phase... %@",name] cString]);
puts([[NSString stringWithFormat: @"\t%@",command] cString]);
[shellScript writeToFile: fileName
atomically: YES
encoding: NSASCIIStringEncoding
error: &error];
system([shellScript cString]);
// NSString *deleteCommand = [NSString stringWithFormat: @"rm -rf %@",fileName];
puts([[NSString stringWithFormat: @"=== Done Executing Script Build Phase... %@",name] cString]);
return YES; // be forgiving since this is not a mac...
}
@end