Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support to download nuget and added python code to automate the… #23961

Merged
merged 4 commits into from Aug 22, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Added support to download nuget and added python code to automate the…

… x64 and arm64 mach build -r/-d --uwp build process.
  • Loading branch information
angelortiz1007 authored and jdm committed Aug 22, 2019
commit 3dd1bfc31759de2b9008ed58c31eb8fe8915edb9
@@ -248,18 +248,31 @@ def build(self, release=False, dev=False, jobs=None, params=None,
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 @@ def build(self, release=False, dev=False, jobs=None, params=None,

# 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 @@ def package_generated_shared_libraries(libs, build_path, servo_exe_dir):
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 @@ def package_openxr_dlls(self, env, servo_exe_dir, target):
return True


def angle_root(target, nuget_env):
arch = {

This conversation was marked as resolved by angelortiz1007

This comment has been minimized.

@jdm

jdm Aug 15, 2019

Member

nit: remove this blank line.

This comment has been minimized.

@angelortiz1007

angelortiz1007 Aug 15, 2019

Author Contributor

Done.

This comment has been minimized.

@jdm

jdm Aug 15, 2019

Member

It's still there :)

"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
@@ -614,6 +614,7 @@ def build_env(self, hosts_file_path=None, target=None, is_build=False, test_unit
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 = {
@@ -7,6 +7,7 @@
"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",
@@ -33,4 +33,4 @@
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
</Package>
@@ -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.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.