@@ -51,13 +51,6 @@ private class Pod {
51
51
/// </summary>
52
52
public string version = null ;
53
53
54
- /// <summary>
55
- /// The App's target to which to add the pod.
56
- ///
57
- /// See: XcodeTargetNames for valid target names.
58
- /// </summary>
59
- public string target = null ;
60
-
61
54
/// <summary>
62
55
/// Properties applied to the pod declaration.
63
56
///
@@ -165,7 +158,6 @@ public string PodFilePodLine {
165
158
/// </summary>
166
159
/// <param name="name">Name of the pod.</param>
167
160
/// <param name="version">Version of the pod.</param>
168
- /// <param name="target">The App's target to which to add the pod.</param>
169
161
/// <param name="bitcodeEnabled">Whether this pod was compiled with
170
162
/// bitcode.</param>
171
163
/// <param name="minTargetSdk">Minimum target SDK revision required by
@@ -176,12 +168,10 @@ public string PodFilePodLine {
176
168
/// a source.</param>
177
169
/// <param name="propertiesByName">Dictionary of additional properties for the pod
178
170
/// reference.</param>
179
- public Pod ( string name , string version , string target , bool bitcodeEnabled ,
180
- string minTargetSdk , IEnumerable < string > sources ,
181
- Dictionary < string , string > propertiesByName ) {
171
+ public Pod ( string name , string version , bool bitcodeEnabled , string minTargetSdk ,
172
+ IEnumerable < string > sources , Dictionary < string , string > propertiesByName ) {
182
173
this . name = name ;
183
174
this . version = version ;
184
- this . target = target ;
185
175
if ( propertiesByName != null ) {
186
176
this . propertiesByName = new Dictionary < string , string > ( propertiesByName ) ;
187
177
}
@@ -219,7 +209,6 @@ public override bool Equals(System.Object obj) {
219
209
return pod != null &&
220
210
name == pod . name &&
221
211
version == pod . version &&
222
- target == pod . target &&
223
212
propertiesByName . Count == pod . propertiesByName . Count &&
224
213
propertiesByName . Keys . All ( key =>
225
214
pod . propertiesByName . ContainsKey ( key ) &&
@@ -314,7 +303,6 @@ protected override bool Read(string filename, Logger logger) {
314
303
var falseStrings = new HashSet < string > { "false" , "0" } ;
315
304
string podName = null ;
316
305
string versionSpec = null ;
317
- string target = null ;
318
306
bool bitcodeEnabled = true ;
319
307
string minTargetSdk = null ;
320
308
var propertiesByName = new Dictionary < string , string > ( ) ;
@@ -339,20 +327,6 @@ protected override bool Read(string filename, Logger logger) {
339
327
}
340
328
}
341
329
versionSpec = reader . GetAttribute ( "version" ) ;
342
- target = reader . GetAttribute ( "target" ) ;
343
- if ( target == null ) {
344
- target = DefaultXcodeTarget ;
345
- } else {
346
- // Make sure that the provided target is supported.
347
- if ( ! XcodeTargetNames . Contains ( target ) ) {
348
- logger . Log ( string . Format ( "Incorrect target name passed {0}." +
349
- "Adding the pod to the default" +
350
- "target: {1}" ,
351
- target ,
352
- DefaultXcodeTarget ) ) ;
353
- target = DefaultXcodeTarget ;
354
- }
355
- }
356
330
var bitcodeEnabledString =
357
331
( reader . GetAttribute ( "bitcode" ) ?? "" ) . ToLower ( ) ;
358
332
bitcodeEnabled |= trueStrings . Contains ( bitcodeEnabledString ) ;
@@ -367,9 +341,7 @@ protected override bool Read(string filename, Logger logger) {
367
341
return false ;
368
342
}
369
343
} else {
370
- AddPodInternal ( podName ,
371
- target ,
372
- preformattedVersion : versionSpec ,
344
+ AddPodInternal ( podName , preformattedVersion : versionSpec ,
373
345
bitcodeEnabled : bitcodeEnabled ,
374
346
minTargetSdk : minTargetSdk ,
375
347
sources : sources ,
@@ -562,9 +534,6 @@ protected override bool Read(string filename, Logger logger) {
562
534
// Parses a source URL from a Podfile.
563
535
private static Regex PODFILE_SOURCE_REGEX = new Regex ( @"^\s*source\s+'([^']*)'" ) ;
564
536
565
- // Regex that matches the start of a target line in a pod file.
566
- private static Regex PODFILE_TARGET_START_LINE_REGEX = new Regex ( "^target '([^']+)' do" ) ;
567
-
568
537
// Parses dependencies from XML dependency files.
569
538
private static IOSXmlDependencies xmlDependencies = new IOSXmlDependencies ( ) ;
570
539
@@ -1113,7 +1082,6 @@ public static void AddPod(string podName, string version = null,
1113
1082
string minTargetSdk = null ,
1114
1083
IEnumerable < string > sources = null ) {
1115
1084
AddPodInternal ( podName ,
1116
- DefaultXcodeTarget ,
1117
1085
preformattedVersion : PodVersionExpressionFromVersionDep ( version ) ,
1118
1086
bitcodeEnabled : bitcodeEnabled , minTargetSdk : minTargetSdk ,
1119
1087
sources : sources ) ;
@@ -1142,7 +1110,6 @@ public static void AddPod(string podName, string version = null,
1142
1110
/// <param name="propertiesByName">Dictionary of additional properties for the pod
1143
1111
/// reference.</param>
1144
1112
private static void AddPodInternal ( string podName ,
1145
- string target ,
1146
1113
string preformattedVersion = null ,
1147
1114
bool bitcodeEnabled = true ,
1148
1115
string minTargetSdk = null ,
@@ -1151,7 +1118,7 @@ private static void AddPodInternal(string podName,
1151
1118
string createdBy = null ,
1152
1119
bool fromXmlFile = false ,
1153
1120
Dictionary < string , string > propertiesByName = null ) {
1154
- var pod = new Pod ( podName , preformattedVersion , target , bitcodeEnabled , minTargetSdk ,
1121
+ var pod = new Pod ( podName , preformattedVersion , bitcodeEnabled , minTargetSdk ,
1155
1122
sources , propertiesByName ) ;
1156
1123
pod . createdBy = createdBy ?? pod . createdBy ;
1157
1124
pod . fromXmlFile = fromXmlFile ;
@@ -1683,21 +1650,10 @@ public static IEnumerable<string> XcodeTargetNames {
1683
1650
get {
1684
1651
// Return hard coded names in the UnityEditor.iOS.Xcode.PBXProject DLL.
1685
1652
return MultipleXcodeTargetsSupported ?
1686
- new List < string > ( ) { "Unity-iPhone" , " UnityFramework" } :
1653
+ new List < string > ( ) { "UnityFramework" } :
1687
1654
new List < string > ( ) { InitializeTargetName ( ) } ;
1688
1655
}
1689
1656
}
1690
-
1691
- /// <summary>
1692
- /// Get the default Xcode target name to which to add pods.
1693
- /// </summary>
1694
- /// <returns>The Xcode target to which to add the pods to by default.</returns>
1695
- public static string DefaultXcodeTarget {
1696
- get {
1697
- return MultipleXcodeTargetsSupported ? "UnityFramework" : InitializeTargetName ( ) ;
1698
- }
1699
- }
1700
-
1701
1657
/// <summary>
1702
1658
/// Get Xcode target GUIDs using a method that works across all Unity versions.
1703
1659
/// </summary>
@@ -1733,6 +1689,7 @@ public static IEnumerable<string> GetXcodeTargetGuids(object xcodeProject) {
1733
1689
}
1734
1690
return targets ;
1735
1691
}
1692
+
1736
1693
// Implementation of OnPostProcessPatchProject().
1737
1694
// NOTE: This is separate from the post-processing method to prevent the
1738
1695
// Mono runtime from loading the Xcode API before calling the post
@@ -1810,11 +1767,10 @@ private static void ParseUnityDeps(string unityPodfilePath) {
1810
1767
string line ;
1811
1768
1812
1769
// We are only interested in capturing the dependencies "Pod depName, depVersion", inside
1813
- // of the targets in XcodeTargetNames . However there can be nested targets such as for
1814
- // testing, so we're counting the depth to determine when to capture the pods. Also we only
1815
- // ever enter the first depth if we're in the exact right target.
1770
+ // of the specific target . However there can be nested targets such as for testing, so we're
1771
+ // counting the depth to determine when to capture the pods. Also we only ever enter the
1772
+ // first depth if we're in the exact right target.
1816
1773
int capturingPodsDepth = 0 ;
1817
- string currentTarget = null ;
1818
1774
var sources = new List < string > ( ) ;
1819
1775
while ( ( line = unityPodfile . ReadLine ( ) ) != null ) {
1820
1776
line = line . Trim ( ) ;
@@ -1823,24 +1779,14 @@ private static void ParseUnityDeps(string unityPodfilePath) {
1823
1779
sources . Add ( sourceLineMatch . Groups [ 1 ] . Value ) ;
1824
1780
continue ;
1825
1781
}
1826
-
1827
- var podFileTargetMatch = PODFILE_TARGET_START_LINE_REGEX . Match ( line ) ;
1828
- if ( podFileTargetMatch . Success ) {
1829
- var target = podFileTargetMatch . Groups [ 1 ] . Value ;
1830
- if ( XcodeTargetNames . Contains ( target ) )
1831
- {
1832
- capturingPodsDepth ++ ;
1833
- currentTarget = target ;
1834
- continue ;
1835
- }
1836
- }
1837
-
1838
- if ( capturingPodsDepth == 0 ) {
1839
- currentTarget = null ;
1782
+ if ( line . StartsWith ( "target 'Unity-iPhone' do" ) ) {
1783
+ capturingPodsDepth ++ ;
1840
1784
continue ;
1841
1785
}
1842
1786
1843
- // Handle other scopes roughly
1787
+ if ( capturingPodsDepth == 0 ) continue ;
1788
+
1789
+ // handle other scopes roughly
1844
1790
if ( line . EndsWith ( " do" ) ) {
1845
1791
capturingPodsDepth ++ ; // Ignore nested targets like tests
1846
1792
} else if ( line == "end" ) {
@@ -1849,16 +1795,9 @@ private static void ParseUnityDeps(string unityPodfilePath) {
1849
1795
1850
1796
if ( capturingPodsDepth != 1 ) continue ;
1851
1797
1852
- if ( currentTarget == null ) {
1853
- Log ( string . Format ( "Couldn't find a valid target for pod {0}, skipping..." , line ) ,
1854
- verbose : true ) ;
1855
- continue ;
1856
- }
1857
-
1858
1798
// Parse "pod" lines from the default target in the file.
1859
1799
var podLineMatch = PODFILE_POD_REGEX . Match ( line ) ;
1860
1800
var podGroups = podLineMatch . Groups ;
1861
-
1862
1801
if ( podGroups . Count > 1 ) {
1863
1802
var podName = podGroups [ "podname" ] . ToString ( ) ;
1864
1803
var podVersion = podGroups [ "podversion" ] . ToString ( ) ;
@@ -1872,7 +1811,6 @@ private static void ParseUnityDeps(string unityPodfilePath) {
1872
1811
}
1873
1812
AddPodInternal (
1874
1813
podName ,
1875
- currentTarget ,
1876
1814
preformattedVersion : String . IsNullOrEmpty ( podVersion ) ? null : podVersion ,
1877
1815
sources : sources , createdBy : unityPodfilePath , overwriteExistingPod : false ,
1878
1816
propertiesByName : propertiesByName ) ;
@@ -1953,9 +1891,8 @@ public static void GenPodfile(BuildTarget buildTarget,
1953
1891
file . WriteLine ( GeneratePodfileSourcesSection ( ) +
1954
1892
String . Format ( "platform :ios, '{0}'\n " , TargetSdk ) ) ;
1955
1893
foreach ( var target in XcodeTargetNames ) {
1956
- var podsToAddToThisTarget = pods . Values . Where ( pod => pod . target . Equals ( target ) ) ;
1957
1894
file . WriteLine ( String . Format ( "target '{0}' do" , target ) ) ;
1958
- foreach ( var pod in podsToAddToThisTarget ) {
1895
+ foreach ( var pod in pods . Values ) {
1959
1896
file . WriteLine ( String . Format ( " {0}" , pod . PodFilePodLine ) ) ;
1960
1897
}
1961
1898
file . WriteLine ( "end" ) ;
0 commit comments