Ejemplo n.º 1
0
    def compareTowDir(path, checkPath):

        copy = Copy()

        for item in os.walk(checkPath):

            if item[0]:
                resDir = item[0].replace(checkPath, path)
                if not os.path.exists(resDir):
                    copy.removeDir(item[0])
                    Tools.writeLog('remove dir = %s from %s' %
                                   (item[0], checkPath))
                    continue

            if not item[2]:
                continue

            for file in item[2]:

                # print os.path.splitext(file)[-1]
                if os.path.splitext(file)[-1] == ".DS_Store":
                    continue

                fullpath = os.path.join(item[0], file)
                resfullpath = fullpath.replace(checkPath, path)
                if not os.path.exists(resfullpath):
                    try:
                        os.remove(fullpath)
                        Tools.writeLog('remove file = %s from %s' %
                                       (file, fullpath))
                    except Exception, e:
                        print e
Ejemplo n.º 2
0
    def __init__(self, _rootpath, platform, platformCode):
        self.platfom_pxiel = platform
        self.rootpath = _rootpath
        self.platformCode = platformCode

        self.mainmkPath = _rootpath + "base/mk/Android.mk"
        self.storeMkPath = _rootpath + "jni/Android.mk"
        self.copy = Copy()
Ejemplo n.º 3
0
    def addDataToJson(path, key, value):
        jsonDic = json.loads(Copy().getFileData(path))
        if not key in jsonDic:
            jsonDic[key] = value
            print "path = %s" % (path)
            print json.dumps(jsonDic)

            Copy().saveDataToFile(
                path, json.dumps(jsonDic, indent=2, ensure_ascii=False))
        else:
            print "当前对象已经有字段 %s" % (key)
Ejemplo n.º 4
0
def assignToIOSPlatform(f, source):
    pPath = "../frameworks/runtime-src/proj.ios_mac/ios/%s/" % source
    if os.path.exists(pPath):
        path = "../frameworks/runtime-src/proj.ios_mac/ios/%s/res" % source
        print "path = %s" % path
        Copy().copyFiles(f, path)
    else:
        print "项目中不存在渠道%s" % source
Ejemplo n.º 5
0
 def changeJsonValue(path, key, value):
     jsonDic = json.loads(Copy().getFileData(path))
     if key in jsonDic:
         jsonDic[key] = value
         copy.saveDataToFile(
             path, json.dumps(jsonDic, indent=2, ensure_ascii=False))
     else:
         print "can't find key %s in json %s" % (key, path)
Ejemplo n.º 6
0
 def checkPlatformJson(path):
     jsonDic = json.loads(Copy().getFileData(path))
     url = jsonDic["game_loginUrl"]
     if '192' in url:
         Tools.alert("当前的是本地环境 地址是%s" % url)
     elif 'test' in url:
         Tools.alert("当前的是测试环境 地址是%s" % url)
     else:
         Tools.alert("当前的正式以布环境 地址是%s" % url)
Ejemplo n.º 7
0
    def __init__(self,
                 code_version='3.0',
                 platform_type=2,
                 platform="android",
                 pList=['default']):
        # self.platformList = ['qihoo','m4399','anzhi','baidu','downjoy','mi','nearme.gamecenter','uc']
        # self.talking_channel_list = ['000023','000108','000005','110000','000003','000066','000020','000255']

        # self.platformList = ['tencent','lenovo','huawei','youku','pps','kkk','wdj','mumayi']
        # self.talking_channel_list = ['000550','000016','000054','000466','000442','010001','010002','000008']
        # self.platformList = ['7659']
        # self.talking_channel_list = ['007659']

        # self.platformList = ['am']
        # self.talking_channel_list = ['000084']
        # self.platformList = ['shoumeng',"xunlei"]
        # self.talking_channel_list = ['shoumeng',"xunlei"]

        # yq
        # self.platformList = ['tailand']
        # self.talking_channel_list = ['tailand']
        self.platformList = pList
        self.talking_channel_list = ["%s_android" % n for n in pList]
        print(self.platformList)
        print("-----------------")
        print(self.talking_channel_list)

        # self.platformList = ['coolpad',"haima","m7659","maple","meizu","test","null","vivo"]
        # self.talking_channel_list = ['000078',"001104","007659","maple","000014","test","null","000368"]

        self.code_version = code_version
        self.platform_type = platform_type
        self.copy = Copy()

        if platform == "android":
            self.loginUrl = 'http://and.mx.maple-game.com/gateway.php'
        elif platform == "ios":
            self.loginUrl = ""
        else:
            raise Exception, "你输入的平台有误 只能接受android 和ios"

        self.root = 'frameworks/runtime-src/proj.android/platform/'
        self.storePath = "frameworks/runtime-src/proj.android/platform/%s/platform.json"
        self.template = 'frameworks/runtime-src/proj.android/template/'
Ejemplo n.º 8
0
    def checkIOSMusicDir():
        print "-----------------------"
        path = 'res/music/android'
        copy = Copy()

        if os.path.exists(path):
            copy.removeDir('music')
            copy.copyDir('res/music', 'music')
            copy.removeDir('res/music/android')
        else:
            print "can't fin res/music/android"
Ejemplo n.º 9
0
    def JSCToJS():
        copy = Copy()

        corePath = "frameworks/js-bindings/bindings/script"
        if Tools.rename(corePath, corePath + '_new'):
            copy.removeDir(corePath + '_new')

        if Tools.rename('src', 'src_new'):
            copy.removeDir('src_new')
Ejemplo n.º 10
0
#encoding=utf-8
from copyFile import Copy
import os, sys, json

copy = Copy()

#findFile = ''
ctn = 0


def main():
    global ctn
    data = copy.getFileData('platform.txt')
    print data
    for (n, p) in json.loads(data)['code'].items():
        file = '../frameworks/runtime-src/proj.android/platform/%s/src/org/cocos2dx/javascript/MyApplication.java' % p
        if os.path.exists(file):
            os.system('open %s' % file)
            print "open platform =  %s \t\tfile = %s" % (p, file)
            ctn = ctn + 1

    baseFile = 'frameworks/runtime-src/proj.android/base/src/org/cocos2dx/javascript/MyApplication.java'
    os.system('open %s' % baseFile)
    print "total open %s files" % ctn


if __name__ == '__main__':
    main()
Ejemplo n.º 11
0
class CreatePlatformJson(object):
    def __init__(self,
                 code_version='3.0',
                 platform_type=2,
                 platform="android",
                 pList=['default']):
        # self.platformList = ['qihoo','m4399','anzhi','baidu','downjoy','mi','nearme.gamecenter','uc']
        # self.talking_channel_list = ['000023','000108','000005','110000','000003','000066','000020','000255']

        # self.platformList = ['tencent','lenovo','huawei','youku','pps','kkk','wdj','mumayi']
        # self.talking_channel_list = ['000550','000016','000054','000466','000442','010001','010002','000008']
        # self.platformList = ['7659']
        # self.talking_channel_list = ['007659']

        # self.platformList = ['am']
        # self.talking_channel_list = ['000084']
        # self.platformList = ['shoumeng',"xunlei"]
        # self.talking_channel_list = ['shoumeng',"xunlei"]

        # yq
        # self.platformList = ['tailand']
        # self.talking_channel_list = ['tailand']
        self.platformList = pList
        self.talking_channel_list = ["%s_android" % n for n in pList]
        print(self.platformList)
        print("-----------------")
        print(self.talking_channel_list)

        # self.platformList = ['coolpad',"haima","m7659","maple","meizu","test","null","vivo"]
        # self.talking_channel_list = ['000078',"001104","007659","maple","000014","test","null","000368"]

        self.code_version = code_version
        self.platform_type = platform_type
        self.copy = Copy()

        if platform == "android":
            self.loginUrl = 'http://and.mx.maple-game.com/gateway.php'
        elif platform == "ios":
            self.loginUrl = ""
        else:
            raise Exception, "你输入的平台有误 只能接受android 和ios"

        self.root = 'frameworks/runtime-src/proj.android/platform/'
        self.storePath = "frameworks/runtime-src/proj.android/platform/%s/platform.json"
        self.template = 'frameworks/runtime-src/proj.android/template/'
        # self.storePath = "%s.json"

    def copyF(self, f, t):
        print "copy   ", f, "  =================>  ", t
        if not os.path.exists(t):

            self.copy.copyFile(f, t)

    def copyD(self, f, t):
        for item in os.walk(f):
            if not item[2]:
                continue
            # print "f = ",f," t = ",t
            for file in item[2]:
                f_ = os.path.join(item[0], file)
                # print 'f_',"   ===   > ",f_  ,"   file  ",file
                t_ = f_.replace(f, t)
                # print 't_',"   ===   > ",t_
                self.copyF(f_, t_)

        # if not os.path.exists(t):
        # 	self.copy.copyFiles(f,t)

    def start(self):
        cnt = len(self.platformList)

        for i in range(cnt):
            platform = self.platformList[i]
            channel_id = self.talking_channel_list[i]
            # self.copy.copyFiles(self.template + 'src',self.root + platform + '/src')

            self.createDirFiles(platform)

            path = self.storePath % platform
            jsonInfo = {}
            jsonInfo["game_loginUrl"] = self.loginUrl
            jsonInfo["platform_name"] = platform
            jsonInfo["platform_version"] = self.code_version
            jsonInfo["platform_type"] = self.platform_type
            jsonInfo["platform_desc"] = platform
            jsonInfo["talkingData_channel"] = channel_id
            jsonInfo["game_code_version"] = '' + self.code_version
            jsonInfo["exit_model"] = 0
            jsonInfo["crashCode"] = "1"
            jsonInfo["use_yaya_sdk"] = 1
            exit_model_desc = "0:  使用游戏内退出方式  1:使用sdk的退出"
            jsonInfo["exit_model_desc"] = exit_model_desc

            f = open(path, 'w')
            f.write(json.dumps(jsonInfo, indent=2, ensure_ascii=False))
            f.close()

            # print "handler ",path,"\nvalue:\n",json.dumps(jsonInfo)

        print "successfull"

    def createDirFiles(self, platform):
        path = self.root + platform
        # self.copy.removeDir(path)
        self.copy.createDir(path)

        self.copy.createDir(path + '/libs')
        self.copy.createDir(path + '/assets')
        self.copy.createDir(path + '/res')
        self.copy.createDir(path + '/src/org/cocos2dx/javascript/platform')
        self.copyF(self.template + 'ForManifest.xml',
                   path + '/ForManifest.xml')
        self.copyD(self.template + 'src', self.root + platform + '/src')
Ejemplo n.º 12
0
def assignToAndroidPlatform(f, source):
    pPath = "../frameworks/runtime-src/proj.android/res"
    if os.path.exists(pPath):
        Copy().copyFiles(f, pPath)
    else:
        print "项目中不存在渠道%s" % source
Ejemplo n.º 13
0
class CreateAndroidMk:

    platfom_pxiel = ''

    mainmk = ""

    mainmkPath = ""
    storeMkPath = ""

    rootpath = ""

    platformCode = 0

    push_platform = ""

    log_platform = ""

    copy = ""

    changeMK = False

    def setPushPlatform(self, pn):
        self.push_platform = pn

    def setLogPlatform(self, pn):
        self.log_platform = pn

    def __init__(self, _rootpath, platform, platformCode):
        self.platfom_pxiel = platform
        self.rootpath = _rootpath
        self.platformCode = platformCode

        self.mainmkPath = _rootpath + "base/mk/Android.mk"
        self.storeMkPath = _rootpath + "jni/Android.mk"
        self.copy = Copy()

    def openFileByWrite(self, path, info):
        path = self.rootpath + path
        f = open(path, 'w')
        f.write(info)
        f.close()

    #读取文件内容
    def getFileData(self, path):
        f = open(path, 'r')
        str = f.read()
        f.close()
        return str

    def saveFile(self, path, info):
        f = open(path, 'w')
        f.write(info)
        f.close()

    #替换文件内容
    #fromStr 源内容
    #flagStr 替换标记
    #replaceStr 替换后内容
    def replaceData(self, fromStr, flagStr, replaceStr):
        #print "flagStr == ",flagStr ,"  replaceStr == ",replaceStr
        return fromStr.replace(flagStr, replaceStr)

    def start(self):
        self.mainmk = self.getFileData(self.mainmkPath)

        platform_mk = self.rootpath + "platform/" + self.platfom_pxiel + "/mk/Android.mk"

        if os.path.exists(platform_mk):
            platform_mk_str = self.getFileData(platform_mk)
            self.mainmk = self.replaceData(self.mainmk, "#platform_so",
                                           platform_mk_str)
            #print "current mk info = \n",self.mainmk
#------------------------- push platform ------------------------------------------------------------

        if self.push_platform.strip():
            pushmkPath = self.rootpath + "push/" + self.push_platform + "/mk/Android.mk"
            #print "pushmkPath = ",pushmkPath
            if os.path.exists(pushmkPath):
                pushmk_str = self.getFileData(pushmkPath)
                self.mainmk = self.replaceData(self.mainmk, "#push_so",
                                               pushmk_str)

# print "current mk info = \n",self.mainmk
#-------------------------- end push platform ---------------------------------------------------------

#-------------------------- start Log platform --------------------------------------------------------
        if self.log_platform.strip():
            logmkPath = self.rootpath + "log/" + self.log_platform + "/mk/Android.mk"
            if os.path.exists(logmkPath):
                loghmk_str = self.getFileData(logmkPath)
                self.mainmk = self.replaceData(self.mainmk, "#log_so",
                                               loghmk_str)

#-------------------------- end log platform ----------------------------------------------------------
        oldMkInfo = self.getFileData(self.storeMkPath)
        if not cmp(oldMkInfo, self.mainmk) == 0:
            tkMessageBox.showinfo("警告", "mk  文件修改了 这下编译so文件的时候又得重新编了")
            self.saveFile(self.storeMkPath, self.mainmk)
        else:
            print "mk文件没变"
            self.changeMK = True

    def __copySoFiles__(self, fromDir, toDir):
        if os.path.exists(fromDir):
            self.copy.copyFiles(fromDir, toDir)

    def copySoFilesToCocos(self):
        toDir = self.rootpath + "jni/prebuild"
        if not self.changeMK:
            return
        #print "copySoFilesToCocos(self):"

        platfor_prebuild_path = self.rootpath + "platform/" + self.platfom_pxiel + "/prebuild"
        self.__copySoFiles__(platfor_prebuild_path, toDir)

        push_prebuild_path = self.rootpath + "push/" + self.push_platform + "/prebuild"
        self.__copySoFiles__(push_prebuild_path, toDir)

        log_prebuild_path = self.rootpath + "log/" + self.push_platform + "/prebuild"
        self.__copySoFiles__(log_prebuild_path, toDir)

    #这个是不编译cpp的处理方式
    def copySoFilesToAndroid(self):
        toDir = self.rootpath + "libs/armeabi"
        self.copy.removeFileByFilter(
            toDir, ['libcocos2djs.so', 'gdb.setup', 'gdbserver'])

        platfor_prebuild_path = self.rootpath + "platform/" + self.platfom_pxiel + "/prebuild"
        self.__copySoFiles__(platfor_prebuild_path, toDir)

        push_prebuild_path = self.rootpath + "push/" + self.push_platform + "/prebuild"
        self.__copySoFiles__(push_prebuild_path, toDir)

        log_prebuild_path = self.rootpath + "log/" + self.log_platform + "/prebuild"
        self.__copySoFiles__(log_prebuild_path, toDir)
Ejemplo n.º 14
0
 def __init__(self, rootPath):
     self._rootPath = rootPath
     self.copy = Copy()
Ejemplo n.º 15
0
class Plugin:

    _rootPath = ""
    copy = ""

    platform_assets = "platform_assets"
    currentPlatform = ""

    def __init__(self, rootPath):
        self._rootPath = rootPath
        self.copy = Copy()

    """
    将临时资源拷贝到项目中
    """

    def tempAssetsToAndroidProject(self):
        self.copy.copyFiles(self.platform_assets, self.fromDir + "assets")

    def registerGamePlatform(self,
                             fromBaseDir,
                             toBaseDir,
                             platformCode,
                             operationCode,
                             platformname="default"):
        if os.path.exists(self.platform_assets):
            shutil.rmtree(self.platform_assets)

        os.mkdir(self.platform_assets)

        self.fromDir = fromBaseDir
        self.toDir = toBaseDir
        """
        平台的assets
        """
        if operationCode == 1:
            self.copy.copyFiles(fromBaseDir + "assets", self.platform_assets)
        elif operationCode == 2:
            self.copy.copyFiles(fromBaseDir + "assets", toBaseDir + "assets")

        self.copy.copyFiles(toBaseDir + "base/assets", toBaseDir + "assets")
        """ 复制 android res """
        Assets().removeAssetsByFilter(toBaseDir + "res", [])
        self.copy.copyFiles(toBaseDir + "base/res", toBaseDir + "res")
        print "copy ", fromBaseDir, " res"
        self.copy.copyFiles(fromBaseDir + "res", toBaseDir + "res")

        mainJsPath = "main.js"
        #if os.path.exists("frameworks/runtime-src/proj.android/platform/main.jsc"):
        #mainJsPath = "main.jsc"

        #if platformCode == 0:
        #self.copy.copyFile(fromBaseDir + mainJsPath, mainJsPath)
        #else:
        # self.copy.copyFile("frameworks/runtime-src/proj.android/platform/" + mainJsPath, mainJsPath)

        # self.copy.removeFileByFilter(toBaseDir + "libs",[])
        """  复制libs """
        # libsList = ["armeabi","armeabi-v7a","mips","x86"]
        self.copy.removeDir(toBaseDir + "libs")

        self.copy.copyFiles(toBaseDir + "base/libs", toBaseDir + "libs")
        self.copy.copyFiles(fromBaseDir + "libs", toBaseDir + "libs")

        # for name in libsList:
        #     ppath = fromBaseDir + 'libs/' + name
        #     if not os.path.exists(ppath):
        #         print "remove unused"
        #         self.copy.removeDir(toBaseDir + 'libs/' + name)

        appPath = 'src/org/cocos2dx/javascript/MyApplication.java'
        self.copy.copyFile(toBaseDir + 'base/' + appPath, toBaseDir + appPath)

        myActivity = 'src/org/cocos2dx/javascript/AppActivity.java'
        self.copy.copyFile(toBaseDir + 'base/' + myActivity,
                           toBaseDir + myActivity)
        """  复制平台代码 """
        Assets().removeAssetsByFilter(
            toBaseDir + "src/org/cocos2dx/javascript/platform",
            ['base', 'PlatformManager.java'])
        # Assets().removeAssetsByFilter(toBaseDir + "src/com/maple/hope/",[])
        Assets().removeAssetsByFilter(toBaseDir + "src/com/", ["android"])
        # self.copy.removeDir(toBaseDir + "src")
        # self.copy.copyFiles(toBaseDir + "base/src",toBaseDir + "src")
        self.copy.copyFiles(toBaseDir + "base/src", toBaseDir + "src")
        self.copy.copyFiles(fromBaseDir + "src", toBaseDir + "src")

        self.copy.copyFile(fromBaseDir + "AndroidManifest.xml",
                           toBaseDir + "AndroidManifest.xml")
        """ 复制平台配置 """
        platformJson = "platform.json"
        self.copy.copyFile(fromBaseDir + platformJson, platformJson)
        self.copy.copyFile(fromBaseDir + platformJson,
                           toBaseDir + 'assets/' + platformJson)

        # #-------------------------------   clear platform code ---------------------------------------
        # #baidu
        # self.copy.removeFileByFilter(toBaseDir + "src/org/cocos2dx/javascript/platform/baidu",[])
        # #oppo
        # self.copy.removeDir(toBaseDir + "src/com/nearme/gamecenter/open/api")

        # #-------------------------------   clear platform code ---------------------------------------

        # #-------------------------------   add platform code -----------------------------------------
        # # baidu_platform
        # if platformCode == 4:
        #     self.refisterBaidu(fromBaseDir,toBaseDir)
        # elif platformCode == 5:
        #     self.registerOppo(fromBaseDir,toBaseDir)
        #-------------------------------   add platform code ----------------------------------------

    def backFileToPlatfrom(self, f, t, t2=""):
        if os.path.exists(t):
            self.copy.copyFile(f, t)
        elif os.path.exists(t2):
            self.copy.copyFile(f, t2)

    """  将在项目中修改的平台代码保存到平台中去 """

    def backToPlatform(self):
        """  平台相关 src  """
        tailPath = 'src/org/cocos2dx/javascript/platform'
        info = self.copy.getFileData('python/log.txt')
        if info == "":
            return
        recoderList = info.split('_')
        platformname = recoderList[0]

        print "将当前项目中修改数据回退到平台%s" % platformname

        # curPlatJsonPath = "frameworks/runtime-src/proj.android/assets/platform.json"
        # jsonData = json.loads(self.copy.getFileData(curPlatJsonPath))
        # if not jsonData['platform_name'] == platformname:
        #     tkMessageBox.showinfo("通知","平台不当 保存的是%s,而当前是%s"%(platformname,jsonData['platform_name']))
        #     return

        headPath = 'frameworks/runtime-src/proj.android/'
        fromDir = headPath + tailPath
        toDir = headPath + 'platform/' + platformname + '/' + tailPath

        print "fromDir = ", fromDir, "  toDir = ", toDir
        for item in os.walk(fromDir):
            # print 'javascript/platform/base    ',item[0] ,'javascript/platform/base' in item[0]
            if not item[2] or 'javascript/platform/base' in item[0]:
                print "filter file%s" % item[0]
                continue

            filterList = ['.DS_Store', 'PlatformManager.java']
            for file in item[2]:
                if file in filterList:
                    continue
                fromPath = os.path.join(item[0], file)
                toPath = fromPath.replace(fromDir, toDir)
                # print fromPath , " ======> ",toPath
                self.copy.copyFile(fromPath, toPath)
        """ handler MyApplication """

        backFiles = [
            "src/org/cocos2dx/javascript/MyApplication.java",
            "src/org/cocos2dx/javascript/AppActivity.java",
            "src/org/cocos2dx/javascript/LoadingActivity.java"
        ]
        for file in backFiles:
            self.backFileToPlatfrom(
                headPath + file,
                headPath + 'platform/' + platformname + '/' + file,
                headPath + 'base/' + file)
        """      back to push   """
        pushname = recoderList[1]
        pushPath = headPath + 'src/org/cocos2dx/javascript/push'
        self.copy.copyFiles(pushPath, headPath + 'push/' + pushname + '/src')
        """  项目配置 """
        self.copy.copyFile(
            headPath + 'assets/platform.json',
            headPath + 'platform/' + platformname + '/platform.json')
        self.copy.copyFile(headPath + 'assets/main.js', 'main.js')
        """  about com dir"""
        for item in os.walk(headPath + "src/com"):
            if not item[2]:
                continue

            for file in item[2]:
                fromFile = os.path.join(item[0], file)
                toFile = fromFile.replace(
                    headPath + "src/com",
                    headPath + "platform/" + platformname + "/src/com", 1)
                if os.path.exists(toFile):
                    self.copy.copyFile(fromFile, toFile)

    def registerPushPlatform(self, fromBaseDir, toBaseDir, pushCode, p=None):

        javaDir = toBaseDir + "src/org/cocos2dx/javascript/push"
        self.copy.removeDir(javaDir)
        self.copy.copyFiles(fromBaseDir + 'src', javaDir)
        """
             tt平台需要用自己的android-support-v4.jar 而这个版本比push里的高,只能特殊处理下了  
        """
        # if not p == "tencent":
        #     self.copy.copyFiles(fromBaseDir + "assets",toBaseDir + "assets")
        #     if not p =="tt":
        #         self.copy.copyFiles(fromBaseDir + "libs",toBaseDir + "libs")
        #     else:
        #         self.copy.copyFiles(fromBaseDir + "libs",toBaseDir + "libs",filterFiles=['android-support-v4.jar'])
        filterList = ["tt", "yeshen"]
        self.copy.copyFiles(fromBaseDir + "assets", toBaseDir + "assets")
        if not p in filterList:
            self.copy.copyFiles(fromBaseDir + "libs", toBaseDir + "libs")
        else:
            self.copy.copyFiles(fromBaseDir + "libs",
                                toBaseDir + "libs",
                                filterFiles=['android-support-v4.jar'])
        self.currentPlatform = p

    def registerLogPlatform(self, fromBaseDir, toBaseDir):
        self.copy.copyFiles(fromBaseDir + "assets", self.platform_assets)
        self.copy.copyFiles(fromBaseDir + "libs", toBaseDir + "libs")
        self.copy.copyFiles(fromBaseDir + "res", toBaseDir + "res")

#---------------------------------------- platform --------------------------------------------------------------------

    def refisterBaidu(self, fromBaseDir, toBaseDir):
        self.copy.copyFiles(fromBaseDir + "src",
                            toBaseDir + "src/org/cocos2dx/javascript/platform")

    def registerOppo(self, fromBaseDir, toBaseDir):
        dirPath = "src/com/nearme/gamecenter/open/api"
        self.copy.copyFiles(fromBaseDir + dirPath, toBaseDir + dirPath)

#---------------------------------------- push -------------------------------------------------------------------------

    def registerXgPush(self, fromBaseDir, toBaseDir):
        javaPath = toBaseDir + "src/com/qq/xgdemo/receiver/MessageReceiver.java"
        #self.copy.removeFile(javaPath)
        self.copy.copyFile(fromBaseDir + "MessageReceiver.java", javaPath)

        javaPath = toBaseDir + "src/com/qq/xgdemo/receiver/XGNotification.java"
        #self.copy.removeFile(javaPath)
        self.copy.copyFile(fromBaseDir + "XGNotification.java", javaPath)

        javaPath = toBaseDir + "src/com/qq/xgdemo/receiver/NotificationService.java"
        #self.copy.removeFile(javaPath)
        self.copy.copyFile(fromBaseDir + "NotificationService.java", javaPath)

        javaPath = toBaseDir + "src/com/qq/xgdemo/receiver/DBOpenHelper.java"
        #self.copy.removeFile(javaPath)
        self.copy.copyFile(fromBaseDir + "DBOpenHelper.java", javaPath)

#------------------------- unit function -------------------------------

    def copyFile(self, fromPath, toPath):
        self.copyFile(fromPath, toPath)
Ejemplo n.º 16
0
def main(key, value):
    nameMap = json.loads(Copy().getFileData('platform.txt'))["code"]
    for (code, _name) in nameMap.items():
        path = "../frameworks/runtime-src/proj.android/platform/%s/platform.json" % _name
        Tools.addDataToJson(path, key, value)