diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 9f2fad6..a35f6ce 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -88,7 +88,6 @@ "ReleaseAll", "ReleaseLibplctag", "ReleaseLibplctagNativeImport", - "Restore", "Test", "UpdateCoreBinaries" ] @@ -111,7 +110,6 @@ "ReleaseAll", "ReleaseLibplctag", "ReleaseLibplctagNativeImport", - "Restore", "Test", "UpdateCoreBinaries" ] diff --git a/build/Build.cs b/build/Build.cs index 6cbddc6..a5736e6 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -34,40 +34,50 @@ class Build : NukeBuild Target Clean => _ => _ - .Before(Restore) .Executes(() => { - DotNetClean(); - SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(dir => dir.DeleteDirectory()); - ArtifactsDirectory.CreateOrCleanDirectory(); - }); - - Target Restore => _ => _ - .Executes(() => - { - DotNetRestore(s => s - .SetProjectFile(Solution)); + SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(dir => { + Log.Debug("Deleting {0}", dir); + dir.DeleteDirectory(); + }); + ArtifactsDirectory.DeleteDirectory(); }); Target Compile => _ => _ - .DependsOn(Restore) + .DependsOn(Clean) .Executes(() => { DotNetBuild(s => s - .SetProjectFile(Solution) + .SetProjectFile(libplctag) + .SetConfiguration(Configuration) + ); + + DotNetBuild(s => s + .SetProjectFile(libplctag_NativeImport) .SetConfiguration(Configuration) - .EnableNoRestore() ); }); Target Test => _ => _ - .DependsOn(Compile) + .DependsOn(PackLibplctagNativeImport) .Executes(() => { + var testProject = Solution.GetProject("libplctag.NativeImport.Tests"); + + DotNetRestore(s => s + .SetProjectFile(testProject) + .SetNoCache(true) + .SetConfigFile(testProject.Directory / "nuget.config") + ); + + DotNetBuild(s => s + .SetProjectFile(testProject) + .SetConfiguration(Configuration) + .SetNoRestore(true) + ); + DotNetTest(s => s - .SetProjectFile(Solution) - .SetConfiguration(Configuration) - .EnableNoRestore() + .SetProjectFile(testProject) ); }); @@ -83,11 +93,10 @@ class Build : NukeBuild .EnableNoRestore() .SetOutputDirectory(ArtifactsDirectory) ); - }); Target PackLibplctagNativeImport => _ => _ - .DependsOn(Test) + .DependsOn(Compile) .Executes(() => { DotNetPack(s => s diff --git a/src/libplctag.NativeImport.Tests/libplctag.NativeImport.Tests.csproj b/src/libplctag.NativeImport.Tests/libplctag.NativeImport.Tests.csproj index 5df0681..4f24d38 100644 --- a/src/libplctag.NativeImport.Tests/libplctag.NativeImport.Tests.csproj +++ b/src/libplctag.NativeImport.Tests/libplctag.NativeImport.Tests.csproj @@ -1,12 +1,8 @@ - + net8.0 false - - - - ../libplctag.NativeImport/bin/Release/ @@ -20,11 +16,11 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + diff --git a/src/libplctag.NativeImport.Tests/nuget.config b/src/libplctag.NativeImport.Tests/nuget.config new file mode 100644 index 0000000..57810f6 --- /dev/null +++ b/src/libplctag.NativeImport.Tests/nuget.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file