-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Packaging updates * Output tools info * Use Mono 5.16 on macOS
- Loading branch information
Showing
12 changed files
with
133 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
<UsingTask TaskName="Zip" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | ||
<ParameterGroup> | ||
<ZipFileName ParameterType="System.String" Required="true" /> | ||
<Files ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" /> | ||
<WorkingDirectory ParameterType="System.String" Required="true" /> | ||
</ParameterGroup> | ||
<Task> | ||
<Reference Include="System.IO.Compression" /> | ||
<Using Namespace="System.IO.Compression" /> | ||
<Code Type="Fragment" Language="cs"> | ||
<![CDATA[ | ||
string cwd = null; | ||
try { | ||
var di = new DirectoryInfo(WorkingDirectory); | ||
if (!di.Exists) { | ||
Log.LogError(string.Format("{0} doesn't exist", WorkingDirectory)); | ||
return false; | ||
} | ||
cwd = Environment.CurrentDirectory; | ||
Environment.CurrentDirectory = di.FullName; | ||
using (Stream zipStream = new FileStream(Path.GetFullPath(ZipFileName), FileMode.Create, FileAccess.Write)) | ||
using (ZipArchive archive = new ZipArchive(zipStream, ZipArchiveMode.Create)) { | ||
foreach (ITaskItem fileItem in Files) { | ||
var filename = fileItem.ItemSpec; | ||
FileInfo fi = new FileInfo(filename); | ||
if (!fi.FullName.StartsWith(di.FullName)) { | ||
Log.LogError(string.Format("{0} not in {1}", filename, WorkingDirectory)); | ||
return false; | ||
} | ||
var archivename = fi.FullName.Substring(di.FullName.Length).TrimStart(new char [] { '\\', '/' }); | ||
using (Stream fileStream = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read)) | ||
using (Stream fileStreamInZip = archive.CreateEntry(archivename).Open()) | ||
fileStream.CopyTo(fileStreamInZip); | ||
} | ||
} | ||
return true; | ||
} catch (Exception ex) { | ||
Log.LogErrorFromException(ex); | ||
return false; | ||
} finally { | ||
if (cwd != null) { | ||
Environment.CurrentDirectory = cwd; | ||
} | ||
} | ||
]]> | ||
</Code> | ||
</Task> | ||
</UsingTask> | ||
|
||
<UsingTask TaskName="FileUpdate" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | ||
<ParameterGroup> | ||
<Files ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" /> | ||
<Expression ParameterType="System.String" Required="true" /> | ||
<Replacement ParameterType="System.String" Required="true" /> | ||
</ParameterGroup> | ||
<Task> | ||
<Using Namespace="System.Text.RegularExpressions" /> | ||
<Code Type="Fragment" Language="cs"> | ||
<![CDATA[ | ||
try { | ||
System.Text.RegularExpressions.Regex replaceRegex = new System.Text.RegularExpressions.Regex(Expression); | ||
foreach(ITaskItem item in Files) { | ||
string fileName = item.ItemSpec; | ||
Log.LogMessage(string.Format("Updating File \"{0}\".", fileName)); | ||
string buffer = File.ReadAllText(fileName); | ||
buffer = replaceRegex.Replace(buffer, Replacement); | ||
File.WriteAllText(fileName, buffer); | ||
} | ||
} catch(Exception ex) { | ||
Log.LogErrorFromException(ex); | ||
return false; | ||
} | ||
return true; | ||
]]> | ||
</Code> | ||
</Task> | ||
</UsingTask> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.