Skip to content

Commit

Permalink
Merge pull request #23 from UniToolsTeam/feature/new-ios-steps
Browse files Browse the repository at this point in the history
Feature/new ios steps
  • Loading branch information
Rinal authored Jan 24, 2023
2 parents 47a5215 + e8ba950 commit 1e95401
Show file tree
Hide file tree
Showing 75 changed files with 486 additions and 244 deletions.
2 changes: 1 addition & 1 deletion Editor/BatchMode/BatchModeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private static async Task RunBuildPipeline(string name)
throw new Exception($"Failed to find a pipeline with name {name}!");
}

await pipeline.PostBuild(summary.outputPath);
await pipeline.PostBuild();
}
}
}
3 changes: 3 additions & 0 deletions Editor/Core/Parameters.meta

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

11 changes: 11 additions & 0 deletions Editor/Core/Parameters/ScriptableBuildParameter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using UnityEngine;

namespace UniTools.Build
{
/// <summary>
/// Any value that can used inside a build pipeline
/// </summary>
public abstract class ScriptableBuildParameter : ScriptableObject
{
}
}
3 changes: 3 additions & 0 deletions Editor/Core/Parameters/ScriptableBuildParameter.cs.meta

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

4 changes: 1 addition & 3 deletions Editor/Core/Pipelines/BuildPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public override async Task Run()
{
if (Application.isBatchMode)
{
//TODO Implement BatchMode exception
throw new Exception($"{nameof(BuildPipeline)}: can not be run from the BatchMode!");
}

Expand All @@ -27,11 +26,10 @@ public override async Task Run()
BuildSummary summary = report.summary;
if (summary.result == BuildResult.Failed)
{
//TODO Create a separate build exception
throw new Exception($"{nameof(BuildPipeline)}: {name} Build failed!");
}

await PostBuild(summary.outputPath);
await PostBuild();
}
catch (Exception e)
{
Expand Down
4 changes: 2 additions & 2 deletions Editor/Core/Pipelines/ScriptablePostBuildPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace UniTools.Build
{
public abstract class ScriptablePostBuildPipeline : ScriptablePreBuildPipeline
{
[SerializeField] private ScriptablePlatformBuildStep m_build = default;
[SerializeField] private ScriptableBuildStep m_build = default;

[Serializable]
private sealed class PostBuildStep
Expand All @@ -21,7 +21,7 @@ private sealed class PostBuildStep

public async Task<BuildReport> Build() => await m_build.Execute();

public async Task PostBuild(string pathToBuiltProject)
public async Task PostBuild()
{
if (m_postBuild == null || m_postBuild.Length == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion Editor/Core/Steps/Build/ScriptableBuildStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace UniTools.Build
/// <summary>
/// This step must be user to create a build (artifacts: iOS, Android, etc...) using Unity API
/// </summary>
public abstract class ScriptablePlatformBuildStep : ScriptableObject
public abstract class ScriptableBuildStep : ScriptableObject
{
public abstract BuildTarget Target { get; }

Expand Down
2 changes: 1 addition & 1 deletion Editor/Core/Steps/Build/ScriptableBuildStepWithOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace UniTools.Build
{
public abstract class ScriptableBuildStepWithOptions : ScriptablePlatformBuildStep
public abstract class ScriptableBuildStepWithOptions : ScriptableBuildStep
{
[SerializeField] private PathProperty m_path = default;
[SerializeField] private bool m_developmentBuild = false;
Expand Down
11 changes: 11 additions & 0 deletions Editor/Core/Steps/Exceptions/BuildStepFailedException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace UniTools.Build
{
public sealed class BuildStepFailedException : Exception
{
public BuildStepFailedException(string message) : base(message)
{
}
}
}
11 changes: 0 additions & 11 deletions Editor/Core/Steps/Exceptions/PostBuildStepFailedException.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Editor/Core/Steps/Exceptions/PreBuildStepFailedException.cs

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions Editor/Defines/Pipelines/ScriptableBuildStepWithDefines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace UniTools.Build
fileName = nameof(ScriptableBuildStepWithDefines),
menuName = MenuPaths.Defines + "BuildWithDefines"
)]
public sealed class ScriptableBuildStepWithDefines : ScriptablePlatformBuildStep
public sealed class ScriptableBuildStepWithDefines : ScriptableBuildStep
{
[SerializeField] private ScriptablePlatformBuildStep m_successor = default;
[SerializeField] private ScriptableBuildStep m_successor = default;
[SerializeField] private ScriptingDefineSymbols m_symbols = default;

public override BuildTarget Target => m_successor.Target;
Expand Down
68 changes: 62 additions & 6 deletions Editor/Platforms/iOS/CustomEditors/Archive/ArchiveEditor.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,93 @@
using UnityEditor;
using UnityEngine;

namespace UniTools.Build
{
[CustomEditor(typeof(Archive), true)]
public sealed class ArchiveEditor : IosPostBuildStepEditor
public sealed class ArchiveEditor : Editor
{
private SerializedProperty m_teamId = default;
private SerializedProperty m_projectPath = default;
private SerializedProperty m_outputPath = default;
private SerializedProperty m_scheme = default;
private SerializedProperty m_useModernBuildSystem = default;
private SerializedProperty m_enableBitcode = default;
private SerializedProperty m_overrideProvisioningProfile = default;
private SerializedProperty m_provisioningProfileUuid = default;

protected override void OnEnable()
private void OnEnable()
{
base.OnEnable();
m_teamId = serializedObject.FindProperty(nameof(m_teamId));

m_projectPath = serializedObject.FindProperty(nameof(m_projectPath));
m_outputPath = serializedObject.FindProperty(nameof(m_outputPath));
m_scheme = serializedObject.FindProperty(nameof(m_scheme));
m_useModernBuildSystem = serializedObject.FindProperty(nameof(m_useModernBuildSystem));
m_enableBitcode = serializedObject.FindProperty(nameof(m_enableBitcode));

m_overrideProvisioningProfile = serializedObject.FindProperty(nameof(m_overrideProvisioningProfile));
m_provisioningProfileUuid = serializedObject.FindProperty(nameof(m_provisioningProfileUuid));
}

public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Use Development Provisioning Profile for the Archive step.", MessageType.Info);

base.OnInspectorGUI();
EditorGUILayout.HelpBox("Make sure that certificate added to the Keychain. The archive will be failed without the certificate.", MessageType.Info);

EditorGUILayout.PropertyField(m_projectPath);
EditorGUILayout.PropertyField(m_outputPath);

bool parseTeamId = false;
EditorGUILayout.BeginVertical("box");
{
EditorGUILayout.HelpBox("Team Id can be parsed from the Provisioning Profile file.", MessageType.Info);

EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.PropertyField(m_teamId);
parseTeamId = GUILayout.Button("From file");
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();

EditorGUILayout.PropertyField(m_scheme);
EditorGUILayout.PropertyField(m_useModernBuildSystem);
EditorGUILayout.PropertyField(m_enableBitcode);
EditorGUILayout.PropertyField(m_overrideProvisioningProfile);

bool parseprovisioningProfileUuid = false;
if (m_overrideProvisioningProfile.boolValue)
{
EditorGUILayout.BeginVertical("box");
{
EditorGUILayout.HelpBox("Provisioning Profile must be overridden if xCode project was created without a Provisioning Profile. " +
"Try SetManualProvisionProfile step to set it during the build pipeline.\n" +
"NOTE: Provisioning Profile can be parsed from the file.", MessageType.Info);

EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.PropertyField(m_provisioningProfileUuid);
parseprovisioningProfileUuid = GUILayout.Button("From file");
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
}

if (parseprovisioningProfileUuid)
{
string path = EditorUtility.OpenFilePanel("Test", Application.dataPath, "mobileprovision");
ProvisioningProfile pp = ProvisioningProfile.Load(path);
m_provisioningProfileUuid.stringValue = pp.Uuid;
}

if (parseTeamId)
{
string path = EditorUtility.OpenFilePanel("Test", Application.dataPath, "mobileprovision");
ProvisioningProfile pp = ProvisioningProfile.Load(path);
m_teamId.stringValue = pp.TeamIdentifier;
}

serializedObject.ApplyModifiedProperties();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,87 @@

namespace UniTools.Build
{
public abstract class DistributeIosApplicationStepEditor : IosPostBuildStepEditor
public abstract class DistributeIosApplicationStepEditor : Editor
{
private SerializedProperty m_bundleIdentifier = default;
private SerializedProperty m_teamId = default;
private SerializedProperty m_provisioningProfileName = default;
private SerializedProperty m_bundleIdentifier = default;
private SerializedProperty m_uploadBitcode = default;
private SerializedProperty m_uploadSymbols = default;
private SerializedProperty m_pathToXCodeProject = default;
private SerializedProperty m_archivePath = default;
private SerializedProperty m_outputPath = default;

protected override void OnEnable()
protected virtual void OnEnable()
{
m_bundleIdentifier = serializedObject.FindProperty(nameof(m_bundleIdentifier));
m_teamId = serializedObject.FindProperty(nameof(m_teamId));
base.OnEnable();
m_provisioningProfileName = serializedObject.FindProperty(nameof(m_provisioningProfileName));
m_bundleIdentifier = serializedObject.FindProperty(nameof(m_bundleIdentifier));
m_uploadBitcode = serializedObject.FindProperty(nameof(m_uploadBitcode));
m_uploadSymbols = serializedObject.FindProperty(nameof(m_uploadSymbols));
m_pathToXCodeProject = serializedObject.FindProperty(nameof(m_pathToXCodeProject));
m_archivePath = serializedObject.FindProperty(nameof(m_archivePath));
m_outputPath = serializedObject.FindProperty(nameof(m_outputPath));
}

public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.PropertyField(m_pathToXCodeProject);
EditorGUILayout.PropertyField(m_archivePath);
EditorGUILayout.PropertyField(m_outputPath);

bool useCurrentBundle = false;
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.PropertyField(m_bundleIdentifier);
useCurrentBundle = GUILayout.Button("Current");
useCurrentBundle = GUILayout.Button("From Player Settings");
}
EditorGUILayout.EndHorizontal();

bool parseTeamId = false;
bool parseProvisioningProfileName = false;
EditorGUILayout.BeginVertical("box");
{
EditorGUILayout.HelpBox("Team Id and Provisioning Profile can be parsed from the Provisioning Profile file.", MessageType.Info);

EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.PropertyField(m_teamId);
parseTeamId = GUILayout.Button("From file");
}
EditorGUILayout.EndHorizontal();

EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.PropertyField(m_provisioningProfileName);
parseProvisioningProfileName = GUILayout.Button("From file");
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();

EditorGUILayout.PropertyField(m_uploadBitcode);
EditorGUILayout.PropertyField(m_uploadSymbols);

if (useCurrentBundle)
{
m_bundleIdentifier.stringValue = PlayerSettings.applicationIdentifier;
}

if (parseTeamId)
{
string path = EditorUtility.OpenFilePanel("Test", Application.dataPath, "mobileprovision");
ProvisioningProfile pp = ProvisioningProfile.Load(path);
m_teamId.stringValue = pp.TeamIdentifier;
}

if (parseProvisioningProfileName)
{
string path = EditorUtility.OpenFilePanel("Test", Application.dataPath, "mobileprovision");
ProvisioningProfile pp = ProvisioningProfile.Load(path);
m_provisioningProfileName.stringValue = pp.Name;
}

serializedObject.ApplyModifiedProperties();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,24 @@

namespace UniTools.Build
{

[CustomEditor(typeof(ExportIpa))]
public sealed class ExportIpaEditor : DistributeIosApplicationStepEditor
{
private SerializedProperty m_method = default;
private SerializedProperty m_archivePath = default;
private SerializedProperty m_outputPath = default;

protected override void OnEnable()
{
base.OnEnable();

m_method = serializedObject.FindProperty(nameof(m_method));
m_archivePath = serializedObject.FindProperty(nameof(m_archivePath));
m_outputPath = serializedObject.FindProperty(nameof(m_outputPath));
}

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

EditorGUILayout.PropertyField(m_method);
EditorGUILayout.PropertyField(m_archivePath);
EditorGUILayout.PropertyField(m_outputPath);

serializedObject.ApplyModifiedProperties();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,5 @@ namespace UniTools.Build
[CustomEditor(typeof(UploadToAppStore))]
public sealed class UploadToAppStoreEditor : DistributeIosApplicationStepEditor
{
private SerializedProperty m_archivePath = default;
private SerializedProperty m_outputPath = default;

protected override void OnEnable()
{
base.OnEnable();
m_archivePath = serializedObject.FindProperty(nameof(m_archivePath));
m_outputPath = serializedObject.FindProperty(nameof(m_outputPath));
}

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

EditorGUILayout.PropertyField(m_archivePath);
EditorGUILayout.PropertyField(m_outputPath);
serializedObject.ApplyModifiedProperties();
}
}
}
}
Loading

0 comments on commit 1e95401

Please sign in to comment.