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 -->
This commit is contained in:
bors-servo 2019-08-22 16:54:13 -04:00 committed by GitHub
commit ee9b3b3864
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 75 additions and 33 deletions

View file

@ -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())
)

View file

@ -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 " +

View file

@ -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

View file

@ -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 = {

View file

@ -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",

View file

@ -33,4 +33,4 @@
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
</Package>

View file

@ -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>

Binary file not shown.