36
36
import shutil
37
37
38
38
39
- def get_args_for_build (path , scheme , output_dir , ios_sdk , configuration ):
39
+ def get_args_for_build (path , scheme , output_dir , ios_sdk , target_os , configuration ):
40
40
"""Constructs subprocess args for an unsigned xcode build.
41
41
42
42
Args:
@@ -45,7 +45,8 @@ def get_args_for_build(path, scheme, output_dir, ios_sdk, configuration):
45
45
scheme (str): Name of the scheme to build.
46
46
output_dir (str): Directory for the resulting build artifacts. Will be
47
47
created if it doesn't already exist.
48
- ios_sdk (str): Where this build will be run: device or simulator.
48
+ ios_sdk (str): Where this build will be run: "device" or "simulator".
49
+ target_os (str): one of "iOS" or "tvOS".
49
50
configuration (str): Value for the -configuration flag.
50
51
51
52
Returns:
@@ -54,7 +55,7 @@ def get_args_for_build(path, scheme, output_dir, ios_sdk, configuration):
54
55
"""
55
56
args = [
56
57
"xcodebuild" ,
57
- "-sdk" , _get_ios_env_from_target (ios_sdk ),
58
+ "-sdk" , _get_ios_env_from_target (ios_sdk , target_os ),
58
59
"-scheme" , scheme ,
59
60
"-configuration" , configuration ,
60
61
"-quiet" ,
@@ -79,14 +80,24 @@ def get_args_for_build(path, scheme, output_dir, ios_sdk, configuration):
79
80
return args
80
81
81
82
82
- def _get_ios_env_from_target (ios_sdk ):
83
+ def _get_ios_env_from_target (ios_sdk , target_os ):
83
84
"""Return a value for the -sdk flag based on the target (device/simulator)."""
84
- if ios_sdk == "device" :
85
- return "iphoneos"
86
- elif ios_sdk == "simulator" :
87
- return "iphonesimulator"
85
+ if target_os == "iOS" :
86
+ if ios_sdk == "device" :
87
+ return "iphoneos"
88
+ elif ios_sdk == "simulator" :
89
+ return "iphonesimulator"
90
+ else :
91
+ raise ValueError ("Unrecognized iOS ios_sdk paramter: %s" % ios_sdk )
92
+ elif target_os == "tvOS" :
93
+ if ios_sdk == "device" :
94
+ return "appletvos"
95
+ elif ios_sdk == "simulator" :
96
+ return "appletvsimulator"
97
+ else :
98
+ raise ValueError ("Unrecognized tvOS ios_sdk parameter: %s" % sdk )
88
99
else :
89
- raise ValueError ("Unrecognized ios_sdk: %s" % ios_sdk )
100
+ raise ValueError ("Unrecognized target_os %s for ios_sdk %s" % ( target_os , ios_sdk ) )
90
101
91
102
92
103
def generate_unsigned_ipa (output_dir , configuration ):
0 commit comments