[zorg] r259974 - Build lld on Windows with VS 2015 and ninja; run lld tests.

Galina Kistanova via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 17:57:27 PST 2016


Author: gkistanova
Date: Fri Feb  5 19:57:26 2016
New Revision: 259974

URL: http://llvm.org/viewvc/llvm-project?rev=259974&view=rev
Log:
Build lld on Windows with VS 2015 and ninja; run lld tests.

Modified:
    zorg/trunk/zorg/buildbot/builders/LLDBuilder.py

Modified: zorg/trunk/zorg/buildbot/builders/LLDBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/LLDBuilder.py?rev=259974&r1=259973&r2=259974&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/LLDBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/LLDBuilder.py Fri Feb  5 19:57:26 2016
@@ -2,9 +2,13 @@ import os
 
 import buildbot
 import buildbot.process.factory
-from buildbot.steps.source import SVN, Git
-from buildbot.steps.shell import Configure, ShellCommand, SetProperty
-from buildbot.process.properties import WithProperties
+from buildbot.steps.source import SVN
+from buildbot.steps.shell import ShellCommand, SetProperty
+from buildbot.steps.slave import RemoveDirectory
+from buildbot.process.properties import WithProperties, Property
+from zorg.buildbot.builders.Util import getVisualStudioEnvironment
+from zorg.buildbot.builders.Util import extractSlaveEnvironment
+from zorg.buildbot.commands.NinjaCommand import NinjaCommand
 
 def getLLDBuildFactory(
            clean = True,
@@ -95,7 +99,14 @@ def getLLDBuildFactory(
 
 
 def getLLDWinBuildFactory(
-           clean = True):
+           clean = True,
+
+           # Default values for VS devenv and build configuration
+           vs = r"""%VS140COMNTOOLS%""",   # Visual Studio 2015.
+           target_arch = None,             # Native.
+
+           extra_configure_args=[],
+           env   = {}):
 
     llvm_srcdir = "llvm.src"
     llvm_objdir = "llvm.obj"
@@ -115,20 +126,20 @@ def getLLDWinBuildFactory(
                   workdir='%s/tools/lld' % llvm_srcdir))
 
     # Clean directory, if requested.
-    if clean:
-        f.addStep(ShellCommand(name="rm-llvm_objdir",
-                               command=["if", "exist", llvm_objdir,
-                                        "rmdir", "/S", "/Q", llvm_objdir],
-                               haltOnFailure=True,
-                               description=["rm build dir", "llvm"],
-                               workdir="."))
+    cleanBuildRequested = lambda step: step.build.getProperty("clean") or clean
+    f.addStep(RemoveDirectory(name='clean '+llvm_objdir,
+                dir=llvm_objdir,
+                haltOnFailure=False,
+                flunkOnFailure=False,
+                doStepIf=cleanBuildRequested
+                ))
 
     f.addStep(ShellCommand(name="create-build-dir",
-                           command=["if", "not", "exist", llvm_objdir,
-                                    "mkdir", llvm_objdir],
-                           haltOnFailure=True,
-                           description=["create build dir"],
-                           workdir="."))
+                command=["if", "not", "exist", llvm_objdir,
+                         "mkdir", llvm_objdir],
+                haltOnFailure=True,
+                description=["create build dir"],
+                workdir="."))
 
     # Is CMake configuration already done?
     checkCMakeCommand = [
@@ -147,36 +158,52 @@ def getLLDWinBuildFactory(
                           description=["check CMake_done"],
                           property="CMake_done"))
 
-    # Create configuration files with cmake
-    cmakeCommand = [
-        "cmake",
-        "-DCMAKE_BUILD_TYPE=Release",
-        "-DLLVM_TARGETS_TO_BUILD=X86",
-        "../%s" % llvm_srcdir]
+    # If set up environment step is requested, do this now.
+    if vs:
+        f.addStep(SetProperty(
+            command=getVisualStudioEnvironment(vs, target_arch),
+            extract_fn=extractSlaveEnvironment))
+        assert not env, "Can't have custom builder env vars with VS"
+        env = Property('slave_env')
+
+    # Always build with ninja.
+    cmakeCommand = ["cmake", "-G", "Ninja"]
+    # Reconsile configure args with the defaults we want.
+    if not any(a.startswith('-DCMAKE_BUILD_TYPE=')   for a in extra_configure_args):
+        cmakeCommand.append('-DCMAKE_BUILD_TYPE=Release')
+    if not any(a.startswith('-DLLVM_ENABLE_WERROR=') for a in extra_configure_args):
+        cmakeCommand.append('-DLLVM_ENABLE_WERROR=ON')
+    if not any(a.startswith('-DLLVM_ENABLE_ASSERTIONS=') for a in extra_configure_args):
+        cmakeCommand.append('-DLLVM_ENABLE_ASSERTIONS=ON')
+    if not any(a.startswith('-DLLVM_LIT_ARGS=') for a in extra_configure_args):
+        cmakeCommand.append('-DLLVM_LIT_ARGS=\"-v\"')
+
+    cmakeCommand += extra_configure_args + ["../%s" % llvm_srcdir]
 
+    # Note: ShellCommand does not pass the params with special symbols right.
+    # The " ".join is a workaround for this bug.
     f.addStep(ShellCommand(
         name="cmake-configure",
         description=["cmake configure"],
         haltOnFailure=True,
         command=WithProperties(" ".join(cmakeCommand)),
+        env=env,
         workdir=llvm_objdir,
         doStepIf=lambda step: step.build.getProperty("CMake_done") != "Yes"))
 
-    # Build Lld
-    f.addStep(ShellCommand(name="build_Lld",
-                               command=["msbuild",
-                                        #"/maxcpucount:1",
-                                        "/verbosity:minimal",
-                                        "/property:Configuration=Release",
-                                        "ALL_BUILD.vcxproj"],
-                               haltOnFailure=True,
-                               description=["build lld"],
-                               workdir=llvm_objdir))
+    # Build Lld.
+    f.addStep(NinjaCommand(name='build lld',
+                           haltOnFailure=True,
+                           description='build lld',
+                           workdir=llvm_objdir,
+                           env=env))
+
     # Test Lld
-    #f.addStep(ShellCommand(name="test_lld",
-    #                           command=["make", "lld-test"],
-    #                           haltOnFailure=True,
-    #                           description=["test lld"],
-    #                           workdir=llvm_objdir))
+    f.addStep(NinjaCommand(name='test lld',
+                           targets=['lld-test'],
+                           haltOnFailure=True,
+                           description='test lld',
+                           workdir=llvm_objdir,
+                           env=env))
 
     return f




More information about the llvm-commits mailing list