Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Changelog
All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.0.5-preview] - 2018-02-08
- Initial submission for package distribution
  • Loading branch information
Unity Technologies committed Feb 7, 2018
0 parents commit d80fe5a
Show file tree
Hide file tree
Showing 151 changed files with 4,441 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog
All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [0.0.5-preview] - 2018-02-08
- Initial submission for package distribution

7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

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

8 changes: 8 additions & 0 deletions Documentation.meta

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

4 changes: 4 additions & 0 deletions Documentation/com.unity.scriptablebuildpipeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Unity scriptablebuildpipeline

scriptablebuildpipeline info placeholder

7 changes: 7 additions & 0 deletions Documentation/com.unity.scriptablebuildpipeline.md.meta

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

10 changes: 10 additions & 0 deletions Editor.meta

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

85 changes: 85 additions & 0 deletions Editor/ContentPipeline.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System.Diagnostics;
using UnityEditor.Build.Interfaces;
using UnityEditor.Build.Utilities;

namespace UnityEditor.Build.AssetBundle
{
public static class ContentPipeline
{
public const string kTempBuildPath = "Temp/ContentBuildData";

public static BuildCallbacks BuildCallbacks = new BuildCallbacks();

public static ReturnCodes BuildContentPacks(IBuildParameters buildParameters, IBuildContent buildContent, out IBuildResults result)
{
var buildTimer = new Stopwatch();
buildTimer.Start();

ReturnCodes exitCode;
result = new BuildBuildResults();

using (var progressTracker = new ProgressTracker())
{
using (var buildCleanup = new BuildStateCleanup(buildParameters.TempOutputFolder))
{
var buildContext = new BuildContext(buildParameters, buildContent, result, progressTracker);
buildContext.SetContextObject(new PrefabPackedIdentifiers());
buildContext.SetContextObject(new BuildDependencyData());
buildContext.SetContextObject(new BuildWriteData());
buildContext.SetContextObject(BuildCallbacks);

var pipeline = DefaultBuildTasks.Create(DefaultBuildTasks.Presets.AutopackReleaseContent, buildParameters.ScriptInfo == null);
exitCode = BuildTasksRunner.Validate(pipeline, buildContext);
if (exitCode >= ReturnCodes.Success)
exitCode = BuildTasksRunner.Run(pipeline, buildContext);
}
}

buildTimer.Stop();
if (exitCode >= ReturnCodes.Success)
BuildLogger.Log("Build Content successful in: {0:c}", buildTimer.Elapsed);
else if (exitCode == ReturnCodes.Canceled)
BuildLogger.LogWarning("Build Content canceled in: {0:c}", buildTimer.Elapsed);
else
BuildLogger.LogError("Build Content failed in: {0:c}. Error: {1}.", buildTimer.Elapsed, exitCode);

return exitCode;
}

public static ReturnCodes BuildAssetBundles(IBuildParameters buildParameters, IBundleContent bundleContent, out IBundleBuildResults result)
{
var buildTimer = new Stopwatch();
buildTimer.Start();

ReturnCodes exitCode;
result = new BundleBuildResults();

using (var progressTracker = new ProgressTracker())
{
using (var buildCleanup = new BuildStateCleanup(buildParameters.TempOutputFolder))
{
var buildContext = new BuildContext(buildParameters, bundleContent, result, progressTracker);
buildContext.SetContextObject(new Unity5PackedIdentifiers());
buildContext.SetContextObject(new BuildDependencyData());
buildContext.SetContextObject(new BundleWriteData());
buildContext.SetContextObject(BuildCallbacks);

var pipeline = DefaultBuildTasks.Create(DefaultBuildTasks.Presets.AssetBundleCompatible, buildParameters.ScriptInfo == null);
exitCode = BuildTasksRunner.Validate(pipeline, buildContext);
if (exitCode >= ReturnCodes.Success)
exitCode = BuildTasksRunner.Run(pipeline, buildContext);
}
}

buildTimer.Stop();
if (exitCode >= ReturnCodes.Success)
BuildLogger.Log("Build Asset Bundles successful in: {0:c}", buildTimer.Elapsed);
else if (exitCode == ReturnCodes.Canceled)
BuildLogger.LogWarning("Build Asset Bundles canceled in: {0:c}", buildTimer.Elapsed);
else
BuildLogger.LogError("Build Asset Bundles failed in: {0:c}. Error: {1}.", buildTimer.Elapsed, exitCode);

return exitCode;
}
}
}
13 changes: 13 additions & 0 deletions Editor/ContentPipeline.cs.meta

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

8 changes: 8 additions & 0 deletions Editor/Interfaces.meta

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

16 changes: 16 additions & 0 deletions Editor/Interfaces/IBuildContent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections.Generic;

namespace UnityEditor.Build.Interfaces
{
public interface IBuildContent : IContextObject
{
List<GUID> Assets { get; }
List<GUID> Scenes { get; }
}

public interface IBundleContent : IBuildContent
{
Dictionary<string, List<GUID>> BundleLayout { get; }
Dictionary<GUID, string> Addresses { get; }
}
}
11 changes: 11 additions & 0 deletions Editor/Interfaces/IBuildContent.cs.meta

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

40 changes: 40 additions & 0 deletions Editor/Interfaces/IBuildContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;

namespace UnityEditor.Build.Interfaces
{
public interface IContextObject { }

public interface IScriptsCallback : IContextObject
{
ReturnCodes PostScripts(IBuildParameters buildParameters, IBuildResults buildResults);
}

public interface IDependencyCallback : IContextObject
{
ReturnCodes PostDependency(IBuildParameters buildParameters, IDependencyData dependencyData);
}

public interface IPackingCallback : IContextObject
{
ReturnCodes PostPacking(IBuildParameters buildParameters, IDependencyData dependencyData, IWriteData writeData);
}

public interface IWritingCallback : IContextObject
{
ReturnCodes PostWriting(IBuildParameters buildParameters, IDependencyData dependencyData, IWriteData writeData, IBuildResults buildResults);
}

public interface IBuildContext
{
bool ContainsContextObject<T>() where T : IContextObject;
bool ContainsContextObject(Type type);

T GetContextObject<T>() where T : IContextObject;
IContextObject GetContextObject(Type type);

void SetContextObject<T>(IContextObject contextObject) where T : IContextObject;
void SetContextObject(IContextObject contextObject);

bool TryGetContextObject<T>(out T contextObject) where T : IContextObject;
}
}
11 changes: 11 additions & 0 deletions Editor/Interfaces/IBuildContext.cs.meta

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

49 changes: 49 additions & 0 deletions Editor/Interfaces/IBuildParameters.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using UnityEditor.Experimental.Build.AssetBundle;
using UnityEditor.Experimental.Build.Player;
using UnityEngine;

namespace UnityEditor.Build.Interfaces
{
//public interface IScriptParameters : IContextObject
//{
// BuildTarget Target { get; set; }
// BuildTargetGroup Group { get; set; }
// ScriptCompilationOptions ScriptOptions { get; set; }

// ScriptCompilationSettings GetScriptCompilationSettings();
//}

//public interface IContentParameters : IContextObject
//{
// BuildTarget Target { get; set; }
// BuildTargetGroup Group { get; set; }
// TypeDB ScriptInfo { get; set; }

// BuildSettings GetContentBuildSettings();

// BuildCompression GetCompressionForIdentifier(string identifier);
//}


public interface IBuildParameters : IContextObject//IScriptParameters, IContentParameters
{
BuildTarget Target { get; set; }
BuildTargetGroup Group { get; set; }

TypeDB ScriptInfo { get; set; }

ScriptCompilationOptions ScriptOptions { get; set; }

string OutputFolder { get; set; }
string TempOutputFolder { get; }
bool UseCache { get; set; }

string GetTempOrCacheBuildPath(Hash128 hash);

BuildSettings GetContentBuildSettings();

BuildCompression GetCompressionForIdentifier(string identifier);

ScriptCompilationSettings GetScriptCompilationSettings();
}
}
11 changes: 11 additions & 0 deletions Editor/Interfaces/IBuildParameters.cs.meta

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

17 changes: 17 additions & 0 deletions Editor/Interfaces/IBuildResults.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Collections.Generic;
using UnityEditor.Experimental.Build.AssetBundle;
using UnityEditor.Experimental.Build.Player;

namespace UnityEditor.Build.Interfaces
{
public interface IBuildResults : IContextObject
{
ScriptCompilationResult ScriptResults { get; set; }
Dictionary<string, WriteResult> WriteResults { get; }
}

public interface IBundleBuildResults : IBuildResults
{
Dictionary<string, BundleDetails> BundleInfos { get; }
}
}
11 changes: 11 additions & 0 deletions Editor/Interfaces/IBuildResults.cs.meta

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

13 changes: 13 additions & 0 deletions Editor/Interfaces/IBuildTasks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace UnityEditor.Build.Interfaces
{
public interface IBuildTask
{
int Version { get; }

Type[] RequiredContextTypes { get; }

ReturnCodes Run(IBuildContext context);
}
}
11 changes: 11 additions & 0 deletions Editor/Interfaces/IBuildTasks.cs.meta

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

14 changes: 14 additions & 0 deletions Editor/Interfaces/IDependencyData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.Generic;
using UnityEditor.Experimental.Build.AssetBundle;

namespace UnityEditor.Build.Interfaces
{
public interface IDependencyData : IContextObject
{
Dictionary<GUID, AssetLoadInfo> AssetInfo { get; }
Dictionary<GUID, BuildUsageTagSet> AssetUsage { get; }

Dictionary<GUID, SceneDependencyInfo> SceneInfo { get; }
Dictionary<GUID, BuildUsageTagSet> SceneUsage { get; }
}
}
11 changes: 11 additions & 0 deletions Editor/Interfaces/IDependencyData.cs.meta

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

Loading

0 comments on commit d80fe5a

Please sign in to comment.