Skip to content
This repository has been archived by the owner on Mar 2, 2018. It is now read-only.

Commit

Permalink
Merge pull request #38 from googlesamples/release-capella
Browse files Browse the repository at this point in the history
release-capella
  • Loading branch information
chaosemer committed Dec 15, 2015
2 parents 41901d9 + ad3722c commit dcd9f10
Show file tree
Hide file tree
Showing 561 changed files with 1,288 additions and 17,220 deletions.
79 changes: 41 additions & 38 deletions UnityExamples/Assets/Editor/BuildTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// </copyright>
//-----------------------------------------------------------------------
using System.Collections;
using System.IO;
using UnityEngine;
using UnityEditor;

Expand All @@ -37,57 +38,59 @@ public class BuildTools
private static BuildUtil.APKSettings examplesAPK = new BuildUtil.APKSettings
{
ProjectName = "Unity Examples",
Icon = "TangoExamples/Common/Textures/ProjectTango_Logo.png",
Icon = "TangoSDK/Examples/Common/Textures/ProjectTango_Logo.png",
Scenes = new string[]
{
"Scenes/MotionTracking.unity",
"Scenes/PointCloud.unity",
"Scenes/AreaLearning.unity",
"Scenes/AreaDescriptionManagement.unity",
"TangoSDK/Examples/Scenes/MotionTracking.unity",
"TangoSDK/Examples/Scenes/PointCloud.unity",
"TangoSDK/Examples/Scenes/AreaLearning.unity",
"TangoSDK/Examples/Scenes/AreaDescriptionManagement.unity",
},
BundleIdentifier = "com.google.projecttango.examples"
};

private static BuildUtil.APKSettings augmentedRealityAPK = new BuildUtil.APKSettings
{
ProjectName = "Unity Augmented Reality",
Icon = "TangoExamples/ExperimentalAugmentedReality/Textures/ar_icon.png",
Scenes = new string[] { "Scenes/ExperimentalAugmentedReality.unity" },
Icon = "TangoSDK/Examples/AugmentedReality/Textures/ar_icon.png",
Scenes = new string[] { "TangoSDK/Examples/Scenes/AugmentedReality.unity" },
BundleIdentifier = "com.projecttango.experiments.augmentedreality"
};

private static BuildUtil.APKSettings meshBuilderAPK = new BuildUtil.APKSettings
{
ProjectName = "Unity Mesh Builder",
Icon = null,
Scenes = new string[] { "Scenes/ExperimentalMeshBuilder.unity" },
Scenes = new string[] { "TangoSDK/Examples/Scenes/ExperimentalMeshBuilder.unity" },
BundleIdentifier = "com.google.projecttango.meshbuilder"
};

private static BuildUtil.APKSettings persistentStateAPK = new BuildUtil.APKSettings
{
ProjectName = "Unity Persistent State",
Icon = "TangoExamples/Common/Textures/ProjectTango_Logo.png",
Scenes = new string[]
{
"Scenes/ExperimentalPersistentState/ExperimentalPersistentState_StartScene.unity",
"Scenes/ExperimentalPersistentState/ExperimentalPersistentState_GameScene.unity"
},
BundleIdentifier = "com.projecttango.persistentstate",
};

private static BuildUtil.APKSettings virtualRealityAPK = new BuildUtil.APKSettings
{
ProjectName = "Unity VirtualReality",
Icon = "TangoExamples/ExperimentalVirtualReality/Textures/icon.png",
Scenes = new string[] { "Scenes/ExperimentalVirtualReality.unity" },
Icon = "TangoSDK/Examples/ExperimentalVirtualReality/Textures/icon.png",
Scenes = new string[] { "TangoSDK/Examples/Scenes/ExperimentalVirtualReality.unity" },
BundleIdentifier = "com.projecttango.experimental.virtualreality"
};

private static BuildUtil.PackageSettings sdkPackage = new BuildUtil.PackageSettings
private static BuildUtil.PackageSettings sdkPackageUnity5 = new BuildUtil.PackageSettings
{
PackageName = "TangoSDK",
Directories = new string[] { "Google-Unity", "Plugins", "TangoPrefabs", "TangoSDK" }
PackageName = "TangoSDK_Unity5",
Directories = new string[]
{
"Google-Unity", "Plugins", "TangoPrefabs", "TangoSDK/Core", "TangoSDK/Editor", "TangoSDK/Examples",
"TangoSDK/TangoSupport", "TangoSDK/TangoUX"
}
};

private static BuildUtil.PackageSettings sdkPackageUnity4 = new BuildUtil.PackageSettings
{
PackageName = "TangoSDK_Unity4",
Directories = new string[]
{
"Google-Unity", "Plugins", "TangoPrefabs", "TangoSDK/Core", "TangoSDK/Editor",
"TangoSDK/TangoSupport", "TangoSDK/TangoUX"
}
};

/// <summary>
Expand All @@ -99,18 +102,27 @@ public static void BuildAll()
BuildUtil.BuildAPK(examplesAPK);
BuildUtil.BuildAPK(augmentedRealityAPK);
BuildUtil.BuildAPK(meshBuilderAPK);
BuildUtil.BuildAPK(persistentStateAPK);
BuildUtil.BuildAPK(virtualRealityAPK);
BuildUtil.BuildPackage(sdkPackage);
BuildSdkPackage();
}

/// <summary>
/// Function for UI.
/// </summary>
[MenuItem("Tango/Build/SDK Package", false, 21)]
[MenuItem("Tango/Build/SDK Packages", false, 21)]
public static void BuildSdkPackage()
{
BuildUtil.BuildPackage(sdkPackage);
// Write out a version file.
string filePath = Application.dataPath + TangoSDKAbout.TANGO_VERSION_DATA_PATH;
using (BinaryWriter binaryWriter = new BinaryWriter(File.Open(filePath, FileMode.Create)))
{
binaryWriter.Write(GitHelpers.GetTagInfo());
binaryWriter.Write(GitHelpers.GetPrettyGitHash());
binaryWriter.Write(GitHelpers.GetRemoteBranchName());
}

BuildUtil.BuildPackage(sdkPackageUnity5);
BuildUtil.BuildPackage(sdkPackageUnity4);
}

/// <summary>
Expand Down Expand Up @@ -140,15 +152,6 @@ public static void BuildMeshBuilder()
BuildUtil.BuildAPK(meshBuilderAPK);
}

/// <summary>
/// Function for UI.
/// </summary>
[MenuItem("Tango/Build/Persistent State")]
public static void BuildPersistentState()
{
BuildUtil.BuildAPK(persistentStateAPK);
}

/// <summary>
/// Function for UI.
/// </summary>
Expand Down
99 changes: 99 additions & 0 deletions UnityExamples/Assets/Editor/GitHelpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
//-----------------------------------------------------------------------
// <copyright file="GitHelpers.cs" company="Google">
//
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Diagnostics;
using UnityEngine;

/// <summary>
/// Git helpers.
/// </summary>
public class GitHelpers
{
private static readonly string SHELL_SCRIPT_DIRECTORY = "/Editor/ShellScripts/";
private static readonly string HASH_PRETTY = "git_pretty_hash.sh";
private static readonly string HASH_FULL = "git_full_hash.sh";
private static readonly string REMOTE_BRANCH_NAME = "git_remote_branch_name.sh";
private static readonly string TAG_INFO = "git_tag_name.sh";

/// <summary>
/// Gets the full git hash.
/// </summary>
/// <returns>The full git hash.</returns>
public static string GetFullGitHash()
{
return _LaunchProcessWithOutput(Application.dataPath + SHELL_SCRIPT_DIRECTORY + HASH_FULL);
}

/// <summary>
/// Gets the pretty git hash.
/// </summary>
/// <returns>The pretty git hash.</returns>
public static string GetPrettyGitHash()
{
return _LaunchProcessWithOutput(Application.dataPath + SHELL_SCRIPT_DIRECTORY + HASH_PRETTY);
}

/// <summary>
/// Gets the name of the remote branch.
/// </summary>
/// <returns>The remote branch name or "undefined" if there is no remote branch.</returns>
public static string GetRemoteBranchName()
{
string rawName = _LaunchProcessWithOutput(Application.dataPath + SHELL_SCRIPT_DIRECTORY + REMOTE_BRANCH_NAME);
if (rawName == String.Empty)
{
return "undefined";
}
else
{
return rawName;
}
}

/// <summary>
/// Gets the tag info.
/// </summary>
/// <returns>The tag info.</returns>
public static string GetTagInfo()
{
return _LaunchProcessWithOutput(Application.dataPath + SHELL_SCRIPT_DIRECTORY + TAG_INFO);
}

/// <summary>
/// Launch a process and return what is printed on stdout as a string.
/// </summary>
/// <returns>Output for the launched process.</returns>
/// <param name="process">Command line to run.</param>
private static string _LaunchProcessWithOutput(string process)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = process;
psi.WindowStyle = ProcessWindowStyle.Normal;
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;

Process p = Process.Start(psi);
string processOutput = p.StandardOutput.ReadToEnd().Replace(Environment.NewLine, string.Empty);
p.WaitForExit();

return processOutput;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions UnityExamples/Assets/Editor/ShellScripts/git_full_hash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo `git rev-parse --verify HEAD`

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions UnityExamples/Assets/Editor/ShellScripts/git_pretty_hash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo `git rev-parse --short HEAD`

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
function git.branch {
git show-ref | grep `git rev-parse HEAD` | grep remotes | sed -e 's/.*remotes.origin.//'
}
git.branch

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions UnityExamples/Assets/Editor/ShellScripts/git_tag_name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
short_hash=`git rev-parse --short HEAD`

echo `git name-rev $short_hash --tags | awk '{sub("tags/", ""); print $2}'`
4 changes: 4 additions & 0 deletions UnityExamples/Assets/Editor/ShellScripts/git_tag_name.sh.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dcd9f10

Please sign in to comment.