@@ -74,15 +74,18 @@ def test(self, sandbox_profile, stdout=sys.stdout, stderr=sys.stderr,
74
74
class XcodeTarget (ProjectTarget ):
75
75
"""An Xcode workspace scheme."""
76
76
77
- def __init__ (self , swiftc , project , target , destination ,
78
- added_xcodebuild_flags , is_workspace , has_scheme ):
77
+ def __init__ (self , swiftc , project , target , destination , env ,
78
+ added_xcodebuild_flags , is_workspace , has_scheme ,
79
+ clean_build ):
79
80
self ._swiftc = swiftc
80
81
self ._project = project
81
82
self ._target = target
82
83
self ._destination = destination
84
+ self ._env = env
83
85
self ._added_xcodebuild_flags = added_xcodebuild_flags
84
86
self ._is_workspace = is_workspace
85
87
self ._has_scheme = has_scheme
88
+ self ._clean_build = clean_build
86
89
87
90
@property
88
91
def project_param (self ):
@@ -108,14 +111,17 @@ def get_build_command(self, incremental=False):
108
111
109
112
build_dir = os .path .join (build_parent_dir , 'build' )
110
113
111
- build = ['clean' , 'build' ]
112
- if incremental :
113
- build = ['build' ]
114
+ build = []
115
+ if self ._clean_build and not incremental :
116
+ build += ['clean' ]
117
+ build += ['build' ]
118
+
114
119
dir_override = []
115
120
if self ._has_scheme :
116
- dir_override = ['-derivedDataPath' , build_dir ]
117
- else :
118
- dir_override = ['SYMROOT=' + build_dir ]
121
+ dir_override += ['-derivedDataPath' , build_dir ]
122
+ elif not 'SYMROOT' in self ._env :
123
+ dir_override += ['SYMROOT=' + build_dir ]
124
+ dir_override += [k + "=" + v for k , v in self ._env .items ()]
119
125
command = (['xcodebuild' ]
120
126
+ build
121
127
+ [project_param , self ._project ,
@@ -321,6 +327,10 @@ def dispatch(root_path, repo, action, swiftc, swift_version,
321
327
initial_xcodebuild_flags += ['-configuration' ,
322
328
action ['configuration' ]]
323
329
330
+ build_env = {}
331
+ if 'environment' in action :
332
+ build_env = action ['environment' ]
333
+
324
334
other_swift_flags = []
325
335
if swift_version :
326
336
if '.' not in swift_version :
@@ -346,14 +356,19 @@ def dispatch(root_path, repo, action, swiftc, swift_version,
346
356
project_path = os .path .join (root_path , repo ['path' ],
347
357
action [match .group (2 ).lower ()])
348
358
has_scheme = match .group (3 ).lower () == 'scheme'
359
+ clean_build = True
360
+ if 'clean_build' in action :
361
+ clean_build = action ['clean_build' ]
349
362
xcode_target = \
350
363
XcodeTarget (swiftc ,
351
364
project_path ,
352
365
action [match .group (3 ).lower ()],
353
366
action ['destination' ],
367
+ build_env ,
354
368
initial_xcodebuild_flags + added_xcodebuild_flags ,
355
369
is_workspace ,
356
- has_scheme )
370
+ has_scheme ,
371
+ clean_build )
357
372
if should_strip_resource_phases :
358
373
strip_resource_phases (os .path .join (root_path , repo ['path' ]),
359
374
stdout = stdout , stderr = stderr )
0 commit comments