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

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

merged 4 commits into from Aug 22, 2019

Conversation

angelortiz1007
Copy link
Contributor

@angelortiz1007 angelortiz1007 commented Aug 13, 2019

… x64 and arm64 mach build -r/-d --uwp build process.

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.


  • There are tests for these changes OR
  • These changes do not require tests because by performing python mach build -r/-d --uwp ---win-arm64 or mach build -r/-d --uwp

This change is Reviewable

@angelortiz1007
Copy link
Contributor Author

Important note.
When building, the msbuild.exe must be within the %PATH%.
If you open a x86_64 VS2017 command prompt msbuild will be found.

if you perform a cross platform build by opening a regular command prompt, you must set the path to where msbuild.exe is prior to:

  1. set PKG_CONFIG_ALLOW_CROSS=1
  2. python mach build -r --uwp --win-arm64

Here is an attempt to determine the msbuild.exe path at build time.
VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\

location of Msbuild.exe => MSBuild\15.0\Bin

VisualStudioVersion =15.0

set MSBUILDDIR=%VSINSTALLDIR%MsBuild%VisualStudioVersion%\bin

@nirbheek
Copy link

Here is an attempt to determine the msbuild.exe path at build time.

The approach used in GStreamer's Cerbero build system is to extract PATH from the environment set by vcvarsall.bat: https://gitlab.freedesktop.org/gstreamer/cerbero/blob/master/cerbero/ide/vs/env.py#L106

Might be worth trying to do the same in Servo too.

@angelortiz1007
Copy link
Contributor Author

Here is an attempt to determine the msbuild.exe path at build time.

The approach used in GStreamer's Cerbero build system is to extract PATH from the environment set by vcvarsall.bat: https://gitlab.freedesktop.org/gstreamer/cerbero/blob/master/cerbero/ide/vs/env.py#L106
Might be worth trying to do the same in Servo too.

Thank you for looking at the pull request and providing this suggestion. I will review your suggestion!

Thank you,
Angel

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 13, 2019
Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start! I've left some comments for ways to make the code a bit more idiomatic and integrate better with the rest of the build system.

python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 15, 2019
@jdm
Copy link
Member

jdm commented Aug 15, 2019

@bors-servo try=windows

@bors-servo
Copy link
Contributor

⌛ Trying commit d28df22 with merge 55e471f...

bors-servo pushed a commit that referenced this pull request Aug 15, 2019
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 -->
@bors-servo
Copy link
Contributor

💔 Test failed - status-taskcluster

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Aug 15, 2019
@jdm
Copy link
Member

jdm commented Aug 15, 2019

@bors-servo retry

@bors-servo
Copy link
Contributor

⌛ Trying commit d28df22 with merge 227ad85...

bors-servo pushed a commit that referenced this pull request Aug 15, 2019
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 -->
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Aug 15, 2019
@angelortiz1007
Copy link
Contributor Author

Implemented changes requested by JDM and performed the below tests. Rebased changes and performed a pull request for testing.

Ran tests to verify the following passed:

  1. mach build -r/-d --uwp

  2. python mach build -r --uwp --win-arm64

  3. Tested return value from build_uwp_hololens() which calls check_call() by modifying msbuild parameter .\support\hololens\servoapp.sln to servoapp.sln2.
    Upon performing a build the logic introduced to set status = 1was tested. Output from test is shown below:
    MSBUILD : error MSB1009: Project file does not exist.
    Switch: .\support\hololens\servoapp.sln2
    Error running mach:

    ['build', '-r', '--uwp']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

CalledProcessError: Command 'm s b u i l d / m / p : p r o j e c t = S e r v o A p p . \ s u p p o r t \ h o l o l e n s \ s e r v o a p p . s l n 2 / p : S o l u t i o n D i r = . \ s u p p o r t \ h o l o l e n s / p : C o n f i g u r a t i o n = R e l e a s e / p : P l a t f o r m = x 6 4 / p : A p p x B u n d l e = A l w a y s ; A p p x B u n d l e P l a t f o r m s = x 6 4' returned non-zero exit status 1

File "C:\git-mozilla\angelortiz1007-2\python\servo\build_commands.py", line 702, in build
if build_uwp_hololens(target_triple, dev):
File "C:\git-mozilla\angelortiz1007-2\python\servo\build_commands.py", line 962, in build_uwp_hololens
check_call(msbuild_cmd + msbuild_conf)
File "C:\git-mozilla\angelortiz1007-2\python\servo\command_base.py", line 195, in check_call
raise subprocess.CalledProcessError(status, ' '.join(*args))

python/servo/build_commands.py Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
print("Angle Found...")
else:
print("Angle not found. Performing nuget to restore Angle package")
check_call(nuget_command)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing a single string, we should use a list:

check_call(["nuget", "restore", nuget_app])

python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
python/servo/build_commands.py Outdated Show resolved Hide resolved
@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 15, 2019
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Aug 19, 2019
@jdm
Copy link
Member

jdm commented Aug 19, 2019

@bors-servo try=windows

@bors-servo
Copy link
Contributor

⌛ Trying commit cd6b048 with merge cad7e83...

bors-servo pushed a commit that referenced this pull request Aug 19, 2019
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 -->
@bors-servo
Copy link
Contributor

💔 Test failed - status-taskcluster

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Aug 19, 2019
@jdm
Copy link
Member

jdm commented Aug 19, 2019

Error running mach:

    ['build', '--dev', '--uwp', '--win-arm64']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

CalledProcessError: Command 'msbuild /m /p:project=ServoApp .\support\hololens\ServoApp.sln /p:SolutionDir=.\support\hololens /p:Configuration=Debug /p:Platform=arm64 /p:AppxBundle=Always;AppxBundlePlatforms=arm64' returned non-zero exit status 1

  File "C:\Users\task_1566239357\repo\python\servo\build_commands.py", line 705, in build
    build_uwp_hololens(target_triple, dev)
  File "C:\Users\task_1566239357\repo\python\servo\build_commands.py", line 976, in build_uwp_hololens
    "/p:AppxBundle=Always;AppxBundlePlatforms=" + vs_platform])
  File "C:\Users\task_1566239357\repo\python\servo\command_base.py", line 195, in check_call
    raise subprocess.CalledProcessError(status, ' '.join(*args))

Let's try using check_output instead of check_call, which should give us any output from the failing msbuild command.

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 22, 2019
@CYBAI
Copy link
Member

CYBAI commented Aug 22, 2019

Build started 8/22/2019 3:41:12 AM.
     1>Project "C:\Users\task_1566430230\repo\support\hololens\ServoApp.sln" on node 1 (default targets).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Debug|x64".
     1>Project "C:\Users\task_1566430230\repo\support\hololens\ServoApp.sln" (1) is building "C:\Users\task_1566430230\repo\support\hololens\ServoApp\ServoApp.vcxproj" (2) on node 1 (default targets).
     2>C:\Users\task_1566430230\repo\support\hololens\ServoApp\ServoApp.vcxproj(323,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Windows.CppWinRT.2.0.190620.2\build\native\Microsoft.Windows.CppWinRT.props.
     2>Done Building Project "C:\Users\task_1566430230\repo\support\hololens\ServoApp\ServoApp.vcxproj" (default targets) -- FAILED.
     1>Done Building Project "C:\Users\task_1566430230\repo\support\hololens\ServoApp.sln" (default targets) -- FAILED.

Build FAILED.

       "C:\Users\task_1566430230\repo\support\hololens\ServoApp.sln" (default target) (1) ->
       "C:\Users\task_1566430230\repo\support\hololens\ServoApp\ServoApp.vcxproj" (default target) (2) ->
       (EnsureNuGetPackageBuildImports target) -> 
         C:\Users\task_1566430230\repo\support\hololens\ServoApp\ServoApp.vcxproj(323,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Windows.CppWinRT.2.0.190620.2\build\native\Microsoft.Windows.CppWinRT.props.

    0 Warning(s)
    1 Error(s)

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Aug 22, 2019
@jdm
Copy link
Member

jdm commented Aug 22, 2019

@bors-servo try=windows

@bors-servo
Copy link
Contributor

⌛ Trying commit 57adaaa with merge 0d7280a...

bors-servo pushed a commit that referenced this pull request Aug 22, 2019
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 -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-taskcluster
State: approved= try=True

@jdm
Copy link
Member

jdm commented Aug 22, 2019

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 57adaaa has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 22, 2019
@bors-servo
Copy link
Contributor

⌛ Testing commit 57adaaa with merge 382ebcc...

bors-servo pushed a commit that referenced this pull request Aug 22, 2019
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 -->
@bors-servo
Copy link
Contributor

💔 Test failed - status-taskcluster

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 22, 2019
@jdm
Copy link
Member

jdm commented Aug 22, 2019

@bors-servo retry

@bors-servo
Copy link
Contributor

💣 Failed to start rebuilding: Unknown error

@bors-servo
Copy link
Contributor

⌛ Testing commit 57adaaa with merge ee9b3b3...

bors-servo pushed a commit that referenced this pull request Aug 22, 2019
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 -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Aug 22, 2019
@bors-servo
Copy link
Contributor

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: jdm
Pushing ee9b3b3 to master...

@bors-servo bors-servo merged commit 57adaaa into servo:master Aug 22, 2019
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 22, 2019
@bors-servo bors-servo mentioned this pull request Aug 22, 2019
3 tasks
@angelortiz1007 angelortiz1007 deleted the servo-issue branch September 11, 2019 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support building UWP app from mach
6 participants