diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-08-22 16:54:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-22 16:54:13 -0400 |
commit | ee9b3b3864ee7988d45e861c19b57b706160edcf (patch) | |
tree | 8038dab46048611691f777bcc10746b7794d9c1d | |
parent | 52b63b7088035aa2f67ccf030ccf181d5f97e954 (diff) | |
parent | 57adaaaf1880ba00e3f9f0c5b75fbeb28c0f20a9 (diff) | |
download | servo-ee9b3b3864ee7988d45e861c19b57b706160edcf.tar.gz servo-ee9b3b3864ee7988d45e861c19b57b706160edcf.zip |
Auto merge of #23961 - angelortiz1007:servo-issue, r=jdm
Added support to download nuget and added python code to automate the…
… x64 and arm64 mach build -r/-d --uwp build process.
<!-- Please describe your changes on the following line: -->
Modified/added python code to:
1. Download nuget which is required for building support\HoloLens
2. added python code to perform a nuget install/restore ServoApp.sln which causes the Angle libraries to be installed so that mach build will succeed.
3. added python code to perform a MsBuild of the support\HoloLens\ServoApp.sln solution so that mach build will build ServoApp and create a ServoApp .appx install file.
Note: The Msbuild path must be present otherwise the msbuild command will fail.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #23753 (GitHub issue number if applicable)
<!-- Either: -->
- [x] There are tests for these changes OR
- [x] These changes do not require tests because by performing python mach build -r/-d --uwp ---win-arm64 or mach build -r/-d --uwp
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- 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/23961)
<!-- Reviewable:end -->
-rw-r--r-- | etc/taskcluster/decision_task.py | 16 | ||||
-rw-r--r-- | etc/taskcluster/windows/first-boot.ps1 | 1 | ||||
-rw-r--r-- | python/servo/build_commands.py | 83 | ||||
-rw-r--r-- | python/servo/command_base.py | 1 | ||||
-rw-r--r-- | python/servo/packages.py | 1 | ||||
-rw-r--r-- | support/hololens/ServoApp/Package.appxmanifest | 2 | ||||
-rw-r--r-- | support/hololens/ServoApp/ServoApp.vcxproj | 4 | ||||
-rw-r--r-- | support/hololens/ServoApp/ServoApp_TemporaryKey.pfx | bin | 0 -> 2512 bytes |
8 files changed, 75 insertions, 33 deletions
diff --git a/etc/taskcluster/decision_task.py b/etc/taskcluster/decision_task.py index fee990f3252..4400e62ba5a 100644 --- a/etc/taskcluster/decision_task.py +++ b/etc/taskcluster/decision_task.py @@ -377,14 +377,6 @@ def windows_arm64(): return ( windows_build_task("UWP dev build", arch="arm64", package=False) .with_treeherder("Windows arm64") - .with_file_mount( - "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", - path="nuget.exe" - ) - .with_script( - "%HOMEDRIVE%%HOMEPATH%\\nuget.exe install ANGLE.WindowsStore.Servo \ - -Version 2.1.13 -o %HOMEDRIVE%%HOMEPATH%\\repo\\support\\hololens\\packages", - ) .with_script("python mach build --dev --uwp --win-arm64") .find_or_create("build.windows_uwp_arm64_dev." + CONFIG.task_id()) ) @@ -394,14 +386,6 @@ def windows_uwp_x64(): return ( windows_build_task("UWP dev build", package=False) .with_treeherder("Windows x64") - .with_file_mount( - "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", - path="nuget.exe" - ) - .with_script( - "%HOMEDRIVE%%HOMEPATH%\\nuget.exe install ANGLE.WindowsStore.Servo \ - -Version 2.1.13 -o %HOMEDRIVE%%HOMEPATH%\\repo\\support\\hololens\\packages", - ) .with_script("mach build --dev --uwp") .find_or_create("build.windows_uwp_x64_dev." + CONFIG.task_id()) ) diff --git a/etc/taskcluster/windows/first-boot.ps1 b/etc/taskcluster/windows/first-boot.ps1 index f77ed2a2fe3..d27814d40c9 100644 --- a/etc/taskcluster/windows/first-boot.ps1 +++ b/etc/taskcluster/windows/first-boot.ps1 @@ -77,6 +77,7 @@ $client.DownloadFile("https://aka.ms/vs/15/release/vs_buildtools.exe", "C:\vs_bu Start-Process C:\vs_buildtools.exe -ArgumentList (` "--passive --norestart --includeRecommended " + "--add Microsoft.VisualStudio.Workload.VCTools " + + "--add Microsoft.VisualStudio.Workload.UniversalBuildTools " + "--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 " + "--add Microsoft.VisualStudio.Component.VC.ATL " + "--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 " + diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 4aa72a457fc..0f1459df482 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -248,18 +248,31 @@ class MachCommands(CommandBase): env['CXXFLAGS'] = '' env["CXXFLAGS"] += "-mmacosx-version-min=10.10" - vcinstalldir = None - vs_version = None + if 'windows' in host: + vcinstalldir = None + msbuildinstalldir = None + vs_version = "15.0" + editions = ["Enterprise", "Professional", "Community", "BuildTools"] + prog_files = os.environ.get("ProgramFiles(x86)") + base_vs_path = os.path.join(prog_files, "Microsoft Visual Studio", "2017") + + for edition in editions: + # C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin + # C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\amd64 + msbuildinstalldir = os.path.join(base_vs_path, edition, "MSBuild", vs_version, "Bin") + if os.path.exists(msbuildinstalldir): + break + else: + print("Can't find MSBuild.exe installation at %s." % base_vs_path) + sys.exit(1) + if host != target_triple and 'windows' in target_triple: if os.environ.get('VisualStudioVersion'): print("Can't cross-compile for Windows inside of a Visual Studio shell.\n" "Please run `python mach build [arguments]` to bypass automatic " "Visual Studio shell.") sys.exit(1) - editions = ["Enterprise", "Professional", "Community", "BuildTools"] - prog_files = os.environ.get("ProgramFiles(x86)") - base_vs_path = os.path.join(prog_files, "Microsoft Visual Studio", "2017") - vs_version = "15.0" + for edition in editions: vcinstalldir = os.path.join(base_vs_path, edition, "VC") if os.path.exists(vcinstalldir): @@ -291,14 +304,7 @@ class MachCommands(CommandBase): # Ensure that the NuGet ANGLE package containing libEGL is accessible # to the Rust linker. - append_to_path_env( - path.join( - os.getcwd(), "support", "hololens", "packages", - "ANGLE.WindowsStore.Servo.2.1.13", "bin", "UAP", arch['angle'] - ), - env, - "LIB" - ) + append_to_path_env(angle_root(target_triple, env), env, "LIB") # Don't want to mix non-UWP libraries with vendored UWP libraries. if "gstreamer" in env['LIB']: @@ -707,6 +713,10 @@ class MachCommands(CommandBase): if not package_msvc_dlls(servo_exe_dir, target_triple, vcinstalldir, vs_version): status = 1 + # UWP build hololens + if uwp: + 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. @@ -776,6 +786,24 @@ class MachCommands(CommandBase): return True +def angle_root(target, nuget_env): + arch = { + + "aarch64": "arm64", + "x86_64": "x64", + } + angle_arch = arch[target.split('-')[0]] + angle_default_path = path.join(os.getcwd(), "support", "hololens", "packages", + "ANGLE.WindowsStore.Servo.2.1.13", "bin", "UAP", angle_arch) + + # Nuget executable command + nuget_app = path.join(os.getcwd(), "support", "hololens", "ServoApp.sln") + if not os.path.exists(angle_default_path): + check_call(['nuget.exe', 'restore', nuget_app], env=nuget_env) + + return angle_default_path + + def package_gstreamer_dlls(env, servo_exe_dir, target, uwp): gst_root = gstreamer_root(target, env) if not gst_root: @@ -917,6 +945,33 @@ 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 diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 94757dbf3b9..9784b0a1af1 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -614,6 +614,7 @@ install them, let us know by filing a bug!") extra_path += [path.join(self.msvc_package_dir("cmake"), "bin")] extra_path += [path.join(self.msvc_package_dir("llvm"), "bin")] extra_path += [path.join(self.msvc_package_dir("ninja"), "bin")] + extra_path += [self.msvc_package_dir("nuget")] arch = (target or host_triple()).split('-')[0] vcpkg_arch = { diff --git a/python/servo/packages.py b/python/servo/packages.py index 1da0d49b13d..ca69b105233 100644 --- a/python/servo/packages.py +++ b/python/servo/packages.py @@ -7,6 +7,7 @@ WINDOWS_MSVC = { "llvm": "8.0.0", "moztools": "3.2", "ninja": "1.7.1", + "nuget": "08-08-2019", "openssl": "111.3.0+1.1.1c-vs2017", "gstreamer-uwp": "1.16.0.3", "openxr-loader-uwp": "1.0", diff --git a/support/hololens/ServoApp/Package.appxmanifest b/support/hololens/ServoApp/Package.appxmanifest index 52e5909a712..8eb1a55ef74 100644 --- a/support/hololens/ServoApp/Package.appxmanifest +++ b/support/hololens/ServoApp/Package.appxmanifest @@ -33,4 +33,4 @@ <Capabilities> <Capability Name="internetClient" /> </Capabilities> -</Package>
\ No newline at end of file +</Package> diff --git a/support/hololens/ServoApp/ServoApp.vcxproj b/support/hololens/ServoApp/ServoApp.vcxproj index d69034d2c14..327ffdc8868 100644 --- a/support/hololens/ServoApp/ServoApp.vcxproj +++ b/support/hololens/ServoApp/ServoApp.vcxproj @@ -12,7 +12,7 @@ <AppContainerApplication>true</AppContainerApplication> <ApplicationType>Windows Store</ApplicationType> <ApplicationTypeRevision>10.0</ApplicationTypeRevision> - <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.17763.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> @@ -78,7 +78,7 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup> <PackageCertificateKeyFile>ServoApp_TemporaryKey.pfx</PackageCertificateKeyFile> - <PackageCertificateThumbprint>E4C66C57CCCED9BC20D14168E6D07460DC1EC503</PackageCertificateThumbprint> + <PackageCertificateThumbprint>8263338D5334DAD5918004E354DDCDCF8A2C2217</PackageCertificateThumbprint> <GenerateAppInstallerFile>False</GenerateAppInstallerFile> <AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision> <AppxBundle>Always</AppxBundle> diff --git a/support/hololens/ServoApp/ServoApp_TemporaryKey.pfx b/support/hololens/ServoApp/ServoApp_TemporaryKey.pfx Binary files differnew file mode 100644 index 00000000000..4602aaa5a79 --- /dev/null +++ b/support/hololens/ServoApp/ServoApp_TemporaryKey.pfx |