def _build_unity(platform, unity_path):
methods = {
'ios': 'BuildEditorScript.PerformiOSBuild',
'android': 'BuildEditorScript.PerformAndroidBuild',
'osx': 'BuildEditorScript.PerformMacOSXBuild'
}
if platform not in methods:
fatal("Unsupported platform.")
unity_path = os.path.join(unity_path, "Unity.app/Contents/MacOS/Unity")
command = "{unity_path} -quit -batchmode " \
"-executeMethod {method} " \
"-logFile ./build.log " \
"-projectPath {current_dir}" \
.format(unity_path=quote(unity_path),
method=methods[platform],
current_dir=quote(os.getcwd()))
info("""The following command will be executed:
{0}.""".format(bold(command)))
returncode = subprocess32.call(command, shell=True)
if returncode != 0:
error("An error occurred, please check the content "
"of the {0} log file.".format(bold('build.log')))
sys.exit(returncode)
if platform == 'ios':
os.chdir(os.path.join(os.getcwd(), 'Build', 'iPhone'))
command = "xcodebuild -scheme Unity-iPhone archive " \
"-archivePath Unity-iPhone.xcarchive"
info("""The following command will be executed:
{0}.""".format(bold(command)))
subprocess32.check_call(command, shell=True)
command = "xcodebuild -exportArchive " \
"-exportFormat ipa " \
"-archivePath \"Unity-iPhone.xcarchive\" " \
"-exportPath \"Unity-iPhone.ipa\" " \
"-exportProvisioningProfile \"wildcard_Development\""
info("""The following command will be executed:
{0}.""".format(bold(command)))
subprocess32.check_call(command, shell=True)
success("""
Your project has been built.
""")
评论列表
文章目录