示例#1
0
文件: build.py 项目: Check-Please/cx
def clearFolder(path, protectedList=None):
    protected = set(['.gitignore']);
    if protectedList != None:
        infil = bash.readfile(protectedList);
        for row in csv.reader(infil):
            protected |= set(row);
        infil.close()
    for fil in bash.ls(path):
        if not fil in protected:
            bash.rm_r(path+"/"+fil);
示例#2
0
def clearFolder(path, protectedList=None):
    protected = set(['.gitignore'])
    if protectedList != None:
        infil = bash.readfile(protectedList)
        for row in csv.reader(infil):
            protected |= set(row)
        infil.close()
    for fil in bash.ls(path):
        if not fil in protected:
            bash.rm_r(path + "/" + fil)
示例#3
0
文件: build.py 项目: chkex/cx
def compileServerOnlyTemplates(src, mVars, mFuns, package=[]):
    tmpPath = src+"/"+tmpFolder;
    if not bash.exists(tmpPath):
        bash.mkdir(tmpPath);
    for fil in bash.ls(src):
        path = src+"/"+fil;
        if bash.isdir(path) and fil != tmpFolder:
            compileServerOnlyTemplates(path, mVars, mFuns, package+[fil]);
        elif fil.endswith(tmpltExt):
            fil = fil[:len(fil)-len(tmpltExt)];
            assert(bash.exists(src+"/"+fil+".tspec"));
            tmpTmplt = tmpPath+"/"+fil+".tmplt"; 
            tmpTspec = tmpPath+"/"+fil+".tspec"; 
            bash.cp_r(src+"/"+fil+".tmplt", tmpTmplt);
            bash.cp_r(src+"/"+fil+".tspec", tmpTspec);
            macros.run(tmpTmplt, mVars, mFuns);
            macros.run(tmpTspec, mVars, mFuns);
            compileTemplateToJava(tmpPath+"/"+fil, package);
    bash.rm_r(tmpPath);
示例#4
0
def compileServerOnlyTemplates(src, mVars, mFuns, package=[]):
    tmpPath = src + "/" + tmpFolder
    if not bash.exists(tmpPath):
        bash.mkdir(tmpPath)
    for fil in bash.ls(src):
        path = src + "/" + fil
        if bash.isdir(path) and fil != tmpFolder:
            compileServerOnlyTemplates(path, mVars, mFuns, package + [fil])
        elif fil.endswith(tmpltExt):
            fil = fil[:len(fil) - len(tmpltExt)]
            assert (bash.exists(src + "/" + fil + ".tspec"))
            tmpTmplt = tmpPath + "/" + fil + ".tmplt"
            tmpTspec = tmpPath + "/" + fil + ".tspec"
            bash.cp_r(src + "/" + fil + ".tmplt", tmpTmplt)
            bash.cp_r(src + "/" + fil + ".tspec", tmpTspec)
            macros.run(tmpTmplt, mVars, mFuns)
            macros.run(tmpTspec, mVars, mFuns)
            compileTemplateToJava(tmpPath + "/" + fil, package)
    bash.rm_r(tmpPath)
示例#5
0
文件: build.py 项目: Check-Please/cx
projectsForApp = set([]);
projectsForAppFil = bash.readfile("build/app-web-projects.csv");
for row in csv.reader(projectsForAppFil):
    projectsForApp |= set(row);
projectsForAppFil.close();

makeWebXML("server/servlet-list.csv",
        javaProjDir+"/war/WEB-INF/web.xml");

mVars, mFuns = macros.load("build/macros");
mVars['TEST'] = "false";
mVars['DEBUG'] = "true" if debug else "false";
mVars['LOCAL'] = "true" if local else "false";
if bash.exists(javaTmpltDir):
    bash.rm_r(javaTmpltDir);
compileServerOnlyTemplates("server/templates", mVars, mFuns);

platforms = ["web", "iOS"];
platformPaths = [javaProjDir+"/war", "iOS/Checkout Express/www"];

if bash.exists(tmpFolder):
    bash.rm_r(tmpFolder);
bash.cp_r("webprojects", tmpFolder);
compileFolder(tmpFolder);
for i in xrange(0, len(platforms)):
    if bash.exists(platformPaths[i]):
        clearFolder(platformPaths[i],
            "server/protected_war.csv" if i == 0 else None)
    else:
        bash.mkdir(platformPaths[i])
示例#6
0
    server = localServer if local else webServer

projectsForApp = set([])
projectsForAppFil = bash.readfile("build/app-web-projects.csv")
for row in csv.reader(projectsForAppFil):
    projectsForApp |= set(row)
projectsForAppFil.close()

makeWebXML("server/servlet-list.csv", javaProjDir + "/war/WEB-INF/web.xml")

mVars, mFuns = macros.load("build/macros")
mVars['TEST'] = "false"
mVars['DEBUG'] = "true" if debug else "false"
mVars['LOCAL'] = "true" if local else "false"
if bash.exists(javaTmpltDir):
    bash.rm_r(javaTmpltDir)
compileServerOnlyTemplates("server/templates", mVars, mFuns)

platforms = ["web", "iOS"]
platformPaths = [javaProjDir + "/war", "iOS/Checkout Express/www"]

if bash.exists(tmpFolder):
    bash.rm_r(tmpFolder)
bash.cp_r("webprojects", tmpFolder)
compileFolder(tmpFolder)
for i in xrange(0, len(platforms)):
    if bash.exists(platformPaths[i]):
        clearFolder(platformPaths[i],
                    "server/protected_war.csv" if i == 0 else None)
    else:
        bash.mkdir(platformPaths[i])