aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/build_commands.py
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-09-17 02:44:18 -0400
committerGitHub <noreply@github.com>2019-09-17 02:44:18 -0400
commit8bc8981ae5ccc54caf443663ddb51ab9053d3ad4 (patch)
tree6698d0f0f21122a62e6c50729e44b6511a7be735 /python/servo/build_commands.py
parent119cb894cd26606b7eff42c9ff96e719c3ccf539 (diff)
parentc1f9dfda254ebb2b1a38adf81baa45f4654c357f (diff)
downloadservo-8bc8981ae5ccc54caf443663ddb51ab9053d3ad4.tar.gz
servo-8bc8981ae5ccc54caf443663ddb51ab9053d3ad4.zip
Auto merge of #24149 - jdm:opt-in-msbuild, r=paulrouget
Add explicit packaging step for UWP apps <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24149) <!-- Reviewable:end -->
Diffstat (limited to 'python/servo/build_commands.py')
-rw-r--r--python/servo/build_commands.py78
1 files changed, 4 insertions, 74 deletions
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index e07a7666e0e..3846cd86877 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -249,15 +249,7 @@ class MachCommands(CommandBase):
env["CXXFLAGS"] += "-mmacosx-version-min=10.10"
if 'windows' in host:
- vsinstalldir = os.environ.get('VSINSTALLDIR')
- vcinstalldir = None
- vs_version = os.environ.get('VisualStudioVersion')
- if vsinstalldir and vs_version:
- msbuild_version = get_msbuild_version(vs_version)
- else:
- (vsinstalldir, vs_version, msbuild_version) = find_highest_msvc_version()
- msbuildinstalldir = os.path.join(vsinstalldir, "MSBuild",
- msbuild_version, "Bin")
+ vs_dirs = self.vs_dirs()
if host != target_triple and 'windows' in target_triple:
if os.environ.get('VisualStudioVersion'):
@@ -265,9 +257,9 @@ class MachCommands(CommandBase):
"Please run `python mach build [arguments]` to bypass automatic "
"Visual Studio shell.")
sys.exit(1)
- vcinstalldir = os.environ.get("VCINSTALLDIR", "") or os.path.join(vsinstalldir, "VC")
+ vcinstalldir = vs_dirs['vcdir']
if not os.path.exists(vcinstalldir):
- print("Can't find Visual C++ %s installation at %s." % (vs_version, vcinstalldir))
+ print("Can't find Visual C++ %s installation at %s." % (vs_dirs['vs_version'], vcinstalldir))
sys.exit(1)
env['PKG_CONFIG_ALLOW_CROSS'] = "1"
@@ -695,13 +687,9 @@ class MachCommands(CommandBase):
# UWP app packaging already bundles all required DLLs for us.
print("Packaging MSVC DLLs")
- if not package_msvc_dlls(servo_exe_dir, target_triple, vcinstalldir, vs_version):
+ if not package_msvc_dlls(servo_exe_dir, target_triple, vs_dirs['vcdir'], vs_dirs['vs_version']):
status = 1
- # UWP build hololens
- if uwp and status == 0:
- build_uwp_hololens(target_triple, dev, msbuildinstalldir)
-
elif sys.platform == "darwin":
# On the Mac, set a lovely icon. This makes it easier to pick out the Servo binary in tools
# like Instruments.app.
@@ -907,33 +895,6 @@ def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
return not missing
-def build_uwp_hololens(target, dev, msbuild_dir):
- # determine Visual studio Build Configuration (Debug/Release) and
- # Build Platform (x64 vs arm64)
- vs_platforms = {
- "x86_64": "x64",
- "i686": "x86",
- "aarch64": "arm64",
- }
- target_arch = target.split('-')[0]
- vs_platform = vs_platforms[target_arch]
-
- if dev:
- Configuration = "Debug"
- else:
- Configuration = "Release"
-
- # execute msbuild
- # Note: /m implies to use as many CPU cores as possible while building.
- # msbuild /m /p:project=ServoApp .\support\hololens\servoapp.sln /p:SolutionDir=.\support\hololens
- # /p:Configuration="Debug" /p:Platform="x64" /property:AppxBundle=Always;AppxBundlePlatforms="x64"
- check_call([msbuild_dir + "\msbuild.exe", "/m", "/p:project=ServoApp", ".\support\hololens\ServoApp.sln",
- "/p:SolutionDir=.\support\hololens",
- "/p:Configuration=" + Configuration,
- "/p:Platform=" + vs_platform,
- "/p:AppxBundle=Always;AppxBundlePlatforms=" + vs_platform])
-
-
def package_msvc_dlls(servo_exe_dir, target, vcinstalldir, vs_version):
# copy some MSVC DLLs to servo.exe dir
msvc_redist_dir = None
@@ -1002,34 +963,3 @@ def package_msvc_dlls(servo_exe_dir, target, vcinstalldir, vs_version):
for msvc_dll in missing:
print("DLL file `{}` not found!".format(msvc_dll))
return not missing
-
-
-def get_msbuild_version(vs_version):
- if vs_version in ("15.0", "14.0"):
- msbuild_version = vs_version
- else:
- msbuild_version = "Current"
- return msbuild_version
-
-
-def find_highest_msvc_version():
- editions = ["Enterprise", "Professional", "Community", "BuildTools"]
- prog_files = os.environ.get("ProgramFiles(x86)")
- base_vs_path = os.path.join(prog_files, "Microsoft Visual Studio")
-
- vs_versions = ["2019", "2017"]
- versions = {
- ("2019", "vs"): "16.0",
- ("2017", "vs"): "15.0",
- }
-
- for version in vs_versions:
- for edition in editions:
- vs_version = versions[version, "vs"]
- msbuild_version = get_msbuild_version(vs_version)
-
- vsinstalldir = os.path.join(base_vs_path, version, edition)
- if os.path.exists(vsinstalldir):
- return (vsinstalldir, vs_version, msbuild_version)
- print("Can't find MSBuild.exe installation under %s." % base_vs_path)
- sys.exit(1)