@@ -12,9 +12,13 @@ open Fake.DocFxHelper
1212// Information about the project for Nuget and Assembly info files
1313let configuration = " Release"
1414
15+ // Configuration values for tests
16+ let testNetCoreVersion = " netcoreapp3.1"
17+ let testNetVersion = " net5.0"
18+
1519// Metadata used when signing packages and DLLs
16- let signingName = " My Library "
17- let signingDescription = " My REALLY COOL Library "
20+ let signingName = " Akka.MultiNode.TestAdapter "
21+ let signingDescription = " Akka.NET Multi-node Test Adapter; used for executing tests written with Akka.Remote.TestKit "
1822let signingUrl = " https://signing.is.cool/"
1923
2024// Read release notes and version
@@ -54,19 +58,24 @@ Target "Clean" (fun _ ->
5458 CleanDir outputPerfTests
5559 CleanDir outputNuGet
5660 CleanDir " docs/_site"
61+
62+ CleanDirs !! " ./**/bin"
63+ CleanDirs !! " ./**/obj"
5764)
5865
5966Target " AssemblyInfo" ( fun _ ->
6067 XmlPokeInnerText " ./src/common.props" " //Project/PropertyGroup/VersionPrefix" releaseNotes.AssemblyVersion
6168 XmlPokeInnerText " ./src/common.props" " //Project/PropertyGroup/PackageReleaseNotes" ( releaseNotes.Notes |> String.concat " \n " )
6269)
6370
64- Target " Build" ( fun _ ->
71+ Target " Build" ( fun _ ->
72+ let additionalArgs = if versionSuffix.Length > 0 then [ sprintf " /p:VersionSuffix=%s " versionSuffix] else []
6573 DotNetCli.Build
6674 ( fun p ->
6775 { p with
6876 Project = solutionFile
69- Configuration = configuration }) // "Rebuild"
77+ Configuration = configuration
78+ AdditionalArgs = additionalArgs }) // "Rebuild"
7079)
7180
7281
@@ -92,25 +101,46 @@ module internal ResultHandling =
92101 >> Option.iter ( failBuildWithMessage errorLevel)
93102
94103Target " RunTests" ( fun _ ->
95- let projects =
96- match ( isWindows) with
97- | true -> !! " ./src/**/*.Tests.csproj"
98- | _ -> !! " ./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
104+ let projects = match ( isWindows) with
105+ | true -> !! " ./src/**/*.Tests.*sproj"
106+ | _ -> !! " ./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
99107
100108 let runSingleProject project =
101109 let arguments =
102110 match ( hasTeamCity) with
103- | true -> ( sprintf " test -c Release --no-build --logger:trx --logger:\" console;verbosity=normal\" --results-directory %s -- -parallel none -teamcity" ( outputTests) )
104- | false -> ( sprintf " test -c Release --no-build --logger:trx --logger:\" console;verbosity=normal\" --results-directory %s -- -parallel none" ( outputTests) )
111+ | true -> ( sprintf " test -c Release --no-build --logger:trx --logger:\" console;verbosity=normal\" --framework %s -- results-directory \" %s \" -- -parallel none -teamcity" testNetCoreVersion outputTests)
112+ | false -> ( sprintf " test -c Release --no-build --logger:trx --logger:\" console;verbosity=normal\" --framework %s -- results-directory \" %s \" -- -parallel none" testNetCoreVersion outputTests)
105113
106114 let result = ExecProcess( fun info ->
107115 info.FileName <- " dotnet"
108116 info.WorkingDirectory <- ( Directory.GetParent project) .FullName
109- info.Arguments <- arguments) ( TimeSpan.FromMinutes 30.0 )
110-
111- ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
117+ info.Arguments <- arguments) ( TimeSpan.FromMinutes 30.0 )
112118
113- projects |> Seq.iter ( log)
119+ ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
120+
121+ CreateDir outputTests
122+ projects |> Seq.iter ( runSingleProject)
123+ )
124+
125+ Target " RunTestsNet" ( fun _ ->
126+ let projects = match ( isWindows) with
127+ | true -> !! " ./src/**/*.Tests.*sproj"
128+ | _ -> !! " ./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
129+
130+ let runSingleProject project =
131+ let arguments =
132+ match ( hasTeamCity) with
133+ | true -> ( sprintf " test -c Release --no-build --logger:trx --logger:\" console;verbosity=normal\" --framework %s --results-directory \" %s \" -- -parallel none -teamcity" testNetVersion outputTests)
134+ | false -> ( sprintf " test -c Release --no-build --logger:trx --logger:\" console;verbosity=normal\" --framework %s --results-directory \" %s \" -- -parallel none" testNetVersion outputTests)
135+
136+ let result = ExecProcess( fun info ->
137+ info.FileName <- " dotnet"
138+ info.WorkingDirectory <- ( Directory.GetParent project) .FullName
139+ info.Arguments <- arguments) ( TimeSpan.FromMinutes 30.0 )
140+
141+ ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
142+
143+ CreateDir outputTests
114144 projects |> Seq.iter ( runSingleProject)
115145)
116146
@@ -192,10 +222,15 @@ Target "SignPackages" (fun _ ->
192222let overrideVersionSuffix ( project : string ) =
193223 match project with
194224 | _ -> versionSuffix // add additional matches to publish different versions for different projects in solution
225+
195226Target " CreateNuget" ( fun _ ->
196227 let projects = !! " src/**/*.csproj"
197228 -- " src/**/*Tests.csproj" // Don't publish unit tests
198229 -- " src/**/*Tests*.csproj"
230+ -- " src/**/*.MultiNode.TestAdapter.csproj" // Do not publish MNTR nuget packages
231+ -- " src/**/*.MultiNode.NodeRunner.csproj"
232+ -- " src/**/*.MultiNode.Shared.csproj"
233+ -- " src/**/*.MultiNode.TestRunner.Shared.csproj"
199234
200235 let runSingleProject project =
201236 DotNetCli.Pack
@@ -210,6 +245,61 @@ Target "CreateNuget" (fun _ ->
210245 projects |> Seq.iter ( runSingleProject)
211246)
212247
248+ Target " PublishMntr" ( fun _ ->
249+ let executableProjects = !! " ./src/**/Akka.MultiNode.TestAdapter.csproj"
250+ let additionalArgs = if versionSuffix.Length > 0 then [ sprintf " /p:VersionSuffix=%s " versionSuffix] else []
251+
252+ executableProjects |> Seq.iter ( fun project ->
253+ DotNetCli.Restore
254+ ( fun p ->
255+ { p with
256+ Project = project
257+ AdditionalArgs = additionalArgs })
258+ )
259+
260+ executableProjects |> Seq.iter ( fun project ->
261+ DotNetCli.Publish
262+ ( fun p ->
263+ { p with
264+ Project = project
265+ Configuration = configuration
266+ Framework = " netstandard2.0"
267+ VersionSuffix = versionSuffix }))
268+ )
269+
270+ Target " CreateMntrNuget" ( fun _ ->
271+
272+ let commonPropsVersionPrefix = XMLRead true " ./src/common.props" " " " " " //Project/PropertyGroup/VersionPrefix" |> Seq.head
273+ let versionReplacement = List.ofSeq [ " @version@" , commonPropsVersionPrefix + ( if ( not ( versionSuffix = " " )) then ( " -" + versionSuffix) else " " ) ]
274+
275+ // uses the template file to create a temporary .nuspec file with the correct version
276+ let generateNuspec ( nuspecTemplatePath : string ) =
277+ let nuspecPath = nuspecTemplatePath.Replace( " .template" , " " )
278+ CopyFile nuspecPath nuspecTemplatePath
279+ TemplateHelper.processTemplates versionReplacement [ nuspecPath ]
280+ nuspecPath
281+
282+ let nuspecTemplates = [
283+ " ./src/Akka.MultiNode.TestAdapter/Akka.MultiNode.TestAdapter.nuspec.template"
284+ ]
285+ let nuspecFiles = List.map ( generateNuspec) nuspecTemplates
286+
287+ let executableProjects = !! " ./src/**/Akka.MultiNode.TestAdapter.csproj"
288+
289+ executableProjects |> Seq.iter ( fun project ->
290+ DotNetCli.Pack
291+ ( fun p ->
292+ { p with
293+ Project = project
294+ Configuration = configuration
295+ AdditionalArgs = [ " --include-symbols" ]
296+ VersionSuffix = versionSuffix
297+ OutputPath = " \" " + outputNuGet + " \" " } )
298+ )
299+
300+ nuspecFiles |> Seq.iter ( DeleteFile)
301+ )
302+
213303Target " PublishNuget" ( fun _ ->
214304 let projects = !! " ./bin/nuget/*.nupkg"
215305 let apiKey = getBuildParamOrDefault " nugetkey" " "
@@ -287,21 +377,24 @@ Target "All" DoNothing
287377Target " Nuget" DoNothing
288378
289379// build dependencies
290- " Clean" ==> " AssemblyInfo" ==> " Build" ==> " BuildRelease"
380+ " Clean" ==> " AssemblyInfo" ==> " Build"
381+ " Build" ==> " PublishMntr" ==> " BuildRelease"
291382
292383// tests dependencies
293384" Build" ==> " RunTests"
385+ " Build" ==> " RunTestsNet"
294386
295387// nuget dependencies
296- " Clean " ==> " Build " ==> " CreateNuget"
388+ " BuildRelease " ==> " CreateMntrNuget " ==> " CreateNuget"
297389" CreateNuget" ==> " SignPackages" ==> " PublishNuget" ==> " Nuget"
298390
299391// docs
300- " Clean " ==> " BuildRelease" ==> " Docfx"
392+ " BuildRelease" ==> " Docfx"
301393
302394// all
303395" BuildRelease" ==> " All"
304396" RunTests" ==> " All"
397+ " RunTestsNet" ==> " All"
305398" NBench" ==> " All"
306399" Nuget" ==> " All"
307400
0 commit comments