+++ /dev/null
-import logging as log
-import sys
-import getopt
-import os
-import subprocess
-import shutil
-import compile
-import tests
-import util
-
-target = ""
-arch = ""
-platform = ""
-workspace = ""
-fullbuilddirpath = ""
-cleanUp = True
-
-def ParseArgs(argv):
- global target
- global platform
- global arch
- global cleanUp
-
- returncode,target,platform,arch,cleanUp = util.ParseArgs(argv)
- return returncode
-
-def Initialize():
- global workspace
- workspace = util.Initialize(platform)
- return 0
-
-def SetupDirectories():
- global fullbuilddirpath
- fullbuilddirpath = util.SetupDirectories(target, arch, platform)
-
- return 0
-
-def CopyBinaries():
- print "\n==================================================\n"
- print "Stub for copying binaries"
- print "\n==================================================\n"
-
- return 0
-
-def main(argv):
- returncode = ParseArgs(argv)
- if returncode != 0:
- return returncode
-
- returncode += Initialize()
- if returncode != 0:
- return returncode
-
- returncode += SetupDirectories()
- if returncode != 0:
- return returncode
-
- returncode += compile.Compile(workspace, target, platform, arch)
- if returncode != 0:
- return returncode
-
- returncode += CopyBinaries()
- if returncode != 0:
- return returncode
-
- returncode += tests.RunTests(platform, fullbuilddirpath, workspace)
- if returncode != 0:
- return returncode
-
- return returncode
-
-if __name__ == "__main__":
- returncode = main(sys.argv[1:])
-
- util.Cleanup(cleanUp,workspace)
-
- sys.exit(returncode)
-
+++ /dev/null
-import logging as log
-import sys
-import getopt
-import os
-import subprocess
-import shutil
-
-def RunCMake(workspace, target, platform):
- # run CMake
- print "\n==================================================\n"
-
- returncode = 0
- if platform == "windows":
- print "Running: vcvarsall.bat x86_amd64 && " + workspace + "\ProjectK\NDP\clr\src\pal\\tools\gen-buildsys-win.bat " + workspace + "\ProjectK\NDP\clr"
- print "\n==================================================\n"
- sys.stdout.flush()
- returncode = subprocess.call(["vcvarsall.bat", "x86_amd64", "&&", workspace + "\ProjectK\NDP\clr\src\pal\\tools\gen-buildsys-win.bat", workspace + "\ProjectK\NDP\clr"])
- elif platform == "linux":
- print "Running: " + workspace + "/ProjectK/NDP/clr/src/pal/tools/gen-buildsys-clang.sh " + workspace + "/ProjectK/NDP/clr DEBUG"
- print "\n==================================================\n"
- sys.stdout.flush()
- scriptDir = "/ProjectK/NDP/clr/src/pal/tools"
- returncode = subprocess.call(workspace + "/ProjectK/NDP/clr/src/pal/tools/gen-buildsys-clang.sh " + workspace + "/ProjectK/NDP/clr " + target + " " + scriptDir, shell=True)
-
- if returncode != 0:
- print "ERROR: cmake failed with exit code " + str(returncode)
-
- return returncode
-
-def RunBuild(target, platform, arch):
- if platform == "windows":
- return RunMsBuild(target, arch)
- elif platform == "linux":
- return RunMake()
-
-def RunMsBuild(target, arch):
- # run MsBuild
- print "\n==================================================\n"
- print "Running: vcvarsall.bat x86_amd64 && msbuild CoreCLR.sln /p:Configuration=" + target + " /p:Platform=" + arch
- print "\n==================================================\n"
- sys.stdout.flush()
-
- returncode = subprocess.call(["vcvarsall.bat","x86_amd64","&&","msbuild","CoreCLR.sln","/p:Configuration=" + target,"/p:Platform=" + arch])
-
- if returncode != 0:
- print "ERROR: vcvarsall.bat failed with exit code " + str(returncode)
-
- return returncode
-
-def RunMake():
- print "\n==================================================\n"
- print "Running: make"
- print "\n==================================================\n"
- sys.stdout.flush()
- returncode = subprocess.call(["make"])
-
- if returncode != 0:
- print "ERROR: make failed with exit code " + str(returncode)
-
- return returncode
-
-def Compile(workspace, target, platform, arch):
- returncode = RunCMake(workspace, target, platform)
- if returncode != 0:
- return returncode
-
- returncode += RunBuild(target, platform, arch)
- if returncode != 0:
- return returncode
-
- return returncode
+++ /dev/null
-import sys
-import getopt
-import os
-import subprocess
-import shutil
-import logging as log
-
-def RunPalTests(fullbuilddirpath, workspace):
- print "\n==================================================\n"
- print "Running PAL Tests."
- print "\n==================================================\n"
-
- print "Running: " + workspace + "/ProjectK/NDP/clr/src/pal/tests/palsuite/runpaltests.sh " + fullbuilddirpath + " " + fullbuilddirpath + "/PalTestOutput"
- print "\n==================================================\n"
- sys.stdout.flush()
- returncode = subprocess.call(workspace + "/ProjectK/NDP/clr/src/pal/tests/palsuite/runpaltests.sh " + fullbuilddirpath + " " + fullbuilddirpath + "/PalTestOutput", shell=True)
-
- if returncode != 0:
- print "ERROR: there were errors failed with exit code " + str(returncode)
-
- return returncode
-
-
-def RunTests(platform, fullbuilddirpath, workspace):
- returncode = 0
-
- if platform == "linux":
- # Execute PAL tests
- returncode = RunPalTests(fullbuilddirpath, workspace)
-
- return returncode
-
-
+++ /dev/null
-import sys
-import getopt
-import os
-import subprocess
-import shutil
-import logging as log
-
-def Initialize(platform):
- print "Initializing Workspace"
- global workspace
- workspace = os.environ['WORKSPACE']
- if platform == "windows":
- # Jenkins puts quotes in the path, which is wrong. Remove quotes.
- os.environ['PATH'] = os.environ['PATH'].replace('"','')
-
- return workspace
-
-def ParseArgs(argv):
- print "Parsing arguments for compile"
- try:
- opts, args = getopt.getopt(argv, "t:p:a:v", ["target=", "platform=", "arch=", "verbose","noclean"])
- except getopt.GetoptError:
- print "ERROR: \n\t usage: python compile.py --target <target> --platform <windows|linux> --arch <arch> [--verbose] [--noclean]"
- return 2,"","","",True
-
- verbose = False
- cleanUp = True
-
- acceptedPlatforms = ['windows','linux']
-
- for opt, arg in opts:
- if opt in ("-t", "--target"):
- target = arg
- elif opt in ("-p", "--platform"):
- if arg.lower() not in acceptedPlatforms:
- print "ERROR: " + arg + "not an accepted platform. Use windows or linux."
- sys.exit(2)
- platform = arg.lower()
- elif opt in ("-a", "--arch"):
- arch = arg
- elif opt in ("-v", "--verbose"):
- verbose = True
- elif opt in ("-c", "--noclean"):
- cleanUp = False
-
- if verbose:
- log.basicConfig(format="%(levelname)s: %(message)s", level=log.DEBUG)
- log.info("In verbose mode.")
- else:
- log.basicConfig(format="%(levelname)s: %(message)s")
-
- if target == "" or platform == "" or arch == "":
- # must specify target, project and arch
- log.error("Must specify target, project and arch")
- return 2,"","","",True
-
- return 0,target,platform,arch,cleanUp
-
-def SetupDirectories(target, arch, platform):
- log.info("Setting up directories")
-
- global rootdir
- global builddir
- global fullBuildDirPath
-
- rootdir = "build"
- if not os.path.isdir(rootdir):
- os.mkdir(rootdir)
- os.chdir(rootdir)
-
- builddir = "build-" + platform
-
- if platform == "windows":
- builddir = builddir + "-" + arch + "-" + target
-
- if os.path.isdir(builddir):
- shutil.rmtree(builddir)
- os.mkdir(builddir)
- os.chdir(builddir)
-
- fullbuilddirpath = workspace + "/" + rootdir + "/" + builddir
-
- return fullbuilddirpath
-
-def Cleanup(cleanUp,workspace):
- print "\n==================================================\n"
- print "Cleaning Up."
- print "\n==================================================\n"
-
- if cleanUp:
- os.chdir(workspace + "/" + rootdir)
- shutil.rmtree(builddir)
- os.chdir("..")
- shutil.rmtree(rootdir)
-
- log.shutdown()
- return 0