1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <Project xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" >
3+ <PropertyGroup >
4+ <Cache >$(MSBuildThisFileDirectory)../.cache/</Cache >
5+ </PropertyGroup >
6+ <Target Name =" CleanChrome" BeforeTargets =" Clean" >
7+ <RemoveDir
8+ Directories =" $(OutDir)chrome-for-testing-$(Version)"
9+ Condition =" Exists('$(OutDir)chrome-for-testing-$(Version)')"
10+ />
11+ </Target >
12+ <Target Name =" DownloadChromeInBuild" AfterTargets =" Build" >
13+ <MakeDir Directories =" $(Cache)" Condition =" !Exists('$(Cache)')" />
14+ <MakeDir Directories =" $(OutDir)chrome-for-testing-$(Version)"
15+ Condition =" !Exists('$(OutDir)chrome-for-testing-$(Version)')" />
16+ <!-- Linux-->
17+ <Exec Command =" uname -m" ConsoleToMSBuild =" true"
18+ Condition =" $([MSBuild]::IsOSPlatform('Linux'))" >
19+ <Output TaskParameter =" ConsoleOutput" PropertyName =" OSArchitecture" />
20+ </Exec >
21+ <Error Text =" Only x86_64 is supported on linux"
22+ Condition =" $([MSBuild]::IsOSPlatform('Linux')) AND '$(OSArchitecture)' != 'x86_64'" />
23+ <PropertyGroup >
24+ <ChromePlatrofm Condition =" $([MSBuild]::IsOSPlatform('Linux')) AND '$(OSArchitecture)' == 'x86_64'" >linux64</ChromePlatrofm >
25+ </PropertyGroup >
26+ <DownloadFile
27+ Condition =" $([MSBuild]::IsOSPlatform('Linux'))"
28+ SourceUrl =" https://github.com/madcoons/chrome-for-testing-nuget/releases/download/v$(Version)/chrome-linux64.tar.gz"
29+ DestinationFolder =" $(Cache)"
30+ DestinationFileName =" chrome-linux64.tar.gz" >
31+ </DownloadFile >
32+ <Exec
33+ Command =" tar -xf '$(Cache)chrome-linux64.tar.gz' -C '$(OutDir)chrome-for-testing-$(Version)'"
34+ Condition =" $([MSBuild]::IsOSPlatform('Linux')) And !Exists('$(OutDir)chrome-for-testing-$(Version)/chrome-root')" />
35+ <!-- MacOS-->
36+ <Exec Command =" uname -m" ConsoleToMSBuild =" true"
37+ Condition =" $([MSBuild]::IsOSPlatform('OSX'))" >
38+ <Output TaskParameter =" ConsoleOutput" PropertyName =" OSArchitecture" />
39+ </Exec >
40+ <Error Text =" Only x86_64 and arm64 are supported on mac"
41+ Condition =" $([MSBuild]::IsOSPlatform('OSX')) AND '$(OSArchitecture)' != 'x86_64' AND '$(OSArchitecture)' != 'arm64'" />
42+ <PropertyGroup >
43+ <ChromePlatrofm Condition =" $([MSBuild]::IsOSPlatform('OSX')) AND '$(OSArchitecture)' == 'arm64'" >mac-arm64</ChromePlatrofm >
44+ <ChromePlatrofm Condition =" $([MSBuild]::IsOSPlatform('OSX')) AND '$(OSArchitecture)' == 'x86_64'" >mac-x64</ChromePlatrofm >
45+ </PropertyGroup >
46+ <DownloadFile
47+ Condition =" $([MSBuild]::IsOSPlatform('OSX'))"
48+ SourceUrl =" https://storage.googleapis.com/chrome-for-testing-public/$(ChromeVersion)/$(ChromePlatrofm)/chrome-$(ChromePlatrofm).zip"
49+ DestinationFolder =" $(Cache)"
50+ DestinationFileName =" chrome.zip" >
51+ </DownloadFile >
52+ <Exec
53+ Command =" unzip '$(Cache)chrome.zip' -d '$(OutDir)chrome-for-testing-$(Version)'"
54+ Condition =" $([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(OutDir)chrome-for-testing-$(Version)/chrome-$(ChromePlatrofm)')" />
55+ </Target >
56+
57+ <Target Name =" DownloadChromeInPublish" AfterTargets =" Publish" >
58+ <MakeDir Directories =" $(Cache)" Condition =" !Exists('$(Cache)')" />
59+ <MakeDir Directories =" $(PublishDir)chrome-for-testing-$(Version)"
60+ Condition =" !Exists('$(PublishDir)chrome-for-testing-$(Version)')" />
61+ <!-- Linux-->
62+ <Exec Command =" uname -m" ConsoleToMSBuild =" true"
63+ Condition =" $([MSBuild]::IsOSPlatform('Linux'))" >
64+ <Output TaskParameter =" ConsoleOutput" PropertyName =" OSArchitecture" />
65+ </Exec >
66+ <Error Text =" Only x86_64 is supported on linux"
67+ Condition =" $([MSBuild]::IsOSPlatform('Linux')) AND '$(OSArchitecture)' != 'x86_64'" />
68+ <PropertyGroup >
69+ <ChromePlatrofm Condition =" $([MSBuild]::IsOSPlatform('Linux')) AND '$(OSArchitecture)' == 'x86_64'" >linux64</ChromePlatrofm >
70+ </PropertyGroup >
71+ <DownloadFile
72+ Condition =" $([MSBuild]::IsOSPlatform('Linux'))"
73+ SourceUrl =" https://github.com/madcoons/chrome-for-testing-nuget/releases/download/v$(Version)/chrome-linux64.tar.gz"
74+ DestinationFolder =" $(Cache)"
75+ DestinationFileName =" chrome-linux64.tar.gz" >
76+ </DownloadFile >
77+ <Exec
78+ Command =" tar -xf '$(Cache)chrome-linux64.tar.gz' -C '$(PublishDir)chrome-for-testing-$(Version)'"
79+ Condition =" $([MSBuild]::IsOSPlatform('Linux')) And !Exists('$(PublishDir)chrome-for-testing-$(Version)/chrome-root')" />
80+ <!-- MacOS-->
81+ <Exec Command =" uname -m" ConsoleToMSBuild =" true"
82+ Condition =" $([MSBuild]::IsOSPlatform('OSX'))" >
83+ <Output TaskParameter =" ConsoleOutput" PropertyName =" OSArchitecture" />
84+ </Exec >
85+ <Error Text =" Only x86_64 and arm64 are supported on mac"
86+ Condition =" $([MSBuild]::IsOSPlatform('OSX')) AND '$(OSArchitecture)' != 'x86_64' AND '$(OSArchitecture)' != 'arm64'" />
87+ <PropertyGroup >
88+ <ChromePlatrofm Condition =" $([MSBuild]::IsOSPlatform('OSX')) AND '$(OSArchitecture)' == 'arm64'" >mac-arm64</ChromePlatrofm >
89+ <ChromePlatrofm Condition =" $([MSBuild]::IsOSPlatform('OSX')) AND '$(OSArchitecture)' == 'x86_64'" >mac-x64</ChromePlatrofm >
90+ </PropertyGroup >
91+ <DownloadFile
92+ Condition =" $([MSBuild]::IsOSPlatform('OSX'))"
93+ SourceUrl =" https://storage.googleapis.com/chrome-for-testing-public/$(ChromeVersion)/$(ChromePlatrofm)/chrome-$(ChromePlatrofm).zip"
94+ DestinationFolder =" $(Cache)"
95+ DestinationFileName =" chrome.zip" >
96+ </DownloadFile >
97+ <Exec
98+ Command =" unzip '$(Cache)chrome.zip' -d '$(PublishDir)chrome-for-testing-$(Version)'"
99+ Condition =" $([MSBuild]::IsOSPlatform('OSX')) And !Exists('$(PublishDir)chrome-for-testing-$(Version)/chrome-$(ChromePlatrofm)')" />
100+ </Target >
101+ </Project >
0 commit comments