def buildTarget(): archivePath = getArchivePath() profileUUID = Common.getCmdResult( "/usr/libexec/PlistBuddy -c 'Print UUID' " + getTmpPlistPath()) p12Path = getAbspath("p12_path") p12Password = m_jsonObj["p12_password"] f = open(p12Path, 'rb') p12 = load_pkcs12(f.read(), p12Password) sign_key = p12.get_friendlyname() team_id = p12.get_certificate().get_subject().OU f.close() buildParams = ' '.join([ '-project', '%s.xcodeproj' % m_newProjName, '-scheme', m_newSchemeName, '-configuration', 'Release', '-archivePath', archivePath, 'archive', 'build', 'CODE_SIGN_IDENTITY="%s"' % sign_key, 'PROVISIONING_PROFILE="%s"' % profileUUID, 'PRODUCT_BUNDLE_IDENTIFIER="%s"' % m_newBundleId, 'CODE_SIGN_STYLE="Manual"', 'DEVELOPMENT_TEAM="%s"' % team_id ]) cmd = 'cd %s/..;xcodebuild %s' % (m_projectDir, buildParams) Common.runCmd(cmd)
def modifyBundleId(): Common.runCmd( '/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier %s" %s' % (m_newBundleId, m_infoPlistPath)) # 修改推送BundleId Common.runCmd( '/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier %s" %s' % (m_newNotifyBundleId, m_notify_info_plist_path))
def createIPA(): ipaPath = exportPath() archivePath = getArchivePath() plistPath = getExportOptionsPlist() cmd = "cd %s;xcodebuild -exportArchive -archivePath %s -exportPath %s -exportOptionsPlist %s" % ( m_projectDir, archivePath, ipaPath, plistPath) # print "====== " + ipaPath Common.runCmd(cmd)
def installP12(): p12Path = getAbspath("p12_path") Common.assertExit(os.path.isfile(p12Path), "p12证书文件不存在,请检查配置") p12Password = m_jsonObj["p12_password"] Common.assertExit(p12Password, "未配置参数p12_password") p12Cmd = "security import %s -k /Users/%s/Library/Keychains/login.keychain -P %s -T /usr/bin/codesign" % ( p12Path, Common.getUserName(), p12Password) Common.runCmd(p12Cmd)
def installNotifyProfile(): tmpPlistPath = getTmpNotifyPlistPath() cmd = "security cms -D -i %s > %s" % (m_notifProfilePath, tmpPlistPath) Common.runCmd(cmd) # 将profile文件拷贝到系统目录 uuid = findNotifyPlistInfoForKey("UUID") targetFile = "/Users/%s/Library/MobileDevice/Provisioning Profiles/%s.mobileprovision" % ( Common.getUserName(), uuid) FileUtils.copyFile(m_notifProfilePath, targetFile)
def copyDingXiangFiles(): if m_isNoDingXiang != "1": curDir = os.path.dirname(__file__) chainPath = os.path.join(curDir, "dingxiang/DX-VM.lite.xctoolchain") keyPath = os.path.join(curDir, "dingxiang/license.key") targetDir = os.path.expanduser( os.path.join('~/Library/Developer/Toolchains', 'DX-VM.lite.xctoolchain')) if os.path.isdir(targetDir): shutil.rmtree(targetDir) targetFile = os.path.expanduser( os.path.join('~/Library/Developer/Toolchains', 'license.key')) if os.path.isfile(targetFile): os.remove(targetFile) Common.runCmd("mkdir -p ~/Library/Developer/Toolchains") Common.runCmd("cp -R %s %s ~/Library/Developer/Toolchains" % (chainPath, keyPath))
def modifyVersion(): Common.runCmd( '/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString %s" %s' % (m_versionName, m_infoPlistPath)) Common.runCmd('/usr/libexec/PlistBuddy -c "Set :CFBundleVersion %s" %s' % (m_buildName, m_infoPlistPath)) # 修改推送版本号,与游戏工程一致 Common.runCmd( '/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString %s" %s' % (m_versionName, m_notify_info_plist_path)) Common.runCmd('/usr/libexec/PlistBuddy -c "Set :CFBundleVersion %s" %s' % (m_buildName, m_notify_info_plist_path))
def buildTarget(): archivePath = getArchivePath() profileUUID = Common.getCmdResult( "/usr/libexec/PlistBuddy -c 'Print UUID' " + getTmpPlistPath()) notifyProfileUUID = Common.getCmdResult( "/usr/libexec/PlistBuddy -c 'Print UUID' " + getTmpNotifyPlistPath()) print 'notifyProfile uuid==%s m_newNotifyBundleId==%s' % ( notifyProfileUUID, m_newNotifyBundleId) p12Path = getAbspath("p12_path") p12Password = m_jsonObj["p12_password"] f = open(p12Path, 'rb') p12 = load_pkcs12(f.read(), p12Password) sign_key = p12.get_friendlyname() team_id = p12.get_certificate().get_subject().OU f.close() buildParams = ' '.join([ '-project', '%s.xcodeproj' % m_newProjName, '-scheme', m_newSchemeName, '-configuration', 'Release', '-archivePath', archivePath, 'archive', 'build', 'CODE_SIGN_IDENTITY="%s"' % sign_key, 'APP_PROVISIONING_PROFILE="%s"' % profileUUID, 'APP_BUNDLE_IDENTIFIER="%s"' % m_newBundleId, 'EXTENSION_PROFILE="%s"' % notifyProfileUUID, 'EXTENSION_BUNDLE_IDENTIFIER="%s"' % m_newNotifyBundleId, 'CODE_SIGN_STYLE="Manual"', 'DEVELOPMENT_TEAM="%s"' % team_id ]) # 添加顶象加固 if m_isNoDingXiang != "1": buildParams += " DX_FLAGS=-steec-extra-opts=-xse=100,-fla=50,-spli=50" buildParams += " -toolchain dx-vm.lite" else: buildParams += ' DX_FLAGS=""' cmd = 'cd %s;xcodebuild %s' % (m_projectDir, buildParams) Common.runCmd(cmd)
def modifyDisplayName(): cmd = '/usr/libexec/PlistBuddy -c "Set :CFBundleDisplayName %s" %s' % ( m_newDisplayName, m_infoPlistPath) Common.runCmd(cmd)
def modifyVersion(): Common.runCmd( '/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString %s" %s' % (m_versionName, m_infoPlistPath)) Common.runCmd('/usr/libexec/PlistBuddy -c "Set :CFBundleVersion %s" %s' % (m_buildName, m_infoPlistPath))
def cleanTarget(): Common.runCmd( 'cd %s/..;xcodebuild clean -project "%s.xcodeproj" -alltargets' % (m_projectDir, m_newProjName))