Class DistroBase
Base class for distributions.
Inheritance
Namespace: sttz.Trimmer.Editor
Assembly: Trimmer-Editor.dll
Syntax
public abstract class DistroBase : ScriptableObject
Remarks
Distributions take the builds generated by one or more Build Profiles and process them in different ways, e.g.
- ItchDistro: Upload builds to itch.io
- MASDistro: Process a mac build for the Mac App Store (no automatic upload)
- SteamDistro: Upload builds to Steam
- UploadDistro: Zip and Upload builds to a FTP server
- ZipDistro: Zip builds
There are also more generic distros:
- ScriptDistro: Call a script with the build path
- MetaDistro: Execute multiple distros
To create a distro, select the type you want from Create » Trimmer » Distro in the Project window's Create menu.
Note that while a distro is running, reloading of scripts is locked, as the assembly reload would abort the distribution.
Fields
| Improve this Doc View Sourcebuilds
Process the builds of these Build Profiles.
Declaration
[HideInInspector]
public List<BuildProfile> builds
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<BuildProfile> |
runningScripts
Declaration
protected List<Action<bool>> runningScripts
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Action<System.Boolean>> |
Properties
| Improve this Doc View SourceCanRunWithoutBuildTargets
Wether the distribution will raise an error if it has no build targets.
Declaration
public virtual bool CanRunWithoutBuildTargets { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRunning
Wether the distribution is currently running.
Declaration
public bool IsRunning { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
While the distribution is running, script reloading is locked. Call ForceCancel() or select it from the distribution's gear menu in case the distribution gets stuck.
Methods
| Improve this Doc View SourceBuild()
Build all linked Build Profiles.
Declaration
[ContextMenu("Build")]
public bool Build()
Returns
Type | Description |
---|---|
System.Boolean |
BuildAndGetBuildPaths(Boolean)
Build all missing targets and return the paths for all build of all linked Build Profiles.
Declaration
public virtual IEnumerable<DistroBase.BuildPath> BuildAndGetBuildPaths(bool forceBuild = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | forceBuild | Force rebuilding all targets, even if a build exists |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<DistroBase.BuildPath> |
Cancel()
Cancel the distribution.
Declaration
public virtual void Cancel()
Distribute()
Process the builds of the linked Build Profiles and build the targets where no build exists.
Declaration
[ContextMenu("Distribute")]
public void Distribute()
Distribute(Boolean)
Process the builds of the linked Build Profiles and build the targets where no build exists.
Declaration
public void Distribute(bool forceBuild)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | forceBuild | Force rebuilding all targets, even if a build exists |
DistributeCoroutine(Boolean)
Coroutine to run the distribution.
Declaration
public virtual IEnumerator DistributeCoroutine(bool forceBuild = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | forceBuild | Force rebuilding all targets, even if a build exists |
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
Remarks
This is not a Unity coroutine but a custom editor coroutine. Use RunCoroutine(IEnumerator) to start it and GetSubroutineResult<T>() to get its result.
DistributeCoroutine(IEnumerable<DistroBase.BuildPath>, Boolean)
Subroutine to override in subclasses to do the actual processing.
Declaration
protected abstract IEnumerator DistributeCoroutine(IEnumerable<DistroBase.BuildPath> buildPaths, bool forceBuild)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<DistroBase.BuildPath> | buildPaths | Build paths of the linked Build Profiles |
System.Boolean | forceBuild | Force rebuilding all targets, even if a build exists |
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
Execute(ProcessStartInfo, String, Action<String>, Action<String>)
Editor coroutine wrapper for OptionHelper.RunScriptAsync.
Declaration
protected IEnumerator Execute(ProcessStartInfo startInfo, string input = null, Action<string> onOutput = null, Action<string> onError = null)
Parameters
Type | Name | Description |
---|---|---|
System.Diagnostics.ProcessStartInfo | startInfo | |
System.String | input | |
System.Action<System.String> | onOutput | |
System.Action<System.String> | onError |
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
Execute(String, String, String, Action<String>, Action<String>)
Editor coroutine wrapper for OptionHelper.RunScriptAsync.
Declaration
protected IEnumerator Execute(string path, string arguments, string input = null, Action<string> onOutput = null, Action<string> onError = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | |
System.String | arguments | |
System.String | input | |
System.Action<System.String> | onOutput | |
System.Action<System.String> | onError |
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
ForceCancel()
Force cancel the distribution. Only call in case the distribution gets stuck, e.g. because of an exception.
Declaration
[ContextMenu("Force Cancel")]
public void ForceCancel()
GetSubroutineResult<T>()
Get the last yielded value of a subroutine. This can only be called in the coroutine that yielded the subroutine and only between after the subroutine finished and before the parent coroutine yields again.
Declaration
public static T GetSubroutineResult<T>()
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
HasAllBuilds()
Check wether there are existing builds for all build target in all linked Build Profiles.
Declaration
public virtual bool HasAllBuilds()
Returns
Type | Description |
---|---|
System.Boolean |
RunCoroutine(IEnumerator)
Editor coroutine runner. It's quite different from Unity's coroutines:
- You can only return null to pause a frame, no WaitForXXX
- You can however return another coroutine IEnumerator and it'll finish that first
- And you can use SubroutineResult to get that coroutine's last yielded value
Declaration
public static void RunCoroutine(IEnumerator routine)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerator | routine |