瀏覽代碼

Pipelines and args

Krzysztof Krysiński 2 年之前
父節點
當前提交
c3f06688d2

+ 25 - 9
src/PixiEditor.Builder/build/Program.cs

@@ -1,13 +1,8 @@
 using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Cake.Common.IO;
 using Cake.Common.Tools.DotNet;
-using Cake.Common.Tools.DotNet.Build;
+using Cake.Common.Tools.DotNet.Publish;
 using Cake.Core;
 using Cake.Core.Diagnostics;
-using Cake.Core.IO;
 using Cake.Frosting;
 using Path = System.IO.Path;
 
@@ -31,7 +26,11 @@ public class BuildContext : FrostingContext
 
     public string BackedUpConstants { get; set; }
 
-    public Stream ConstantsStream { get; set; }
+    public string BuildConfiguration { get; set; } = "Release";
+
+    public string OutputDirectory { get; set; } = "Builds";
+
+    public string Runtime { get; set; }
 
     public BuildContext(ICakeContext context)
         : base(context)
@@ -46,6 +45,20 @@ public class BuildContext : FrostingContext
         {
             PathToProject = context.Arguments.GetArgument("project-path");
         }
+
+        bool hasCustomConfiguration = context.Arguments.HasArgument("build-configuration");
+        if (hasCustomConfiguration)
+        {
+            BuildConfiguration = context.Arguments.GetArgument("build-configuration");
+        }
+
+        bool hasCustomOutputDirectory = context.Arguments.HasArgument("o");
+        if (hasCustomOutputDirectory)
+        {
+            OutputDirectory = context.Arguments.GetArgument("o");
+        }
+
+        Runtime = context.Arguments.GetArgument("runtime");
     }
 }
 
@@ -94,9 +107,12 @@ public sealed class BuildProjectTask : FrostingTask<BuildContext>
         context.Log.Information("Building project...");
         string projectPath = context.PathToProject;
 
-        context.DotNetBuild(projectPath, new DotNetBuildSettings
+        context.DotNetPublish(projectPath, new DotNetPublishSettings()
         {
-            Configuration = "Release",
+            Configuration = context.BuildConfiguration,
+            SelfContained = false,
+            Runtime = context.Runtime,
+            OutputDirectory = context.OutputDirectory,
         });
     }
 

+ 5 - 9
windows-x64-release-dev.yml

@@ -46,16 +46,12 @@ steps:
   displayName: "Set tag version"
   inputs:
     filePath: 'assemblyVerReader.ps1'
-
-- task: DotNetCoreCLI@2
-  displayName: "Build release PixiEditor x64 light"
+    
+- task: PowerShell@2
+  displayName: Publish PixiEditor
   inputs:
-    command: 'publish'
-    publishWebProjects: false
-    projects: '**/PixiEditor.csproj'
-    arguments: >
-      -o "Builds\PixiEditor-x64-light" --self-contained=false -r "win-x64" -c "Dev Release"
-    zipAfterPublish: false
+    filePath: '$(solution)/PixiEditor.Builder/build.ps1'
+    arguments: '--project-path "$(solution)/PixiEditor" --build-configuration "Dev_Release" --runtime "win-x64" -o "Builds/PixiEditor-x64-light" --crash-report-webhook-url "$(crash-webhook-url)"'
     
 - task: ArchiveFiles@2
   inputs:

+ 4 - 7
windows-x64-release.yml

@@ -47,14 +47,11 @@ steps:
   inputs:
     filePath: 'assemblyVerReader.ps1'
 
-- task: DotNetCoreCLI@2
-  displayName: "Build release PixiEditor x64 light"
+- task: PowerShell@2
+  displayName: Publish PixiEditor
   inputs:
-    command: 'publish'
-    publishWebProjects: false
-    projects: '**/PixiEditor.csproj'
-    arguments: '-o "Builds\PixiEditor-x64-light" --self-contained=false -r "win-x64" -c Release'
-    zipAfterPublish: false
+    filePath: '$(solution)/PixiEditor.Builder/build.ps1'
+    arguments: '--project-path "$(solution)/PixiEditor" --build-configuration "Release" --runtime "win-x64" -o "Builds/PixiEditor-x64-light" --crash-report-webhook-url "$(crash-webhook-url)"'
     
 - task: ArchiveFiles@2
   inputs:

+ 4 - 8
windows-x86-release-dev.yml

@@ -49,15 +49,11 @@ steps:
   inputs:
     filePath: 'assemblyVerReader.ps1'
 
-- task: DotNetCoreCLI@2
-  displayName: "Build release PixiEditor x86 light"
+- task: PowerShell@2
+  displayName: Publish PixiEditor
   inputs:
-    command: 'publish'
-    publishWebProjects: false
-    projects: '**/PixiEditor.csproj'
-    arguments: >
-      -o "Builds\PixiEditor-x86-light" --self-contained=false -r "win-x86" -c "Dev Release"
-    zipAfterPublish: false
+    filePath: '$(solution)/PixiEditor.Builder/build.ps1'
+    arguments: '--project-path "$(solution)/PixiEditor" --build-configuration "Dev_Release" --runtime "win-x86" -o "Builds/PixiEditor-x86-light" --crash-report-webhook-url "$(crash-webhook-url)"'
 
 - task: ArchiveFiles@2
   inputs:

+ 4 - 7
windows-x86-release.yml

@@ -49,14 +49,11 @@ steps:
   inputs:
     filePath: 'assemblyVerReader.ps1'
 
-- task: DotNetCoreCLI@2
-  displayName: "Build release PixiEditor x86 light"
+- task: PowerShell@2
+  displayName: Publish PixiEditor
   inputs:
-    command: 'publish'
-    publishWebProjects: false
-    projects: '**/PixiEditor.csproj'
-    arguments: '-o "Builds\PixiEditor-x86-light" --self-contained=false -r "win-x86" -c Release'
-    zipAfterPublish: false
+    filePath: '$(solution)/PixiEditor.Builder/build.ps1'
+    arguments: '--project-path "$(solution)/PixiEditor" --build-configuration "Release" --runtime "win-x86" -o "Builds/PixiEditor-x86-light" --crash-report-webhook-url "$(crash-webhook-url)"'
 
 - task: ArchiveFiles@2
   inputs: