@@ -23,9 +23,6 @@ internal static void Main()
23
23
var buildScriptsRoot = monoRoot . Combine ( "external" ) . Combine ( "buildscripts" ) ;
24
24
Console . WriteLine ( ">>> Build scripts directory: " + buildScriptsRoot ) ;
25
25
26
- var monoBuildDeps = monoRoot . Parent . Parent . Combine ( "mono-build-deps" ) . Combine ( "build" ) ;
27
- Console . WriteLine ( ">>> Mono build dependecies directory: " + monoBuildDeps ) ;
28
-
29
26
var buildDependenciesConfigFile = buildScriptsRoot . Combine ( "buildDependencies.txt" ) ;
30
27
Console . WriteLine ( ">>> Mono build dependecies stevedore version config file: " + buildDependenciesConfigFile ) ;
31
28
@@ -34,21 +31,14 @@ internal static void Main()
34
31
35
32
if ( buildDependenciesConfigFile . Exists ( ) )
36
33
{
37
- if ( ! monoBuildDeps . DirectoryExists ( ) )
38
- {
39
- Console . WriteLine ( ">>> " + monoBuildDeps + " does not exist. Creating it ..." ) ;
40
- monoBuildDeps . CreateDirectory ( ) ;
41
- }
34
+ var artifactList = ParseBuildDependenciesConfigFile ( buildDependenciesConfigFile . ToString ( ) ) ;
42
35
43
- var artifactNameIdFilesDictionary = ParseBuildDependenciesConfigFile ( buildDependenciesConfigFile . ToString ( ) ) ;
44
-
45
- foreach ( var item in artifactNameIdFilesDictionary )
36
+ foreach ( var item in artifactList )
46
37
{
47
- var artifactName = item . Key . Item1 ;
48
- var artifactId = item . Key . Item2 ;
49
- var repoName = item . Key . Item3 ;
50
- var artifactFiles = item . Value ;
51
- DownloadAndCopyArtifact ( artifactId , artifactName , repoName , artifactFiles , monoBuildDeps , stevedoreArtifactsDir ) ;
38
+ var artifactName = item . Item1 ;
39
+ var artifactId = item . Item2 ;
40
+ var repoName = item . Item3 ;
41
+ DownloadArtifact ( artifactId , artifactName , repoName ) ;
52
42
}
53
43
}
54
44
else
@@ -57,46 +47,13 @@ internal static void Main()
57
47
}
58
48
}
59
49
60
- private static void DownloadAndCopyArtifact ( string artifactId , string artifactName , string repoName , IEnumerable < NPath > artifacts , NPath monoBuildDeps , NPath stevedoreArtifactsDir )
50
+ private static void DownloadArtifact ( string artifactId , string artifactName , string repoName )
61
51
{
52
+ Console . WriteLine ( $ ">>> Registering artifact { artifactName } ") ;
62
53
var artifact = new StevedoreArtifact ( repoName , new ArtifactId ( artifactId ) ) ;
63
54
Backend . Current . Register ( artifact ) ;
64
-
65
- var inputs = new List < NPath > ( ) ;
66
- var targetFiles = new List < NPath > ( ) ;
67
- foreach ( var item in artifacts )
68
- {
69
- inputs . Add ( stevedoreArtifactsDir . Combine ( artifactName ) . Combine ( item ) ) ;
70
- targetFiles . Add ( monoBuildDeps . Combine ( artifactName ) . Combine ( item ) ) ;
71
- }
72
-
73
- var targetDir = monoBuildDeps ;
74
- if ( HostPlatform . IsWindows )
75
- {
76
- targetDir = monoBuildDeps . Combine ( artifactName ) ;
77
- }
78
-
79
- Backend . Current . AddAction (
80
- actionName : "CopyArtifact" ,
81
- targetFiles : targetFiles . ToArray ( ) ,
82
- inputs : inputs . ToArray ( ) ,
83
- executableStringFor : ExecutableStringForDirectoryCopy ( stevedoreArtifactsDir . Combine ( artifactName ) , targetDir ) ,
84
- commandLineArguments : new string [ ] { } ,
85
- allowUnwrittenOutputFiles : true
86
- ) ;
87
55
}
88
56
89
- private static void ExecuteBuildScript ( NPath [ ] inputFiles , NPath buildScript , NPath buildRoot )
90
- {
91
- Backend . Current . AddAction (
92
- actionName : "ExecuteBuildScript" ,
93
- targetFiles : new [ ] { buildRoot } ,
94
- inputs : inputFiles ,
95
- executableStringFor : $ "perl { buildScript } ",
96
- commandLineArguments : new string [ ] { } ,
97
- allowUnwrittenOutputFiles : true
98
- ) ;
99
- }
100
57
private static NPath GetMonoRootDir ( )
101
58
{
102
59
var exePath = new NPath ( System . Reflection . Assembly . GetEntryAssembly ( ) . Location ) ;
@@ -109,13 +66,6 @@ private static NPath GetMonoRootDir()
109
66
return monoRoot ;
110
67
}
111
68
112
- private static string ExecutableStringForDirectoryCopy ( NPath from , NPath target )
113
- {
114
- return HostPlatform . IsWindows
115
- ? $ "xcopy { from . InQuotes ( SlashMode . Native ) } { target . InQuotes ( SlashMode . Native ) } /s /e /d /Y"
116
- : $ "cp -r -v { from . InQuotes ( SlashMode . Native ) } { target . InQuotes ( SlashMode . Native ) } ";
117
- }
118
-
119
69
private static bool IsRunningOnBuildMachine ( )
120
70
{
121
71
var buildMachine = Environment . GetEnvironmentVariable ( "UNITY_THISISABUILDMACHINE" ) ;
@@ -128,21 +78,18 @@ private static bool IsRunningOnBuildMachine()
128
78
# name : <stevedore artifact name>
129
79
# id : <stevedore artifact id>
130
80
# repo : <stevedore repo name (can be testing/public/unityinternal)>
131
- # files : <folder and/or comma-separated list of files downloaded and unpacked>
132
81
133
82
name: 7z
134
83
id: 7z/9df1e3b3b120_12ed325f6a47f0e5cebc247dbe9282a5da280d392cce4e6c9ed227d57ff1e2ff.7z
135
84
repo: testing
136
- files : 7z
137
85
138
86
name: libgdiplus
139
87
id : libgdiplus/9df1e3b3b120_4cf7c08770db93922f54f38d2461b9122cddc898db58585864446e70c5ad3057.7z
140
88
repo: public
141
- files : libgdiplus,lib2
142
89
*/
143
- private static Dictionary < Tuple < string , string , string > , List < NPath > > ParseBuildDependenciesConfigFile ( string buildDependenciesConfigFile )
90
+ private static List < Tuple < string , string , string > > ParseBuildDependenciesConfigFile ( string buildDependenciesConfigFile )
144
91
{
145
- var artifactNameIdFilesDictionary = new Dictionary < Tuple < string , string , string > , List < NPath > > ( ) ;
92
+ var artifactNameIdFilesDictionary = new List < Tuple < string , string , string > > ( ) ;
146
93
147
94
var fileStream = new FileStream ( buildDependenciesConfigFile , FileMode . Open , FileAccess . Read ) ;
148
95
using ( var streamReader = new StreamReader ( fileStream , Encoding . UTF8 ) )
@@ -158,7 +105,6 @@ private static Dictionary<Tuple<string, string, string>, List<NPath>> ParseBuild
158
105
var name = "" ;
159
106
var id = "" ;
160
107
var repoName = "" ;
161
- var files = "" ;
162
108
163
109
//read name
164
110
name = line . Split ( ':' ) [ 1 ] . Trim ( ) ;
@@ -175,25 +121,7 @@ private static Dictionary<Tuple<string, string, string>, List<NPath>> ParseBuild
175
121
else
176
122
throw new Exception ( $ ">>> Invalid { buildDependenciesConfigFile } , repo name does not exist") ;
177
123
178
- //read comma separated folder/files list
179
- if ( ( line = streamReader . ReadLine ( ) ) != null )
180
- files = line . Split ( ':' ) [ 1 ] . Trim ( ) ;
181
- else
182
- throw new Exception ( $ ">>> Invalid { buildDependenciesConfigFile } , files do not exist") ;
183
-
184
- var filesList = new List < NPath > ( ) ;
185
- if ( ! string . IsNullOrEmpty ( files ) )
186
- {
187
- if ( files . Contains ( "," ) )
188
- files . Split ( ',' ) . ForEach ( f => { filesList . Add ( new NPath ( f . Trim ( ) ) ) ; } ) ;
189
- else
190
- filesList . Add ( new NPath ( files . Trim ( ) ) ) ;
191
- }
192
- else
193
- {
194
- throw new Exception ( $ ">>> Invalid { buildDependenciesConfigFile } ") ;
195
- }
196
- artifactNameIdFilesDictionary . Add ( new Tuple < string , string , string > ( name , id , repoName ) , filesList ) ;
124
+ artifactNameIdFilesDictionary . Add ( new Tuple < string , string , string > ( name , id , repoName ) ) ;
197
125
}
198
126
}
199
127
}
0 commit comments