switch create-zip task to class type to simplify encapsulation

This commit is contained in:
Jesse Plamondon-Willard 2017-10-07 20:16:04 -04:00
parent 78e59e1a48
commit 4d32b37790
1 changed files with 81 additions and 53 deletions

View File

@ -1,6 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--********************************************* <!--*********************************************
** Define build tasks used below ** Define build tasks
**********************************************--> **********************************************-->
<!--###### <!--######
## create a release zip file for a mod (CodeTaskFactory only available on Windows?) ## create a release zip file for a mod (CodeTaskFactory only available on Windows?)
@ -15,11 +15,37 @@
<Reference Include="System.IO" /> <Reference Include="System.IO" />
<Reference Include="System.IO.Compression" /> <Reference Include="System.IO.Compression" />
<Reference Include="System.Web.Extensions"/> <Reference Include="System.Web.Extensions"/>
<Using Namespace="System.IO" /> <Code Type="Class" Language="cs">
<Using Namespace="System.IO.Compression" />
<Using Namespace="System.Web.Script.Serialization"/>
<Code Type="Fragment" Language="cs">
<![CDATA[ <![CDATA[
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Web.Script.Serialization;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
/// <summary>A build task which packs mod files into a conventional release zip.</summary>
public class CreateModReleaseZip : Task, ITask
{
/*********
** Accessors
*********/
/// <summary>The mod files to pack.</summary>
public ITaskItem[] Files { get; set; }
/// <summary>The name of the mod.</param>
public string ModName { get; set; }
/// <summary>The absolute or relative path to the folder which should contain the generated zip file.</summary>
public string OutputFolderPath { get; set; }
/*********
** Public methods
*********/
public override bool Execute()
{
try try
{ {
// create output path if needed // create output path if needed
@ -79,6 +105,8 @@
Log.LogErrorFromException(ex); Log.LogErrorFromException(ex);
return false; return false;
} }
}
}
]]> ]]>
</Code> </Code>
</Task> </Task>