@@ -194,7 +194,7 @@ public IOSXmlDependencies() {
194
194
/// Read XML declared dependencies.
195
195
/// </summary>
196
196
/// <param name="filename">File to read.</param>
197
- /// <param name="logger">Logging delegate .</param>
197
+ /// <param name="logger">Logger to log with .</param>
198
198
///
199
199
/// Parses dependencies in the form:
200
200
///
@@ -210,8 +210,7 @@ public IOSXmlDependencies() {
210
210
/// </iosPod>
211
211
/// </iosPods>
212
212
/// </dependencies>
213
- protected override bool Read ( string filename ,
214
- PlayServicesSupport . LogMessageWithLevel logger ) {
213
+ protected override bool Read ( string filename , Logger logger ) {
215
214
IOSResolver . Log ( String . Format ( "Reading iOS dependency XML file {0}" , filename ) ,
216
215
verbose : true ) ;
217
216
var sources = new List < string > ( ) ;
@@ -242,10 +241,10 @@ protected override bool Read(string filename,
242
241
minTargetSdk = reader . GetAttribute ( "minTargetSdk" ) ;
243
242
sources = new List < string > ( ) ;
244
243
if ( podName == null ) {
245
- logger (
244
+ logger . Log (
246
245
String . Format ( "Pod name not specified while reading {0}:{1}\n " ,
247
246
filename , reader . LineNumber ) ,
248
- level : PlayServicesSupport . LogLevel . Warning ) ;
247
+ level : LogLevel . Warning ) ;
249
248
return false ;
250
249
}
251
250
} else {
@@ -415,6 +414,9 @@ protected override bool Read(string filename,
415
414
// Parses dependencies from XML dependency files.
416
415
private static IOSXmlDependencies xmlDependencies = new IOSXmlDependencies ( ) ;
417
416
417
+ // Project level settings for this module.
418
+ private static ProjectSettings settings = new ProjectSettings ( PREFERENCE_NAMESPACE ) ;
419
+
418
420
// Search for a file up to a maximum search depth stopping the
419
421
// depth first search each time the specified file is found.
420
422
private static List < string > FindFile (
@@ -545,7 +547,7 @@ exception is TypeInitializationException ||
545
547
// Prompt the user to use workspaces if they aren't at least using project level
546
548
// integration.
547
549
if ( EditorUserBuildSettings . activeBuildTarget == BuildTarget . iOS &&
548
- ( CocoapodsIntegrationMethod ) EditorPrefs . GetInt ( PREFERENCE_COCOAPODS_INTEGRATION_METHOD ,
550
+ ( CocoapodsIntegrationMethod ) settings . GetInt ( PREFERENCE_COCOAPODS_INTEGRATION_METHOD ,
549
551
CocoapodsIntegrationUpgradeDefault ) == CocoapodsIntegrationMethod . None &&
550
552
! InBatchMode && ! UpgradeToWorkspaceWarningDisabled ) {
551
553
@@ -557,8 +559,8 @@ exception is TypeInitializationException ||
557
559
"to integrating Cocoapods with the .xcodeproj file.\n " ,
558
560
"Yes" , "Not Now" , "Silence Warning" ) ) {
559
561
case 0 : // Yes
560
- EditorPrefs . SetInt ( PREFERENCE_COCOAPODS_INTEGRATION_METHOD ,
561
- ( int ) CocoapodsIntegrationMethod . Workspace ) ;
562
+ settings . SetInt ( PREFERENCE_COCOAPODS_INTEGRATION_METHOD ,
563
+ ( int ) CocoapodsIntegrationMethod . Workspace ) ;
562
564
break ;
563
565
case 1 : // Not now
564
566
break ;
@@ -602,7 +604,7 @@ public static void RemapXcodeExtension() {
602
604
/// Reset settings of this plugin to default values.
603
605
/// </summary>
604
606
internal static void RestoreDefaultSettings ( ) {
605
- VersionHandlerImpl . RestoreDefaultSettings ( PREFERENCE_KEYS ) ;
607
+ settings . DeleteKeys ( PREFERENCE_KEYS ) ;
606
608
}
607
609
608
610
/// <summary>
@@ -630,11 +632,11 @@ private static int CocoapodsIntegrationUpgradeDefault {
630
632
/// </summary>
631
633
public static CocoapodsIntegrationMethod CocoapodsIntegrationMethodPref {
632
634
get {
633
- return ( CocoapodsIntegrationMethod ) EditorPrefs . GetInt (
635
+ return ( CocoapodsIntegrationMethod ) settings . GetInt (
634
636
PREFERENCE_COCOAPODS_INTEGRATION_METHOD ,
635
637
defaultValue : CocoapodsIntegrationUpgradeDefault ) ;
636
638
}
637
- set { EditorPrefs . SetInt ( PREFERENCE_COCOAPODS_INTEGRATION_METHOD , ( int ) value ) ; }
639
+ set { settings . SetInt ( PREFERENCE_COCOAPODS_INTEGRATION_METHOD , ( int ) value ) ; }
638
640
}
639
641
640
642
/// <summary>
@@ -654,57 +656,62 @@ public static bool CocoapodsInstallEnabled {
654
656
/// CocoapodsIntegrationEnabled.
655
657
/// </summary>
656
658
private static bool LegacyCocoapodsInstallEnabled {
657
- get { return EditorPrefs . GetBool ( PREFERENCE_COCOAPODS_INSTALL_ENABLED ,
659
+ get { return settings . GetBool ( PREFERENCE_COCOAPODS_INSTALL_ENABLED ,
658
660
defaultValue : true ) ; }
659
- set { EditorPrefs . SetBool ( PREFERENCE_COCOAPODS_INSTALL_ENABLED , value ) ; }
661
+ set { settings . SetBool ( PREFERENCE_COCOAPODS_INSTALL_ENABLED , value ) ; }
660
662
}
661
663
662
664
/// <summary>
663
665
/// Enable / disable Podfile generation.
664
666
/// </summary>
665
667
public static bool PodfileGenerationEnabled {
666
- get { return EditorPrefs . GetBool ( PREFERENCE_PODFILE_GENERATION_ENABLED ,
668
+ get { return settings . GetBool ( PREFERENCE_PODFILE_GENERATION_ENABLED ,
667
669
defaultValue : true ) ; }
668
- set { EditorPrefs . SetBool ( PREFERENCE_PODFILE_GENERATION_ENABLED , value ) ; }
670
+ set { settings . SetBool ( PREFERENCE_PODFILE_GENERATION_ENABLED , value ) ; }
669
671
}
670
672
671
673
/// <summary>
672
674
/// Enable / disable execution of the pod tool via the shell.
673
675
/// </summary>
674
676
public static bool PodToolExecutionViaShellEnabled {
675
- get { return EditorPrefs . GetBool ( PREFERENCE_POD_TOOL_EXECUTION_VIA_SHELL_ENABLED ,
676
- defaultValue : false ) ; }
677
- set { EditorPrefs . SetBool ( PREFERENCE_POD_TOOL_EXECUTION_VIA_SHELL_ENABLED , value ) ; }
677
+ get { return settings . GetBool ( PREFERENCE_POD_TOOL_EXECUTION_VIA_SHELL_ENABLED ,
678
+ defaultValue : false ) ; }
679
+ set { settings . SetBool ( PREFERENCE_POD_TOOL_EXECUTION_VIA_SHELL_ENABLED , value ) ; }
678
680
}
679
681
680
682
/// <summary>
681
683
/// Enable automated pod tool installation in the editor. This is only performed when the
682
684
/// editor isn't launched in batch mode.
683
685
/// </summary>
684
686
public static bool AutoPodToolInstallInEditorEnabled {
685
- get { return EditorPrefs . GetBool ( PREFERENCE_AUTO_POD_TOOL_INSTALL_IN_EDITOR ,
686
- defaultValue : true ) ; }
687
- set { EditorPrefs . SetBool ( PREFERENCE_AUTO_POD_TOOL_INSTALL_IN_EDITOR , value ) ; }
687
+ get { return settings . GetBool ( PREFERENCE_AUTO_POD_TOOL_INSTALL_IN_EDITOR ,
688
+ defaultValue : true ) ; }
689
+ set { settings . SetBool ( PREFERENCE_AUTO_POD_TOOL_INSTALL_IN_EDITOR , value ) ; }
688
690
}
689
691
690
692
/// <summary>
691
693
/// Get / set the nag prompt disabler setting for turning on workspace integration.
692
694
/// </summary>
693
695
public static bool UpgradeToWorkspaceWarningDisabled {
694
- get { return EditorPrefs . GetBool ( PREFERENCE_WARN_UPGRADE_WORKSPACE ,
695
- defaultValue : false ) ; }
696
- set { EditorPrefs . SetBool ( PREFERENCE_WARN_UPGRADE_WORKSPACE , value ) ; }
696
+ get { return settings . GetBool ( PREFERENCE_WARN_UPGRADE_WORKSPACE , defaultValue : false ) ; }
697
+ set { settings . SetBool ( PREFERENCE_WARN_UPGRADE_WORKSPACE , value ) ; }
697
698
}
698
699
699
700
/// <summary>
700
701
/// Enable / disable verbose logging.
701
702
/// </summary>
702
703
public static bool VerboseLoggingEnabled {
703
- get { return EditorPrefs . GetBool ( PREFERENCE_VERBOSE_LOGGING_ENABLED ,
704
- defaultValue : false ) ; }
705
- set { EditorPrefs . SetBool ( PREFERENCE_VERBOSE_LOGGING_ENABLED , value ) ; }
704
+ get { return settings . GetBool ( PREFERENCE_VERBOSE_LOGGING_ENABLED , defaultValue : false ) ; }
705
+ set { settings . SetBool ( PREFERENCE_VERBOSE_LOGGING_ENABLED , value ) ; }
706
706
}
707
707
708
+ /// <summary>
709
+ /// Whether to use project level settings.
710
+ /// </summary>
711
+ public static bool UseProjectSettings {
712
+ get { return settings . UseProjectSettings ; }
713
+ set { settings . UseProjectSettings = value ; }
714
+ }
708
715
709
716
/// <summary>
710
717
/// Determine whether it's possible to perform iOS dependency injection.
@@ -779,18 +786,11 @@ public static bool CocoapodsIntegrationEnabled {
779
786
}
780
787
}
781
788
782
- /// <summary>
783
- /// Log severity.
784
- /// </summary>
785
- internal enum LogLevel {
786
- Info ,
787
- Warning ,
788
- Error ,
789
- } ;
790
-
791
789
private delegate void LogMessageDelegate ( string message , bool verbose = false ,
792
790
LogLevel level = LogLevel . Info ) ;
793
791
792
+ private static Google . Logger logger = new Google . Logger ( ) ;
793
+
794
794
/// <summary>
795
795
/// Log a message.
796
796
/// </summary>
@@ -800,19 +800,8 @@ private delegate void LogMessageDelegate(string message, bool verbose = false,
800
800
/// <param name="level">Severity of the message.</param>
801
801
internal static void Log ( string message , bool verbose = false ,
802
802
LogLevel level = LogLevel . Info ) {
803
- if ( ! verbose || VerboseLoggingEnabled || InBatchMode ) {
804
- switch ( level ) {
805
- case LogLevel . Info :
806
- Debug . Log ( message ) ;
807
- break ;
808
- case LogLevel . Warning :
809
- Debug . LogWarning ( message ) ;
810
- break ;
811
- case LogLevel . Error :
812
- Debug . LogError ( message ) ;
813
- break ;
814
- }
815
- }
803
+ logger . Level = ( VerboseLoggingEnabled || InBatchMode ) ? LogLevel . Verbose : LogLevel . Info ;
804
+ logger . Log ( message , level : verbose ? LogLevel . Verbose : level ) ;
816
805
}
817
806
818
807
/// <summary>
@@ -2432,7 +2421,7 @@ private static void RefreshXmlDependencies() {
2432
2421
pods . Remove ( podName ) ;
2433
2422
}
2434
2423
// Read pod specifications from XML dependencies.
2435
- xmlDependencies . ReadAll ( IOSXmlDependencies . LogMessage ) ;
2424
+ xmlDependencies . ReadAll ( logger ) ;
2436
2425
}
2437
2426
2438
2427
/// <summary>
0 commit comments