TapBootstrap-Unity/Editor/TapBootstrapIOSProcessor.cs

55 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.IO;
using TapTap.Common.Editor;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEngine;
namespace TapTap.Bootstrap.Editor
{
public static class TapBootstrapIOSProcessor
{
// 添加标签unity导出工程后自动执行该函数
[PostProcessBuild(100)]
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
if (buildTarget != BuildTarget.iOS) return;
// 获得工程路径
var projPath = TapCommonCompile.GetProjPath(path);
var proj = TapCommonCompile.ParseProjPath(projPath);
var target = TapCommonCompile.GetUnityTarget(proj);
if (TapCommonCompile.CheckTarget(target))
{
Debug.LogError("Unity-iPhone is NUll");
return;
}
var parentFolder = Directory.GetParent(Application.dataPath).FullName;
var plistFile = TapFileHelper.RecursionFilterFile(parentFolder + "/Assets/Plugins/", "TDS-Info.plist");
if (!plistFile.Exists)
{
Debug.LogError("TapSDK Can't find TDS-Info.plist in Project/Assets/Plugins/!");
}
TapCommonCompile.HandlerPlist(path, plistFile.FullName);
if (TapCommonCompile.HandlerIOSSetting(path,
Application.dataPath,
"TapBootstrapResource",
"com.taptap.tds.bootstrap",
"Bootstrap",
new[] {"TapBootstrapResource.bundle"},
target, projPath, proj))
{
Debug.Log("TapBootstrap add Bundle Success!");
return;
}
Debug.LogWarning("TapBootstrap add Bundle Failed!");
}
}
}