forked from keysight-eggplant/libs-xcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
XCBuildConfiguration.m
69 lines (60 loc) · 1.72 KB
/
XCBuildConfiguration.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
#import "PBXCommon.h"
#import "XCBuildConfiguration.h"
#import "GSXCBuildContext.h"
#import <stdlib.h>
@implementation XCBuildConfiguration
// Methods....
- (NSMutableDictionary *) buildSettings // getter
{
return buildSettings;
}
- (void) setBuildSettings: (NSMutableDictionary *)object; // setter
{
ASSIGN(buildSettings,object);
}
- (NSString *) name // getter
{
return name;
}
- (void) setName: (NSString *)object; // setter
{
ASSIGN(name,object);
}
- (void) apply
{
puts([[NSString stringWithFormat: @"=== Applying Build Configuration %@",name] cString]);
GSXCBuildContext *context = [GSXCBuildContext sharedBuildContext];
NSEnumerator *en = [buildSettings keyEnumerator];
NSString *key = nil;
while ((key = [en nextObject]) != nil)
{
id value = [buildSettings objectForKey: key];
if ([value isKindOfClass: [NSString class]])
{
NSDebugLog(@"\tEnvironment: %@ = %@",key,value);
setenv([key cString],[value cString],1);
}
else if([value isKindOfClass: [NSArray class]])
{
[context setObject: value
forKey: key];
NSDebugLog(@"\tContext: %@ = %@",key,value);
}
else
{
NSDebugLog(@"\tWARNING: Can't interpret value %@, for environment variable %@", value, key);
}
}
if ([buildSettings objectForKey: @"TARGET_BUILD_DIR"] == nil)
{
NSDebugLog(@"\tEnvironment: TARGET_BUILD_DIR = build (built-in)");
setenv("TARGET_BUILD_DIR","build",1);
}
if ([buildSettings objectForKey: @"BUILT_PRODUCTS_DIR"] == nil)
{
NSDebugLog(@"\tEnvironment: BUILT_PRODUCTS_DIR = build (built-in)");
setenv("BUILT_PRODUCTS_DIR","build",1);
}
puts([[NSString stringWithFormat: @"=== Done Applying Build Configuration for %@",name] cString]);
}
@end