update: 删除Firebase 11.7.0 的自动修复, 兼容升级后额 11.9.0
Signed-off-by: huyufei <yufei.hu@castbox.fm>
parent
70fe718792
commit
fce6dda997
|
|
@ -1,119 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_IOS
|
||||
|
||||
namespace Guru.Editor
|
||||
{
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor.Callbacks;
|
||||
|
||||
|
||||
public class IOSPostBuild_Firebase_VersionFix
|
||||
{
|
||||
|
||||
|
||||
private static string[] fixedLibs = new string[]
|
||||
{
|
||||
"Firebase/Core",
|
||||
"Firebase/Firestore",
|
||||
"Firebase/Analytics",
|
||||
"Firebase/Storage",
|
||||
"Firebase/Auth",
|
||||
"Firebase/Messaging",
|
||||
"Firebase/Crashlytics",
|
||||
"Firebase/DynamicLinks",
|
||||
"Firebase/RemoteConfig",
|
||||
};
|
||||
|
||||
private static string[] additionLibs = new string[]
|
||||
{
|
||||
"FirebaseFirestoreInternal",
|
||||
};
|
||||
|
||||
private static string fixedVersion = "10.22.0";
|
||||
private static string minTargetSdk = "8.0";
|
||||
|
||||
// <iosPod name="Firebase/Core" version="10.22.0" minTargetSdk="8.0" />
|
||||
|
||||
|
||||
|
||||
// Firebase 10.20.0 fixed to 10.22.0. BUT higher version do not open this ATTRIBUTE !!
|
||||
// [PostProcessBuild(47)] // MAX POD Process Order
|
||||
public static void PostBuildFixPodDeps(BuildTarget target, string projPath)
|
||||
{
|
||||
if (target != BuildTarget.iOS) return;
|
||||
|
||||
string podfile = Path.Combine(projPath, "Podfile");
|
||||
if (!File.Exists(podfile)) return;
|
||||
|
||||
FixFirebasePodVersion(podfile);
|
||||
}
|
||||
|
||||
|
||||
private static void FixFirebasePodVersion(string podfile)
|
||||
{
|
||||
var lines = File.ReadAllLines(podfile).ToList();
|
||||
string line = "";
|
||||
int idx = 0;
|
||||
bool isDirty = false;
|
||||
List<string> needAdded = new List<string>(additionLibs);
|
||||
for (int i = 0; i < lines.Count; i++)
|
||||
{
|
||||
line = lines[i];
|
||||
|
||||
if (line.Contains("pod '"))
|
||||
{
|
||||
idx = i;
|
||||
}
|
||||
|
||||
foreach (var libName in fixedLibs)
|
||||
{
|
||||
if (line.Contains(libName))
|
||||
{
|
||||
lines[i] = FixOneFirebaseLibVersion(line, fixedVersion);
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var libName in additionLibs)
|
||||
{
|
||||
if (line.Contains(libName))
|
||||
{
|
||||
needAdded.Remove(libName);
|
||||
lines[i] = FixOneFirebaseLibVersion(line, fixedVersion);
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needAdded.Count > 0)
|
||||
{
|
||||
// pod 'Firebase/DynamicLinks', '10.20.0'
|
||||
foreach (var libName in needAdded)
|
||||
{
|
||||
idx++;
|
||||
idx = Mathf.Min(idx, lines.Count - 1);
|
||||
lines.Insert(idx, $"\tpod '{libName}', '{fixedVersion}'");
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(isDirty) File.WriteAllLines(podfile, lines);
|
||||
}
|
||||
|
||||
private static string FixOneFirebaseLibVersion(string line, string fixedVersion)
|
||||
{
|
||||
if(!line.Contains("', '") || !line.Contains("pod")) return line;
|
||||
string fixedLine = line.Substring(0, line.IndexOf("', '") + 4) + $"{fixedVersion}'";
|
||||
return fixedLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2aab28d86c8346e581c650a86cad060f
|
||||
timeCreated: 1717039005
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 21655bd888424261bed6cea66e8f76eb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b7d6cb5c63a940ba85c55c10841e5ad2
|
||||
timeCreated: 1709704186
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<dependencies>
|
||||
<iosPods>
|
||||
<iosPod name="Firebase/Core" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="Firebase/Firestore" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="Firebase/Storage" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="Firebase/Auth" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="Firebase/Messaging" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="Firebase/Crashlytics" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="Firebase/DynamicLinks" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="Firebase/RemoteConfig" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="Firebase/Analytics" version="10.22.0" minTargetSdk="8.0" />
|
||||
<iosPod name="FirebaseFirestoreInternal" version="10.22.0" minTargetSdk="8.0" />
|
||||
</iosPods>
|
||||
</dependencies>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 23787d57e81d4fa18d986c16746ab31e
|
||||
timeCreated: 1709641668
|
||||
Loading…
Reference in New Issue