Skip to content

Commit fb62db9

Browse files
committed
Add fix for cocoapods podfile source (-10 min to build time)
1 parent 6e01c2a commit fb62db9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/BuildCommand.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
using System;
2+
using System.IO;
23
using System.Linq;
34
using System.Collections.Generic;
5+
using UnityEngine;
46
using UnityEditor;
57
using UnityEditor.Build.Reporting;
8+
using UnityEditor.Callbacks;
69

710
namespace kuler90
811
{
@@ -78,6 +81,8 @@ private static void HandleVersion(Dictionary<string, string> args)
7881
int buildNumber = int.Parse(args["buildNumber"]);
7982
PlayerSettings.Android.bundleVersionCode = buildNumber;
8083
PlayerSettings.iOS.buildNumber = buildNumber.ToString();
84+
PlayerSettings.macOS.buildNumber = buildNumber.ToString();
85+
PlayerSettings.tvOS.buildNumber = buildNumber.ToString();
8186
}
8287
}
8388

@@ -120,5 +125,21 @@ private static void ParseCommandLineArguments(out Dictionary<string, string> res
120125
result.Add(flag, value);
121126
}
122127
}
128+
129+
[PostProcessBuild(45)]
130+
// https://github.com/googlesamples/unity-jar-resolver/issues/328
131+
static void OnPostProcessPodfile(BuildTarget target, string path)
132+
{
133+
if (target == BuildTarget.iOS)
134+
{
135+
string podfilePath = Path.Combine(path, "podfile");
136+
if (File.Exists(podfilePath))
137+
{
138+
string text = File.ReadAllText(podfilePath);
139+
text = text.Replace("https://github.com/CocoaPods/Specs.git", "https://cdn.cocoapods.org");
140+
File.WriteAllText(podfilePath, text);
141+
}
142+
}
143+
}
123144
}
124145
}

0 commit comments

Comments
 (0)