feat: 更新iOS构建脚本、Firebase依赖及图标资源
- 优化 iOS 重复 Shell 脚本修复逻辑 - 添加 Firebase Analytics 依赖 - 重命名图标资源为 Icon-iPhone 标准格式
This commit is contained in:
parent
1847d74de2
commit
82c997068d
@ -3,24 +3,79 @@ using UnityEditor;
|
|||||||
using UnityEditor.Callbacks;
|
using UnityEditor.Callbacks;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
public class iOSFixDuplicateShellScript
|
public class iOSFixDuplicateShellScript
|
||||||
{
|
{
|
||||||
[PostProcessBuild]
|
[PostProcessBuild(999)]
|
||||||
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
|
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
|
||||||
{
|
{
|
||||||
if (target != BuildTarget.iOS) return;
|
if (target != BuildTarget.iOS) return;
|
||||||
|
|
||||||
|
FixDuplicateShellScript(pathToBuiltProject);
|
||||||
|
FixPodfile(pathToBuiltProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void FixDuplicateShellScript(string pathToBuiltProject)
|
||||||
|
{
|
||||||
string projPath = Path.Combine(pathToBuiltProject, "Unity-iPhone.xcodeproj/project.pbxproj");
|
string projPath = Path.Combine(pathToBuiltProject, "Unity-iPhone.xcodeproj/project.pbxproj");
|
||||||
if (!File.Exists(projPath)) return;
|
if (!File.Exists(projPath))
|
||||||
|
{
|
||||||
|
Debug.LogWarning("[FixDupShellScript] pbxproj not found: " + projPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string content = File.ReadAllText(projPath);
|
string content = File.ReadAllText(projPath);
|
||||||
|
|
||||||
// 匹配 GameAssembly target 的 buildPhases 中连续两个相同的 ShellScript
|
string pattern = @"(\t+([A-F0-9]+) /\* ShellScript \*/,)\r?\n\t+\2 /\* ShellScript \*,/";
|
||||||
string pattern = @"(\t+([A-F0-9]+) /\* ShellScript \*/,)\n\t+\2 /\* ShellScript \*,/";
|
string newContent = Regex.Replace(content, pattern, "$1");
|
||||||
content = Regex.Replace(content, pattern, "$1");
|
|
||||||
|
|
||||||
File.WriteAllText(projPath, content);
|
if (newContent != content)
|
||||||
|
{
|
||||||
|
File.WriteAllText(projPath, newContent);
|
||||||
|
Debug.Log("[FixDupShellScript] Removed duplicate ShellScript from GameAssembly target");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("[FixDupShellScript] No duplicate ShellScript found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void FixPodfile(string pathToBuiltProject)
|
||||||
|
{
|
||||||
|
string podfilePath = Path.Combine(pathToBuiltProject, "Podfile");
|
||||||
|
if (!File.Exists(podfilePath))
|
||||||
|
{
|
||||||
|
Debug.LogWarning("[FixPodfile] Podfile not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string content = File.ReadAllText(podfilePath);
|
||||||
|
bool modified = false;
|
||||||
|
|
||||||
|
// 移除不需要的 Firebase/Analytics
|
||||||
|
if (content.Contains("Firebase/Analytics"))
|
||||||
|
{
|
||||||
|
content = Regex.Replace(content, @"\s*pod\s+'Firebase/Analytics'[^\n]*\n?", "\n");
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 12.4.0 统一为 12.14.0
|
||||||
|
if (content.Contains("12.4.0"))
|
||||||
|
{
|
||||||
|
content = content.Replace("12.4.0", "12.14.0");
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modified)
|
||||||
|
{
|
||||||
|
File.WriteAllText(podfilePath, content);
|
||||||
|
Debug.Log("[FixPodfile] Cleaned up Podfile");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("[FixPodfile] Podfile already clean");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -5,6 +5,8 @@ FirebaseAnalytics iOS and Android Dependencies.
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<iosPods>
|
<iosPods>
|
||||||
|
<iosPod name="Firebase/Analytics" version="12.14.0" minTargetSdk="15.0">
|
||||||
|
</iosPod>
|
||||||
</iosPods>
|
</iosPods>
|
||||||
<androidPackages>
|
<androidPackages>
|
||||||
<androidPackage spec="com.google.firebase:firebase-analytics:23.0.0">
|
<androidPackage spec="com.google.firebase:firebase-analytics:23.0.0">
|
||||||
|
|||||||
@ -6,7 +6,7 @@ TextureImporter:
|
|||||||
serializedVersion: 13
|
serializedVersion: 13
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 1
|
enableMipMap: 0
|
||||||
sRGBTexture: 1
|
sRGBTexture: 1
|
||||||
linearTexture: 0
|
linearTexture: 0
|
||||||
fadeOut: 0
|
fadeOut: 0
|
||||||
@ -37,13 +37,13 @@ TextureImporter:
|
|||||||
filterMode: 1
|
filterMode: 1
|
||||||
aniso: 1
|
aniso: 1
|
||||||
mipBias: 0
|
mipBias: 0
|
||||||
wrapU: 0
|
wrapU: 1
|
||||||
wrapV: 0
|
wrapV: 1
|
||||||
wrapW: 0
|
wrapW: 0
|
||||||
nPOTScale: 1
|
nPOTScale: 0
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
spriteMode: 0
|
spriteMode: 1
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
alignment: 0
|
alignment: 0
|
||||||
@ -52,9 +52,9 @@ TextureImporter:
|
|||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 0
|
alphaIsTransparency: 1
|
||||||
spriteTessellationDetail: -1
|
spriteTessellationDetail: -1
|
||||||
textureType: 0
|
textureType: 8
|
||||||
textureShape: 1
|
textureShape: 1
|
||||||
singleChannelComponent: 0
|
singleChannelComponent: 0
|
||||||
flipbookRows: 1
|
flipbookRows: 1
|
||||||
@ -125,7 +125,7 @@ TextureImporter:
|
|||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
bones: []
|
bones: []
|
||||||
spriteID:
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
internalID: 0
|
internalID: 0
|
||||||
vertices: []
|
vertices: []
|
||||||
indices:
|
indices:
|
||||||
|
|||||||
@ -40,10 +40,10 @@ TextureImporter:
|
|||||||
wrapU: 0
|
wrapU: 0
|
||||||
wrapV: 0
|
wrapV: 0
|
||||||
wrapW: 0
|
wrapW: 0
|
||||||
nPOTScale: 1
|
nPOTScale: 0
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
spriteMode: 0
|
spriteMode: 1
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
alignment: 0
|
alignment: 0
|
||||||
@ -97,12 +97,12 @@ TextureImporter:
|
|||||||
buildTarget: iPhone
|
buildTarget: iPhone
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: 50
|
||||||
textureCompression: 1
|
textureCompression: 1
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
crunchedCompression: 0
|
crunchedCompression: 0
|
||||||
allowsAlphaSplitting: 0
|
allowsAlphaSplitting: 0
|
||||||
overridden: 0
|
overridden: 1
|
||||||
ignorePlatformSupport: 0
|
ignorePlatformSupport: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
@ -125,7 +125,7 @@ TextureImporter:
|
|||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
bones: []
|
bones: []
|
||||||
spriteID:
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
internalID: 0
|
internalID: 0
|
||||||
vertices: []
|
vertices: []
|
||||||
indices:
|
indices:
|
||||||
|
|||||||
@ -40,10 +40,10 @@ TextureImporter:
|
|||||||
wrapU: 0
|
wrapU: 0
|
||||||
wrapV: 0
|
wrapV: 0
|
||||||
wrapW: 0
|
wrapW: 0
|
||||||
nPOTScale: 1
|
nPOTScale: 0
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
spriteMode: 0
|
spriteMode: 1
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 1
|
||||||
alignment: 0
|
alignment: 0
|
||||||
@ -97,12 +97,12 @@ TextureImporter:
|
|||||||
buildTarget: iPhone
|
buildTarget: iPhone
|
||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
resizeAlgorithm: 0
|
resizeAlgorithm: 0
|
||||||
textureFormat: -1
|
textureFormat: 50
|
||||||
textureCompression: 1
|
textureCompression: 1
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
crunchedCompression: 0
|
crunchedCompression: 0
|
||||||
allowsAlphaSplitting: 0
|
allowsAlphaSplitting: 0
|
||||||
overridden: 0
|
overridden: 1
|
||||||
ignorePlatformSupport: 0
|
ignorePlatformSupport: 0
|
||||||
androidETC2FallbackOverride: 0
|
androidETC2FallbackOverride: 0
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
@ -125,7 +125,7 @@ TextureImporter:
|
|||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
bones: []
|
bones: []
|
||||||
spriteID:
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
internalID: 0
|
internalID: 0
|
||||||
vertices: []
|
vertices: []
|
||||||
indices:
|
indices:
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d89f75d2829914aefabc2c12ee61e74d
|
guid: 2fe29f66f37c34d5ca39cf642d8a2ba3
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 72592ba5df3304ad8a664eb6c0ab04da
|
guid: 29fdb52e7fc6c411891c323b5d5b6f01
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@ -174,7 +174,7 @@ PlayerSettings:
|
|||||||
buildNumber:
|
buildNumber:
|
||||||
Standalone: 0
|
Standalone: 0
|
||||||
VisionOS: 0
|
VisionOS: 0
|
||||||
iPhone: 0
|
iPhone: 2
|
||||||
tvOS: 0
|
tvOS: 0
|
||||||
overrideDefaultApplicationIdentifier: 1
|
overrideDefaultApplicationIdentifier: 1
|
||||||
AndroidBundleVersionCode: 1
|
AndroidBundleVersionCode: 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user