From add3cfc891954b586ec893d8003fb4913e6fcaf6 Mon Sep 17 00:00:00 2001 From: Ram Parameswaran Date: Fri, 7 Oct 2016 21:15:13 -0700 Subject: [PATCH] Version 3.1.0 of the Google Mobile Ads Unity Plugin --- ChangeLog.txt | 11 + build.gradle | 41 +- .../Scripts/GoogleMobileAdsDemoScript.cs | 6 +- source/android-library/app/build.gradle | 4 +- .../google/unity/ads/RewardBasedVideo.java | 5 +- source/android-library/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- .../Assets/GoogleMobileAds/Api/AdRequest.cs | 2 +- .../Editor/AdMobDependencies.cs | 88 +++ .../Editor/AdMobDependencies.cs.meta | 0 .../GoogleMobileAds/Editor/CocoaPodHelper.cs | 84 --- .../Editor/CocoaPodHelper.cs.meta | 12 - .../Assets/GoogleMobileAds/Editor/Podfile | 5 - .../GoogleMobileAds/Editor/Podfile.meta | 8 - .../GoogleMobileAds/Editor/PostProcessor.cs | 81 -- .../Editor/PostProcessor.cs.meta | 12 - .../Editor/AdMobDependencies.cs | 23 - .../Editor/CommandLine.cs | 601 --------------- .../Editor/CommandLine.cs.meta | 12 - .../Editor/CommandLineDialog.cs | 243 ------ .../Editor/CommandLineDialog.cs.meta | 12 - .../Editor/DefaultResolver.cs | 363 --------- .../Editor/DefaultResolver.cs.meta | 12 - .../PlayServicesResolver/Editor/IResolver.cs | 90 --- .../Editor/IResolver.cs.meta | 12 - .../Editor/JarResolverLib.dll | Bin 19456 -> 0 bytes .../Editor/JarResolverLib.dll.meta | 20 - .../Editor/PlayServicesResolver.cs | 268 ------- .../Editor/PlayServicesResolver.cs.meta | 12 - .../Editor/ResolverVer1_1.cs | 692 ------------------ .../Editor/ResolverVer1_1.cs.meta | 12 - .../Editor/ResolverVer1_2.cs | 64 -- .../Editor/ResolverVer1_2.cs.meta | 12 - .../Editor/SampleDependencies.cs | 57 -- .../Editor/SampleDependencies.cs.meta | 12 - .../Editor/SettingsDialog.cs | 73 -- .../Editor/SettingsDialog.cs.meta | 12 - .../Editor/TextAreaDialog.cs | 160 ---- .../Editor/TextAreaDialog.cs.meta | 12 - 39 files changed, 147 insertions(+), 2992 deletions(-) create mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs rename source/plugin/Assets/{PlayServicesResolver => GoogleMobileAds}/Editor/AdMobDependencies.cs.meta (100%) delete mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs delete mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs.meta delete mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/Podfile delete mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/Podfile.meta delete mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs delete mode 100644 source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/CommandLine.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/CommandLine.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/CommandLineDialog.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/CommandLineDialog.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/DefaultResolver.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/DefaultResolver.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/IResolver.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/IResolver.cs.meta delete mode 100755 source/plugin/Assets/PlayServicesResolver/Editor/JarResolverLib.dll delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/JarResolverLib.dll.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_1.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_1.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/SettingsDialog.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/SettingsDialog.cs.meta delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/TextAreaDialog.cs delete mode 100644 source/plugin/Assets/PlayServicesResolver/Editor/TextAreaDialog.cs.meta diff --git a/ChangeLog.txt b/ChangeLog.txt index 0be89ff28..6916cc3f5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,5 +1,16 @@ Google Mobile Ads Unity Plugin Change Log +************* +Version 3.1.0 +************* +- Integrate plugin with play-services-resolver-1.2.1.0. +- Removal of CocoaPods integration. + +Built and tested with: +- Google Play services 9.6.0 +- Google Mobile Ads iOS SDK 7.12.0 +- Unity Jar Resolver 1.2.1.0 + ************* Version 3.0.7 ************* diff --git a/build.gradle b/build.gradle index d2ce10cf5..953fedcca 100644 --- a/build.gradle +++ b/build.gradle @@ -18,10 +18,17 @@ project.ext { if (unity_exe == null || unity_exe.isEmpty()) { unity_exe ='/Applications/Unity/Unity.app/Contents/MacOS/Unity' } + resolverPackageUri = System.getProperty("RESOLVER_PACKAGE_URI") + if (resolverPackageUri == null) { + resolverPackageUri = ( + 'https://github.com/googlesamples/unity-jar-resolver/raw/master/' + + 'play-services-resolver-1.2.1.0.unitypackage') + } pluginSource = file('source/plugin').absolutePath pluginBuildDir = file('temp/plugin-build-dir').absolutePath buildPath = file('temp').absolutePath exportPath = file('GoogleMobileAds.unitypackage').absolutePath + resolverPath = file('play-services-resolver.unitypackage').absolutePath } // Delete existing android plugin jar file. @@ -45,6 +52,21 @@ task copyAndroidLibraryJar(type: Copy) { copyAndroidLibraryJar.dependsOn(clearJar, buildAndroidPluginJar) +task downloadResolver() { + description = "Download the Play Services Resolver" + doLast { + def resolver = new File("${resolverPath}") + if (!resolver.exists()) { + new URL("${resolverPackageUri}").withInputStream{ + inputStream -> resolver.withOutputStream{ it << inputStream }} + } + } +} + +task deleteResolver(type: Delete) { + delete { "${resolverPath}" } +} + // Build unity package using through command line interface. // Create new unity project with files in temporary build directory and export files within Assets/GoogleMobileAds // to a unity package. @@ -54,7 +76,17 @@ task exportPackage() { doLast { exec { executable "${unity_exe}" - args "-g.building", "-batchmode", "-projectPath", "${pluginBuildDir}", "-logFile", "temp/unity.log", "-exportPackage", "Assets/GoogleMobileAds", "Assets/Plugins", "Assets/PlayServicesResolver", "${exportPath}", "-quit" + args "-g.building", + "-batchmode", + "-projectPath", "${pluginBuildDir}", + "-logFile", "temp/unity.log", + "-importPackage", "${resolverPath}", + "-exportPackage", + "Assets/GoogleMobileAds", + "Assets/Plugins", + "Assets/PlayServicesResolver", + "${exportPath}", + "-quit" } } } @@ -65,8 +97,9 @@ task createTempBuildFolder(type: Copy) { } task clearTempBuildFolder(type:Delete) { - delete {"${buildPath}"} + delete {"${buildPath}"} } -exportPackage.dependsOn(createTempBuildFolder, copyAndroidLibraryJar) -exportPackage.finalizedBy(clearTempBuildFolder) +exportPackage.dependsOn(createTempBuildFolder, copyAndroidLibraryJar, + downloadResolver) +exportPackage.finalizedBy(clearTempBuildFolder, deleteResolver) diff --git a/samples/HelloWorld/Assets/Scripts/GoogleMobileAdsDemoScript.cs b/samples/HelloWorld/Assets/Scripts/GoogleMobileAdsDemoScript.cs index e30ea46e5..14a8d24c3 100644 --- a/samples/HelloWorld/Assets/Scripts/GoogleMobileAdsDemoScript.cs +++ b/samples/HelloWorld/Assets/Scripts/GoogleMobileAdsDemoScript.cs @@ -293,9 +293,9 @@ private void RequestRewardBasedVideo() #if UNITY_EDITOR string adUnitId = "unused"; #elif UNITY_ANDROID - string adUnitId = "ca-app-pub-3940256099942544/6905715713"; + string adUnitId = "INSERT_AD_UNIT_HERE"; #elif UNITY_IPHONE - string adUnitId = "ca-app-pub-3940256099942544/9998782919"; + string adUnitId = "INSERT_AD_UNIT_HERE"; #else string adUnitId = "unexpected_platform"; #endif @@ -458,4 +458,4 @@ public void HandleRewardBasedVideoLeftApplication(object sender, EventArgs args) } #endregion -} \ No newline at end of file +} diff --git a/source/android-library/app/build.gradle b/source/android-library/app/build.gradle index a9eaa1736..1857e0984 100644 --- a/source/android-library/app/build.gradle +++ b/source/android-library/app/build.gradle @@ -24,8 +24,8 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:24.2.0' - compile 'com.google.android.gms:play-services:9.4.0' + compile 'com.android.support:appcompat-v7:24.2.1' + compile 'com.google.android.gms:play-services:9.6.0' } task clearJar(type: Delete) { diff --git a/source/android-library/app/src/main/java/com/google/unity/ads/RewardBasedVideo.java b/source/android-library/app/src/main/java/com/google/unity/ads/RewardBasedVideo.java index 615549fe0..0df6e15d7 100644 --- a/source/android-library/app/src/main/java/com/google/unity/ads/RewardBasedVideo.java +++ b/source/android-library/app/src/main/java/com/google/unity/ads/RewardBasedVideo.java @@ -49,8 +49,6 @@ public class RewardBasedVideo { */ private boolean isLoaded; - private final Object mLock = new Object(); - public RewardBasedVideo(Activity activity, UnityRewardBasedVideoAdListener adListener) { this.activity = activity; this.adListener = adListener; @@ -149,7 +147,8 @@ public void run() { * Destroys the {@link RewardedVideoAd}. */ public void destroy() { - rewardBasedVideo.destroy(); + // Currently there is no destroy() method for the RewardedVideoAd class. This method is a + // placeholder in case there is any cleanup to do here in the future. } } diff --git a/source/android-library/build.gradle b/source/android-library/build.gradle index 1b7886d14..b1932998a 100644 --- a/source/android-library/build.gradle +++ b/source/android-library/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.3.0' + classpath 'com.android.tools.build:gradle:2.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/source/android-library/gradle/wrapper/gradle-wrapper.properties b/source/android-library/gradle/wrapper/gradle-wrapper.properties index 4835653de..41f4c5d51 100644 --- a/source/android-library/gradle/wrapper/gradle-wrapper.properties +++ b/source/android-library/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Dec 18 19:33:03 EST 2015 +#Fri Sep 30 15:07:15 PDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs b/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs index ece866ff0..7070f9806 100644 --- a/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs +++ b/source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs @@ -20,7 +20,7 @@ namespace GoogleMobileAds.Api { public class AdRequest { - public const string Version = "3.0.7"; + public const string Version = "3.1.0"; public const string TestDeviceSimulator = "SIMULATOR"; public class Builder diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs b/source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs new file mode 100644 index 000000000..cc42e8b56 --- /dev/null +++ b/source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs @@ -0,0 +1,88 @@ +// Copyright (C) 2016 Google, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using UnityEditor; + +/// AdMob dependencies file. +[InitializeOnLoad] +public class AdMobDependencies : AssetPostprocessor +{ + /// Initializes static members of the class. + static AdMobDependencies() { SetupDeps(); } + + static void SetupDeps() { +#if UNITY_ANDROID + // Setup the resolver using reflection as the module may not be + // available at compile time. + Type playServicesSupport = Google.VersionHandler.FindClass( + "Google.JarResolver", "Google.JarResolver.PlayServicesSupport"); + if (playServicesSupport == null) { + return; + } + object svcSupport = Google.VersionHandler.InvokeStaticMethod( + playServicesSupport, "CreateInstance", + new object[] { + "AdMobUnity", + EditorPrefs.GetString("AndroidSdkRoot"), + "ProjectSettings" + }); + + Google.VersionHandler.InvokeInstanceMethod( + svcSupport, "DependOn", + new object[] { "com.google.android.gms", "play-services-ads", + "LATEST" }, + namedArgs: new Dictionary() { + {"packageIds", new string[] { + "extra-google-m2repository", + "extra-android-m2repository"} } + }); + + // Marshmallow permissions requires app-compat. + Google.VersionHandler.InvokeInstanceMethod( + svcSupport, "DependOn", + new object[] { "com.android.support", "appcompat-v7", "23.1.0+" }, + namedArgs: new Dictionary() { + {"packageIds", new string[] { "extra-android-m2repository" }}, + }); +#elif UNITY_IOS + Type iosResolver = Google.VersionHandler.FindClass( + "Google.IOSResolver", "Google.IOSResolver"); + if (iosResolver == null) { + return; + } + Google.VersionHandler.InvokeStaticMethod( + iosResolver, "AddPod", + new object[] { "Google-Mobile-Ads-SDK" }, + namedArgs: new Dictionary() { + { "version", "7.8+" } + }); +#endif // UNITY_IOS + } + + // Handle delayed loading of the dependency resolvers. + private static void OnPostprocessAllAssets( + string[] importedAssets, string[] deletedAssets, + string[] movedAssets, string[] movedFromPath) { + foreach (string asset in importedAssets) { + if (asset.Contains("IOSResolver") || + asset.Contains("JarResolver")) { + SetupDeps(); + break; + } + } + } +} + diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs.meta b/source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs.meta similarity index 100% rename from source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs.meta rename to source/plugin/Assets/GoogleMobileAds/Editor/AdMobDependencies.cs.meta diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs b/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs deleted file mode 100644 index 6127e77d8..000000000 --- a/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; - -namespace GoogleMobileAds -{ - public class CocoaPodHelper - { - public static string Update(string projDir) - { - if (!Directory.Exists(projDir)) - { - throw new Exception("project not found: " + projDir); - } - - string podPath = ExecuteCommand("which", "pod", null); - if (podPath.Equals("")) - { - throw new Exception("pod executable not found"); - } - return ExecuteCommand(podPath.Trim(), "update", projDir); - } - - private static string ExecuteCommand(string command, string argument, string workingDir) - { - using (var process = new Process()) - { - if (!process.StartInfo.EnvironmentVariables.ContainsKey("LANG")) - { - process.StartInfo.EnvironmentVariables.Add("LANG", "en_US.UTF-8"); - } - - string path = process.StartInfo.EnvironmentVariables["PATH"]; - if(!path.Contains("/usr/local/bin")) - { - path = path + ":/usr/local/bin"; - process.StartInfo.EnvironmentVariables.Remove("PATH"); - process.StartInfo.EnvironmentVariables.Add("PATH", path); - } - - if (workingDir != null) - { - process.StartInfo.WorkingDirectory = workingDir; - } - process.StartInfo.FileName = command; - process.StartInfo.Arguments = argument; - UnityEngine.Debug.Log("Executing " + command + " argument: " + - process.StartInfo.Arguments); - process.StartInfo.CreateNoWindow = true; - process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; - process.StartInfo.UseShellExecute = false; - process.StartInfo.RedirectStandardError = true; - process.StartInfo.RedirectStandardOutput = true; - - try - { - process.Start(); - process.StandardError.ReadToEnd(); - var stdOutput = process.StandardOutput.ReadToEnd(); - var stdError = process.StandardError.ReadToEnd(); - - UnityEngine.Debug.Log("command stdout: " + stdOutput); - - if (stdError != null && stdError.Length > 0) - { - UnityEngine.Debug.LogError("command stderr: " + stdError); - } - - if (!process.WaitForExit(10 * 1000)) - { - throw new Exception("command did not exit in a timely fashion"); - } - - return stdOutput; - - } - catch (Exception e) - { - throw new Exception("Encountered unexpected error while running pod", e); - } - } - } - } -} diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs.meta b/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs.meta deleted file mode 100644 index c7c4857d8..000000000 --- a/source/plugin/Assets/GoogleMobileAds/Editor/CocoaPodHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cfeac208a3724482086035106261688b -timeCreated: 1452108518 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/Podfile b/source/plugin/Assets/GoogleMobileAds/Editor/Podfile deleted file mode 100644 index 727a62f9b..000000000 --- a/source/plugin/Assets/GoogleMobileAds/Editor/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' - -target 'Unity-iPhone' do - pod 'Google-Mobile-Ads-SDK', '~> 7.8' -end diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/Podfile.meta b/source/plugin/Assets/GoogleMobileAds/Editor/Podfile.meta deleted file mode 100644 index 54f014eae..000000000 --- a/source/plugin/Assets/GoogleMobileAds/Editor/Podfile.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4509f285e81ca4b9dae8ca67fe5c9ec0 -timeCreated: 1452117117 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs b/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs deleted file mode 100644 index 04aae7d76..000000000 --- a/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using UnityEditor; -using UnityEditor.Callbacks; - -#if (UNITY_5 && UNITY_IOS) - using UnityEditor.iOS.Xcode; -#endif - -namespace GoogleMobileAds -{ - public class Postprocessor - { - [PostProcessBuildAttribute(1)] - public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) - { - BuildTarget iOSBuildTarget; - #if UNITY_5 - iOSBuildTarget = BuildTarget.iOS; - #else - iOSBuildTarget = BuildTarget.iPhone; - #endif - - if (target == iOSBuildTarget) - { - RunPodUpdate(pathToBuiltProject); - } - } - - public static void RunPodUpdate(string path) - { - #if !UNITY_CLOUD_BUILD - // Copy the podfile into the project. - string podfile = "Assets/GoogleMobileAds/Editor/Podfile"; - string destPodfile = path + "/Podfile"; - - if (!System.IO.File.Exists(podfile)) - { - UnityEngine.Debug.LogWarning(@"Could not locate Podfile in - Assets/GoogleMobileAds/Editor/"); - return; - } - - if (!System.IO.File.Exists(destPodfile)) - { - FileUtil.CopyFileOrDirectory(podfile, destPodfile); - } - else - { - FileUtil.ReplaceFile(podfile, destPodfile); - } - - try - { - CocoaPodHelper.Update(path); - } - catch (Exception e) - { - UnityEngine.Debug.LogWarning("Could not create a new Xcode project with " + - "CocoaPods: " + e.Message); - } - #endif - - #if (UNITY_5 && UNITY_IOS) - string pbxprojPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj"; - PBXProject project = new PBXProject(); - project.ReadFromString(File.ReadAllText(pbxprojPath)); - string target = project.TargetGuidByName("Unity-iPhone"); - - project.SetBuildProperty(target, "CLANG_ENABLE_MODULES", "YES"); - project.AddBuildProperty(target, "OTHER_LDFLAGS", "$(inherited)"); - - File.WriteAllText(pbxprojPath, project.WriteToString()); - #else - UnityEngine.Debug.Log("Unable to modify build settings in XCode project. Build " + - "settings must be set manually"); - #endif - } - } -} diff --git a/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs.meta b/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs.meta deleted file mode 100644 index 02f4fc0ce..000000000 --- a/source/plugin/Assets/GoogleMobileAds/Editor/PostProcessor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 02007caae92be4088b4adc1f155585fb -timeCreated: 1451944116 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs b/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs deleted file mode 100644 index b5e6b16d5..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/AdMobDependencies.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Google.JarResolver; -using UnityEditor; - -/// AdMob dependencies file. -[InitializeOnLoad] -public static class AdMobDependencies -{ - /// The name of the plugin. - private static readonly string PluginName = "AdMobUnity"; - - /// 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", "23.1.0+"); - } -} diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/CommandLine.cs b/source/plugin/Assets/PlayServicesResolver/Editor/CommandLine.cs deleted file mode 100644 index 496cce4a3..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/CommandLine.cs +++ /dev/null @@ -1,601 +0,0 @@ -// -// Copyright (C) 2016 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace GooglePlayServices -{ - using System.Collections.Generic; - using System.Diagnostics; - using System.IO; - using System.Text.RegularExpressions; - using System.Threading; - using System; -#if UNITY_EDITOR - using UnityEditor; -#endif // UNITY_EDITOR - - public static class CommandLine - { - /// - /// Result from Run(). - /// - public class Result - { - /// String containing the standard output stream of the tool. - public string stdout; - /// String containing the standard error stream of the tool. - public string stderr; - /// Exit code returned by the tool when execution is complete. - public int exitCode; - }; - - /// - /// Called when a RunAsync() completes. - /// - public delegate void CompletionHandler(Result result); - - /// - /// Text and byte representations of an array of data. - /// - public class StreamData - { - /// - /// Handle to the stream this was read from. - /// e.g 0 for stdout, 1 for stderr. - /// - public int handle = 0; - /// - /// Text representation of "data". - /// - public string text = ""; - /// - /// Array of bytes or "null" if no data is present. - /// - public byte[] data = null; - /// - /// Whether this marks the end of the stream. - /// - public bool end; - - /// - /// Initialize this instance. - /// - /// Stream identifier. - /// String - /// Bytes - /// Whether this is the end of the stream. - public StreamData(int handle, string text, byte[] data, bool end) - { - this.handle = handle; - this.text = text; - this.data = data; - this.end = end; - } - - /// - /// Get an empty StreamData instance. - /// - public static StreamData Empty - { - get { return new StreamData(0, "", null, false); } - } - } - - /// - /// Called when data is received from either the standard output or standard error - /// streams with a reference to the current standard input stream to enable simulated - /// interactive input. - /// - /// Executing process. - /// Standard input stream. - /// Data read from the standard output or error streams. - public delegate void IOHandler(Process process, StreamWriter stdin, StreamData streamData); - - /// - /// Asynchronously execute a command line tool, calling the specified delegate on - /// completion. - /// - /// Tool to execute. - /// String to pass to the tools' command line. - /// Called when the tool completes. - /// Directory to execute the tool from. - /// Additional environment variables to set for the command. - /// Allows a caller to provide interactive input and also handle - /// both output and error streams from a single delegate. - public static void RunAsync( - string toolPath, string arguments, CompletionHandler completionDelegate, - string workingDirectory = null, - Dictionary envVars = null, - IOHandler ioHandler = null) - { - Thread thread = new Thread(new ThreadStart(() => { - Result result = Run(toolPath, arguments, workingDirectory, envVars: envVars, - ioHandler: ioHandler); - completionDelegate(result); - })); - thread.Start(); - } - - /// - /// Asynchronously reads binary data from a stream using a configurable buffer. - /// - private class AsyncStreamReader - { - /// - /// Delegate called when data is read from the stream. - /// Data read from the stream. - /// - public delegate void Handler(StreamData streamData); - /// - /// Event which is signalled when data is received. - /// - public event Handler DataReceived; - - // Signalled when a read completes. - private AutoResetEvent readEvent = null; - // Handle to the stream. - private int handle; - // Stream to read. - private Stream stream; - // Buffer used to read data from the stream. - private byte[] buffer; - // Whether reading is complete. - volatile bool complete = false; - - /// - /// Initialize the reader. - /// - /// Stream to read. - /// Size of the buffer to read. - public AsyncStreamReader(int handle, Stream stream, int bufferSize) - { - readEvent = new AutoResetEvent(false); - this.handle = handle; - this.stream = stream; - buffer = new byte[bufferSize]; - } - - /// - /// Get the handle of the stream associated with this reader. - /// - public int Handle - { - get - { - return handle; - } - } - - - /// - /// Start reading. - /// - public void Start() - { - if (!complete) (new Thread(new ThreadStart(Read))).Start(); - } - - /// - /// Read from the stream until the end is reached. - /// - private void Read() - { - while (!complete) - { - stream.BeginRead( - buffer, 0, buffer.Length, (asyncResult) => { - int bytesRead = stream.EndRead(asyncResult); - if (!complete) - { - complete = bytesRead == 0; - if (DataReceived != null) - { - byte[] copy = new byte[bytesRead]; - Array.Copy(buffer, copy, copy.Length); - DataReceived(new StreamData( - handle, System.Text.Encoding.UTF8.GetString(copy), copy, - complete)); - } - } - readEvent.Set(); - }, null); - readEvent.WaitOne(); - } - } - - /// - /// Create a set of readers to read the specified streams, handles are assigned - /// based upon the index of each stream in the provided array. - /// - /// Streams to read. - /// Size of the buffer to use to read each stream. - public static AsyncStreamReader[] CreateFromStreams(Stream[] streams, int bufferSize) - { - AsyncStreamReader[] readers = new AsyncStreamReader[streams.Length]; - for (int i = 0; i < streams.Length; i++) - { - readers[i] = new AsyncStreamReader(i, streams[i], bufferSize); - } - return readers; - } - } - - /// - /// Multiplexes data read from multiple AsyncStreamReaders onto a single thread. - /// - private class AsyncStreamReaderMultiplexer - { - /// Used to wait on items in the queue. - private AutoResetEvent queuedItem = null; - /// Queue of Data read from the readers. - private System.Collections.Queue queue = null; - /// Active stream handles. - private HashSet activeStreams; - - /// - /// Called when all streams reach the end or the reader is shut down. - /// - public delegate void CompletionHandler(); - - - /// - /// Called when all streams reach the end or the reader is shut down. - /// - public event CompletionHandler Complete; - - /// - /// Handler called from the multiplexer's thread. - /// - public event AsyncStreamReader.Handler DataReceived; - - /// - /// Create the multiplexer and attach it to the specified handler. - /// - /// Readers to read. - /// Called for queued data item. - /// Called when all readers complete. - public AsyncStreamReaderMultiplexer(AsyncStreamReader[] readers, - AsyncStreamReader.Handler handler, - CompletionHandler complete = null) - { - queuedItem = new AutoResetEvent(false); - queue = System.Collections.Queue.Synchronized(new System.Collections.Queue()); - activeStreams = new HashSet(); - foreach (AsyncStreamReader reader in readers) - { - reader.DataReceived += HandleRead; - activeStreams.Add(reader.Handle); - } - DataReceived += handler; - if (complete != null) Complete += complete; - (new Thread(new ThreadStart(PollQueue))).Start(); - } - - /// - /// Shutdown the multiplexer. - /// - public void Shutdown() - { - lock (activeStreams) - { - activeStreams.Clear(); - } - queuedItem.Set(); - } - - // Handle stream read notification. - private void HandleRead(StreamData streamData) - { - queue.Enqueue(streamData); - queuedItem.Set(); - } - - // Poll the queue. - private void PollQueue() - { - while (activeStreams.Count > 0) - { - queuedItem.WaitOne(); - while (queue.Count > 0) - { - StreamData data = (StreamData)queue.Dequeue(); - if (data.end) - { - lock(activeStreams) - { - activeStreams.Remove(data.handle); - } - } - if (DataReceived != null) DataReceived(data); - } - } - if (Complete != null) Complete(); - } - } - - /// - /// Aggregates lines read by AsyncStreamReader. - /// - public class LineReader - { - // List of data keyed by stream handle. - private Dictionary> streamDataByHandle = - new Dictionary>(); - - /// - /// Event called with a new line of data. - /// - public event IOHandler LineHandler; - - /// - /// Event called for each piece of data received. - /// - public event IOHandler DataHandler; - - /// - /// Initialize the instance. - /// - /// Called for each line read. - public LineReader(IOHandler handler = null) - { - if (handler != null) LineHandler += handler; - } - - /// - /// Retrieve the currently buffered set of data. - /// This allows the user to retrieve data before the end of a stream when - /// a newline isn't present. - /// - /// Handle of the stream to query. - /// List of data for the requested stream. - public List GetBufferedData(int handle) - { - List handleData; - return streamDataByHandle.TryGetValue(handle, out handleData) ? - new List(handleData) : new List(); - } - - /// - /// Flush the internal buffer. - /// - public void Flush() - { - foreach (List handleData in streamDataByHandle.Values) - { - handleData.Clear(); - } - } - - /// - /// Aggregate the specified list of StringBytes into a single structure. - /// - /// Stream handle. - /// Data to aggregate. - public static StreamData Aggregate(List dataStream) - { - // Build a list of strings up to the newline. - List stringList = new List(); - int byteArraySize = 0; - int handle = 0; - bool end = false; - foreach (StreamData sd in dataStream) - { - stringList.Add(sd.text); - byteArraySize += sd.data.Length; - handle = sd.handle; - end |= sd.end; - } - string concatenatedString = String.Join("", stringList.ToArray()); - - // Concatenate the list of bytes up to the StringBytes before the - // newline. - byte[] byteArray = new byte[byteArraySize]; - int byteArrayOffset = 0; - foreach (StreamData sd in dataStream) - { - Array.Copy(sd.data, 0, byteArray, byteArrayOffset, sd.data.Length); - byteArrayOffset += sd.data.Length; - } - return new StreamData(handle, concatenatedString, byteArray, end); - } - - /// - /// Delegate method which can be attached to AsyncStreamReader.DataReceived to - /// aggregate data until a new line is found before calling LineHandler. - /// - public void AggregateLine(Process process, StreamWriter stdin, StreamData data) - { - if (DataHandler != null) DataHandler(process, stdin, data); - bool linesProcessed = false; - - if (data.data != null) - { - // Simplify line tracking by converting linefeeds to newlines. - data.text = data.text.Replace("\r\n", "\n").Replace("\r", "\n"); - - List aggregateList = GetBufferedData(data.handle); - aggregateList.Add(data); - bool complete = false; - while (!complete) - { - List newAggregateList = new List(); - int textDataIndex = 0; - int aggregateListSize = aggregateList.Count; - complete = true; - - foreach (StreamData textData in aggregateList) - { - bool end = data.end && (++textDataIndex == aggregateListSize); - newAggregateList.Add(textData); - int newlineOffset = textData.text.Length; - if (!end) - { - newlineOffset = textData.text.IndexOf("\n"); - if (newlineOffset < 0) continue; - newAggregateList.Remove(textData); - } - - StreamData concatenated = Aggregate(newAggregateList); - - // Flush the aggregation list and store the overflow. - newAggregateList.Clear(); - if (!end) - { - // Add the remaining line to the concatenated data. - concatenated.text += textData.text.Substring(0, newlineOffset + 1); - // Save the line after the newline in the buffer. - newAggregateList.Add(new StreamData( - data.handle, textData.text.Substring(newlineOffset + 1), - textData.data, false)); - complete = false; - } - - // Report the data. - if (LineHandler != null) LineHandler(process, stdin, concatenated); - linesProcessed = true; - } - aggregateList = newAggregateList; - } - streamDataByHandle[data.handle] = aggregateList; - } - // If no lines were processed call the handle to allow it to look ahead. - if (!linesProcessed && LineHandler != null) - { - LineHandler(process, stdin, StreamData.Empty); - } - } - } - - /// - /// Execute a command line tool. - /// - /// Tool to execute. - /// String to pass to the tools' command line. - /// Directory to execute the tool from. - /// Additional environment variables to set for the command. - /// Allows a caller to provide interactive input and also handle - /// both output and error streams from a single delegate. - /// CommandLineTool result if successful, raises an exception if it's not - /// possible to execute the tool. - public static Result Run(string toolPath, string arguments, string workingDirectory = null, - Dictionary envVars = null, - IOHandler ioHandler = null) - { - System.Text.Encoding inputEncoding = Console.InputEncoding; - System.Text.Encoding outputEncoding = Console.OutputEncoding; - Console.InputEncoding = System.Text.Encoding.UTF8; - Console.OutputEncoding = System.Text.Encoding.UTF8; - - Process process = new Process(); - process.StartInfo.UseShellExecute = false; - process.StartInfo.Arguments = arguments; - process.StartInfo.CreateNoWindow = true; - process.StartInfo.RedirectStandardOutput = true; - process.StartInfo.RedirectStandardError = true; - if (envVars != null) - { - foreach (var env in envVars) - { - process.StartInfo.EnvironmentVariables[env.Key] = env.Value; - } - } - process.StartInfo.RedirectStandardInput = (ioHandler != null); - process.StartInfo.FileName = toolPath; - process.StartInfo.WorkingDirectory = workingDirectory ?? Environment.CurrentDirectory; - - process.Start(); - - // If an I/O handler was specified, call it with no data to provide a process and stdin - // handle before output data is sent to it. - if (ioHandler != null) ioHandler(process, process.StandardInput, StreamData.Empty); - - AutoResetEvent complete = new AutoResetEvent(false); - List[] stdouterr = new List[] { new List(), - new List() }; - // Read raw output from the process. - AsyncStreamReader[] readers = AsyncStreamReader.CreateFromStreams( - new Stream[] { process.StandardOutput.BaseStream, - process.StandardError.BaseStream }, 1); - new AsyncStreamReaderMultiplexer( - readers, - (StreamData data) => { - stdouterr[data.handle].Add(data.text); - if (ioHandler != null) ioHandler(process, process.StandardInput, data); - }, - complete: () => { complete.Set(); }); - foreach (AsyncStreamReader reader in readers) reader.Start(); - - process.WaitForExit(); - // Wait for the reading threads to complete. - complete.WaitOne(); - - Result result = new Result(); - result.stdout = String.Join("", stdouterr[0].ToArray()); - result.stderr = String.Join("", stdouterr[1].ToArray()); - result.exitCode = process.ExitCode; - Console.InputEncoding = inputEncoding; - Console.OutputEncoding = outputEncoding; - return result; - } - - /// - /// Split a string into lines using newline, carriage return or a combination of both. - /// - /// String to split into lines - public static string[] SplitLines(string multilineString) - { - return Regex.Split(multilineString, "\r\n|\r|\n"); - } - -#if UNITY_EDITOR - /// - /// Get an executable extension. - /// - /// Platform specific extension for executables. - public static string GetExecutableExtension() - { - return (UnityEngine.RuntimePlatform.WindowsEditor == - UnityEngine.Application.platform) ? ".exe" : ""; - } - - /// - /// Locate an executable in the system path. - /// - /// Executable name without a platform specific extension like - /// .exe - /// A string to the executable path if it's found, null otherwise. - public static string FindExecutable(string executable) - { - string which = (UnityEngine.RuntimePlatform.WindowsEditor == - UnityEngine.Application.platform) ? "where" : "which"; - try - { - Result result = Run(which, executable, Environment.CurrentDirectory); - if (result.exitCode == 0) - { - return SplitLines(result.stdout)[0]; - } - } - catch (Exception e) - { - UnityEngine.Debug.Log("'" + which + "' command is not on path. " + - "Unable to find executable '" + executable + - "' (" + e.ToString() + ")"); - } - return null; - } -#endif // UNITY_EDITOR - } -} diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/CommandLine.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/CommandLine.cs.meta deleted file mode 100644 index 24bdcdbbc..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/CommandLine.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 56c0a3ffa26444c1b013db051267714a -timeCreated: 1469662165 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/CommandLineDialog.cs b/source/plugin/Assets/PlayServicesResolver/Editor/CommandLineDialog.cs deleted file mode 100644 index 11f0287f7..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/CommandLineDialog.cs +++ /dev/null @@ -1,243 +0,0 @@ -// -// Copyright (C) 2016 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace GooglePlayServices -{ - using System.Collections.Generic; - using System.Collections; - using System.Diagnostics; - using System.IO; - using System; - using UnityEditor; - using UnityEngine; - - public class CommandLineDialog : TextAreaDialog - { - /// - /// Forwards the output of the currently executing command to a CommandLineDialog window. - /// - public class ProgressReporter : CommandLine.LineReader - { - /// - /// Used to scale the progress bar by the number of lines reported by the command - /// line tool. - /// - public int maxProgressLines; - - // Queue of command line output lines to send to the main / UI thread. - private System.Collections.Queue textQueue = null; - // Number of lines reported by the command line tool. - private volatile int linesReported; - // Command line tool result, set when command line execution is complete. - private volatile CommandLine.Result result = null; - - /// - /// Event called on the main / UI thread when the outstanding command line tool - /// completes. - /// - public event CommandLine.CompletionHandler Complete; - - /// - /// Construct a new reporter. - /// - public ProgressReporter(CommandLine.IOHandler handler = null) - { - textQueue = System.Collections.Queue.Synchronized(new System.Collections.Queue()); - maxProgressLines = 0; - linesReported = 0; - LineHandler += CommandLineIOHandler; - Complete = null; - } - - // Count the number of newlines and carriage returns in a string. - private int CountLines(string str) - { - return str.Split(new char[] { '\n', '\r' }).Length - 1; - } - - /// - /// Called from RunCommandLine() tool to report the output of the currently - /// executing commmand. - /// - /// Executing process. - /// Standard input stream. - /// Data read from the standard output or error streams. - private void CommandLineIOHandler(Process process, StreamWriter stdin, - CommandLine.StreamData data) - { - if (process.HasExited || data.data == null) return; - // Count lines in stdout. - if (data.handle == 0) linesReported += CountLines(data.text); - // Enqueue data for the text view. - textQueue.Enqueue(System.Text.Encoding.UTF8.GetString(data.data)); - } - - /// - /// Called when the currently executing command completes. - /// - public void CommandLineToolCompletion(CommandLine.Result result) - { - this.result = result; - } - - /// - /// Called from CommandLineDialog in the context of the main / UI thread. - /// - public void Update(CommandLineDialog window) - { - if (textQueue.Count > 0) - { - List textList = new List(); - while (textQueue.Count > 0) textList.Add((string)textQueue.Dequeue()); - string bodyText = window.bodyText + String.Join("", textList.ToArray()); - // Really weak handling of carriage returns. Truncates to the previous - // line for each newline detected. - while (true) - { - // Really weak handling carriage returns for progress style updates. - int carriageReturn = bodyText.LastIndexOf("\r"); - if (carriageReturn < 0 || bodyText.Substring(carriageReturn, 1) == "\n") - { - break; - } - string bodyTextHead = ""; - int previousNewline = bodyText.LastIndexOf("\n", carriageReturn, - carriageReturn); - if (previousNewline >= 0) - { - bodyTextHead = bodyText.Substring(0, previousNewline + 1); - } - bodyText = bodyTextHead + bodyText.Substring(carriageReturn + 1); - } - window.bodyText = bodyText; - if (window.autoScrollToBottom) - { - window.scrollPosition.y = Mathf.Infinity; - } - window.Repaint(); - } - if (maxProgressLines > 0) - { - window.progress = (float)linesReported / (float)maxProgressLines; - } - if (result != null) - { - window.progressTitle = ""; - if (Complete != null) - { - Complete(result); - Complete = null; - } - } - } - } - - public volatile float progress; - public string progressTitle; - public string progressSummary; - public volatile bool autoScrollToBottom; - - /// - /// Event delegate called from the Update() method of the window. - /// - public delegate void UpdateDelegate(CommandLineDialog window); - - public event UpdateDelegate UpdateEvent; - - private bool progressBarVisible; - - /// - /// Create a dialog box which can display command line output. - /// - /// Reference to the new window. - public static CommandLineDialog CreateCommandLineDialog(string title) - { - CommandLineDialog window = (CommandLineDialog)EditorWindow.GetWindow( - typeof(CommandLineDialog), true, title); - window.Initialize(); - return window; - } - - /// - /// Initialize all members of the window. - /// - public override void Initialize() - { - base.Initialize(); - progress = 0.0f; - progressTitle = ""; - progressSummary = ""; - UpdateEvent = null; - progressBarVisible = false; - autoScrollToBottom = false; - } - - /// - /// Asynchronously execute a command line tool in this window, showing progress - /// and finally calling the specified delegate on completion from the main / UI thread. - /// - /// Tool to execute. - /// String to pass to the tools' command line. - /// Called when the tool completes. - /// Directory to execute the tool from. - /// Allows a caller to provide interactive input and also handle - /// both output and error streams from a single delegate. - /// Specifies the number of lines output by the - /// command line that results in a 100% value on a progress bar. - /// Reference to the new window. - public void RunAsync( - string toolPath, string arguments, - CommandLine.CompletionHandler completionDelegate, - string workingDirectory = null, Dictionary envVars = null, - CommandLine.IOHandler ioHandler = null, int maxProgressLines = 0) - { - CommandLineDialog.ProgressReporter reporter = new CommandLineDialog.ProgressReporter(); - reporter.maxProgressLines = maxProgressLines; - // Call the reporter from the UI thread from this window. - UpdateEvent += reporter.Update; - // Connect the user's delegate to the reporter's completion method. - reporter.Complete += completionDelegate; - // Connect the caller's IoHandler delegate to the reporter. - reporter.DataHandler += ioHandler; - // Disconnect the reporter when the command completes. - CommandLine.CompletionHandler reporterUpdateDisable = - (CommandLine.Result unusedResult) => { this.UpdateEvent -= reporter.Update; }; - reporter.Complete += reporterUpdateDisable; - CommandLine.RunAsync(toolPath, arguments, reporter.CommandLineToolCompletion, - workingDirectory: workingDirectory, envVars: envVars, - ioHandler: reporter.AggregateLine); - } - - /// - /// Call the update event from the UI thread, optionally display / hide the progress bar. - /// - protected virtual void Update() - { - if (UpdateEvent != null) UpdateEvent(this); - if (progressTitle != "") - { - progressBarVisible = true; - EditorUtility.DisplayProgressBar(progressTitle, progressSummary, - progress); - } - else if (progressBarVisible) - { - progressBarVisible = false; - EditorUtility.ClearProgressBar(); - } - } - } -} diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/CommandLineDialog.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/CommandLineDialog.cs.meta deleted file mode 100644 index ae16ca7ed..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/CommandLineDialog.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 62db8ae41f7344bebae4c731ddab8d17 -timeCreated: 1469662167 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/DefaultResolver.cs b/source/plugin/Assets/PlayServicesResolver/Editor/DefaultResolver.cs deleted file mode 100644 index 7ed88f5d6..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/DefaultResolver.cs +++ /dev/null @@ -1,363 +0,0 @@ -// -// Copyright (C) 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#if UNITY_ANDROID -namespace GooglePlayServices -{ - using UnityEditor; - using Google.JarResolver; - using System.IO; - using UnityEngine; - using System; - using System.Collections.Generic; - - /// - /// Default resolver base class. - /// - /// This class contains the default implementation of the - /// standard methods used to resolve the play-services dependencies. - /// The intention is that common, stable methods are implemented here, and - /// subsequent versions of the resolver would extend this class to modify the - /// behavior. - /// - public abstract class DefaultResolver : IResolver - { - #region IResolver implementation - - /// - /// Version of the resolver - 1.0.0 - /// - public virtual int Version() - { - return MakeVersionNumber(1, 0, 0); - } - - /// - /// Enables automatic resolution. - /// - /// If set to true flag. - public virtual void SetAutomaticResolutionEnabled(bool flag) - { - EditorPrefs.GetBool("GooglePlayServices.AutoResolverEnabled", flag); - } - - /// - /// Returns true if automatic resolution is enabled. - /// - /// true, if resolution enabled was automaticed, false otherwise. - public virtual bool AutomaticResolutionEnabled() - { - return EditorPrefs.GetBool("GooglePlayServices.AutoResolverEnabled", - SupportsAarFiles); - } - - /// - /// Returns true if Android package installation is enabled. - /// - /// true, package installation is enabled, false otherwise. - /// - public virtual bool AndroidPackageInstallationEnabled() - { - return EditorPrefs.GetBool("GooglePlayServices.AndroidPackageInstallationEnabled", - true); - } - - /// - /// Checks based on the asset changes, if resolution should occur. - /// - /// - /// The resolution only happens if a script file (.cs, or .js) was imported - /// or if an Android plugin was deleted. This allows for changes to - /// assets that do not affect the dependencies to happen without processing. - /// This also avoids an infinite loop when a version of a dependency is - /// deleted during resolution. - /// - /// true, if auto resolution should happen, false otherwise. - /// Imported assets. - /// Deleted assets. - /// Moved assets. - /// Moved from asset paths. - public virtual bool ShouldAutoResolve( - string[] importedAssets, - string[] deletedAssets, - string[] movedAssets, - string[] movedFromAssetPaths) - { - if (AutomaticResolutionEnabled()) - { - // look for imported scripts - foreach (string s in importedAssets) - { - if (s.EndsWith(".cs") || s.EndsWith(".js")) - { - Debug.Log(s + " imported, resolving play-services"); - return true; - } - } - - // look for deleted android plugins - foreach (string s in deletedAssets) - { - if (s.StartsWith("Assets/Plugins/Android")) - { - Debug.Log(s + " deleted, resolving play-services"); - return true; - } - } - // don't resolve if assets are moved around. - } - return false; - } - - /// - /// Shows the settings dialog. - /// - public virtual void ShowSettingsDialog() - { - - SettingsDialog window = (SettingsDialog)EditorWindow.GetWindow( - typeof(SettingsDialog), true, "Play Services Resolver Settings"); - window.Initialize(); - window.Show(); - } - - /// - /// Does the resolution of the play-services aars. - /// - /// Svc support. - /// Destination directory. - /// Handle overwrite confirmation. - /// Delegate called when resolution is complete. - public virtual void DoResolution( - PlayServicesSupport svcSupport, string destinationDirectory, - PlayServicesSupport.OverwriteConfirmation handleOverwriteConfirmation, - System.Action resolutionComplete) - { - DoResolution(svcSupport, destinationDirectory, handleOverwriteConfirmation); - resolutionComplete(); - } - - /// - /// Called during Update to allow the resolver to check the bundle ID of the application - /// to see whether resolution should be triggered again. - /// - /// Array of packages that should be re-resolved if resolution should occur, - /// null otherwise. - public virtual string[] OnBundleId(string bundleId) - { - return null; - } - - #endregion - - /// - /// Compatibility method for synchronous implementations of DoResolution(). - /// - /// Svc support. - /// Destination directory. - /// Handle overwrite confirmation. - public abstract void DoResolution( - PlayServicesSupport svcSupport, string destinationDirectory, - PlayServicesSupport.OverwriteConfirmation handleOverwriteConfirmation); - - /// - /// Makes the version number. - /// - /// This combines the major/minor/point version components into - /// an integer. If multiple resolvers are registered, then the greatest version - /// is used. - /// - /// The version number. - /// Maj. - /// Minimum. - /// Point. - internal int MakeVersionNumber(int maj, int min, int pt) - { - return maj * 10000 + min + 100 + pt; - } - - /// - /// Gets a value indicating whether this version of Unity supports aar files. - /// - /// true if supports aar files; otherwise, false. - internal bool SupportsAarFiles - { - get - { - // Get the version number. - string majorVersion = Application.unityVersion.Split('.')[0]; - int ver; - if (!int.TryParse(majorVersion, out ver)) - { - #if UNITY_4 - ver = 4; - #else - ver = 5; - #endif - } - return ver >= 5; - } - } - - /// - /// Find a Java tool. - /// - /// Name of the tool to search for. - private string FindJavaTool(string javaTool) - { - string javaHome = Environment.GetEnvironmentVariable("JAVA_HOME"); - string toolPath; - if (javaHome != null) - { - toolPath = Path.Combine( - javaHome, Path.Combine( - "bin", javaTool + CommandLine.GetExecutableExtension())); - if (!File.Exists(toolPath)) - { - EditorUtility.DisplayDialog("Play Services Dependencies", - "JAVA_HOME environment references a directory (" + - javaHome + ") that does not contain " + javaTool + - " which is required to process Play Services " + - "dependencies.", "OK"); - throw new Exception("JAVA_HOME references incomplete Java distribution. " + - javaTool + " not found."); - } - } else { - toolPath = CommandLine.FindExecutable(javaTool); - if (!File.Exists(toolPath)) - { - EditorUtility.DisplayDialog("Play Services Dependencies", - "Unable to find " + javaTool + " in the system " + - "path. This tool is required to process Play " + - "Services dependencies. Either set JAVA_HOME " + - "or add " + javaTool + " to the PATH variable " + - "to resolve this error.", "OK"); - throw new Exception(javaTool + " not found."); - } - } - return toolPath; - } - - /// - /// Create a temporary directory. - /// - /// If temporary directory creation fails, return null. - public static string CreateTemporaryDirectory() - { - int retry = 100; - while (retry-- > 0) - { - string temporaryDirectory = Path.Combine(Path.GetTempPath(), - Path.GetRandomFileName()); - if (File.Exists(temporaryDirectory)) - { - continue; - } - Directory.CreateDirectory(temporaryDirectory); - return temporaryDirectory; - } - return null; - } - - // store the AndroidManifest.xml in a temporary directory before processing it. - /// - /// Extract an AAR to the specified directory. - /// - /// Name of the AAR file to extract. - /// List of files to extract from the AAR. If this array - /// is empty or null all files are extracted. - /// Directory to extract the AAR file to. - /// true if successful, false otherwise. - internal virtual bool ExtractAar(string aarFile, string[] extractFilenames, - string outputDirectory) - { - try - { - string aarPath = Path.GetFullPath(aarFile); - string extractFilesArg = extractFilenames != null && extractFilenames.Length > 0 ? - " \"" + String.Join("\" \"", extractFilenames) + "\"" : ""; - CommandLine.Result result = CommandLine.Run(FindJavaTool("jar"), - "xvf " + "\"" + aarPath + "\"" + - extractFilesArg, - workingDirectory: outputDirectory); - if (result.exitCode != 0) - { - Debug.LogError("Error expanding " + aarPath + " err: " + - result.exitCode + ": " + result.stderr); - return false; - } - } - catch (Exception e) - { - Debug.Log(e); - throw e; - } - return true; - } - - /// - /// Explodes a single aar file. This is done by calling the - /// JDK "jar" command, then moving the classes.jar file. - /// - /// the parent directory of the plugin. - /// Aar file to explode. - /// The path to the exploded aar. - internal virtual string ProcessAar(string dir, string aarFile) - { - string workingDir = Path.Combine(dir, Path.GetFileNameWithoutExtension(aarFile)); - Directory.CreateDirectory(workingDir); - if (!ExtractAar(aarFile, null, workingDir)) return workingDir; - - // move the classes.jar file to libs. - string libDir = Path.Combine(workingDir, "libs"); - if (!Directory.Exists(libDir)) - { - Directory.CreateDirectory(libDir); - } - if (File.Exists(Path.Combine(libDir, "classes.jar"))) - { - File.Delete(Path.Combine(libDir, "classes.jar")); - } - if (File.Exists(Path.Combine(workingDir, "classes.jar"))) - { - File.Move(Path.Combine(workingDir, "classes.jar"), - Path.Combine(libDir, "classes.jar")); - } - - // Create the project.properties file which indicates to - // Unity that this directory is a plugin. - if (!File.Exists(Path.Combine(workingDir, "project.properties"))) - { - // write out project.properties - string[] props = - { - "# Project target.", - "target=android-9", - "android.library=true" - }; - - File.WriteAllLines(Path.Combine(workingDir, "project.properties"), - props); - } - - // Clean up the aar file. - File.Delete(Path.GetFullPath(aarFile)); - Debug.Log(aarFile + " expanded successfully"); - return workingDir; - } - } -} -#endif diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/DefaultResolver.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/DefaultResolver.cs.meta deleted file mode 100644 index 166135db0..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/DefaultResolver.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0da7d735c3c5c4e2daeb7e6fbf781ec7 -timeCreated: 1454690833 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/IResolver.cs b/source/plugin/Assets/PlayServicesResolver/Editor/IResolver.cs deleted file mode 100644 index ae58e08a8..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/IResolver.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Copyright (C) 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#if UNITY_ANDROID - -namespace GooglePlayServices -{ - using Google.JarResolver; - - public interface IResolver - { - /// - /// Version of the resolver. - /// - /// - /// The resolver with the greatest version is used when resolving. - /// The value of the verison is calcuated using MakeVersion in DefaultResolver - /// - /// - int Version(); - - /// - /// Returns true if automatic resolution is enabled. - /// - /// true, if resolution is enabled false otherwise. - bool AutomaticResolutionEnabled(); - - /// - /// Sets the automatic resolution flag. - /// - /// If set to true flag. - void SetAutomaticResolutionEnabled(bool flag); - - /// - /// Checks based on the asset changes, if resolution should occur. - /// - /// - /// Resolution should only happen when needed, and avoid infinite loops - /// of automatic resolution triggered by resolution actions. - /// - /// true, if auto resolution should happen, false otherwise. - /// - /// Imported assets. - /// Deleted assets. - /// Moved assets. - /// Moved from asset paths. - bool ShouldAutoResolve(string[] importedAssets, - string[] deletedAssets, - string[] movedAssets, - string[] movedFromAssetPaths); - - /// - /// Shows the settings dialog. - /// - void ShowSettingsDialog(); - - /// - /// Does the resolution of the play-services aars. - /// - /// Svc support. - /// Destination directory. - /// Handle overwrite confirmation. - /// Delegate called when resolution is complete. - void DoResolution(PlayServicesSupport svcSupport, - string destinationDirectory, - PlayServicesSupport.OverwriteConfirmation handleOverwriteConfirmation, - System.Action resolutionComplete); - - /// - /// Called during Update to allow the resolver to check the bundle ID of the application - /// to see whether resolution should be triggered again. - /// - /// Array of packages that should be re-resolved if resolution should occur, - /// null otherwise. - string[] OnBundleId(string bundleId); - } -} -#endif diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/IResolver.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/IResolver.cs.meta deleted file mode 100644 index e5887f368..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/IResolver.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b3af7b07b16d249738653c0811f4d6e8 -timeCreated: 1454633926 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/JarResolverLib.dll b/source/plugin/Assets/PlayServicesResolver/Editor/JarResolverLib.dll deleted file mode 100755 index 070b436d1c31b8d6d1b01d1e2799cdcaf43815bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19456 zcmeHvdwg8=b?3RynYkm4b!ViJjV*hO9}Ip7+dvozgDp$45tbiV!Zw7|j5XKtgwfpb zosqEs6VW{B1}LFTvA668oOF}WCA%phG|jth$cwaPH)&`CEm^uD`w3~&4cpz2*52@nDZk+LwzoSg zL(+SPiAFVpKA8A}1NGTnA$@sVixLf?#a6Am596M}Zx%o1E`yt{_(na8d>{(1kE4@m-H2bywUvlxn{#bA ztg6hLP8MaZBYJ5ikv0eG7q6r?=rkCj>(y@P?<7c>dKSA}rz@MhFrz*ub<)?Tm?QmeZb|!?%W-m|hV}OaNs!hvR>)%V_aMO0D81lY5i`HH_xo1Y{f;4ku@}5#!R%n=GCk+ZU7qa3|fYJi!K6`EBf8w$IOB<){Xx9 zTDR137e4@*2*a#DFf7Bss~QQ0!-h-ryIE6bvXEXYEuCOVZ2GLPrrgi!E%WKLyN+Y{ zEJ`KNY&%Hx^`gsQWuaBXDy<9A3b})>ZLr$xY$t$|gAOR&AdPif^g5a#2cDlf3{bB4 z3FcBY_%Ko@fO;xE0*(`p^sQFJn_31o8KK&Fp0!$cTkeBswEM>y*9a-`_&%te2>r+T zu2}4TfX!l6dRgydz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|W0sMGIuP;_#A4!L0)t5XOj$)B3@_>mD$A#EtPbFs`Ypln~ z7|GeE63N+5EKvsW6zhu_Y0m)nDK3SbI;u$86K0lRA$Vt#(kL-E<;Ql;mP8#I#nnrJ z%t(0xdpn~x4l$Wc8#dzIdlx<`X&F9_gC2H2=E9wQIg0leLTV|0d@`=54+Qzj?v|(j z<3|Jk&Z-uD_O9FZFS_cL`*~U-{@S{JUC-rAy*Bq=|Nle~;cgleO8oOtVQ5&RplWGu{pO9h@clfzCB`{XpmMH}=yQ z&Zqlv*w}~C2omAlsE+_{N13nBng4*#9{AmxMmyj2YMSA7?J@n1JhEUZ&m6OTs zNG~}V=hG~wl6wTQ8mT~;3pQd^4)+9G0Tu&fXCmd0j zW_>k7po%wU!dnH@)!~cBXYku9-*(k;_XD?iPGy{pptuRYw+QE4yAppn)a8?%a6C(_ zd0Z;BaCxIhmJc`0b9sPo)QbE+%fU4y^N*r`5||~CLbW&e3q!X_98jfU@wY3Yl~;Cub*qI1^(aN@W>1E-HW3_34eU8 zl)3qE?4xyBPX4VrVjO -// Copyright (C) 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#if UNITY_ANDROID -namespace GooglePlayServices -{ - using System; - using Google.JarResolver; - using UnityEditor; - using UnityEngine; - - /// - /// Play services resolver. This is a background post processor - /// that copies over the Google play services .aar files that - /// plugins have declared as dependencies. If the Unity version is less than - /// 5, aar files are not supported so this class 'explodes' the aar file into - /// a plugin directory. Once the version of Unity is upgraded, the exploded - /// files are removed in favor of the .aar files. - /// - [InitializeOnLoad] - public class PlayServicesResolver : AssetPostprocessor - { - /// - /// The instance to the play services support object. - /// - private static PlayServicesSupport svcSupport; - - /// - /// The resolver to use, injected to allow for version updating. - /// - private static IResolver _resolver; - - /// - /// Whether the resolver executed on the last Update() event. - /// This is used to de-duplicate resolutions when assets change *and* C# classes get - /// reloaded i.e The following occurs: - /// * Load classes - schedule resolve - /// * Update - Resolve - /// * OnPostprocessAllAssets - Resolve <= Prevents this case. - /// - private static bool resolvedOnUpdate = false; - - /// - /// Seconds to wait until re-resolving dependencies after the bundle ID has changed. - /// - private const int bundleUpdateDelaySeconds = 3; - - /// - /// Last time the bundle ID was checked. - /// - private static DateTime lastBundleIdPollTime = DateTime.Now; - - /// - /// Last bundle ID value. - /// - private static string lastBundleId = PlayerSettings.bundleIdentifier; - - /// - /// Last value of bundle ID since the last time OnBundleId() was called. - /// - private static string bundleId = ""; - - /// - /// Initializes the class. - /// - 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; - } - - /// - /// Registers the resolver. - /// - /// - /// The resolver with the greatest version number is retained - /// - /// The resolver. - /// Resolver impl. - public static IResolver RegisterResolver(IResolver resolverImpl) - { - if (resolverImpl == null) - { - return _resolver; - } - if (_resolver == null || _resolver.Version() < resolverImpl.Version()) - { - _resolver = resolverImpl; - } - Debug.Log("Resolver version is now: " + _resolver.Version()); - return _resolver; - } - - /// - /// Gets the resolver. - /// - /// The resolver. - public static IResolver Resolver - { - get - { - return _resolver; - } - } - - /// - /// Called by Unity when all assets have been updated. This - /// is used to kick off resolving the dependendencies declared. - /// - /// Imported assets. (unused) - /// Deleted assets. (unused) - /// Moved assets. (unused) - /// Moved from asset paths. (unused) - static void OnPostprocessAllAssets(string[] importedAssets, - string[] deletedAssets, - string[] movedAssets, - string[] movedFromAssetPaths) - { - if (Resolver.ShouldAutoResolve(importedAssets, deletedAssets, - movedAssets, movedFromAssetPaths) && !resolvedOnUpdate) - { - AutoResolve(); - } - } - - /// - /// Resolve dependencies if auto-resolution is enabled. - /// - private static void AutoResolve() - { - if (Resolver.AutomaticResolutionEnabled() && !resolvedOnUpdate) - { - // Prevent resolution on the call to OnPostprocessAllAssets(). - // This method is called on the next Update event then removed from the Update - // list. - resolvedOnUpdate = true; - Resolve(); - } - else - { - EditorApplication.update -= AutoResolve; - // Allow resolution on calls to OnPostprocessAllAssets(). - resolvedOnUpdate = false; - } - } - - /// - /// If the user changes the bundle ID, perform resolution again. - /// - private static void PollBundleId() - { - string currentBundleId = PlayerSettings.bundleIdentifier; - DateTime currentPollTime = DateTime.Now; - if (currentBundleId != bundleId) - { - // If the bundle ID setting hasn't changed for a while. - if (currentBundleId == lastBundleId) - { - if (currentPollTime.Subtract(lastBundleIdPollTime).Seconds >= - bundleUpdateDelaySeconds) - { - if (Resolver.AutomaticResolutionEnabled()) - { - bundleId = currentBundleId; - if (DeleteFiles(Resolver.OnBundleId(bundleId))) Resolve(); - } - } - } - else - { - lastBundleId = currentBundleId; - lastBundleIdPollTime = currentPollTime; - } - } - } - - /// - /// Delete the specified array of files and directories. - /// - /// Array of files or directories to delete. - /// true if files are deleted, false otherwise. - private static bool DeleteFiles(string[] filenames) - { - if (filenames == null) return false; - foreach (string artifact in filenames) - { - PlayServicesSupport.DeleteExistingFileOrDirectory(artifact); - } - AssetDatabase.Refresh(); - return true; - } - - /// - /// Resolve dependencies. - /// - /// Delegate called when resolution is complete. - private static void Resolve(System.Action resolutionComplete = null) - { - DeleteFiles(Resolver.OnBundleId(PlayerSettings.bundleIdentifier)); - Resolver.DoResolution(svcSupport, "Assets/Plugins/Android", - HandleOverwriteConfirmation, - () => { - AssetDatabase.Refresh(); - if (resolutionComplete != null) resolutionComplete(); - }); - } - - /// - /// Add a menu item for resolving the jars manually. - /// - [MenuItem("Assets/Google Play Services/Settings")] - public static void SettingsDialog() - { - Resolver.ShowSettingsDialog(); - } - - /// - /// Add a menu item for resolving the jars manually. - /// - [MenuItem("Assets/Google Play Services/Resolve Client Jars")] - public static void MenuResolve() - { - Resolve(() => { EditorUtility.DisplayDialog("Android Jar Dependencies", - "Resolution Complete", "OK"); }); - } - - /// - /// Handles the overwrite confirmation. - /// - /// true, if overwrite confirmation was handled, false otherwise. - /// Old dependency. - /// New dependency replacing old. - public static bool HandleOverwriteConfirmation(Dependency oldDep, Dependency newDep) - { - // Don't prompt overwriting the same version, just do it. - if (oldDep.BestVersion != newDep.BestVersion) - { - string msg = "Remove or replace " + oldDep.Artifact + " version " + - oldDep.BestVersion + " with version " + newDep.BestVersion + "?"; - return EditorUtility.DisplayDialog("Android Jar Dependencies", - msg, "OK", "Keep"); - } - return true; - } - } -} -#endif diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs.meta deleted file mode 100644 index 32306d6dc..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/PlayServicesResolver.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1d32a23dbd9d24dbb95a3e9cb04e7770 -timeCreated: 1448926551 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_1.cs b/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_1.cs deleted file mode 100644 index e9e92fa8c..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_1.cs +++ /dev/null @@ -1,692 +0,0 @@ -// -// Copyright (C) 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#if UNITY_ANDROID - -namespace GooglePlayServices -{ - using UnityEngine; - using UnityEditor; - using System.Collections.Generic; - using Google.JarResolver; - using System.Collections; - using System.IO; - using System.Text.RegularExpressions; - using System.Xml; - - [InitializeOnLoad] - public class ResolverVer1_1 : DefaultResolver - { - // Caches data associated with an aar so that it doesn't need to be queried to determine - // whether it should be expanded / exploded if it hasn't changed. - private class AarExplodeData - { - // Time the file was modified the last time it was inspected. - public System.DateTime modificationTime; - // Whether the AAR file should be expanded / exploded. - public bool explode = false; - // Project's bundle ID when this was expanded. - public string bundleId = ""; - // Path of the target AAR package. - public string path = ""; - } - - private Dictionary aarExplodeData = - new Dictionary(); - // File used to to serialize aarExplodeData. This is required as Unity will reload classes - // in the editor when C# files are modified. - private string aarExplodeDataFile = Path.Combine("ProjectSettings", - "GoogleAarExplodeCache.xml"); - - private const int MajorVersion = 1; - private const int MinorVersion = 1; - private const int PointVersion = 0; - - static ResolverVer1_1() - { - ResolverVer1_1 resolver = new ResolverVer1_1(); - resolver.LoadAarExplodeCache(); - PlayServicesResolver.RegisterResolver(resolver); - } - - /// - /// Load data cached in aarExplodeDataFile into aarExplodeData. - /// - private void LoadAarExplodeCache() - { - if (!File.Exists(aarExplodeDataFile)) return; - - XmlTextReader reader = new XmlTextReader(new StreamReader(aarExplodeDataFile)); - aarExplodeData.Clear(); - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element && reader.Name == "aars") - { - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element && reader.Name == "explodeData") - { - string aar = ""; - AarExplodeData aarData = new AarExplodeData(); - do - { - if (!reader.Read()) break; - if (reader.NodeType == XmlNodeType.Element) - { - string elementName = reader.Name; - if (reader.Read() && reader.NodeType == XmlNodeType.Text) - { - if (elementName == "aar") - { - aar = reader.ReadContentAsString(); - } - else if (elementName == "modificationTime") - { - aarData.modificationTime = - reader.ReadContentAsDateTime(); - } - else if (elementName == "explode") - { - aarData.explode = reader.ReadContentAsBoolean(); - } - else if (elementName == "bundleId") - { - aarData.bundleId = reader.ReadContentAsString(); - } - else if (elementName == "path") - { - aarData.path = reader.ReadContentAsString(); - } - } - } - } while (!(reader.Name == "explodeData" && - reader.NodeType == XmlNodeType.EndElement)); - if (aar != "") aarExplodeData[aar] = aarData; - } - } - } - } - } - - /// - /// Save data from aarExplodeData into aarExplodeDataFile. - /// - private void SaveAarExplodeCache() - { - if (File.Exists(aarExplodeDataFile)) - { - File.Delete(aarExplodeDataFile); - } - XmlTextWriter writer = new XmlTextWriter(new StreamWriter(aarExplodeDataFile)); - writer.WriteStartElement("aars"); - foreach (KeyValuePair kv in aarExplodeData) - { - writer.WriteStartElement("explodeData"); - writer.WriteStartElement("aar"); - writer.WriteValue(kv.Key); - writer.WriteEndElement(); - writer.WriteStartElement("modificationTime"); - writer.WriteValue(kv.Value.modificationTime); - writer.WriteEndElement(); - writer.WriteStartElement("explode"); - writer.WriteValue(kv.Value.explode); - writer.WriteEndElement(); - writer.WriteStartElement("bundleId"); - writer.WriteValue(PlayerSettings.bundleIdentifier); - writer.WriteEndElement(); - writer.WriteStartElement("path"); - writer.WriteValue(kv.Value.path); - writer.WriteEndElement(); - writer.WriteEndElement(); - } - writer.WriteEndElement(); - writer.Flush(); - writer.Close(); - } - - /// - /// Find a tool in the Android SDK. - /// - /// PlayServicesSupport instance used to retrieve the SDK - /// path. - /// Name of the tool to search for. - /// String with the path to the tool if found, null otherwise. - internal static string FindAndroidSdkTool(PlayServicesSupport svcSupport, string toolName) - { - string toolPath = null; - string sdkPath = svcSupport.SDK; - if (sdkPath == null || sdkPath == "") - { - Debug.LogWarning(PlayServicesSupport.AndroidSdkConfigurationError + - " Will fallback to searching for " + toolName + - " in the system path."); - } - else - { - toolPath = Path.Combine( - sdkPath, Path.Combine( - "tools", toolName + CommandLine.GetExecutableExtension())); - } - if (toolPath == null || !File.Exists(toolPath)) - { - toolPath = CommandLine.FindExecutable(toolName); - } - return toolPath; - } - - /// - /// Generate an array from a string collection. - /// - /// An array of strings. - private static string[] CollectionToArray(ICollection enumerator) - { - return (string[])(new ArrayList(enumerator)).ToArray(typeof(string)); - } - - /// - /// Delegate called when GetAvailablePackages() completes. - /// - internal delegate void GetAvailablePackagesComplete(Dictionary packages); - - // Answers Android SDK manager license questions. - private class LicenseResponder : CommandLine.LineReader - { - private const string Question = "Do you accept the license"; - - private string response; - - // Initialize the class to respond "yes" or "no" to license questions. - public LicenseResponder(bool accept) - { - LineHandler += CheckAndRespond; - response = accept ? "yes" : "no"; - } - - // Respond license questions with the "response". - public void CheckAndRespond(System.Diagnostics.Process process, StreamWriter stdin, - CommandLine.StreamData data) - { - if (process.HasExited) return; - if ((data.data != null && data.text.Contains(Question)) || - CommandLine.LineReader.Aggregate(GetBufferedData(0)).text.Contains(Question)) - { - Flush(); - // Ignore I/O exceptions as this could race with the process exiting. - try - { - foreach (byte b in System.Text.Encoding.UTF8.GetBytes( - response + System.Environment.NewLine)) - { - stdin.BaseStream.WriteByte(b); - } - stdin.BaseStream.Flush(); - } - catch (System.IO.IOException) - { - } - } - } - } - - /// - /// Get the set of available SDK packages and whether they're installed. - /// - /// Path to the Android SDK manager tool. - /// PlayServicesSupport instance used to retrieve the SDK - /// path. - /// Delegate called with a dictionary of package names and whether - /// they're installed or null if the Android SDK isn't configured correctly. - internal static void GetAvailablePackages( - string androidTool, PlayServicesSupport svcSupport, - GetAvailablePackagesComplete complete) - { - CommandLineDialog window = CommandLineDialog.CreateCommandLineDialog( - "Get Installed Android SDK packages."); - window.modal = false; - window.summaryText = "Getting list of installed Android packages."; - window.progressTitle = window.summaryText; - window.autoScrollToBottom = true; - window.RunAsync( - androidTool, "list sdk -u -e -a", - (result) => { - window.Close(); - if (result.exitCode != 0) - { - Debug.LogError("Unable to determine which Android packages are " + - "installed. Failed to run " + androidTool + ". " + - result.stderr + " (" + result.exitCode.ToString() + ")"); - complete(null); - return; - } - Dictionary packages = new Dictionary(); - string[] lines = Regex.Split(result.stdout, "\r\n|\r|\n"); - string packageIdentifier = null; - foreach (string line in lines) - { - // Find the start of a package description. - Match match = Regex.Match(line, "^id:\\W+\\d+\\W+or\\W+\"([^\"]+)\""); - if (match.Success) - { - packageIdentifier = match.Groups[1].Value; - packages[packageIdentifier] = false; - continue; - } - if (packageIdentifier == null) - { - continue; - } - // Parse the install path and record whether the package is installed. - match = Regex.Match(line, "^\\W+Install[^:]+:\\W+([^ ]+)"); - if (match.Success) - { - packages[packageIdentifier] = File.Exists( - Path.Combine(Path.Combine(svcSupport.SDK, match.Groups[1].Value), - "source.properties")); - packageIdentifier = null; - } - } - complete(packages); - }, - maxProgressLines: 50); - window.Show(); - } - - #region IResolver implementation - - /// - /// Version of the resolver. - 1.1.0 - /// - /// The resolver with the greatest version is used when resolving. - /// The value of the verison is calcuated using MakeVersion in DefaultResolver - /// - public override int Version() - { - return MakeVersionNumber(MajorVersion, MinorVersion, PointVersion); - } - - /// - /// Perform the resolution and the exploding/cleanup as needed. - /// - public override void DoResolution( - PlayServicesSupport svcSupport, string destinationDirectory, - PlayServicesSupport.OverwriteConfirmation handleOverwriteConfirmation, - System.Action resolutionComplete) - { - System.Action resolve = () => { - DoResolutionNoAndroidPackageChecks(svcSupport, destinationDirectory, - handleOverwriteConfirmation); - resolutionComplete(); - }; - - // Set of packages that need to be installed. - Dictionary installPackages = new Dictionary(); - // Retrieve the set of required packages and whether they're installed. - Dictionary> requiredPackages = - new Dictionary>(); - foreach (Dependency dependency in - svcSupport.LoadDependencies(true, keepMissing: true).Values) - { - if (dependency.PackageIds != null) - { - foreach (string packageId in dependency.PackageIds) - { - Dictionary dependencySet; - if (!requiredPackages.TryGetValue(packageId, out dependencySet)) - { - dependencySet = new Dictionary(); - } - dependencySet[dependency.Key] = false; - requiredPackages[packageId] = dependencySet; - // If the dependency is missing, add it to the set that needs to be - // installed. - if (System.String.IsNullOrEmpty(dependency.BestVersionPath)) - { - installPackages[packageId] = false; - } - } - } - } - - // If no packages need to be installed or Android SDK package installation is disabled. - if (installPackages.Count == 0 || !AndroidPackageInstallationEnabled()) - { - // Report missing packages as warnings and try to resolve anyway. - foreach (string pkg in requiredPackages.Keys) - { - string depString = System.String.Join( - ", ", CollectionToArray(requiredPackages[pkg].Keys)); - if (installPackages.ContainsKey(pkg) && depString.Length > 0) - { - Debug.LogWarning(pkg + " not installed or out of date! This is " + - "required by the following dependencies " + depString); - } - } - // Attempt resolution. - resolve(); - return; - } - - // Find the Android SDK manager. - string sdkPath = svcSupport.SDK; - string androidTool = FindAndroidSdkTool(svcSupport, "android"); - if (androidTool == null || sdkPath == null || sdkPath == "") - { - Debug.LogError("Unable to find the Android SDK manager tool. " + - "Required Android packages (" + - System.String.Join(", ", CollectionToArray(installPackages.Keys)) + - ") can not be installed. " + - PlayServicesSupport.AndroidSdkConfigurationError); - return; - } - - // Get the set of available and installed packages. - GetAvailablePackages( - androidTool, svcSupport, - (Dictionary packageInfo) => { - if (packageInfo == null) - { - return; - } - - // Filter the set of packages to install by what is available. - foreach (string pkg in requiredPackages.Keys) - { - bool installed = false; - string depString = System.String.Join( - ", ", CollectionToArray(requiredPackages[pkg].Keys)); - if (packageInfo.TryGetValue(pkg, out installed)) - { - if (!installed) - { - installPackages[pkg] = false; - Debug.LogWarning(pkg + " not installed or out of date! " + - "This is required by the following " + - "dependencies " + depString); - } - } - else - { - Debug.LogWarning(pkg + " referenced by " + depString + - " not available in the Android SDK. This " + - "package will not be installed."); - installPackages.Remove(pkg); - } - } - - if (installPackages.Count == 0) - { - resolve(); - return; - } - - // Start installation. - string installPackagesString = System.String.Join( - ",", CollectionToArray(installPackages.Keys)); - string packagesCommand = "update sdk -a -u -t " + installPackagesString; - CommandLineDialog window = CommandLineDialog.CreateCommandLineDialog( - "Install Android SDK packages"); - window.summaryText = "Retrieving licenses..."; - window.modal = false; - window.progressTitle = window.summaryText; - window.RunAsync( - androidTool, packagesCommand, - (CommandLine.Result getLicensesResult) => { - // Get the start of the license text. - int licenseTextStart = getLicensesResult.stdout.IndexOf("--------"); - if (getLicensesResult.exitCode != 0 || licenseTextStart < 0) - { - window.Close(); - Debug.LogError("Unable to retrieve licenses for packages " + - installPackagesString); - return; - } - - // Remove the download output from the string. - string licenseText = getLicensesResult.stdout.Substring( - licenseTextStart); - window.summaryText = ("License agreement(s) required to install " + - "Android SDK packages"); - window.bodyText = licenseText; - window.yesText = "agree"; - window.noText = "decline"; - window.result = false; - window.Repaint(); - window.buttonClicked = (TextAreaDialog dialog) => { - if (!dialog.result) - { - window.Close(); - return; - } - - window.summaryText = "Installing Android SDK packages..."; - window.bodyText = ""; - window.yesText = ""; - window.noText = ""; - window.buttonClicked = null; - window.progressTitle = window.summaryText; - window.autoScrollToBottom = true; - window.Repaint(); - // Kick off installation. - ((CommandLineDialog)window).RunAsync( - androidTool, packagesCommand, - (CommandLine.Result updateResult) => { - window.Close(); - if (updateResult.exitCode == 0) - { - resolve(); - } - else - { - Debug.LogError("Android SDK update failed. " + - updateResult.stderr + "(" + - updateResult.exitCode.ToString() + ")"); - } - }, - ioHandler: (new LicenseResponder(true)).AggregateLine, - maxProgressLines: 500); - }; - }, - ioHandler: (new LicenseResponder(false)).AggregateLine, - maxProgressLines: 250); - }); - } - - public override void DoResolution( - PlayServicesSupport svcSupport, string destinationDirectory, - PlayServicesSupport.OverwriteConfirmation handleOverwriteConfirmation) - { - DoResolution(svcSupport, destinationDirectory, handleOverwriteConfirmation, - () => {}); - } - - /// - /// Called during Update to allow the resolver to check the bundle ID of the application - /// to see whether resolution should be triggered again. - /// - /// Array of packages that should be re-resolved if resolution should occur, - /// null otherwise. - public override string[] OnBundleId(string bundleId) - { - // Determine which packages need to be updated. - List packagesToUpdate = new List(); - List aarsToResolve = new List(); - foreach (KeyValuePair kv in aarExplodeData) - { - if (kv.Value.explode && kv.Value.bundleId != bundleId && kv.Value.path != "") - { - packagesToUpdate.Add(kv.Value.path); - aarsToResolve.Add(kv.Key); - } - } - // Remove AARs that will be resolved from the dictionary so the next call to - // OnBundleId triggers another resolution process. - foreach (string aar in aarsToResolve) aarExplodeData.Remove(aar); - return packagesToUpdate.Count > 0 ? packagesToUpdate.ToArray() : null; - } - - #endregion - - /// - /// Perform resolution with no Android package dependency checks. - /// - private void DoResolutionNoAndroidPackageChecks( - PlayServicesSupport svcSupport, string destinationDirectory, - PlayServicesSupport.OverwriteConfirmation handleOverwriteConfirmation) - { - try - { - // Get the collection of dependencies that need to be copied. - Dictionary deps = - svcSupport.ResolveDependencies(true); - // Copy the list - svcSupport.CopyDependencies(deps, - destinationDirectory, - handleOverwriteConfirmation); - - } - catch (Google.JarResolver.ResolutionException e) - { - Debug.LogError(e.ToString()); - return; - } - - // we want to look at all the .aars to decide to explode or not. - // Some aars have variables in their AndroidManifest.xml file, - // e.g. ${applicationId}. Unity does not understand how to process - // these, so we handle it here. - ProcessAars(destinationDirectory); - - SaveAarExplodeCache(); - } - - /// - /// Processes the aars. - /// - /// Each aar copied is inspected and determined if it should be - /// exploded into a directory or not. Unneeded exploded directories are - /// removed. - /// - /// Exploding is needed if the version of Unity is old, or if the artifact - /// has been explicitly flagged for exploding. This allows the subsequent - /// processing of variables in the AndroidManifest.xml file which is not - /// supported by the current versions of the manifest merging process that - /// Unity uses. - /// - /// The directory to process. - void ProcessAars(string dir) - { - string[] files = Directory.GetFiles(dir, "*.aar"); - foreach (string f in files) - { - string dirPath = Path.Combine(dir, Path.GetFileNameWithoutExtension(f)); - string targetPath = Path.Combine(dir, Path.GetFileName(f)); - if (ShouldExplode(f)) - { - ReplaceVariables(ProcessAar(Path.GetFullPath(dir), f)); - targetPath = dirPath; - } - else - { - // Clean up previously expanded / exploded versions of the AAR. - if (Directory.Exists(dirPath)) - { - PlayServicesSupport.DeleteExistingFileOrDirectory(dirPath); - } - } - aarExplodeData[f].path = targetPath; - aarExplodeData[f].bundleId = PlayerSettings.bundleIdentifier; - } - } - - /// - /// Determined whether an aar file should be exploded (extracted). - /// - /// This is required for some aars so that the Unity Jar Resolver can perform variable - /// expansion on manifests in the package before they're merged by aapt. - /// - /// true, if the aar should be exploded, false otherwise. - /// The aar file. - internal virtual bool ShouldExplode(string aarFile) - { - AarExplodeData aarData = null; - if (!aarExplodeData.TryGetValue(aarFile, out aarData)) aarData = new AarExplodeData(); - bool explode = !SupportsAarFiles; - if (!explode) - { - System.DateTime modificationTime = File.GetLastWriteTime(aarFile); - if (modificationTime.CompareTo(aarData.modificationTime) <= 0) - { - explode = aarData.explode; - } - } - if (!explode) - { - string temporaryDirectory = CreateTemporaryDirectory(); - if (temporaryDirectory == null) return false; - string manifestFilename = "AndroidManifest.xml"; - try - { - if (ExtractAar(aarFile, new string[] {manifestFilename}, - temporaryDirectory)) - { - string manifestPath = Path.Combine(temporaryDirectory, - manifestFilename); - if (File.Exists(manifestPath)) - { - string manifest = File.ReadAllText(manifestPath); - explode = manifest.IndexOf("${applicationId}") >= 0; - } - aarData.modificationTime = File.GetLastWriteTime(aarFile); - } - } - catch (System.Exception e) - { - Debug.Log("Unable to examine AAR file " + aarFile + ", err: " + e); - throw e; - } - finally - { - PlayServicesSupport.DeleteExistingFileOrDirectory(temporaryDirectory); - } - } - aarData.explode = explode; - aarExplodeData[aarFile] = aarData; - return explode; - } - - /// - /// Replaces the variables in the AndroidManifest file. - /// - /// Exploded. - void ReplaceVariables(string exploded) - { - string manifest = Path.Combine(exploded, "AndroidManifest.xml"); - if (File.Exists(manifest)) - { - StreamReader sr = new StreamReader(manifest); - string body = sr.ReadToEnd(); - sr.Close(); - - body = body.Replace("${applicationId}", PlayerSettings.bundleIdentifier); - - using (var wr = new StreamWriter(manifest, false)) - { - wr.Write(body); - } - } - } - } -} -#endif diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_1.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_1.cs.meta deleted file mode 100644 index 4582720df..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_1.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 504a43783a32842d5938987de8331dff -timeCreated: 1454633908 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs b/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs deleted file mode 100644 index 829e26daf..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Copyright (C) 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#if UNITY_ANDROID - -namespace GooglePlayServices -{ - using UnityEngine; - using UnityEditor; - - [InitializeOnLoad] - public class ResolverVer1_2 : ResolverVer1_1 - { - - private const int MajorVersion = 1; - private const int MinorVersion = 2; - private const int PointVersion = 0; - - static ResolverVer1_2() - { - PlayServicesResolver.RegisterResolver(new ResolverVer1_2()); - Debug.Log("Registering resolver version " + MajorVersion + "." + - MinorVersion + "." + PointVersion); - PlayServicesResolver.RegisterResolver(new ResolverVer1_2()); - - } - /// - /// Version of the resolver. - /// - /// The resolver with the greatest version is used when resolving. - /// The value of the verison is calcuated using MakeVersion in DefaultResolver - /// - public override int Version() - { - return MakeVersionNumber(MajorVersion, MinorVersion, PointVersion); - } - - /// - /// Shoulds the explode the aar file. - /// - /// true, if explode was shoulded, false otherwise. - /// The aar file. - internal override bool ShouldExplode(string aarFile) - { - return base.ShouldExplode(aarFile) || - aarFile.Contains("firebase-common") || - aarFile.Contains("firebase-measurement") || - !SupportsAarFiles; - } - } -} -#endif \ No newline at end of file diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs.meta deleted file mode 100644 index 92bd1e5ec..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/ResolverVer1_2.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d0a531f52488040fcb06574d22589f60 -timeCreated: 1462986618 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs b/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs deleted file mode 100644 index f8b97b327..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright (C) 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -using Google.JarResolver; -using UnityEditor; - -/// -/// Sample dependencies file. Copy this to a different name specific to your -/// plugin and add the Google Play Services and Android Support components that -/// your plugin depends on. -/// -[InitializeOnLoad] -public static class SampleDependencies -{ - /// - /// The name of your plugin. This is used to create a settings file - /// which contains the dependencies specific to your plugin. - /// - -/* - private static readonly string PluginName = "your_plugin_name"; - public static PlayServicesSupport svcSupport; - - /// - /// Initializes static members of the class. - /// - static SampleDependencies() - { - - PlayServicesSupport svcSupport = PlayServicesSupport.CreateInstance( - PluginName, - EditorPrefs.GetString("AndroidSdkRoot"), - "ProjectSettings"); - RegisterDependencies(); - } - - public static void RegisterDependencies() - { - // add your dependencies here - - // svcSupport.DependOn("com.google.android.gms", "play-services-base", "8.1+"); - } -*/ -} diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs.meta deleted file mode 100644 index 2cb4cb87f..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/SampleDependencies.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f68b1911efe9d4dd596c12bf750c2bfe -timeCreated: 1448995461 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/SettingsDialog.cs b/source/plugin/Assets/PlayServicesResolver/Editor/SettingsDialog.cs deleted file mode 100644 index d3ae9b20d..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/SettingsDialog.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (C) 2015 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#if UNITY_ANDROID - -namespace GooglePlayServices -{ - using UnityEditor; - using UnityEngine; - - /// - /// Settings dialog for PlayServices Resolver. - /// - public class SettingsDialog : EditorWindow - { - - bool mEnableAutoResolution; - bool mInstallAndroidPackages; - - public void Initialize() - { - minSize = new Vector2(300, 200); - position = new Rect(UnityEngine.Screen.width / 3, UnityEngine.Screen.height / 3, - minSize.x, minSize.y); - } - - public void OnEnable() - { - mEnableAutoResolution = - EditorPrefs.GetBool("GooglePlayServices.AutoResolverEnabled", true); - mInstallAndroidPackages = - EditorPrefs.GetBool("GooglePlayServices.AndroidPackageInstallationEnabled", true); - } - - /// - /// Called when the GUI should be rendered. - /// - public void OnGUI() - { - GUI.skin.label.wordWrap = true; - GUILayout.BeginVertical(); - GUILayout.Label("Enable Background resolution", EditorStyles.boldLabel); - mEnableAutoResolution = EditorGUILayout.Toggle(mEnableAutoResolution); - GUILayout.Label("Install Android packages", EditorStyles.boldLabel); - mInstallAndroidPackages = EditorGUILayout.Toggle(mInstallAndroidPackages); - GUILayout.Space(10); - if (GUILayout.Button("OK")) - { - EditorPrefs.SetBool( - "GooglePlayServices.AutoResolverEnabled", - mEnableAutoResolution); - EditorPrefs.SetBool( - "GooglePlayServices.AndroidPackageInstallationEnabled", - mInstallAndroidPackages); - Close(); - } - GUILayout.EndVertical(); - } - } -} -#endif diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/SettingsDialog.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/SettingsDialog.cs.meta deleted file mode 100644 index 89ff71fb6..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/SettingsDialog.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f0112949d570044df9ffa48dbda06b11 -timeCreated: 1454701920 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/TextAreaDialog.cs b/source/plugin/Assets/PlayServicesResolver/Editor/TextAreaDialog.cs deleted file mode 100644 index 0bd31c058..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/TextAreaDialog.cs +++ /dev/null @@ -1,160 +0,0 @@ -// -// Copyright (C) 2016 Google Inc. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -namespace GooglePlayServices -{ - using UnityEditor; - using UnityEngine; - - /// - /// Window which displays a scrollable text area and two buttons at the bottom. - /// - public class TextAreaDialog : EditorWindow - { - /// - /// Delegate type, called when a button is clicked. - /// - public delegate void ButtonClicked(TextAreaDialog dialog); - - /// - /// Delegate called when a button is clicked. - /// - public ButtonClicked buttonClicked; - - /// - /// Whether this window should be modal. - /// NOTE: This emulates modal behavior by re-acquiring focus when it's lost. - /// - public bool modal = true; - - /// - /// Set the text to display in the summary area of the window. - /// - public string summaryText = ""; - - /// - /// Set the text to display on the "yes" (left-most) button. - /// - public string yesText = ""; - - /// - /// Set the text to display on the "no" (left-most) button. - /// - public string noText = ""; - - /// - /// Set the text to display in the scrollable text area. - /// - public string bodyText = ""; - - /// - /// Result of yes / no button press. true if the "yes" button was pressed, false if the - /// "no" button was pressed. Defaults to "false". - /// - public bool result = false; - - /// - /// Current position of the scrollbar. - /// - public Vector2 scrollPosition; - - /// - /// Get the existing text area window or create a new one. - /// - /// Title to display on the window. - /// Reference to this class - public static TextAreaDialog CreateTextAreaDialog(string title) - { - TextAreaDialog window = (TextAreaDialog)EditorWindow.GetWindow(typeof(TextAreaDialog), - true, title, true); - window.Initialize(); - return window; - } - - public virtual void Initialize() - { - yesText = ""; - noText = ""; - summaryText = ""; - bodyText = ""; - result = false; - scrollPosition = new Vector2(0, 0); - minSize = new Vector2(300, 200); - position = new Rect(UnityEngine.Screen.width / 3, UnityEngine.Screen.height / 3, - minSize.x * 2, minSize.y * 2); - } - - // Draw the GUI. - protected virtual void OnGUI() - { - GUILayout.BeginVertical(); - - GUILayout.Label(summaryText, EditorStyles.boldLabel); - - scrollPosition = GUILayout.BeginScrollView(scrollPosition); - // Unity text elements can only display up to a small X number of characters (rumors - // are ~65k) so generate a set of labels one for each subset of the text being - // displayed. - int bodyTextOffset = 0; - System.Collections.Generic.List bodyTextList = - new System.Collections.Generic.List(); - const int chunkSize = 5000; // Conservative chunk size < 65k characters. - while (bodyTextOffset < bodyText.Length) - { - int readSize = chunkSize; - readSize = bodyTextOffset + readSize >= bodyText.Length ? - bodyText.Length - bodyTextOffset : readSize; - bodyTextList.Add(bodyText.Substring(bodyTextOffset, readSize)); - bodyTextOffset += readSize; - } - foreach (string bodyTextChunk in bodyTextList) - { - GUILayout.Label(bodyTextChunk, EditorStyles.wordWrappedLabel); - } - GUILayout.EndScrollView(); - - bool yesPressed = false; - bool noPressed = false; - GUILayout.BeginHorizontal(); - if (yesText != "") yesPressed = GUILayout.Button(yesText); - if (noText != "") noPressed = GUILayout.Button(noText); - GUILayout.EndHorizontal(); - - GUILayout.EndVertical(); - - // If yes or no buttons were pressed, call the buttonClicked delegate. - if (yesPressed || noPressed) - { - if (yesPressed) - { - result = true; - } - else if (noPressed) - { - result = false; - } - if (buttonClicked != null) buttonClicked(this); - } - } - - // Optionally make the dialog modal. - protected virtual void OnLostFocus() - { - if (modal) Focus(); - } - } - -} diff --git a/source/plugin/Assets/PlayServicesResolver/Editor/TextAreaDialog.cs.meta b/source/plugin/Assets/PlayServicesResolver/Editor/TextAreaDialog.cs.meta deleted file mode 100644 index f1222a2c0..000000000 --- a/source/plugin/Assets/PlayServicesResolver/Editor/TextAreaDialog.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ce6f88420ce84faf94d3c6c6805ca8de -timeCreated: 1469662175 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: