@@ -101,6 +101,7 @@ public static void DotnetPack()
101
101
Shell . Run ( "dotnet" , $ "pack { Settings . SrcProjectPath } " +
102
102
$ "/p:BuildNumber=\" { Settings . BuildNumber } \" " +
103
103
$ "/p:NoWorkers=\" true\" " +
104
+ $ "/p:TargetFramework=net6.0 " + // without TargetFramework, the generated nuspec has incorrect path for the copy files operation.
104
105
$ "/p:CommitHash=\" { Settings . CommitId } \" " +
105
106
( string . IsNullOrEmpty ( Settings . IntegrationBuildNumber ) ? string . Empty : $ "/p:IntegrationBuildNumber=\" { Settings . IntegrationBuildNumber } \" ") +
106
107
$ "-o { outputPath } -c Release --no-build") ;
@@ -110,19 +111,21 @@ public static void DotnetPublishForZips()
110
111
{
111
112
foreach ( var runtime in Settings . TargetRuntimes )
112
113
{
114
+ var isMinVersion = runtime . StartsWith ( Settings . MinifiedVersionPrefix ) ;
113
115
var outputPath = Path . Combine ( Settings . OutputDir , runtime ) ;
114
116
var rid = GetRuntimeId ( runtime ) ;
115
- Shell . Run ( "dotnet" , $ "publish { Settings . ProjectFile } " +
116
- $ "/p:BuildNumber=\" { Settings . BuildNumber } \" " +
117
- $ "/p:CommitHash=\" { Settings . CommitId } \" " +
118
- ( string . IsNullOrEmpty ( Settings . IntegrationBuildNumber ) ? string . Empty : $ "/p:IntegrationBuildNumber=\" { Settings . IntegrationBuildNumber } \" ") +
119
- $ "-o { outputPath } -c Release " +
120
- ( string . IsNullOrEmpty ( rid ) ? string . Empty : $ " -r { rid } ") ) ;
121
-
122
- if ( runtime . StartsWith ( Settings . MinifiedVersionPrefix ) )
117
+
118
+ ExecuteDotnetPublish ( outputPath , rid , "net6.0" , skipLaunchingNet8ChildProcess : isMinVersion ) ;
119
+
120
+ if ( isMinVersion )
123
121
{
124
122
RemoveLanguageWorkers ( outputPath ) ;
125
123
}
124
+
125
+ // Publish net8 version of the artifact as well.
126
+ var outputPathNet8 = BuildNet8ArtifactFullPath ( runtime ) ;
127
+ ExecuteDotnetPublish ( outputPathNet8 , rid , "net8.0" , skipLaunchingNet8ChildProcess : true ) ;
128
+ RemoveLanguageWorkers ( outputPathNet8 ) ;
126
129
}
127
130
128
131
if ( ! string . IsNullOrEmpty ( Settings . IntegrationBuildNumber ) && ( _integrationManifest != null ) )
@@ -131,6 +134,24 @@ public static void DotnetPublishForZips()
131
134
}
132
135
}
133
136
137
+ private static string BuildNet8ArtifactFullPath ( string runtime )
138
+ {
139
+ return Path . Combine ( Settings . OutputDir , BuildNet8ArtifactDirectory ( runtime ) ) ;
140
+ }
141
+
142
+ private static string BuildNet8ArtifactDirectory ( string runtime ) => runtime + "_net8.0" ;
143
+
144
+ private static void ExecuteDotnetPublish ( string outputPath , string rid , string targetFramework , bool skipLaunchingNet8ChildProcess )
145
+ {
146
+ Shell . Run ( "dotnet" , $ "publish { Settings . ProjectFile } " +
147
+ $ "/p:BuildNumber=\" { Settings . BuildNumber } \" " +
148
+ $ "/p:SkipInProcessHost=\" { skipLaunchingNet8ChildProcess } \" " +
149
+ $ "/p:CommitHash=\" { Settings . CommitId } \" " +
150
+ ( string . IsNullOrEmpty ( Settings . IntegrationBuildNumber ) ? string . Empty : $ "/p:IntegrationBuildNumber=\" { Settings . IntegrationBuildNumber } \" ") +
151
+ $ "-o { outputPath } -c Release -f { targetFramework } --self-contained" +
152
+ ( string . IsNullOrEmpty ( rid ) ? string . Empty : $ " -r { rid } ") ) ;
153
+ }
154
+
134
155
public static void FilterPowershellRuntimes ( )
135
156
{
136
157
var minifiedRuntimes = Settings . TargetRuntimes . Where ( r => r . StartsWith ( Settings . MinifiedVersionPrefix ) ) ;
@@ -153,7 +174,7 @@ public static void FilterPowershellRuntimes()
153
174
$ "{ Environment . NewLine } Found runtimes are { string . Join ( ", " , allFoundPowershellRuntimes ) } ") ;
154
175
}
155
176
156
- // Delete all the runtimes that should not belong to the current runtime
177
+ // Delete all the runtimes that should not belong to the current artifactDirectory
157
178
allFoundPowershellRuntimes . Except ( powershellRuntimesForCurrentToolsRuntime ) . ToList ( ) . ForEach ( r => Directory . Delete ( Path . Combine ( powershellRuntimePath , r ) , recursive : true ) ) ;
158
179
}
159
180
}
@@ -177,6 +198,8 @@ public static void FilterPowershellRuntimes()
177
198
}
178
199
}
179
200
}
201
+
202
+ // No action needed for the "_net8.0" versions of these artifacts as they have an empty "workers" directory.
180
203
}
181
204
182
205
public static void FilterPythonRuntimes ( )
@@ -205,11 +228,13 @@ public static void FilterPythonRuntimes()
205
228
206
229
if ( ! atLeastOne )
207
230
{
208
- throw new Exception ( $ "No Python worker matched the OS '{ Settings . RuntimesToOS [ runtime ] } ' for runtime '{ runtime } '. " +
231
+ throw new Exception ( $ "No Python worker matched the OS '{ Settings . RuntimesToOS [ runtime ] } ' for artifactDirectory '{ runtime } '. " +
209
232
$ "Something went wrong.") ;
210
233
}
211
234
}
212
235
}
236
+
237
+ // No action needed for the "_net8.0" versions of these artifacts as they have an empty "workers" directory.
213
238
}
214
239
215
240
public static void AddDistLib ( )
@@ -232,6 +257,8 @@ public static void AddDistLib()
232
257
233
258
File . Delete ( distLibZip ) ;
234
259
Directory . Delete ( distLibDir , recursive : true ) ;
260
+
261
+ // No action needed for the "_net8.0" versions of these artifacts as we don't ship workers for them.
235
262
}
236
263
237
264
public static void AddTemplatesNupkgs ( )
@@ -314,7 +341,7 @@ public static void Test()
314
341
315
342
Environment . SetEnvironmentVariable ( "DURABLE_FUNCTION_PATH" , Settings . DurableFolder ) ;
316
343
317
- Shell . Run ( "dotnet" , $ "test { Settings . TestProjectFile } --logger trx") ;
344
+ Shell . Run ( "dotnet" , $ "test { Settings . TestProjectFile } -f net6.0 - -logger trx") ;
318
345
}
319
346
320
347
public static void CopyBinariesToSign ( )
@@ -371,7 +398,7 @@ public static void CopyBinariesToSign()
371
398
372
399
// These assemblies are currently signed, but with an invalid root cert.
373
400
// Until that is resolved, we are explicity signing the AppService.Middleware packages
374
-
401
+
375
402
unSignedBinaries = unSignedBinaries . Concat ( allFiles
376
403
. Where ( f => f . Contains ( "Microsoft.Azure.AppService.Middleware" ) || f . Contains ( "Microsoft.Azure.AppService.Proxy" ) ) ) . ToList ( ) ;
377
404
@@ -384,6 +411,8 @@ public static void CopyBinariesToSign()
384
411
385
412
public static void TestPreSignedArtifacts ( )
386
413
{
414
+ var filterExtensionsSignSet = new HashSet < string > ( Settings . SignInfo . FilterExtensionsSign ) ;
415
+
387
416
foreach ( var supportedRuntime in Settings . SignInfo . RuntimesToSign )
388
417
{
389
418
if ( supportedRuntime . StartsWith ( "osx" ) )
@@ -397,20 +426,30 @@ public static void TestPreSignedArtifacts()
397
426
Directory . CreateDirectory ( targetDir ) ;
398
427
FileHelpers . RecursiveCopy ( sourceDir , targetDir ) ;
399
428
400
- var toSignPaths = Settings . SignInfo . authentiCodeBinaries . Select ( el => Path . Combine ( targetDir , el ) ) ;
401
- var toSignThirdPartyPaths = Settings . SignInfo . thirdPartyBinaries . Select ( el => Path . Combine ( targetDir , el ) ) ;
429
+ var inProc8Directory = Path . Combine ( targetDir , "in-proc8" ) ;
430
+ var inProc8DirectoryExists = Directory . Exists ( inProc8Directory ) ;
431
+
432
+ var toSignPathsForInProc8 = inProc8DirectoryExists
433
+ ? Settings . SignInfo . authentiCodeBinaries . Select ( el => Path . Combine ( inProc8Directory , el ) )
434
+ : Enumerable . Empty < string > ( ) ;
435
+ var toSignPaths = Settings . SignInfo . authentiCodeBinaries . Select ( el => Path . Combine ( targetDir , el ) ) . Concat ( toSignPathsForInProc8 ) ;
436
+
437
+ var toSignThirdPartyPathsForInProc8 = inProc8DirectoryExists
438
+ ? Settings . SignInfo . thirdPartyBinaries . Select ( el => Path . Combine ( inProc8Directory , el ) )
439
+ : Enumerable . Empty < string > ( ) ;
440
+ var toSignThirdPartyPaths = Settings . SignInfo . thirdPartyBinaries . Select ( el => Path . Combine ( targetDir , el ) ) . Concat ( toSignThirdPartyPathsForInProc8 ) ;
441
+
402
442
var unSignedFiles = FileHelpers . GetAllFilesFromFilesAndDirs ( FileHelpers . ExpandFileWildCardEntries ( toSignPaths ) )
403
- . Where ( file => ! Settings . SignInfo . FilterExtensionsSign . Any ( ext => file . EndsWith ( ext ) ) ) . ToList ( ) ;
443
+ . Where ( file => ! filterExtensionsSignSet . Any ( ext => file . EndsWith ( ext ) ) ) . ToList ( ) ;
404
444
405
445
unSignedFiles . AddRange ( FileHelpers . GetAllFilesFromFilesAndDirs ( FileHelpers . ExpandFileWildCardEntries ( toSignThirdPartyPaths ) )
406
- . Where ( file => ! Settings . SignInfo . FilterExtensionsSign . Any ( ext => file . EndsWith ( ext ) ) ) ) ;
446
+ . Where ( file => ! filterExtensionsSignSet . Any ( ext => file . EndsWith ( ext ) ) ) ) ;
407
447
408
448
unSignedFiles . ForEach ( filePath => File . Delete ( filePath ) ) ;
409
449
410
450
var unSignedPackages = GetUnsignedBinaries ( targetDir ) ;
411
451
if ( unSignedPackages . Count ( ) != 0 )
412
452
{
413
-
414
453
var missingSignature = string . Join ( $ ",{ Environment . NewLine } ", unSignedPackages ) ;
415
454
ColoredConsole . Error . WriteLine ( $ "This files are missing valid signatures: { Environment . NewLine } { missingSignature } ") ;
416
455
throw new Exception ( $ "sigcheck.exe test failed. Following files are unsigned: { Environment . NewLine } { missingSignature } ") ;
@@ -498,31 +537,47 @@ public static List<string> GetUnsignedBinaries(string targetDir)
498
537
return unSignedPackages ;
499
538
}
500
539
540
+ private static void CreateZipFromArtifact ( string artifactSourcePath , string zipPath )
541
+ {
542
+ if ( ! Directory . Exists ( artifactSourcePath ) )
543
+ {
544
+ throw new Exception ( $ "Artifact source path { artifactSourcePath } does not exist.") ;
545
+ }
546
+
547
+ ColoredConsole . WriteLine ( $ "Creating { zipPath } ") ;
548
+ ZipFile . CreateFromDirectory ( artifactSourcePath , zipPath , CompressionLevel . Optimal , includeBaseDirectory : false ) ;
549
+ }
550
+
501
551
public static void Zip ( )
502
552
{
503
553
var version = CurrentVersion ;
504
554
505
555
foreach ( var runtime in Settings . TargetRuntimes )
506
556
{
507
- var path = Path . Combine ( Settings . OutputDir , runtime ) ;
557
+ var isMinVersion = runtime . StartsWith ( Settings . MinifiedVersionPrefix ) ;
558
+ var artifactPath = Path . Combine ( Settings . OutputDir , runtime ) ;
508
559
509
560
var zipPath = Path . Combine ( Settings . OutputDir , $ "Azure.Functions.Cli.{ runtime } .{ version } .zip") ;
510
- ColoredConsole . WriteLine ( $ "Creating { zipPath } ") ;
511
- ZipFile . CreateFromDirectory ( path , zipPath , CompressionLevel . Optimal , includeBaseDirectory : false ) ;
561
+ CreateZipFromArtifact ( artifactPath , zipPath ) ;
562
+
563
+ // Zip the .net8 version as well.
564
+ var net8Path = BuildNet8ArtifactFullPath ( runtime ) ;
565
+ var net8ZipPath = zipPath . Replace ( ".zip" , "_net8.0.zip" ) ;
566
+ CreateZipFromArtifact ( net8Path , net8ZipPath ) ;
567
+
512
568
513
569
// We leave the folders beginning with 'win' to generate the .msi files. They will be deleted in
514
570
// the ./generateMsiFiles.ps1 script
515
571
if ( ! runtime . StartsWith ( "win" ) )
516
572
{
517
573
try
518
574
{
519
- Directory . Delete ( path , recursive : true ) ;
575
+ Directory . Delete ( artifactPath , recursive : true ) ;
520
576
}
521
- catch
577
+ catch ( Exception ex )
522
578
{
523
- ColoredConsole . Error . WriteLine ( $ "Error deleting { path } ") ;
579
+ ColoredConsole . Error . WriteLine ( $ "Error deleting { artifactPath } . Exception: { ex } ") ;
524
580
}
525
-
526
581
}
527
582
528
583
ColoredConsole . WriteLine ( ) ;
@@ -549,12 +604,15 @@ private static string CurrentVersion
549
604
public static void GenerateSBOMManifestForZips ( )
550
605
{
551
606
Directory . CreateDirectory ( Settings . SBOMManifestTelemetryDir ) ;
552
- // Generate the SBOM manifest for each runtime
553
- foreach ( var runtime in Settings . TargetRuntimes )
607
+ // Generate the SBOM manifest for each artifactDirectory
608
+
609
+ var allArtifactDirectories = Settings . TargetRuntimes . Concat ( Settings . TargetRuntimes . Select ( r => BuildNet8ArtifactDirectory ( r ) ) ) ;
610
+
611
+ foreach ( var artifactDirectory in allArtifactDirectories )
554
612
{
555
- var packageName = $ "Azure.Functions.Cli.{ runtime } .{ CurrentVersion } ";
556
- var buildPath = Path . Combine ( Settings . OutputDir , runtime ) ;
557
- var manifestFolderPath = Path . Combine ( buildPath , "_manifest" ) ;
613
+ var packageName = $ "Azure.Functions.Cli.{ artifactDirectory } .{ CurrentVersion } ";
614
+ var artifactDirectoryFullPath = Path . Combine ( Settings . OutputDir , artifactDirectory ) ;
615
+ var manifestFolderPath = Path . Combine ( artifactDirectoryFullPath , "_manifest" ) ;
558
616
var telemetryFilePath = Path . Combine ( Settings . SBOMManifestTelemetryDir , Guid . NewGuid ( ) . ToString ( ) + ".json" ) ;
559
617
560
618
// Delete the manifest folder if it exists
@@ -565,8 +623,8 @@ public static void GenerateSBOMManifestForZips()
565
623
566
624
// Generate the SBOM manifest
567
625
Shell . Run ( "dotnet" ,
568
- $ "{ Settings . SBOMManifestToolPath } generate -PackageName { packageName } -BuildDropPath { buildPath } "
569
- + $ " -BuildComponentPath { buildPath } -Verbosity Information -t { telemetryFilePath } ") ;
626
+ $ "{ Settings . SBOMManifestToolPath } generate -PackageName { packageName } -BuildDropPath { artifactDirectoryFullPath } "
627
+ + $ " -BuildComponentPath { artifactDirectoryFullPath } -Verbosity Information -t { telemetryFilePath } ") ;
570
628
}
571
629
}
572
630
@@ -576,9 +634,10 @@ public static void DotnetPublishForNupkg()
576
634
Shell . Run ( "dotnet" , $ "publish { Settings . ProjectFile } " +
577
635
$ "/p:BuildNumber=\" { Settings . BuildNumber } \" " +
578
636
$ "/p:NoWorkers=\" true\" " +
637
+ $ "/p:TargetFramework=net6.0 " +
579
638
$ "/p:CommitHash=\" { Settings . CommitId } \" " +
580
639
( string . IsNullOrEmpty ( Settings . IntegrationBuildNumber ) ? string . Empty : $ "/p:IntegrationBuildNumber=\" { Settings . IntegrationBuildNumber } \" ") +
581
- $ "-c Release") ;
640
+ $ "-c Release -f net6.0 ") ;
582
641
}
583
642
584
643
public static void GenerateSBOMManifestForNupkg ( )
0 commit comments