Skip to content

Commit

Permalink
Merge pull request #4 from UniToolsTeam/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Rinal authored Nov 16, 2021
2 parents a8d650a + bed01e0 commit ea0819d
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 31 deletions.
1 change: 1 addition & 0 deletions Editor/CustomEditors/Distribute/ExportIpaEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace UniTools.Build.iOS
{

[CustomEditor(typeof(ExportIpa))]
public sealed class ExportIpaEditor : DistributeIosApplicationStepEditor
{
Expand Down
2 changes: 1 addition & 1 deletion Editor/CustomEditors/Distribute/UploadToAppStoreEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public override void OnInspectorGUI()
serializedObject.ApplyModifiedProperties();
}
}
}
}
7 changes: 6 additions & 1 deletion Editor/CustomEditors/IosPostBuildStepEditor.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using UnityEditor;
using UnityEngine;

Expand All @@ -18,6 +19,7 @@ protected virtual void OnEnable()

public override void OnInspectorGUI()
{
#if UNITY_IOS
EditorGUILayout.HelpBox("Make sure that certificate added to the Keychain", MessageType.Info);
bool load = false;

Expand Down Expand Up @@ -49,6 +51,9 @@ public override void OnInspectorGUI()
}

serializedObject.ApplyModifiedProperties();
#else
throw new Exception($"{nameof(IosPostBuildStepEditor)}: unsupported platform for {m_teamId}, {m_provisioningProfileName}, {m_provisioningProfileUuid}");
#endif
}
}
}
}
2 changes: 1 addition & 1 deletion Editor/CustomEditors/Plist/ModifyInfoPlistEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ public override void OnInspectorGUI()
base.OnInspectorGUI();
}
}
}
}
9 changes: 8 additions & 1 deletion Editor/Models/ProvisioningProfile.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif

namespace UniTools.Build.iOS
{
Expand All @@ -17,6 +20,7 @@ private ProvisioningProfile()

public static ProvisioningProfile Load(string pathToFile)
{
#if UNITY_IOS
const string patternPlist = "<plist(.*)<\\/plist>";

ProvisioningProfile profile = new ProvisioningProfile();
Expand All @@ -32,6 +36,9 @@ public static ProvisioningProfile Load(string pathToFile)
profile.TeamIdentifier = plistDocument.root["TeamIdentifier"].AsArray().values[0].AsString();

return profile;
#else
throw new Exception($"{nameof(ProvisioningProfile)}: unsupported platform.");
#endif
}
}
}
}
10 changes: 9 additions & 1 deletion Editor/Post/Distribute/DistributeIosApplicationStep.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System;
using System.IO;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
using UnityEngine;

namespace UniTools.Build.iOS
Expand All @@ -15,8 +18,12 @@ protected string ExportOptionsPath(string root)
const string fileName = "ExportOptions.plist";

return Path.Combine(root, fileName);
#if !UNITY_IOS
throw new Exception($"{nameof(DistributeIosApplicationStep)}: unsupported platform for {m_bundleIdentifier}, {m_uploadBitcode}, {m_uploadSymbols}");
#endif
}

#if UNITY_IOS
protected PlistDocument CreateExportOptions()
{
PlistDocument plist = new PlistDocument();
Expand All @@ -35,5 +42,6 @@ protected PlistDocument CreateExportOptions()

return plist;
}
#endif
}
}
}
10 changes: 8 additions & 2 deletions Editor/Post/Distribute/ExportIpa.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System;
using System.IO;
using System.Threading.Tasks;
using UniTools.CLI;
using UniTools.IO;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
using UnityEngine;

namespace UniTools.Build.iOS
Expand All @@ -20,7 +23,7 @@ public sealed class ExportIpa : DistributeIosApplicationStep
public override async Task Execute(string pathToBuiltProject)
{
await Task.CompletedTask;

#if UNITY_IOS
PlistDocument exportOptions = CreateExportOptions();
string exportOptionsPath = ExportOptionsPath(pathToBuiltProject);

Expand Down Expand Up @@ -52,6 +55,9 @@ public override async Task Execute(string pathToBuiltProject)
{
throw new PostBuildStepFailedException($"{nameof(Archive)}: Failed! {result.ToString()}");
}
#else
throw new Exception($"{nameof(ExportIpa)}: unsupported platform for {m_archivePath}, {m_outputPath}, {m_method}");
#endif
}
}
}
}
9 changes: 8 additions & 1 deletion Editor/Post/Distribute/UploadToAppStore.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System;
using System.IO;
using System.Threading.Tasks;
using UniTools.CLI;
using UniTools.IO;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
using UnityEngine;

namespace UniTools.Build.iOS
Expand All @@ -20,6 +23,7 @@ public override async Task Execute(string pathToBuiltProject)
{
await Task.CompletedTask;

#if UNITY_IOS
PlistDocument exportOptions = CreateExportOptions();
string exportOptionsPath = ExportOptionsPath(pathToBuiltProject);

Expand All @@ -41,6 +45,9 @@ public override async Task Execute(string pathToBuiltProject)
{
throw new PostBuildStepFailedException($"{nameof(Archive)}: Failed! {result.ToString()}");
}
#else
throw new Exception($"{nameof(UploadToAppStore)}: unsupported platform for {m_archivePath}, {m_outputPath}");
#endif
}
}
}
}
7 changes: 5 additions & 2 deletions Editor/Post/Plist/Elements/BoolPlistElement.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
using System;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;

#endif
namespace UniTools.Build.iOS
{
[Serializable]
public sealed class BoolPlistElement : SerializablePlistElement<bool>
{
#if UNITY_IOS
public override void AddTo(PlistElementDict plistElementDict)
{
plistElementDict.SetBoolean(Key, Value);
}
#endif
}
}
}
6 changes: 5 additions & 1 deletion Editor/Post/Plist/Elements/FloatPlistElement.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
using System;
using UnityEditor.iOS.Xcode;

#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
namespace UniTools.Build.iOS
{
[Serializable]
public sealed class FloatPlistElement : SerializablePlistElement<float>
{
#if UNITY_IOS
public override void AddTo(PlistElementDict plistElementDict)
{
plistElementDict.SetReal(Key, Value);
}
#endif
}
}
11 changes: 8 additions & 3 deletions Editor/Post/Plist/Elements/IPlistElement.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#if UNITY_IOS
using UnityEditor.iOS.Xcode;

#endif
namespace UniTools.Build.iOS
{
public interface IPlistElement
{
void AddTo(PlistElementDict plistElementDict);
void AddTo(
#if UNITY_IOS
PlistElementDict plistElementDict
#endif
);
}
}
}
6 changes: 5 additions & 1 deletion Editor/Post/Plist/Elements/IntPlistElement.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
using System;
using UnityEditor.iOS.Xcode;

#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
namespace UniTools.Build.iOS
{
[Serializable]
public sealed class IntPlistElement : SerializablePlistElement<int>
{
#if UNITY_IOS
public override void AddTo(PlistElementDict plistElementDict)
{
plistElementDict.SetInteger(Key, Value);
}
#endif
}
}
15 changes: 13 additions & 2 deletions Editor/Post/Plist/Elements/SerializablePlistElement.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
using System;
using UnityEditor.iOS.Xcode;
using UnityEngine;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif

namespace UniTools.Build.iOS
{
[Serializable]
public abstract class SerializablePlistElement<TValue> : IPlistElement
public abstract class SerializablePlistElement<TValue>
: IPlistElement
{
[SerializeField] protected string Key;
[SerializeField] protected TValue Value;

#if UNITY_IOS
public abstract void AddTo(PlistElementDict plistElementDict);
#else
public void AddTo()
{
throw new Exception($"{nameof(SerializablePlistElement<TValue>)}:Unsupported platform for {Key} and {Value}");
}

#endif
}
}
7 changes: 6 additions & 1 deletion Editor/Post/Plist/Elements/StringPlistElement.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
using System;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif

namespace UniTools.Build.iOS
{
[Serializable]
public sealed class StringPlistElement : SerializablePlistElement<string>
{
#if UNITY_IOS

public override void AddTo(PlistElementDict plistElementDict)
{
plistElementDict.SetString(Key, Value);
}
#endif
}
}
}
13 changes: 10 additions & 3 deletions Editor/Post/Plist/ModifyInfoPlist.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System.Collections.Generic;
using System.IO;
using System;
using System.Threading.Tasks;
using UnityEditor.iOS.Xcode;
using UnityEngine;
using System.IO;
using System.Collections.Generic;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif

namespace UniTools.Build.iOS
{
Expand All @@ -21,6 +24,7 @@ public override async Task Execute(string pathToBuiltProject)
{
await Task.CompletedTask;

#if UNITY_IOS
List<IPlistElement> elements = new List<IPlistElement>();
if (m_bool != null)
{
Expand Down Expand Up @@ -51,6 +55,9 @@ public override async Task Execute(string pathToBuiltProject)
}

File.WriteAllText(plistPath, plist.WriteToString());
#else
throw new Exception($"{nameof(ModifyInfoPlist)}: unsupported platform for {m_bool}, {m_float}, {m_int}, {m_string}");
#endif
}
}
}
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
{
"displayName": "UniTools.Build.iOS",
"name": "com.unitools.build.ios",
"version": "0.0.0",
"version": "0.0.1-preview",
"unity": "2019.1",
"description": "AdvancedBuildPipeline",
"description": "Part of the Customizable Build Pipeline tool for the iOS build target",
"keywords": [
"unity",
"ios",
"build",
"unity3d",
"cli",
"CI",
"CD",
"C#"
"ci-cd",
"build-tool",
"ci-cd-pipeline",
"unity-tool"
],
"category": "Libraries",
"type": "library",
"dependencies": {
"com.unitools.cli": "0.0.0",
"com.unitools.io": "0.0.0",
"com.unitools.build": "0.0.0"
"com.unitools.cli": "0.0.1-preview",
"com.unitools.io": "0.0.1-preview",
"com.unitools.build": "0.0.1-preview"
}
}

0 comments on commit ea0819d

Please sign in to comment.