[zorg] r352726 - Added ability to ClangAndLLDBuilder to choose version of Visual Studio to build with.

Galina Kistanova via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 30 21:29:01 PST 2019


Author: gkistanova
Date: Wed Jan 30 21:29:00 2019
New Revision: 352726

URL: http://llvm.org/viewvc/llvm-project?rev=352726&view=rev
Log:
Added ability to ClangAndLLDBuilder to choose version of Visual Studio to build with.

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

Modified: zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py?rev=352726&r1=352725&r2=352726&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py (original)
+++ zorg/trunk/zorg/buildbot/builders/ClangAndLLDBuilder.py Wed Jan 30 21:29:00 2019
@@ -5,10 +5,13 @@ import buildbot.process.factory
 from buildbot.steps.source import SVN
 from buildbot.steps.shell import ShellCommand
 from buildbot.steps.shell import WarningCountingShellCommand
-from buildbot.process.properties import WithProperties
+from buildbot.steps.shell import SetProperty
+from buildbot.process.properties import WithProperties, Property
 from zorg.buildbot.commands.LitTestCommand import LitTestCommand
 from zorg.buildbot.commands.NinjaCommand import NinjaCommand
 
+import zorg.buildbot.builders.Util as builders_util
+
 def getClangAndLLDBuildFactory(
            clean=True,
            env=None,
@@ -18,6 +21,11 @@ def getClangAndLLDBuildFactory(
            buildWithSanitizerOptions=None,
            triple=None,
            isMSVC=False,
+           # Choose VS tools to build with. For example,
+           # "autodetect" to find the latest installed Visual Studio, or
+           # %VS140COMNTOOLS% to selects the 2015 toolchain.
+           vs=None,
+           target_arch=None,
            prefixCommand=["nice", "-n", "10"], # For backward compatibility.
            extraLitArgs=None
     ):
@@ -30,6 +38,7 @@ def getClangAndLLDBuildFactory(
         'TERM' : 'dumb' # Make sure Clang doesn't use color escape sequences.
                  }
     if env is not None:
+        assert not (isMSVC and vs), "Can't have custom builder env vars with VS"
         # Overwrite pre-set items with the given ones, so user can set anything.
         merged_env.update(env)
 
@@ -132,6 +141,13 @@ def getClangAndLLDBuildFactory(
         "../%s" % llvm_srcdir
     ]
 
+    if isMSVC and vs:
+        # Set up VS environment, if requested.
+        f.addStep(SetProperty(
+            command=builders_util.getVisualStudioEnvironment(vs, target_arch),
+            extract_fn=builders_util.extractSlaveEnvironment))
+        merged_env = Property('slave_env')
+
     # 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",




More information about the llvm-commits mailing list