Пример #1
0
def updateChannel(channel,ishd): 
    print("updateChannel")
    # project_config = common.GetProjectConfigApp() + "/android" + "/gradle"
    targetDir = common.GetRootDirAndroidStudio()
    sourceDir = common.GetProjectConfigApp()
    project_android = "android/project"
    rootAndroidStudio = common.GetRootDirAndroidStudio()
    targetDir = rootAndroidStudio+"/src/main"

    if ishd==True: 
        project_android = "android/project_hd"

    if channel == source.GP:
        config_adsdk_android.SetAdSdk(source.ADMOB, True) 
        config_adsdk_android.SetAdSdk(source.ADVIEW, False)
        config_adsdk_android.SetAdSdk(source.GDT, False)
        config_adsdk_android.SetAdSdk(source.XIAOMI, False)
        config_adsdk_android.SetAdSdk(source.UNITY, True)
        config_adsdk_android.SetAdSdk(source.MOBVISTA, False)   
            # 
        project_config = sourceDir+"/"+project_android+"/config" 
        xml = sourceDir+"/"+project_android+"/xml_gp" 

    else:
        xml = sourceDir+"/"+project_android+"/xml"
        config_adsdk_android.SetAdSdk(source.ADMOB, True)
        config_adsdk_android.SetAdSdk(source.MOBVISTA, False)
        config_adsdk_android.SetAdSdk(source.UNITY, True)
            # 
        project_config = sourceDir+"/"+project_android+"/config"
        
    common.coverFiles(project_config,   targetDir)
    common.coverFiles(xml,   targetDir)

    build_gradle = common.GetProjectConfigApp() + "/android" + "/gradle/build"
    # or (channel == source.GP)
    if (channel == source.TAPTAP) :
        build_gradle = build_gradle+"_"+channel 

    build_gradle = build_gradle+".gradle"

    #配置build.grade
    #common.coverFiles(build_gradle,   targetDir)

    build_gradle_dst = rootAndroidStudio+"/build.gradle"
    flag = os.path.exists(build_gradle_dst)
    if flag:
        os.remove(build_gradle_dst)

    common.copyOneFile(build_gradle,build_gradle_dst)

    #  "channel_android": "xiaomi"
    file = getConfigJsonFile()
    print ("channel_android="+file)
    strStart = "channel_android\": \""
    strEnd = "\""
    strOut = replaceStringOfFile(file, strStart, strEnd, channel)
    saveString2File(strOut, file)
# 主函数的实现
if __name__ == "__main__":

    print ("脚本名:", sys.argv[0])
    cmdPath = common.cur_file_dir()
    count = len(sys.argv)
    isHD = False

    for i in range(1, count):
        print ("参数", i, sys.argv[i])
        if i == 1:
            cmdPath = sys.argv[i]

        if i == 2:
            if sys.argv[i] == "hd":
                isHD = True

    common.SetCmdPath(cmdPath)

    android_studio_dir = common.GetRootDirAndroidStudio()
    # python 里无法直接执行cd目录,要用chdir改变当前的工作目录
    os.chdir(android_studio_dir)

    for channel in listChannel:
        print "apk_build_all:" + channel
        appchannel.updateChannel(channel,isHD) 
        apk_build.buildApk()
        apk_build.copyApk(channel)

    print "apk_build_all sucess"
Пример #3
0
import os.path
import time, datetime

#include common.py
sys.path.append('./common')
import common

#主函数的实现
if __name__ == "__main__":

    #入口参数:http://blog.csdn.net/intel80586/article/details/8545572
    cmdPath = common.cur_file_dir()
    count = len(sys.argv)
    for i in range(1, count):
        print("参数", i, sys.argv[i])
        if i == 1:
            cmdPath = sys.argv[i]

    common.SetCmdPath(cmdPath)

    # rootDir ="/Users/jaykie/sourcecode/cocos2dx/product/game/ertong"
    rootAndroidStudio = common.GetRootDirAndroidStudio()
    rootiOSXcode = common.GetRootDirXcode()
    rootCode = common.GetRootDir() + "/ios_code_unity_moon"

    #
    targetDir = rootiOSXcode + "/Classes"
    common.copyFiles(rootCode, targetDir)

    print "copy_ios_code sucess"
def GetRootDirAdSdkJavaCode():
    return common.GetRootDirAndroidStudio(
    ) + "/src/main/java/com/moonma/common/adkit/platform"
def GetRootDirLibs():
    return common.GetRootDirAndroidStudio() + "/libs"
import os.path
import time
import datetime
import sys
# include common.py
sys.path.append('./common')
import common


# 主函数的实现
if __name__ == "__main__":

    cmdPath = common.cur_file_dir()
    count = len(sys.argv)
    for i in range(1, count):
        print("参数", i, sys.argv[i])
        if i == 1:
            cmdPath = sys.argv[i]

    common.SetCmdPath(cmdPath)

    targetDir = common.GetRootDirAndroidStudio()

    # build
    dir2 = targetDir + "/build"
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)

    print("apk_build_clean sucess")