@@ -723,7 +723,7 @@ exception is TypeInitializationException ||
723
723
/// </summary>
724
724
[ MenuItem ( "Assets/Play Services Resolver/iOS Resolver/Documentation" ) ]
725
725
public static void OpenDocumentation ( ) {
726
- Application . OpenURL ( VersionHandlerImpl . DocumentationUrl ( "#ios-resolver-usage" ) ) ;
726
+ analytics . OpenUrl ( VersionHandlerImpl . DocumentationUrl ( "#ios-resolver-usage" ) , "Usage" ) ;
727
727
}
728
728
729
729
// Display the iOS resolver settings menu.
@@ -777,6 +777,7 @@ public static void RemapXcodeExtension() {
777
777
/// </summary>
778
778
internal static void RestoreDefaultSettings ( ) {
779
779
settings . DeleteKeys ( PREFERENCE_KEYS ) ;
780
+ analytics . RestoreDefaultSettings ( ) ;
780
781
}
781
782
782
783
/// <summary>
@@ -984,6 +985,16 @@ private delegate void LogMessageDelegate(string message, bool verbose = false,
984
985
985
986
private static Google . Logger logger = new Google . Logger ( ) ;
986
987
988
+ // Analytics reporter.
989
+ internal static EditorMeasurement analytics = new EditorMeasurement (
990
+ settings , logger , VersionHandlerImpl . GA_TRACKING_ID ,
991
+ "com.google.unity.oss.play_services_resolver" , "iOS Resolver" , "" ,
992
+ VersionHandlerImpl . PRIVACY_POLICY ) {
993
+ BasePath = "/iosresolver/" ,
994
+ BaseQuery = String . Format ( "version={0}" , IOSResolverVersionNumber . Value . ToString ( ) ) ,
995
+ BaseReportName = "iOS Resolver: "
996
+ } ;
997
+
987
998
/// <summary>
988
999
/// Log a message.
989
1000
/// </summary>
@@ -1181,6 +1192,8 @@ public static bool UpdateTargetSdk(bool runningBuild) {
1181
1192
").\n " +
1182
1193
"Would you like to update the target SDK version?" ,
1183
1194
"Yes" , cancel : "No" ) ;
1195
+ analytics . Report ( "updatetargetsdk/" + ( update ? "apply" : "cancel" ) ,
1196
+ "Update Target SDK" ) ;
1184
1197
if ( update ) {
1185
1198
TargetSdkVersion = minVersionAndPodNames . Key ;
1186
1199
if ( runningBuild ) {
@@ -1467,7 +1480,9 @@ public static void InstallCocoapods(bool interactive, string workingDirectory,
1467
1480
"For more information see:\n " +
1468
1481
" https://guides.cocoapods.org/using/getting-started.html\n \n " ;
1469
1482
1470
- // Log the set of install pods.
1483
+ analytics . Report ( "installpodtool/querygems" , "Install Pod Tool Query Ruby Gems" ) ;
1484
+
1485
+ // Log the set of install gems.
1471
1486
RunCommand ( GEM_EXECUTABLE , "list" ) ;
1472
1487
1473
1488
// Gem is being executed in an RVM directory it's already configured to perform a
@@ -1491,6 +1506,7 @@ public static void InstallCocoapods(bool interactive, string workingDirectory,
1491
1506
installArgs += " --verbose" ;
1492
1507
}
1493
1508
1509
+ analytics . Report ( "installpodtool/installgems" , "Install Pod Tool Ruby Gem" ) ;
1494
1510
var commandList = new List < CommandItem > ( ) ;
1495
1511
if ( ! QueryGemInstalled ( "activesupport" , logMessage : logMessage ) ) {
1496
1512
// Workaround activesupport (dependency of the CocoaPods gem) requiring
@@ -1515,6 +1531,9 @@ public static void InstallCocoapods(bool interactive, string workingDirectory,
1515
1531
var lastCommand = commands [ commandIndex ] ;
1516
1532
commandIndex += 1 ;
1517
1533
if ( result . exitCode != 0 ) {
1534
+ analytics . Report ( "installpodtool/failed" ,
1535
+ String . Format ( "Install Pod Tool Ruby Gem Failed {0}" ,
1536
+ result . exitCode ) ) ;
1518
1537
logMessage ( String . Format (
1519
1538
"Failed to install CocoaPods for the current user.\n \n " +
1520
1539
"{0}\n " +
@@ -1535,15 +1554,20 @@ public static void InstallCocoapods(bool interactive, string workingDirectory,
1535
1554
"'{0} {1}' succeeded but the {2} tool cannot be found.\n \n " +
1536
1555
"{3}\n " , lastCommand . Command , lastCommand . Arguments ,
1537
1556
POD_EXECUTABLE , commonInstallErrorMessage ) , level : LogLevel . Error ) ;
1557
+ analytics . Report ( "installpodtool/failedmissing" ,
1558
+ "Install Pod Tool Ruby Gem Succeeded, Missing Tool" ) ;
1538
1559
complete . Set ( ) ;
1539
1560
return - 1 ;
1540
1561
}
1541
1562
if ( dialog != null ) {
1563
+ analytics . Report ( "installpodtool/downloadrepo" ,
1564
+ "Install Pod Tool Download Cocoapods Repo" ) ;
1542
1565
dialog . bodyText += ( "\n \n Downloading CocoaPods Master Repository\n " +
1543
1566
"(this can take a while)\n " ) ;
1544
1567
}
1545
1568
commands [ commandIndex ] . Command = podToolPath ;
1546
1569
} else if ( commandIndex == commands . Length ) {
1570
+ analytics . Report ( "installpodtool/success" , "Install Pod Tool Succeeded" ) ;
1547
1571
complete . Set ( ) ;
1548
1572
logMessage ( "CocoaPods tools successfully installed." ) ;
1549
1573
cocoapodsToolsInstallPresent = true ;
@@ -1839,6 +1863,7 @@ private static string GeneratePodfileSourcesSection() {
1839
1863
// processing step.
1840
1864
public static void GenPodfile ( BuildTarget buildTarget ,
1841
1865
string pathToBuiltProject ) {
1866
+ analytics . Report ( "generatepodfile" , "Generate Podfile" ) ;
1842
1867
string podfilePath = GetPodfilePath ( pathToBuiltProject ) ;
1843
1868
1844
1869
string unityPodfile = FindExistingUnityPodfile ( podfilePath ) ;
@@ -1858,6 +1883,7 @@ public static void GenPodfile(BuildTarget buildTarget,
1858
1883
( CocoapodsWorkspaceIntegrationEnabled ? "Xcode workspace" :
1859
1884
( CocoapodsProjectIntegrationEnabled ? "Xcode project" : "no target" ) ) ) ,
1860
1885
verbose : true ) ;
1886
+
1861
1887
using ( StreamWriter file = new StreamWriter ( podfilePath ) ) {
1862
1888
file . WriteLine ( GeneratePodfileSourcesSection ( ) +
1863
1889
String . Format ( "platform :ios, '{0}'\n " , TargetSdk ) ) ;
@@ -1869,6 +1895,38 @@ public static void GenPodfile(BuildTarget buildTarget,
1869
1895
file . WriteLine ( "end" ) ;
1870
1896
}
1871
1897
}
1898
+
1899
+ int versionCount = 0 ;
1900
+ int localPathCount = 0 ;
1901
+ int targetSdkCount = 0 ;
1902
+ int maxProperties = 0 ;
1903
+ int maxSources = Pod . Sources . Count ;
1904
+ int fromXmlFileCount = 0 ;
1905
+ foreach ( var pod in pods . Values ) {
1906
+ maxProperties = Math . Max ( maxProperties , pod . propertiesByName . Count ) ;
1907
+ maxSources = Math . Max ( maxSources , pod . sources . Count ) ;
1908
+ if ( ! String . IsNullOrEmpty ( pod . version ) ) versionCount ++ ;
1909
+ if ( ! String . IsNullOrEmpty ( pod . minTargetSdk ) ) targetSdkCount ++ ;
1910
+ if ( ! String . IsNullOrEmpty ( pod . LocalPath ) ) localPathCount ++ ;
1911
+ if ( pod . fromXmlFile ) fromXmlFileCount ++ ;
1912
+ }
1913
+ analytics . Report ( "generatepodfile/podinfo" ,
1914
+ new KeyValuePair < string , string > [ ] {
1915
+ new KeyValuePair < string , string > ( "numPods" , pods . Count . ToString ( ) ) ,
1916
+ new KeyValuePair < string , string > ( "numPodsWithVersions" ,
1917
+ versionCount . ToString ( ) ) ,
1918
+ new KeyValuePair < string , string > ( "numLocalPods" ,
1919
+ localPathCount . ToString ( ) ) ,
1920
+ new KeyValuePair < string , string > ( "numMinTargetSdk" ,
1921
+ targetSdkCount . ToString ( ) ) ,
1922
+ new KeyValuePair < string , string > ( "maxNumProperties" ,
1923
+ maxProperties . ToString ( ) ) ,
1924
+ new KeyValuePair < string , string > ( "maxNumSources" ,
1925
+ maxSources . ToString ( ) ) ,
1926
+ new KeyValuePair < string , string > ( "numFromXmlFiles" ,
1927
+ fromXmlFileCount . ToString ( ) )
1928
+ } ,
1929
+ "Generate Podfile Pods Section" ) ;
1872
1930
}
1873
1931
1874
1932
/// <summary>
@@ -2219,6 +2277,7 @@ public static void OnPostProcessInstallPods(BuildTarget buildTarget,
2219
2277
if ( UnityCanLoadWorkspace &&
2220
2278
CocoapodsIntegrationMethodPref == CocoapodsIntegrationMethod . Workspace &&
2221
2279
SkipPodInstallWhenUsingWorkspaceIntegration ) {
2280
+ analytics . Report ( "installpods/disabled" , "Pod Install Disabled" ) ;
2222
2281
Log ( "Skipping pod install." , level : LogLevel . Warning ) ;
2223
2282
return ;
2224
2283
}
@@ -2227,9 +2286,14 @@ public static void OnPostProcessInstallPods(BuildTarget buildTarget,
2227
2286
CommandLine . Result result ;
2228
2287
result = RunPodCommand ( "--version" , pathToBuiltProject ) ;
2229
2288
if ( result . exitCode == 0 ) podsVersion = result . stdout . Trim ( ) ;
2289
+ var cocoapodsVersionParameters = new KeyValuePair < string , string > [ ] {
2290
+ new KeyValuePair < string , string > ( "cocoapodsVersion" , podsVersion )
2291
+ } ;
2230
2292
2231
2293
if ( result . exitCode != 0 ||
2232
2294
( ! String . IsNullOrEmpty ( podsVersion ) && podsVersion [ 0 ] == '0' ) ) {
2295
+ analytics . Report ( "installpods/outofdate" , cocoapodsVersionParameters ,
2296
+ "Pod Install, Tool Out Of Date" ) ;
2233
2297
Log ( "Error running CocoaPods. Please ensure you have at least " +
2234
2298
"version 1.0.0. " + COCOAPOD_INSTALL_INSTRUCTIONS + "\n \n " +
2235
2299
"'" + POD_EXECUTABLE + " --version' returned status: " +
@@ -2239,16 +2303,21 @@ public static void OnPostProcessInstallPods(BuildTarget buildTarget,
2239
2303
return ;
2240
2304
}
2241
2305
2306
+ analytics . Report ( "installpods/install" , cocoapodsVersionParameters , "Pod Install" ) ;
2242
2307
result = RunPodCommand ( "install" , pathToBuiltProject ) ;
2243
2308
2244
2309
// If pod installation failed it may be due to an out of date pod repo.
2245
2310
// We'll attempt to resolve the error by updating the pod repo -
2246
2311
// which is a slow operation - and retrying pod installation.
2247
2312
if ( result . exitCode != 0 ) {
2313
+ analytics . Report ( "installpods/repoupdate" , cocoapodsVersionParameters ,
2314
+ "Pod Install Repo Update" ) ;
2248
2315
CommandLine . Result repoUpdateResult =
2249
2316
RunPodCommand ( "repo update" , pathToBuiltProject ) ;
2250
2317
bool repoUpdateSucceeded = repoUpdateResult . exitCode == 0 ;
2251
2318
2319
+ analytics . Report ( "installpods/install2" , cocoapodsVersionParameters ,
2320
+ "Pod Install Attempt 2" ) ;
2252
2321
// Second attempt result.
2253
2322
// This is isolated in case it fails, so we can just report the
2254
2323
// original failure.
@@ -2257,6 +2326,8 @@ public static void OnPostProcessInstallPods(BuildTarget buildTarget,
2257
2326
2258
2327
// If the repo update still didn't fix the problem...
2259
2328
if ( result2 . exitCode != 0 ) {
2329
+ analytics . Report ( "installpods/failed" , cocoapodsVersionParameters ,
2330
+ "Pod Install Failed" ) ;
2260
2331
Log ( "iOS framework addition failed due to a " +
2261
2332
"CocoaPods installation failure. This will will likely " +
2262
2333
"result in an non-functional Xcode project.\n \n " +
@@ -2305,6 +2376,7 @@ public static void UpdateProjectDeps(
2305
2376
// failed.
2306
2377
var podsDir = Path . Combine ( pathToBuiltProject , PODS_DIR ) ;
2307
2378
if ( ! Directory . Exists ( podsDir ) ) return ;
2379
+ analytics . Report ( "injectpodsintoxcproj" , "Inject Pods Into xcproj" ) ;
2308
2380
2309
2381
// If Unity can load workspaces, and one has been generated, yet we're still
2310
2382
// trying to patch the project file, then we have to actually get rid of the workspace
0 commit comments