Skip to content

Commit

Permalink
First public version of uplift
Browse files Browse the repository at this point in the history
  • Loading branch information
niezbop committed Nov 6, 2017
0 parents commit 7f90bbd
Show file tree
Hide file tree
Showing 390 changed files with 152,405 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# /
/Temp
/Library
/target
/test-results
/obj
/*.csproj
/*.csproj.user
/*.pidb
/*.sln
/*.suo
/*.userprefs
/*.patch
/*.log
/*.vs
/*.vscode
*.unityproj
*.pyc
*.pidb
*.pidb.meta
.DS_Store
.db
Thumbs.db
/.idea
/results.xml

/Assets/UPackages.meta
# == UPLIFT GITIGNORE START ==
# This section of the .gitignore has been created automatically by Uplift. Do not modify it or remove it.
/UPackages
/UPackages.meta
/Assets/UPackages/PackageX~1.0.0
/Assets/UPackages/PackageX~1.0.0.meta
/Assets/UPackages/TestPackage.MetaFilesPackageTest~0.0.1
/Assets/UPackages/TestPackage.MetaFilesPackageTest~0.0.1.meta
/Assets/UPackages/TestPackage.NoMetaFilesPackageTest~0.0.1
/Assets/UPackages/TestPackage.NoMetaFilesPackageTest~0.0.1.meta
/Assets/UPackages/TestPackage.UnityPackageTest~0.0.1
/Assets/UPackages/TestPackage.UnityPackageTest~0.0.1.meta
/Assets/UPackages/DependencyRoot~0.0.1
/Assets/UPackages/DependencyRoot~0.0.1.meta
/Assets/UPackages/DependencyMiddle~0.0.1
/Assets/UPackages/DependencyMiddle~0.0.1.meta
/Assets/UPackages/DependencyLeaf~0.0.1
/Assets/UPackages/DependencyLeaf~0.0.1.meta
/Assets/Plugins/AnotherPluginScript.cs
/Assets/Plugins/AnotherPluginScript.cs.meta
/Assets/Plugins/PluginScript.cs
/Assets/Plugins/PluginScript.cs.meta
/Assets/UPackages/AnotherRoot~0.0.1
/Assets/UPackages/AnotherRoot~0.0.1.meta
# == UPLIFT GITIGNORE END ==

UpliftTesting/bin
UpliftTesting/obj
UpliftTesting/*.csproj
UpliftTesting/*.csproj.user
UpliftTesting/*.sln
9 changes: 9 additions & 0 deletions Assets/Plugins.meta

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

9 changes: 9 additions & 0 deletions Assets/Plugins/Editor.meta

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

9 changes: 9 additions & 0 deletions Assets/Plugins/Editor/BuildTool.meta

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

43 changes: 43 additions & 0 deletions Assets/Plugins/Editor/BuildTool/BuildLibraryData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// --- BEGIN LICENSE BLOCK ---
/*
* Copyright (c) 2017-present WeWantToKnow AS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
// --- END LICENSE BLOCK ---

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using Uplift.Common;

using System.Diagnostics;
using System.Text;
using System.Linq;

namespace BuildTool {

public class BuildLibraryData {
public string[] References;
public string[] Files;
public int SdkLevel;
public string OutFile;
}
}
12 changes: 12 additions & 0 deletions Assets/Plugins/Editor/BuildTool/BuildLibraryData.cs.meta

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

84 changes: 84 additions & 0 deletions Assets/Plugins/Editor/BuildTool/BuildPaths.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// --- BEGIN LICENSE BLOCK ---
/*
* Copyright (c) 2017-present WeWantToKnow AS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
// --- END LICENSE BLOCK ---

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;

namespace BuildTool {
public class BuildPaths {
private UnityInstallation unity;

public BuildPaths(UnityInstallation unity) {
this.unity = unity;
}

public string Managed(string file) {
string RootPath = ManagedPath();
string Path = Helper.PathCombine(RootPath, file);
EnsureFilePath (Path);
return Path;
}

private void EnsureFilePath(string path) {
if (!File.Exists(path)) {
throw new System.Exception("File " + path + " not found.");
}
}
private void EnsureDirPath(string path) {
if (!Directory.Exists(path)) {
throw new System.Exception("Directory " + path + " not found.");
}
}

public string ManagedPath() {
string ManagedPath;
if (Helper.IsMac ()) {
ManagedPath = Helper.PathCombine(unity.RootPath, "Unity.app", "Contents", "Managed");
if (!Directory.Exists(ManagedPath)) { // Pre 5.6
ManagedPath = Helper.PathCombine(unity.RootPath, "Unity.app", "Contents", "Frameworks", "Managed");
}
} else {
ManagedPath = Helper.PathCombine(unity.RootPath, "Editor", "Data", "Managed");
}
EnsureDirPath (ManagedPath);
return ManagedPath;
}

public string Mcs() {
string ManagedPath;
if (Helper.IsMac ()) {
ManagedPath = Helper.PathCombine(unity.RootPath, "Unity.app", "Contents", "MonoBleedingEdge", "bin", "mcs");
if (!File.Exists(ManagedPath)) { // Pre 5.6
ManagedPath = Helper.PathCombine(unity.RootPath, "Unity.app", "Contents", "Frameworks", "MonoBleedingEdge", "bin", "mcs");
}
} else {
ManagedPath = Helper.PathCombine(unity.RootPath, "Editor", "Data", "MonoBleedingEdge", "bin", "mcs");
}
EnsureFilePath (ManagedPath);
return ManagedPath;
}
}
}
12 changes: 12 additions & 0 deletions Assets/Plugins/Editor/BuildTool/BuildPaths.cs.meta

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

98 changes: 98 additions & 0 deletions Assets/Plugins/Editor/BuildTool/DllCompiler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// --- BEGIN LICENSE BLOCK ---
/*
* Copyright (c) 2017-present WeWantToKnow AS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
// --- END LICENSE BLOCK ---

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Uplift.Common;
using System.Linq;
using System.IO;

namespace BuildTool {
public class DllCompiler {
static string UpliftDLL = "target/Uplift.dll";

[MenuItem("Tools/Uplift/Build/BuildAndExportDll", false, 0)]
public static void BuildPackage() {
BuildUpliftDll ();
PrepareExportArea();
}

[MenuItem("Tools/Uplift/Build/BuildDll", false, 1)]
public static void BuildUpliftDll() {
UnityInstallation unity = UnityInstallationUtils.Current ();

BuildLibraryData Data = new BuildLibraryData ();

Data.References = new string[] {
unity.Paths().Managed("UnityEditor.dll"),
unity.Paths().Managed("UnityEngine.dll"),
Helper.PathCombine("Assets", "Plugins", "Editor", "SharpCompress.dll")
};

// All under Uplift except Testing code
List<string> FileList = new List<string> ();
FileList.AddRange (FileSystemUtil.GetFiles (Helper.PathCombine ("Assets", "Plugins", "Editor", "Uplift")).Where (f => f.EndsWith(".cs") && !f.Contains ("Testing")));
// FileList.AddRange (FileSystemUtil.GetFiles (Helper.PathCombine ("Assets", "Plugins", "Editor", "BuildTool")).Where (f => f.EndsWith(".cs")));
FileList.AddRange (FileSystemUtil.GetFiles (Helper.PathCombine ("Assets", "Plugins", "Editor", "UnityHacks")).Where (f => f.EndsWith(".cs")));
Data.Files = FileList.ToArray ();

Data.SdkLevel = 2;
Data.OutFile = UpliftDLL;

unity.BuildLibrary(Data);
}

private static void PrepareExportArea() {
string PackingDir = "Build";
string EditorDir = Helper.PathCombine ("Assets", "Plugins", "Editor");
string EditorPackingDir = Helper.PathCombine (PackingDir, EditorDir);
FileSystemUtil.EnsureDirExists (EditorPackingDir);

// copy packaged dependencies from current project into packing dir
string[] DllAndMeta = System.IO.Directory.GetFiles(EditorDir, "SharpCompress.dll*", SearchOption.AllDirectories);
foreach (string path in DllAndMeta) {
CopyFileExactly(path, Helper.PathCombine (PackingDir, path));
}

string UpliftDir = Helper.PathCombine ("Assets", "Plugins", "Editor", "Uplift");
string UpliftPackingDir = Helper.PathCombine (PackingDir, UpliftDir);
FileSystemUtil.EnsureDirExists (UpliftPackingDir);
CopyFileExactly(UpliftDLL, Helper.PathCombine(UpliftPackingDir, "Uplift.dll"));
}

public static void CopyFileExactly(string copyFromPath, string copyToPath)
{
var origin = new FileInfo(copyFromPath);

origin.CopyTo(copyToPath, true);

var destination = new FileInfo(copyToPath);
destination.CreationTime = origin.CreationTime;
destination.LastWriteTime = origin.LastWriteTime;
destination.LastAccessTime = origin.LastAccessTime;
}
}
}
12 changes: 12 additions & 0 deletions Assets/Plugins/Editor/BuildTool/DllCompiler.cs.meta

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

Loading

0 comments on commit 7f90bbd

Please sign in to comment.