Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 132687c

Browse files
SotoiGhostSotoiGhost
authored andcommitted
Added logic to fix mismatch dependencies versions on Podfiles
1 parent 6cb0a39 commit 132687c

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

common.cake

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,19 @@ void CreateAndInstallPodfile (Artifact artifact)
4040
var podfile = new List<string> ();
4141
var podfileBegin = new List<string> (PODFILE_BEGIN);
4242

43-
podfileBegin [0] = string.Format (podfileBegin [0], artifact.MinimunSupportedVersion);
43+
var minimunSupportedVersion = GetMinimunSupportedVersion (artifact);
44+
podfileBegin [0] = string.Format (podfileBegin [0], minimunSupportedVersion);
4445
podfile.AddRange (podfileBegin);
4546

4647
if (artifact.ExtraPodfileLines != null)
4748
podfile.AddRange (artifact.ExtraPodfileLines);
4849

4950
podfile.AddRange (PODFILE_TARGET);
51+
podfile.AddRange (GetPodfileLines (artifact));
5052

51-
foreach (var podSpec in artifact.PodSpecs) {
52-
if (podSpec.FrameworkSource != FrameworkSource.Pods)
53-
continue;
54-
55-
podfile.AddRange (podSpec.BuildPodLines ());
56-
}
53+
if (artifact.Dependencies != null)
54+
foreach (var dependency in artifact.Dependencies)
55+
podfile.AddRange (GetPodfileLines (dependency));
5756

5857
if (podfile.Count == PODFILE_BEGIN.Length + PODFILE_TARGET.Length + (artifact.ExtraPodfileLines?.Length ?? 0))
5958
return;
@@ -67,6 +66,34 @@ void CreateAndInstallPodfile (Artifact artifact)
6766
CocoaPodInstall (podfilePath);
6867
}
6968

69+
string GetMinimunSupportedVersion (Artifact artifact)
70+
{
71+
var version = artifact.MinimunSupportedVersion;
72+
73+
if (artifact.Dependencies == null)
74+
return version;
75+
76+
foreach (var dependency in artifact.Dependencies)
77+
if (string.Compare (version, dependency.MinimunSupportedVersion) == -1)
78+
version = dependency.MinimunSupportedVersion;
79+
80+
return version;
81+
}
82+
83+
List<string> GetPodfileLines (Artifact artifact)
84+
{
85+
var podfileLines = new List<string> ();
86+
87+
foreach (var podSpec in artifact.PodSpecs) {
88+
if (podSpec.FrameworkSource != FrameworkSource.Pods)
89+
continue;
90+
91+
podfileLines.AddRange (podSpec.BuildPodLines ());
92+
}
93+
94+
return podfileLines;
95+
}
96+
7097
void BuildSdkOnPodfile (Artifact artifact)
7198
{
7299
if (artifact.PodSpecs?.Length == 0)

components.cake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@ void SetArtifactsPodSpecs ()
111111
PodSpec.Create ("Firebase", "6.5.0", frameworkSource: FrameworkSource.Pods, frameworkName: "FirebaseFirestore", targetName: "FirebaseFirestore", subSpecs: new [] { "Firestore" }),
112112
PodSpec.Create ("BoringSSL-GRPC", "0.0.3", frameworkSource: FrameworkSource.Pods, frameworkName: "openssl_grpc"),
113113
PodSpec.Create ("gRPC-Core", "1.21.0", frameworkSource: FrameworkSource.Pods, frameworkName: "grpc"),
114-
PodSpec.Create ("gRPC-C++", "0.0.9", frameworkSource: FrameworkSource.Pods, frameworkName: "grpcpp"),
115-
PodSpec.Create ("Protobuf", "3.8.0", frameworkSource: FrameworkSource.Pods, canBeBuild: false),
114+
PodSpec.Create ("gRPC-C++", "0.0.9", frameworkSource: FrameworkSource.Pods, frameworkName: "grpcpp")
116115
};
117116
FIREBASE_CLOUD_MESSAGING_ARTIFACT.PodSpecs = new [] {
118-
PodSpec.Create ("Firebase", "6.5.0", frameworkSource: FrameworkSource.Pods, frameworkName: "FirebaseMessaging", targetName: "FirebaseMessaging", subSpecs: new [] { "Messaging" }),
119-
PodSpec.Create ("Protobuf", "3.8.0", frameworkSource: FrameworkSource.Pods, canBeBuild: false),
117+
PodSpec.Create ("Firebase", "6.5.0", frameworkSource: FrameworkSource.Pods, frameworkName: "FirebaseMessaging", targetName: "FirebaseMessaging", subSpecs: new [] { "Messaging" })
120118
};
121119
FIREBASE_CORE_ARTIFACT.PodSpecs = new [] {
122120
PodSpec.Create ("Firebase", "6.5.0", frameworkSource: FrameworkSource.Pods, frameworkName: "FirebaseCore", targetName: "FirebaseCore", subSpecs: new [] { "CoreOnly" }),

0 commit comments

Comments
 (0)