/// <summary> /// Initializes static members of the <see cref="SampleDependencies"/> class. /// </summary> static GPGSDependencies() { PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance( PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-games", PluginVersion.PlayServicesVersionConstraint); // need nearby too, even if it is not used. svcSupport.DependOn("com.google.android.gms", "play-services-nearby", PluginVersion.PlayServicesVersionConstraint); // Plus is needed if Token support is enabled. svcSupport.DependOn("com.google.android.gms", "play-services-plus", PluginVersion.PlayServicesVersionConstraint); // Marshmallow permissions requires app-compat svcSupport.DependOn("com.android.support", "support-v4", "23.1.0+"); // GA svcSupport.DependOn("com.google.android.gms", "play-services-analytics", PluginVersion.PlayServicesVersionConstraint); }
static FBJarDependencies() { svcSupport = PlayServicesSupport.CreateInstance(PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.firebase", "firebase-database", "11.8.0"); svcSupport.DependOn("com.android.support", "support-v13", "23.4.0"); svcSupport.DependOn("com.google.gms", "google-services", "3.1.1"); }
/// <summary> /// Initializes the <see cref="GooglePlayServices.PlayServicesResolver"/> class. /// </summary> static PlayServicesResolver() { svcSupport = PlayServicesSupport.CreateInstance( "PlayServicesResolver", EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); }
public void TestCustomRepoPath() { string[] repos = { "../../testData/extras/google/m2repository" }; PlayServicesSupport support = PlayServicesSupport.CreateInstance( "testInstance", "..", repos, Path.GetTempPath()); Assert.True(Directory.Exists(support.SDK)); // happy path support.ResetDependencies(); support.DependOn("test", "artifact", "LATEST"); Dictionary <string, Dependency> deps = support.ResolveDependencies(false); Assert.NotNull(deps); // should be only 1 and version 8.1 Assert.True(deps.Count == 1); IEnumerator <Dependency> iter = deps.Values.GetEnumerator(); iter.MoveNext(); Assert.True(iter.Current.BestVersion == "8.2.0-alpha"); }
static SmartAdServerDependencies() { PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance(PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-ads", "9.8.0"); svcSupport.DependOn("com.google.android.gms", "play-services-location", "9.8.0"); }
static DriveJarDependencies() { // this only handles google player services api stuff, not the raw google api jars... those have to be added manually.. ugh svcSupport = PlayServicesSupport.CreateInstance(PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-auth", "9.2.1"); svcSupport.DependOn("com.android.support", "support-v13", "23.4.0"); }
static GADependencies() { svcSupport = PlayServicesSupport.CreateInstance( PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); RegisterDependencies(); }
static ResolveDependencies() { var SvcSupport = PlayServicesSupport.CreateInstance( "GooglePlayGames", EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings" ); SvcSupport.DependOn("com.android.support", "customtabs", "23.0.0"); }
/// Initializes static members of the class. static AnalyticsDependencies() { PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance(PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-analytics", "LATEST"); }
/// <summary> /// Initializes the <see cref="GooglePlayServices.PlayServicesResolver"/> class. /// </summary> static PlayServicesResolver() { svcSupport = PlayServicesSupport.CreateInstance( "PlayServicesResolver", EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-ads", "9+"); svcSupport.DependOn("com.google.android.gms", "play-services-analytics", "9+"); }
/// <summary> /// Initializes the <see cref="GooglePlayGames.BackgroundResolution"/> class. /// </summary> static BackgroundResolution() { svcSupport = PlayServicesSupport.CreateInstance( "Google.GPGS", EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); AddDependencies(); }
/// <summary> /// Initializes the <see cref="GooglePlayServices.PlayServicesResolver"/> class. /// </summary> static PlayServicesResolver() { updateQueue = System.Collections.Queue.Synchronized(new System.Collections.Queue()); if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android) { RegisterResolver(new ResolverVer1_1()); RegisterResolver(new GradlePreBuildResolver(), ResolverType.GradlePrebuild); svcSupport = PlayServicesSupport.CreateInstance( "PlayServicesResolver", EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings", logMessageWithLevel: (string message, PlayServicesSupport.LogLevel level) => { switch (level) { case PlayServicesSupport.LogLevel.Info: UnityEngine.Debug.Log(message); break; case PlayServicesSupport.LogLevel.Warning: UnityEngine.Debug.LogWarning(message); break; case PlayServicesSupport.LogLevel.Error: UnityEngine.Debug.LogError(message); break; default: break; } }); EditorApplication.update -= AutoResolve; EditorApplication.update += AutoResolve; BundleIdChanged -= ResolveOnBundleIdChanged; BundleIdChanged += ResolveOnBundleIdChanged; AndroidBuildSystemChanged -= ResolveOnBuildSystemChanged; AndroidBuildSystemChanged += ResolveOnBuildSystemChanged; AndroidTargetDeviceAbiChanged -= ResolveOnTargetDeviceAbiChanged; AndroidTargetDeviceAbiChanged += ResolveOnTargetDeviceAbiChanged; } EditorApplication.update -= PollBundleId; EditorApplication.update += PollBundleId; EditorApplication.update -= PollBuildSystem; EditorApplication.update += PollBuildSystem; EditorApplication.update -= PollTargetDeviceAbi; EditorApplication.update += PollTargetDeviceAbi; EditorApplication.update -= InitializationComplete; EditorApplication.update += InitializationComplete; EditorApplication.update -= PumpUpdateQueue; EditorApplication.update += PumpUpdateQueue; previousGradlePrebuildEnabled = GooglePlayServices.SettingsDialog.PrebuildWithGradle; OnSettingsChanged(); }
/// Initializes static members of the class. static AdMobDependencies() { PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance(PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-ads", "LATEST"); // Marshmallow permissions requires app-compat. svcSupport.DependOn("com.android.support", "appcompat-v7", "LATEST"); }
/// <summary> /// Create a PlayServicesSupport instance for testing. /// </summary> public static PlayServicesSupport CreateInstance( string instanceName = null, string sdkPath = null, string[] additionalRepositories = null, PlayServicesSupport.LogMessage logger = null) { var instance = PlayServicesSupport.CreateInstance( instanceName ?? "testInstance", sdkPath ?? PATH, additionalRepositories, Path.GetTempPath(), logger: logger ?? Console.WriteLine); PlayServicesSupport.verboseLogging = VERBOSE_LOGGING; return(instance); }
/// <summary> /// Initializes the <see cref="GooglePlayServices.PlayServicesResolver"/> class. /// </summary> static PlayServicesResolver() { svcSupport = PlayServicesSupport.CreateInstance( "PlayServicesResolver", EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings", logger: UnityEngine.Debug.Log); EditorApplication.update -= AutoResolve; EditorApplication.update += AutoResolve; EditorApplication.update -= PollBundleId; EditorApplication.update += PollBundleId; }
public void TestLogger() { List <string> messageList = new List <string>(); string logMessage = "this is a test"; PlayServicesSupport support = PlayServicesSupport.CreateInstance( "log_test", "../../testData", Path.GetTempPath(), logger: (message) => messageList.Add(message)); Assert.AreEqual(messageList.Count, 0); support.Log(logMessage); Assert.AreEqual(messageList.Count, 1); Assert.AreEqual(messageList[0], logMessage); }
public void TestMultiClient() { PlayServicesSupport client1 = PlayServicesSupport.CreateInstance( "client1", "../../testData", Path.GetTempPath()); PlayServicesSupport client2 = PlayServicesSupport.CreateInstance( "client2", "../../testData", Path.GetTempPath()); client1.ResetDependencies(); client2.ResetDependencies(); client1.DependOn("test", "artifact", "1+"); client2.DependOn("test", "subdep", "1.1.0"); Dictionary <string, Dependency> deps = client1.ResolveDependencies(true); Assert.NotNull(deps); Dependency d = deps["test:artifact"]; Assert.True(d.BestVersion == "8.1.0"); // client 1 needs to see client 2 deps d = deps["test:subdep"]; Assert.True(d.BestVersion == "1.1.0"); // now check that client 2 sees them also deps = client2.ResolveDependencies(true); Assert.NotNull(deps); d = deps["test:artifact"]; Assert.True(d.BestVersion == "8.1.0"); d = deps["test:subdep"]; Assert.True(d.BestVersion == "1.1.0"); // Now clear client2's deps, and client1 should not see subdep client2.ClearDependencies(); deps = client1.ResolveDependencies(true); Assert.NotNull(deps); d = deps["test:artifact"]; Assert.True(d.BestVersion == "8.1.0"); Assert.False(deps.ContainsKey("test:subdep")); }
/// Initializes static members of the class. static AdMobDependencies() { PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance(PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-ads", "LATEST"); // Marshmallow permissions requires app-compat. try { svcSupport.DependOn("com.android.support", "appcompat-v7", "23.1.0+"); } catch (System.Exception e) { Debug.LogWarning(e.Message); } }
/// <summary> /// Initializes static members of the <see cref="SampleDependencies"/> class. /// </summary> static LocationDependencies() { PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance( PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); // add your dependencies here //svcSupport.DependOn("com.google.android.gms", "play-services-base", "8.1+"); svcSupport.DependOn("com.google.android.gms", "play-services-location", "LATEST"); // Marshmallow permissions requires app-compat. svcSupport.DependOn("com.android.support", "appcompat-v7", "23.1.0+"); }
/// <summary> /// Find and read all XML declared dependencies. /// </summary> /// <param name="logger">Logger to log with.</param> public override bool ReadAll(Logger logger) { const string XML_DEPENDENCIES_INSTANCE = "InternalXmlDependencies"; if (PlayServicesSupport.instances.TryGetValue(XML_DEPENDENCIES_INSTANCE, out svcSupport)) { svcSupport.ClearDependencies(); } else { svcSupport = PlayServicesSupport.CreateInstance( XML_DEPENDENCIES_INSTANCE, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings", logMessageWithLevel: PlayServicesResolver.LogDelegate); } return(base.ReadAll(logger)); }
// /// <summary> // /// Initializes static members of the <see cref="KongregateGPSDependencies"/> class. // /// </summary> static KongregateGPSDependencies() { Debug.Log("Loading Kongregate GPS dependencies"); PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance( PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); // add your dependencies here svcSupport.DependOn("com.google.android.gms", "play-services-gcm", "8.1+"); svcSupport.DependOn("com.google.android.gms", "play-services-ads", "8.1+"); svcSupport.DependOn("com.android.support", "support-v4", "23.0+"); svcSupport.DependOn("com.android.support", "appcompat-v7", "23.0+"); Debug.Log("Kongregate GPS dependencies loaded"); }
/// <summary> /// Initializes the <see cref="GooglePlayServices.PlayServicesResolver"/> class. /// </summary> static PlayServicesResolver() { if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android) { svcSupport = PlayServicesSupport.CreateInstance( "PlayServicesResolver", EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings", logger: UnityEngine.Debug.Log); EditorApplication.update -= AutoResolve; EditorApplication.update += AutoResolve; BundleIdChanged -= ResolveOnBundleIdChanged; BundleIdChanged += ResolveOnBundleIdChanged; } EditorApplication.update -= PollBundleId; EditorApplication.update += PollBundleId; }
static AppodealDependencies() { PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance( PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-ads", "LATEST"); svcSupport.DependOn("com.google.android.gms", "play-services-location", "LATEST"); svcSupport.DependOn("com.android.support", "support-v4", "23.1+"); }
private static void addGMSLibrary() { svcSupport = PlayServicesSupport.CreateInstance(PluginName, EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings"); svcSupport.DependOn("com.google.android.gms", "play-services-gcm", PLAY_SERVICES_VERSION); svcSupport.DependOn("com.google.android.gms", "play-services-location", PLAY_SERVICES_VERSION); // Adds play-services-base, play-services-basement, play-services-iid, and support-v4 will be automaticly added. // Also adds play-services-tasks but this isn't used by OneSignal, it just added as a depency from the above. // Setting 8.3+ does not work with unity-jar-resolver-1.2.0 and GooglePlayGamesPlugin-0.9.34. // It creates conflicting aar files with mismatched version of 8.4 and 9.4 // svcSupport.DependOn("com.google.android.gms", "play-services-gcm", "8.3+"); // svcSupport.DependOn("com.google.android.gms", "play-services-location", "8.3+"); // play-services-base, play-services-basement, and support-v4 will be automaticly added. // play-services-maps and play-services-measurement are not used by OneSignal // but are included as depencies from the other parts of play-services. }
private static void CreateDependencies() { PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance( PluginName, EditorPrefs.GetString("AndroidSdkRoot"), DependencyFileDirectory); svcSupport.ClearDependencies(); if (NPSettings.Application.SupportedFeatures.UsesGameServices) { svcSupport.DependOn("com.google.android.gms", "play-services-games", "LATEST"); // need nearby too, even if it is not used. svcSupport.DependOn("com.google.android.gms", "play-services-nearby", "LATEST"); } if (NPSettings.Application.SupportedFeatures.UsesNotificationService) { svcSupport.DependOn("com.google.android.gms", "play-services-gcm", "LATEST"); } // Marshmallow permissions requires app-compat. Also used by some old API's for compatibility. svcSupport.DependOn("com.android.support", "support-v4", "23.+"); // If not enabled by default, resolve manually. if (!PlayServicesResolver.Resolver.AutomaticResolutionEnabled()) { PlayServicesResolver.Resolver.DoResolution(svcSupport, "Assets/Plugins/Android", PlayServicesResolver.HandleOverwriteConfirmation); AssetDatabase.Refresh(); } }
/// <summary> /// Initializes the <see cref="GooglePlayServices.PlayServicesResolver"/> class. /// </summary> static PlayServicesResolver() { updateQueue = System.Collections.Queue.Synchronized(new System.Collections.Queue()); if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android) { RegisterResolver(new ResolverVer1_1()); RegisterResolver(new GradlePreBuildResolver(), ResolverType.GradlePrebuild); // Monitor Android dependency XML files to perform auto-resolution. AddAutoResolutionFilePatterns(xmlDependencies.fileRegularExpressions); svcSupport = PlayServicesSupport.CreateInstance( "PlayServicesResolver", EditorPrefs.GetString("AndroidSdkRoot"), "ProjectSettings", logMessageWithLevel: LogDelegate); EditorApplication.update -= AutoResolve; EditorApplication.update += AutoResolve; BundleIdChanged -= ResolveOnBundleIdChanged; BundleIdChanged += ResolveOnBundleIdChanged; AndroidBuildSystemChanged -= ResolveOnBuildSystemChanged; AndroidBuildSystemChanged += ResolveOnBuildSystemChanged; AndroidTargetDeviceAbiChanged -= ResolveOnTargetDeviceAbiChanged; AndroidTargetDeviceAbiChanged += ResolveOnTargetDeviceAbiChanged; } EditorApplication.update -= PollBundleId; EditorApplication.update += PollBundleId; EditorApplication.update -= PollBuildSystem; EditorApplication.update += PollBuildSystem; EditorApplication.update -= PollTargetDeviceAbi; EditorApplication.update += PollTargetDeviceAbi; EditorApplication.update -= InitializationComplete; EditorApplication.update += InitializationComplete; EditorApplication.update -= PumpUpdateQueue; EditorApplication.update += PumpUpdateQueue; previousGradlePrebuildEnabled = GooglePlayServices.SettingsDialog.PrebuildWithGradle; OnSettingsChanged(); }
public void TestUseLatest() { PlayServicesSupport support = PlayServicesSupport.CreateInstance( "testInstance", "../../testData", Path.GetTempPath()); Assert.True(Directory.Exists(support.SDK)); support.DependOn("test", "artifact", "1+"); support.DependOn("test", "subdep", "1.1.0"); support.DependOn("test", "transdep", "LATEST"); Dictionary <string, Dependency> deps = support.ResolveDependencies(true); Assert.NotNull(deps); Dependency d = deps["test:artifact"]; Assert.True(d.BestVersion == "8.1.0"); d = deps["test:subdep"]; Assert.True(d.BestVersion == "1.1.0"); }
public void TestNonActiveClient() { PlayServicesSupport client1 = PlayServicesSupport.CreateInstance( "client1", "../../testData", Path.GetTempPath()); PlayServicesSupport client2 = PlayServicesSupport.CreateInstance( "client2", "../../testData", Path.GetTempPath()); client1.ResetDependencies(); client2.ResetDependencies(); client1.DependOn("test", "artifact", "1+"); client2.DependOn("test", "subdep", "1.1.0"); // now make a third client with no dependencies and make sure it // sees client1 & 2 PlayServicesSupport client3 = PlayServicesSupport.CreateInstance( "client3", "../../testData", Path.GetTempPath()); // now check that client 2 sees them also Dictionary <string, Dependency> deps = client3.ResolveDependencies(true); Assert.NotNull(deps); Dependency d = deps["test:artifact"]; Assert.True(d.BestVersion == "8.1.0"); d = deps["test:subdep"]; Assert.True(d.BestVersion == "1.1.0"); }
public void TestLatestResolution() { PlayServicesSupport client1 = PlayServicesSupport.CreateInstance( "client1", "../../testData", Path.GetTempPath()); client1.ResetDependencies(); //trans dep needs subdep 0.9 client1.DependOn("test", "transdep", "1.0.0"); // so top level require subdep 1.0 or greater client1.DependOn("test", "subdep", "1.0+"); Dictionary <string, Dependency> deps = null; // this should fail since we need 0.9 and 1.1.0 ResolutionException ex = null; try { deps = client1.ResolveDependencies(false); } catch (ResolutionException e) { ex = e; } Assert.NotNull(ex, "Expected exception, but got none"); // now try with useLatest == true, should have no exception ex = null; try { deps = client1.ResolveDependencies(true); } catch (ResolutionException e) { ex = e; } Assert.Null(ex, "unexpected exception"); Assert.NotNull(deps); Assert.IsTrue(deps.Count == 2, "Expected 2 dependencies, got " + deps.Count); // now check that that all the dependencies have the correct // best version Dependency d = deps["test:transdep"]; Assert.NotNull(d, "could not find transdep"); Assert.IsTrue(d.BestVersion == "1.0.0", "Expected version 1.0.0, got " + d.BestVersion); d = deps["test:subdep"]; Assert.NotNull(d, "could not find subdep"); Assert.IsTrue(d.BestVersion == "1.1.0", "Expected version 1.1.0, got " + d.BestVersion); // try without wildcard client1.ResetDependencies(); //trans dep needs subdep 0.9 client1.DependOn("test", "transdep", "1.0.0"); // so top level requires exactly subdep 1.1.0. client1.DependOn("test", "subdep", "1.1.0"); ex = null; try { deps = client1.ResolveDependencies(false); } catch (ResolutionException e) { ex = e; } Assert.NotNull(ex, "Expected exception, but got none"); ex = null; try { deps = client1.ResolveDependencies(true); } catch (ResolutionException e) { ex = e; } Assert.Null(ex, "unexpected exception"); Assert.NotNull(deps); Assert.IsTrue(deps.Count == 2, "Expected 2 dependencies, got " + deps.Count); // now check that that all the dependencies have the correct // best version d = deps["test:transdep"]; Assert.NotNull(d, "could not find transdep"); Assert.IsTrue(d.BestVersion == "1.0.0", "Expected version 1.0.0, got " + d.BestVersion); d = deps["test:subdep"]; Assert.NotNull(d, "could not find subdep"); Assert.IsTrue(d.BestVersion == "1.1.0", "Expected version 1.1.0, got " + d.BestVersion); }
public void TestResolveDependencies() { PlayServicesSupport support = PlayServicesSupport.CreateInstance( "testInstance", "../../testData", Path.GetTempPath()); Assert.True(Directory.Exists(support.SDK)); support.ResetDependencies(); // happy path support.DependOn("test", "artifact", "LATEST"); Dictionary <string, Dependency> deps = support.ResolveDependencies(false); Assert.NotNull(deps); // should be only 1 and version 8.1 Assert.True(deps.Count == 1); IEnumerator <Dependency> iter = deps.Values.GetEnumerator(); iter.MoveNext(); Assert.True(iter.Current.BestVersion == "8.1.0"); // check dependency that has transitive dependencies support.DependOn("test", "transdep", "1.0"); deps = support.ResolveDependencies(false); Assert.NotNull(deps); // 1 is the previous test, then 2 for transdep and subdep. Assert.True(deps.Count == 3); Dependency d = deps["test:artifact"]; Assert.True(d.BestVersion == "8.1.0"); d = deps["test:transdep"]; Assert.AreEqual(d.BestVersion, "1.0.0"); d = deps["test:subdep"]; Assert.True(d.BestVersion == "0.9"); // check constraining down to a later version - the LATEST // will make this fail. support.DependOn("test", "artifact", "7.0.0"); ResolutionException ex = null; try { deps = support.ResolveDependencies(false); } catch (ResolutionException e) { ex = e; } Assert.NotNull(ex); // Now add it as 7+ and LATEST and it will work. support.ResetDependencies(); support.DependOn("test", "artifact", "LATEST"); support.DependOn("test", "artifact", "7+"); deps = support.ResolveDependencies(false); Assert.NotNull(deps); d = deps["test:artifact"]; Assert.True(d.BestVersion == "8.1.0"); // Test downversioning. support.ResetDependencies(); support.DependOn("test", "artifact", "1+"); support.DependOn("test", "artifact", "2+"); support.DependOn("test", "artifact", "7.0.0"); deps = support.ResolveDependencies(false); Assert.NotNull(deps); d = deps["test:artifact"]; Assert.True(d.BestVersion == "7.0.0"); // test the transitive dep influencing a top level support.ResetDependencies(); support.DependOn("test", "artifact", "1+"); support.DependOn("test", "subdep", "0+"); support.DependOn("test", "transdep", "LATEST"); deps = support.ResolveDependencies(false); Assert.NotNull(deps); d = deps["test:artifact"]; Assert.True(d.BestVersion == "8.1.0"); d = deps["test:subdep"]; Assert.True(d.BestVersion == "0.9"); }