Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guitarrapc/unitybuildrunner
Wrapper cli tool which output Unity batch build log to StandardOutput.
https://github.com/guitarrapc/unitybuildrunner
dotnet-tool unity-build unity-windows unity3d
Last synced: 2 months ago
JSON representation
Wrapper cli tool which output Unity batch build log to StandardOutput.
- Host: GitHub
- URL: https://github.com/guitarrapc/unitybuildrunner
- Owner: guitarrapc
- License: mit
- Created: 2018-07-12T03:56:43.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-10-10T09:22:04.000Z (about 1 year ago)
- Last Synced: 2024-05-01T22:19:08.774Z (8 months ago)
- Topics: dotnet-tool, unity-build, unity-windows, unity3d
- Language: C#
- Homepage: https://www.nuget.org/packages/UnityBuildRunner
- Size: 1.46 MB
- Stars: 21
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![dotnet-build](https://github.com/guitarrapc/UnityBuildRunner/actions/workflows/dotnet-build.yaml/badge.svg)](https://github.com/guitarrapc/UnityBuildRunner/actions/workflows/dotnet-build.yaml)
[![release](https://github.com/guitarrapc/UnityBuildRunner/actions/workflows/dotnet-release.yaml/badge.svg)](https://github.com/guitarrapc/UnityBuildRunner/actions/workflows/dotnet-release.yaml)
[![NuGet](https://img.shields.io/nuget/v/UnityBuildRunner.Core.svg?label=UnityBuildRunner.Core%20nuget)](https://www.nuget.org/packages/UnityBuildRunner.Core)
[![NuGet](https://img.shields.io/nuget/v/UnityBuildRunner.svg?label=UnityBuildRunner%20nuget)](https://www.nuget.org/packages/UnityBuildRunner)## UnityBuildRunner
This tool enable you stdout Unity Build log on windows, and control Timeout.
> **Note**: Linux/macOS don't need use this tool, just pass `-logfile -` argument to see log on stdout.
# Motivation
Windows Unity BatchBuild not provide Unity Build log standard output option. This small tool provide realtime stdout build log output and build timeout control.
# Installation
You can install as .NET Global Tool or .NET Tool.
```sh
# install as global tool
dotnet tool install -g UnityBuildRunner# install to project's .config
dotnet tool install UnityBuildRunner
```Or, you can install as nuget package library.
```sh
Install-Package UnityBuildRunner.Core
```# Usage
## CLI (Help)
You can run installed tool via `UnityBuildRunner` (.NET Global Tool) or `dotnet UnityBuildRunner` (.NET Tool) command.
```
$ UnityBuildRunner --help
Usage: UnityBuildRunner [options...]Options:
-unity-path, --unity-path Full Path to the Unity.exe (Leave empty when use 'UnityPath' Environment variables instead.) (Default: )
-timeout, --timeout Timeout to terminate execution within. default: "00:60:00" (Default: 02:00:00)Commands:
help Display help.
version Display version.
```## CLI (Basic)
All you need to do is pass unity's path as `-u UnityPath` and leave other argments as is.
> [Unity \- Manual: Command line arguments](https://docs.unity3d.com/2018.3/Documentation/Manual/CommandLineArguments.html)
If you are running Unity batch build like this.
```sh
$ "C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\git\MRTKSample\Unity" -logfile "log.log" -executeMethod "HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"
```Then, append `UnityBuildRunner --unity-path ` or `dotnet UnityBuildRunner --unity-path ` to existing command, that's all.
```sh
# .NET Global Tool
$ UnityBuildRunner --unity-path "C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\git\MRTKSample\Unity" -logfile "log.log" -executeMethod "HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"# .NET Tool
$ dotnet UnityBuildRunner --unity-path "C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\git\MRTKSample\Unity" -logfile "log.log" -executeMethod "HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"
```> **Note**: Another way to specifying UnityPath is via Environment Variable `UnityPath`.
```sh
# Environment Variables
$ set UnityPath=C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Unity.exe# .NET Global Tool
$ UnityBuildRunner -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\git\MRTKSample\Unity" -logfile "log.log" -executeMethod "HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"# .NET Tool
$ dotnet UnityBuildRunner -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\git\MRTKSample\Unity" -logfile "log.log" -executeMethod "HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"
```## Library (Basic)
You can use as Library as well. This is sample code to run Unity Build.
```csharp
// Parse settings from argument
var settings = DefaultSettings.Parse(args, @"C:\Program Files\Unity\Hub\Editor\2022.3.3f1\Editor\Unity.exe", TimeSpan.FromMinutes(30));
using var cts = settings.CreateCancellationTokenSource();// Run build
IBuilder builder = new DefaultBuilder(settings, logger);
await builder.BuildAsync(cts.Token);// ExitCode is UnityBuildRunner and respect Unity's ExitCode.
Console.WriteLine(builder.ExitCode);
```## FAQ
**What happen when passing `-logFile -` argument?**
Unity.exe not generate log file when passing `-` as log file name. Therefore UnityBuildRunner replace `-` to temporary log file `unitybuild.log` instead.