This repository has been archived by the owner on Sep 10, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented build task for zipping artifacts.
- Loading branch information
Kenneth
committed
Sep 1, 2019
1 parent
f9de365
commit 9b78020
Showing
8 changed files
with
79 additions
and
3 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
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,18 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 0ead8d19a849f46459ade8202df21b28, type: 3} | ||
m_Name: ZipArtifacts | ||
m_EditorClassIdentifier: | ||
subfolders: | ||
- Win64 | ||
archiveDestination: Win64.zip | ||
backend7ZipExePath: C:/Program Files/7-Zip/7z.exe |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
38 changes: 38 additions & 0 deletions
38
Assets/UnityTK/Code/EditorCode/BuildSystem/BuildTask_Zip.cs
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,38 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEditor; | ||
using System.IO; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
|
||
namespace UnityTK.BuildSystem | ||
{ | ||
/// <summary> | ||
/// <see cref="BuildTask"/> which will run a job. | ||
/// </summary> | ||
[CreateAssetMenu(fileName = "CreateZipTask", menuName = "UnityTK/BuildSystem/Create Zip Task")] | ||
public class BuildTask_Zip : BuildTask | ||
{ | ||
[Header("Build config")] | ||
public List<string> subfolders; | ||
public string archiveDestination; | ||
|
||
[Header("Backend: 7-Zip")] | ||
public string backend7ZipExePath = "C:/Program Files/7-Zip/7z.exe"; | ||
|
||
public override void Run(BuildJob job, BuildJobParameters parameters) | ||
{ | ||
List<string> subfolders = new List<string>(this.subfolders); | ||
if (subfolders.Count == 1) | ||
subfolders[0] += "/*"; | ||
|
||
if (File.Exists(backend7ZipExePath)) | ||
{ | ||
// Use 7zip backend | ||
string arguments = "a " + Path.Combine(parameters.destination, archiveDestination) + " " + string.Join(" ", subfolders.Select(s => "\"" + Path.Combine(parameters.destination, s) + "\"")); | ||
Process.Start(backend7ZipExePath, arguments).WaitForExit(); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/UnityTK/Code/EditorCode/BuildSystem/BuildTask_Zip.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.