@@ -82,7 +82,7 @@ Task("Pack-Nuget")
82
82
} ) ;
83
83
84
84
Task ( "Pack-Chocolatey" )
85
- . WithCriteria < BuildParameters > ( ( context , parameters ) => parameters . IsRunningOnWindows , "Pack-Chocolatey works only on Windows agents." )
85
+ . WithCriteria < BuildParameters > ( ( context , parameters ) => parameters . IsRunningOnWindows , "Pack-Chocolatey works only on Windows agents." )
86
86
. WithCriteria < BuildParameters > ( ( context , parameters ) => parameters . IsMainBranch && ! parameters . IsPullRequest , "Pack-Chocolatey works only for main branch." )
87
87
. IsDependentOn ( "Pack-Prepare" )
88
88
. Does < BuildParameters > ( ( parameters ) =>
@@ -110,43 +110,52 @@ Task("Zip-Files")
110
110
. IsDependentOn ( "Pack-Prepare" )
111
111
. Does < BuildParameters > ( ( parameters ) =>
112
112
{
113
- var platform = Context . Environment . Platform . Family . ToString ( ) . ToLower ( ) ;
114
-
115
- var sourceDir = parameters . Paths . Directories . Native . Combine ( platform ) ;
116
- var targetDir = parameters . Paths . Directories . ArtifactsRoot . Combine ( "native" ) ;
117
- EnsureDirectoryExists ( targetDir ) ;
118
- var fileName = $ "gitversion-{ platform } -{ parameters . Version . SemVersion } .tar.gz". ToLower ( ) ;
119
- var tarFile = targetDir . CombineWithFilePath ( fileName ) ;
120
- GZipCompress ( sourceDir , tarFile ) ;
113
+ var platform = Context . Environment . Platform . Family ;
114
+ var runtimes = parameters . NativeRuntimes [ platform ] ;
115
+
116
+ foreach ( var runtime in runtimes )
117
+ {
118
+ var sourceDir = parameters . Paths . Directories . Native . Combine ( platform . ToString ( ) . ToLower ( ) ) . Combine ( runtime ) ;
119
+ var targetDir = parameters . Paths . Directories . ArtifactsRoot . Combine ( "native" ) ;
120
+ EnsureDirectoryExists ( targetDir ) ;
121
+ var fileName = $ "gitversion-{ runtime } -{ parameters . Version . SemVersion } .tar.gz". ToLower ( ) ;
122
+ var tarFile = targetDir . CombineWithFilePath ( fileName ) ;
123
+ GZipCompress ( sourceDir , tarFile ) ;
124
+ }
121
125
} ) ;
122
126
123
127
void PackPrepareNative ( ICakeContext context , BuildParameters parameters )
124
128
{
125
129
// publish single file for all native runtimes (self contained)
126
130
var platform = Context . Environment . Platform . Family ;
127
- var runtime = parameters . NativeRuntimes [ platform ] ;
128
- var outputPath = parameters . Paths . Directories . Native . Combine ( platform . ToString ( ) . ToLower ( ) ) ;
131
+ var runtimes = parameters . NativeRuntimes [ platform ] ;
129
132
130
- var settings = new DotNetCorePublishSettings
133
+ foreach ( var runtime in runtimes )
131
134
{
132
- Framework = parameters . CoreFxVersion31 ,
133
- Runtime = runtime ,
134
- NoRestore = false ,
135
- Configuration = parameters . Configuration ,
136
- OutputDirectory = outputPath ,
137
- MSBuildSettings = parameters . MSBuildSettings ,
138
- } ;
135
+ var outputPath = parameters . Paths . Directories . Native . Combine ( platform . ToString ( ) . ToLower ( ) ) . Combine ( runtime ) ;
139
136
140
- settings . ArgumentCustomization =
141
- arg => arg
142
- . Append ( "/p:PublishSingleFile=true" )
143
- . Append ( "/p:PublishTrimmed=true" )
144
- . Append ( "/p:IncludeSymbolsInSingleFile=true" ) ;
137
+ var settings = new DotNetCorePublishSettings
138
+ {
139
+ Framework = parameters . CoreFxVersion31 ,
140
+ Runtime = runtime ,
141
+ NoRestore = false ,
142
+ Configuration = parameters . Configuration ,
143
+ OutputDirectory = outputPath ,
144
+ MSBuildSettings = parameters . MSBuildSettings ,
145
+ } ;
146
+
147
+ settings . ArgumentCustomization =
148
+ arg => arg
149
+ . Append ( "/p:PublishSingleFile=true" )
150
+ . Append ( "/p:PublishTrimmed=true" )
151
+ . Append ( "/p:IncludeSymbolsInSingleFile=true" ) ;
145
152
146
- context . DotNetCorePublish ( "./src/GitVersionExe/GitVersionExe.csproj" , settings ) ;
153
+ context . DotNetCorePublish ( "./src/GitVersionExe/GitVersionExe.csproj" , settings ) ;
147
154
148
- context . Information ( "Validating native lib:" ) ;
155
+ context . Information ( "Validating native lib:" ) ;
156
+
157
+ var nativeExe = outputPath . CombineWithFilePath ( IsRunningOnWindows ( ) ? "gitversion.exe" : "gitversion" ) ;
158
+ ValidateOutput ( nativeExe . FullPath , "/showvariable FullSemver" , parameters . Version . GitVersion . FullSemVer ) ;
159
+ }
149
160
150
- var nativeExe = outputPath . CombineWithFilePath ( IsRunningOnWindows ( ) ? "gitversion.exe" : "gitversion" ) ;
151
- ValidateOutput ( nativeExe . FullPath , "/showvariable FullSemver" , parameters . Version . GitVersion . FullSemVer ) ;
152
161
}
0 commit comments