Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Scripting Implementation per Platform #91

Merged
merged 16 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Initial Scripting Backend Option
  • Loading branch information
RobProductions committed Nov 19, 2022
commit 20b299418f96108797829cba0aa609cfbcc9e06c
11 changes: 10 additions & 1 deletion Editor/Build/Platform/BuildPC.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEditor;

namespace SuperUnityBuild.BuildTool
Expand Down Expand Up @@ -46,6 +46,15 @@ public override void Init()
};
}

if(scriptBackends == null || scriptBackends.Length == 0)
{
scriptBackends = new BuildScriptBackend[]
{
new BuildScriptBackend(ScriptingImplementation.Mono2x, "Mono 2x Runtime", true),
new BuildScriptBackend(ScriptingImplementation.IL2CPP, "IL2CPP Runtime", false),
};
}

if (variants == null || variants.Length == 0)
{
variants = new BuildVariant[] {
Expand Down
23 changes: 22 additions & 1 deletion Editor/Build/Platform/BuildPlatform.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
Expand All @@ -13,6 +13,7 @@ public class BuildPlatform : ScriptableObject
public BuildDistributionList distributionList = new BuildDistributionList();
public BuildArchitecture[] architectures = new BuildArchitecture[0];
public BuildVariant[] variants = new BuildVariant[0];
public BuildScriptBackend[] scriptBackends = new BuildScriptBackend[0];

public string platformName;
public string dataDirNameFormat;
Expand Down Expand Up @@ -99,6 +100,22 @@ public void Draw(SerializedObject obj)
}
}

SerializedProperty scriptBackendList = obj.FindProperty("scriptBackends");

if(scriptBackendList.arraySize > 0)
{
GUILayout.Label("Scripting Backends", UnityBuildGUIUtility.midHeaderStyle);
for (int i = 0; i < scriptBackendList.arraySize; i++)
{
SerializedProperty scriptProperty = scriptBackendList.GetArrayElementAtIndex(i);
SerializedProperty scriptName = scriptProperty.FindPropertyRelative("name");
SerializedProperty scriptEnabled = scriptProperty.FindPropertyRelative("enabled");

scriptEnabled.boolValue = GUILayout.Toggle(scriptEnabled.boolValue, scriptName.stringValue);
scriptProperty.serializedObject.ApplyModifiedProperties();
}
}

SerializedProperty variantList = obj.FindProperty("variants");

if (variantList.arraySize > 0)
Expand Down Expand Up @@ -182,12 +199,16 @@ public override string ToString()
string name = platformName;

IEnumerable<BuildArchitecture> enabledArchitectures = architectures.Where(item => item.enabled);
IEnumerable<BuildScriptBackend> enabledScriptBackends = scriptBackends.Where(item => item.enabled);

List<string> architecturesAndVariants = new List<string>();

if (architectures.Length > 1 && enabledArchitectures.Count() > 0)
architecturesAndVariants.AddRange(enabledArchitectures.Select(item => item.ToString()));

if (scriptBackends.Length > 1 && enabledScriptBackends.Count() > 0)
architecturesAndVariants.AddRange(enabledScriptBackends.Select(item => item.ToString()));

if (variants.Length > 0)
architecturesAndVariants.AddRange(variants.Select(item => item.ToString()));

Expand Down
27 changes: 27 additions & 0 deletions Editor/Build/Platform/BuildScriptBackend.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace SuperUnityBuild.BuildTool
{
[System.Serializable]
public class BuildScriptBackend
{
public ScriptingImplementation scriptBackend;
public string name;
public bool enabled;

public BuildScriptBackend(ScriptingImplementation scriptBackend, string name, bool enabled)
{
this.scriptBackend = scriptBackend;
this.name = name;
this.enabled = enabled;
}

public override string ToString()
{
return name;
}
}
}
11 changes: 11 additions & 0 deletions Editor/Build/Platform/BuildScriptBackend.cs.meta

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

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"unity": "2019.1",
"description": "SuperUnityBuild is a Unity utility that automates the process of generating builds. It's easy and quick enough to use on small apps, but it's also powerful and extensible enough to be extremely useful on larger projects. The key to this flexibility lies in SuperUnityBuild's configurable degrees of granularity and its BuildActions framework which allows additional operations to be added into the build process.",
"documentationUrl": "https://github.com/superunitybuild/buildtool/wiki",
"license": "MIT License",
"author": {
"name": "SuperUnityBuild",
"url": "https://github.com/superunitybuild"
},
"type": "tool"
}
}