Skip to content

guitarrapc/UnityBuildRunner

Repository files navigation

UnityBuildRunner

dotnet-build release

NuGet NuGet

This tool enable you stdout Unity Build log on windows, and control Timeout.

Note: Linux/macOS don't need use this tool, just pass non string with -logfile argument to see log on stdout.

Motivation

Unity Batch Build for Windows still not provide Unity Build log StdOut option, wheres macOS can check stdout with -logfile + no argument. This small tool provide realtime stdout logging for Jenkins, VSTS and others.

Installation

Install with .NET Global Tool is the minimum cost.

dotnet tool install -g UnityBuildRunner

Also provided as a library.

Install-Package UnityBuildRunner.Core

Usage

You can use this tool via both CLI and Library.

$ UnityBuildRunner --help
Usage: full [options...]

Options:
  -u, --unity-path <String>    Full Path to the Unity.exe (Default: )
  -t, --timeout <String>        (Default: 00:60:00)

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

If you are running Unity batch build like this.

"C:\Program Files\UnityApplications\2017.2.2p2\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\workspace\Source\Repos\MRTKSample\Unity" -logfile "log.log" -executeMethod HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"

Then, append UnityBuildRunner --unity-path to existing command, that's all.

UnityBuildRunner --unity-path "C:\Program Files\UnityApplications\2017.2.2p2\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\workspace\Source\Repos\MRTKSample\Unity" -logfile "log.log" -executeMethod HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"

CLI (Specifying UnityPath)

You can pass Unity Path via Argument or EnvironmentVariables.

  1. Argument: Add argument --unity-path <PATH_TO_UNITY> (or -u <PATH_TO_UNITY> for short parameter).
  2. Environment Variable: Set UnityPath Environment Variable. UnityBuildRunner automatically load it if argument is not specified.

Examples

Pass Unity Path via Argument --unity-path.

UnityBuildRunner --unity-path "C:\Program Files\UnityApplications\2017.2.2p2\Editor\Unity.exe" -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\workspace\Source\Repos\MRTKSample\Unity" -logfile "log.log" -executeMethod HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"

Pass Unity Path via EnvironmentVariables UnityPath.

set UnityPath=C:\Program Files\UnityApplications\2017.2.2p2\Editor\Unity.exe
UnityBuildRunner -quit -batchmode -buildTarget "WindowsStoreApps" -projectPath "C:\workspace\Source\Repos\MRTKSample\Unity" -logfile "log.log" -executeMethod "HoloToolkit.Unity.HoloToolkitCommands.BuildSLN"

Library

You can use this library as your tool chain.

IBuilder builder = new Builder(logger);
ISettings settings = Settings.Parse(args, @"C:\Program Files\Unity\Hub\Editor\2021.3.11f1\Editor\Unity.exe");
builder.BuildAsync(settings, TimeSpan.FromMinutes(30));

TODO

  • dotnet global command
  • core logic as nuget

About

Wrapper cli tool which output Unity batch build log to StandardOutput.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 6

Languages