From 3dd1bfc31759de2b9008ed58c31eb8fe8915edb9 Mon Sep 17 00:00:00 2001 From: angelortiz1007 Date: Tue, 13 Aug 2019 11:30:10 -0500 Subject: [PATCH] Added support to download nuget and added python code to automate the x64 and arm64 mach build -r/-d --uwp build process. --- python/servo/build_commands.py | 83 +++++++++++++++--- python/servo/command_base.py | 1 + python/servo/packages.py | 1 + .../hololens/ServoApp/Package.appxmanifest | 2 +- support/hololens/ServoApp/ServoApp.vcxproj | 2 +- .../ServoApp/ServoApp_TemporaryKey.pfx | Bin 0 -> 2512 bytes 6 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 support/hololens/ServoApp/ServoApp_TemporaryKey.pfx 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 @@ - \ No newline at end of file + diff --git a/support/hololens/ServoApp/ServoApp.vcxproj b/support/hololens/ServoApp/ServoApp.vcxproj index d69034d2c14..e68434183cf 100644 --- a/support/hololens/ServoApp/ServoApp.vcxproj +++ b/support/hololens/ServoApp/ServoApp.vcxproj @@ -78,7 +78,7 @@ ServoApp_TemporaryKey.pfx - E4C66C57CCCED9BC20D14168E6D07460DC1EC503 + 8263338D5334DAD5918004E354DDCDCF8A2C2217 False False Always diff --git a/support/hololens/ServoApp/ServoApp_TemporaryKey.pfx b/support/hololens/ServoApp/ServoApp_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..4602aaa5a793cf1e20fb9339e30b4b4bbc578ba5 GIT binary patch literal 2512 zcmZXUcU05K7RP^q7ziLGfK(A9Ss@^VVgd*Y5`4M{gcdpqm;lldklsQU!GQE$L>4I$ zdJv>3O0Pzw$U<9cX3a%sAk%fhA3`_z~>wH6N50pK%V;@n_c_2yL2w4p{$98bs8d4BzDFg3Y zDtcZ0Z8T)d9jA6`OUg#~lCJ%GN|9#X+Q4W{(Q_q+!E*Gx$a|vMDE9unP)g&hIsBO2 zs;F>_|G@Tv>lHorg!59F+9i&6RUawXN2oC1DUU^XO!6F={h59;zPKdE z^Cs4#sMlxux_Y4Vhj=@bWmlXMeBxEhFdN|PkP^L(tdIPM+utGUNF^{qC(V6fa{ezPyXnt$Ax4{kHi ztBYxuoVa^N3u=|&zqgP`TDog*sEN08oF7fk`vCDkAIpe@?_>QwCFuOfbf*?X zr9Tp~fV{ZTOpYtJS=nsd+;;Tm@WOTWwrw|EFVO!I?VckL-A$Ejmh(kEL ztJAMM#B;@q+{1Tp4)VjA9i&MaaWG!}4F$tC^QBYFwdbM`-8{{B21K`zopXUGKWcGKE>H-+ur zpX|xt6Ef9%gvi(Y&bU5=Nc{MM^vdtQ5kZh zgId+rHW|{EOI2N3N*CPoGMC_ttUtCQJhr2lpZDF7gg=(r3Cf%Xmh7cl_(9{?p;!h| z1ua8-o;>PloRm|7+ng~jfw@uy2Pz5rw0INz5Gi&Fo)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