2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
4
using System ;
5
- using System . Collections ;
6
- using System . Collections . Generic ;
7
5
using System . IO ;
8
6
using System . Linq ;
9
- using System . Runtime . InteropServices ;
10
- using JetBrains . Annotations ;
11
7
using Nuke . Common ;
12
- using Nuke . Common . CI . GitHubActions ;
13
- using Nuke . Common . Git ;
14
8
using Nuke . Common . IO ;
15
9
using Nuke . Common . Tooling ;
16
- using Nuke . Common . Tools . DotNet ;
17
- using Nuke . Common . Tools . Git ;
18
- using Octokit ;
19
- using Octokit . Internal ;
20
- using static Nuke . Common . IO . CompressionTasks ;
10
+ using Nuke . Common . Utilities . Collections ;
21
11
using static Nuke . Common . IO . FileSystemTasks ;
22
- using static Nuke . Common . IO . HttpTasks ;
23
- using static Nuke . Common . Tooling . ProcessTasks ;
24
- using static Nuke . Common . Tools . DotNet . DotNetTasks ;
25
- using static Nuke . Common . Tools . Git . GitTasks ;
26
- using static Nuke . Common . Tools . GitHub . GitHubTasks ;
27
12
28
13
partial class Build {
29
- // NOTE: Disabled until space issues are resolved! If you are a user who needs this please submit a PR!
14
+ // NOTE: Enabled only on MacOS until space issues are resolved! If you are a user who needs this please submit a PR!
30
15
31
- // AbsolutePath AnglePath => RootDirectory / "build" / "submodules" / "ANGLE";
16
+ Target Angle => CommonTarget
17
+ (
18
+ x => x . Before ( Compile )
19
+ . After ( Clean )
20
+ . Executes
21
+ (
22
+ ( ) =>
23
+ {
24
+ var tempDir = ( AbsolutePath ) Directory . CreateTempSubdirectory ( "silkDotNetAngleBuild" ) . FullName ;
25
+ InheritedShell ( $ "git clone --depth 1 --single-branch https://chromium.googlesource.com/chromium/tools/depot_tools.git", tempDir ) . AssertZeroExitCode ( ) ;
26
+ AddToPath ( tempDir / "depot_tools" ) ;
32
27
33
- // Target Angle => CommonTarget
34
- // (
35
- // x => x.Before(Compile)
36
- // .After(Clean)
37
- // .Executes
38
- // (
39
- // () =>
40
- // {
41
- // var @out = AnglePath / "out" / "Release";
42
- // EnsureCleanDirectory(@out);
43
- // var zip = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
44
- // var unzip = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
45
- // HttpDownloadFile("https://storage.googleapis.com/chrome-infra/depot_tools.zip", zip);
46
- // UncompressZip(zip, unzip);
47
- // if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())
48
- // {
49
- // InheritedShell($"chmod -R 777 \"{unzip}\"");
50
- // }
28
+ if ( OperatingSystem . IsWindows ( ) )
29
+ {
30
+ Environment . SetEnvironmentVariable ( "DEPOT_TOOLS_WIN_TOOLCHAIN" , "0" ) ;
31
+ }
51
32
52
- // AddToPath(unzip);
53
- // if (OperatingSystem.IsWindows())
54
- // {
55
- // Environment.SetEnvironmentVariable("DEPOT_TOOLS_WIN_TOOLCHAIN", "0");
56
- // }
33
+ var angleSourceDir = tempDir / "angle_source" ;
34
+ EnsureCleanDirectory ( angleSourceDir ) ;
35
+ InheritedShell ( "fetch --no-history angle" , angleSourceDir ) . AssertZeroExitCode ( ) ;
57
36
58
- // InheritedShell("python scripts/bootstrap.py", AnglePath).AssertZeroExitCode();
59
- // InheritedShell("gclient sync", AnglePath).AssertZeroExitCode();
60
- // if (OperatingSystem.IsLinux())
61
- // {
62
- // InheritedShell("sudo ./build/install-build-deps.sh", AnglePath).AssertZeroExitCode();
63
- // }
37
+ // save space
38
+ // DeleteDirectory takes too long (it deletes individual files)
39
+ Directory . Delete ( angleSourceDir / "third_party" / "VK-GL-CTS" , true ) ; // this is only possible because we disable tests below
40
+ Directory . Delete ( angleSourceDir / "third_party" / "dawn" , true ) ; // this is only possible because we disable wgpu below
41
+ ( angleSourceDir / "third_party" ) . GlobDirectories ( "*.git" ) . ForEach ( DeleteDirectory ) ;
42
+
43
+ if ( OperatingSystem . IsLinux ( ) )
44
+ {
45
+ InheritedShell ( "sudo ./build/install-build-deps.sh" , angleSourceDir ) . AssertZeroExitCode ( ) ;
46
+ }
64
47
65
- // var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.OpenGLES.ANGLE.Native" / "runtimes";
66
- // if (OperatingSystem.IsWindows())
67
- // {
68
- // InheritedShell
69
- // (
70
- // "gn gen out/Release " +
71
- // "--args='is_component_build=false target_cpu=\"\"x86\"\" is_debug=false'",
72
- // AnglePath
73
- // )
74
- // .AssertZeroExitCode();
75
- // InheritedShell($"autoninja -C \"{@out}\"", AnglePath).AssertZeroExitCode();
76
- // CopyAll
77
- // (
78
- // // libANGLE might not exist, this is fine
79
- // @out.GlobFiles("libGLESv2.dll", "libEGL.dll", "libANGLE.dll"),
80
- // runtimes / "win-x64" / "native"
81
- // );
82
- // CopyAll
83
- // (
84
- // @out.GlobFiles("libGLESv2.dll", "libEGL.dll", "libANGLE.dll"),
85
- // runtimes / "win-x86" / "native"
86
- // );
87
- // }
88
- // else
89
- // {
90
- // InheritedShell
91
- // (
92
- // $"gn gen \"{@out}\" " +
93
- // "--args=\"is_component_build=false is_debug=false\"",
94
- // AnglePath
95
- // )
96
- // .AssertZeroExitCode();
97
- // InheritedShell($"autoninja -C \"{@out}\"", AnglePath).AssertZeroExitCode();
98
- // CopyAll
99
- // (
100
- // @out.GlobFiles
101
- // (
102
- // "libGLESv2.so", "libEGL.so", "libANGLE.so",
103
- // "libGLESv2.dylib", "libEGL.dylib", "libANGLE.dylib"
104
- // ),
105
- // runtimes / (OperatingSystem.IsMacOS() ? "osx-x64" : "linux-x64") / "native"
106
- // );
107
- // }
48
+ var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.OpenGLES.ANGLE.Native" / "runtimes" ;
49
+ // if (OperatingSystem.IsWindows())
50
+ // {
51
+ // var @out = angleSourceDir / "out" / "Release";
52
+ // EnsureCleanDirectory(@out);
53
+ // InheritedShell
54
+ // (
55
+ // "gn gen out/Release " +
56
+ // "--args='is_component_build=false target_cpu=\"\"x86\"\" is_debug=false'",
57
+ // angleSourceDir
58
+ // )
59
+ // .AssertZeroExitCode();
60
+ // InheritedShell($"autoninja -C \"{@out}\"", angleSourceDir).AssertZeroExitCode();
61
+ // CopyAll
62
+ // (
63
+ // // libANGLE might not exist, this is fine
64
+ // @out.GlobFiles("libGLESv2.dll", "libEGL.dll", "libANGLE.dll"),
65
+ // runtimes / "win-x64" / "native"
66
+ // );
67
+ // CopyAll
68
+ // (
69
+ // @out.GlobFiles("libGLESv2.dll", "libEGL.dll", "libANGLE.dll"),
70
+ // runtimes / "win-x86" / "native"
71
+ // );
72
+ // }
73
+ // else
74
+ if ( OperatingSystem . IsMacOS ( ) )
75
+ {
76
+ foreach ( var arch in new [ ] { "arm64" , "x64" } )
77
+ {
78
+ var @out = angleSourceDir / "out" / $ "Release_{ arch } ";
79
+ EnsureCleanDirectory ( @out ) ;
80
+ var args = new [ ]
81
+ {
82
+ ( "target_cpu" , $ "\" { arch } \" ") ,
83
+ ( "is_debug" , "false" ) ,
84
+ // ("angle_assert_always_on", "true"),
85
+ ( "angle_build_tests" , "false" ) ,
86
+ ( "angle_enable_null" , "false" ) ,
87
+ ( "angle_enable_vulkan" , "false" ) ,
88
+ ( "angle_enable_wgpu" , "false" ) ,
89
+ // ("angle_enable_abseil", "false"),
90
+ ( "angle_enable_gl" , "false" ) ,
91
+ } ;
92
+ InheritedShell
93
+ (
94
+ $ "gn gen \" { @out } \" --args='{ string . Join ( " " , args . Select ( arg => $ "{ arg . Item1 } = { arg . Item2 } ") ) } '",
95
+ angleSourceDir
96
+ )
97
+ . AssertZeroExitCode ( ) ;
98
+ InheritedShell ( $ "autoninja -C \" { @out } \" ", angleSourceDir ) . AssertZeroExitCode ( ) ;
99
+ }
100
+
101
+ // create universal mac binaries
102
+ var universalNativeRuntimes = runtimes / "osx" / "native" ;
103
+ EnsureCleanDirectory ( universalNativeRuntimes ) ;
104
+ foreach ( var lib in new [ ] { "libGLESv2.dylib" , "libEGL.dylib" } )
105
+ {
106
+ var x64Lib = angleSourceDir / "out" / "Release_x64" / lib ;
107
+ var arm64Lib = angleSourceDir / "out" / "Release_arm64" / lib ;
108
+ InheritedShell
109
+ (
110
+ $ "lipo -create \" { arm64Lib } \" \" { x64Lib } \" -output \" { universalNativeRuntimes / lib } \" ",
111
+ angleSourceDir
112
+ )
113
+ . AssertZeroExitCode ( ) ;
114
+ }
115
+ }
116
+ // else
117
+ // if (OperatingSystem.IsLinux())
118
+ // {
119
+ // var @out = angleSourceDir / "out" / "Release";
120
+ // EnsureCleanDirectory(@out);
121
+ // InheritedShell
122
+ // (
123
+ // $"gn gen \"{@out}\" " +
124
+ // "--args=\"is_component_build=false is_debug=false\"",
125
+ // angleSourceDir
126
+ // )
127
+ // .AssertZeroExitCode();
128
+ // InheritedShell($"autoninja -C \"{@out}\"", angleSourceDir).AssertZeroExitCode();
129
+ // CopyAll
130
+ // (
131
+ // @out.GlobFiles
132
+ // (
133
+ // "libGLESv2.so", "libEGL.so", "libANGLE.so"
134
+ // ),
135
+ // runtimes / "linux-x64" / "native"
136
+ // );
137
+ // }
108
138
109
- // PrUpdatedNativeBinary("ANGLE");
110
- // }
111
- // )
112
- // );
113
- }
139
+ PrUpdatedNativeBinary ( "ANGLE" ) ;
140
+ }
141
+ )
142
+ ) ;
143
+ }
0 commit comments