Skip to content
Permalink
Browse files
Implemented automatic build script for building demo scenes.
  • Loading branch information
zachkinstner committed Sep 30, 2015
1 parent 1e01573 commit 151e6d769fb804ec1b5a89f05f11260b8ec69b25
@@ -0,0 +1,62 @@
@echo off


:: ---- HOVERBOARD --------------------------------------------

call :setVr 0 "Hoverboard Demo (Non-VR)"
call :build BuildBoardKeysNonVr

call :setVr 1 "Hoverboard Demo (VR)"
call :build BuildBoardKeysVr


:: ---- HOVERCAST ---------------------------------------------

call :setVr 0 "Hovercast Demo (Non-VR)"
call :build BuildCastCubesNonVr

call :setVr 1 "Hovercast Demo (VR)"
call :build BuildCastCubesVr


:: ---- CLEANUP -----------------------------------------------

del Unity\ProjectSettings\*.bak

echo %DATE% %TIME% > Builds/Auto/timestamp.txt
timeout /t -1
exit /b


:: ---- FUNCTIONS ---------------------------------------------


:setVr
if %1 == 1 (
SET res=2
SET aspect=0
) else (
SET res=1
SET aspect=1
)

SET file="Unity\ProjectSettings\ProjectSettings.asset"

@echo on
perl -i.bak -pe 's/productName: .+/productName: %2/' %file%
perl -i.bak -pe 's/virtualRealitySupported: \d/virtualRealitySupported: %1/' %file%
@echo off
perl -i.bak -pe 's/displayResolutionDialog: \d/displayResolutionDialog: %res%/' %file%
perl -i.bak -pe 's/4:3: \d/4:3: %aspect%/' %file%
perl -i.bak -pe 's/5:4: \d/5:4: %aspect%/' %file%
perl -i.bak -pe 's/Others: \d/Others: %aspect%/' %file%
goto :eof



:build
@echo on
C:\Zach\Programs\Dev\Unity5\Editor\Unity.exe -quit -batchmode -executeMethod Hover.Unity.Editor.AutomatedBuilds.%~1
@echo off
goto :eof

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,90 @@
using System;
using UnityEditor;

namespace Hover.Unity.Editor {

/*================================================================================================*/
public class AutomatedBuilds {

public const string DemoPath = "Assets/Hover/Demo/";
public const string BoardKeysPath = DemoPath+"BoardKeys/Scenes/";
public const string CastCubesPath = DemoPath+"CastCubes/Scenes/";


////////////////////////////////////////////////////////////////////////////////////////////////
/*--------------------------------------------------------------------------------------------*/
public static void BuildBoardKeysVr() {
Build(BuildTarget.StandaloneWindows, BoardKeysPath, "HoverboardDemo-LeapVR");
}

/*--------------------------------------------------------------------------------------------*/
public static void BuildBoardKeysNonVr() {
const string leapHeadScene = "HoverboardDemo-LeapOnly-HeadMount";
const string leapTableScene = "HoverboardDemo-LeapOnly-TableMount";

Build(BuildTarget.StandaloneWindows, BoardKeysPath, leapHeadScene);
Build(BuildTarget.StandaloneWindows, BoardKeysPath, leapTableScene);

//Build(BuildTarget.StandaloneOSXIntel, BoardKeysPath, leapHeadScene);
//Build(BuildTarget.StandaloneOSXIntel, BoardKeysPath, leapTableScene);
}


////////////////////////////////////////////////////////////////////////////////////////////////
/*--------------------------------------------------------------------------------------------*/
public static void BuildCastCubesVr() {
Build(BuildTarget.StandaloneWindows, CastCubesPath, "HovercastDemo-LeapVR");
Build(BuildTarget.StandaloneWindows, CastCubesPath, "HovercastDemo-LeapLookVR");
}

/*--------------------------------------------------------------------------------------------*/
public static void BuildCastCubesNonVr() {
const string leapHeadScene = "HovercastDemo-LeapOnly-HeadMount";
const string leapTableScene = "HovercastDemo-LeapOnly-TableMount";

Build(BuildTarget.StandaloneWindows, CastCubesPath, leapHeadScene);
Build(BuildTarget.StandaloneWindows, CastCubesPath, leapTableScene);

//Build(BuildTarget.StandaloneOSXIntel, CastCubesPath, leapHeadScene);
//Build(BuildTarget.StandaloneOSXIntel, CastCubesPath, leapTableScene);
}


////////////////////////////////////////////////////////////////////////////////////////////////
/*--------------------------------------------------------------------------------------------*/
private static void Build(BuildTarget pPlatform, string pPath, string pScene) {
BuildPipeline.BuildPlayer(
new[] { pPath+pScene+".unity" },
GetPath(pPlatform, pScene),
pPlatform,
BuildOptions.None
);
}

/*--------------------------------------------------------------------------------------------*/
private static string GetPath(BuildTarget pPlatform, string pScene) {
string platformLabel;
string outputFilename = pScene;

switch ( pPlatform ) {
case BuildTarget.StandaloneWindows:
platformLabel = "PC";
outputFilename += ".exe";
break;

case BuildTarget.StandaloneOSXIntel:
platformLabel = "Mac";
break;

default:
throw new Exception("Unsupported build target: "+pPlatform);
}

string demoGroup = pScene.Substring(0, pScene.IndexOf('-'));
//string date = DateTime.UtcNow.ToString("yyyy-MM-dd");
return "../Builds/Auto/"+demoGroup+"-"+/*date+"-"+*/platformLabel+"/"+outputFilename;
}

}

}

Some generated files are not rendered by default. Learn more.

0 comments on commit 151e6d7

Please sign in to comment.