3636import shutil
3737
3838
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 ):
4040 """Constructs subprocess args for an unsigned xcode build.
4141
4242 Args:
@@ -45,7 +45,8 @@ def get_args_for_build(path, scheme, output_dir, ios_sdk, configuration):
4545 scheme (str): Name of the scheme to build.
4646 output_dir (str): Directory for the resulting build artifacts. Will be
4747 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".
4950 configuration (str): Value for the -configuration flag.
5051
5152 Returns:
@@ -54,7 +55,7 @@ def get_args_for_build(path, scheme, output_dir, ios_sdk, configuration):
5455 """
5556 args = [
5657 "xcodebuild" ,
57- "-sdk" , _get_ios_env_from_target (ios_sdk ),
58+ "-sdk" , _get_ios_env_from_target (ios_sdk , target_os ),
5859 "-scheme" , scheme ,
5960 "-configuration" , configuration ,
6061 "-quiet" ,
@@ -79,14 +80,24 @@ def get_args_for_build(path, scheme, output_dir, ios_sdk, configuration):
7980 return args
8081
8182
82- def _get_ios_env_from_target (ios_sdk ):
83+ def _get_ios_env_from_target (ios_sdk , target_os ):
8384 """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 )
8899 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 ) )
90101
91102
92103def generate_unsigned_ipa (output_dir , configuration ):
0 commit comments