From a08a6c17d9ca848201fd358b9323854cae99de39 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 18:30:58 +0000 Subject: [PATCH 1/6] feat: Copy analytics_win.dll for Windows Build and Play Mode This change addresses an issue where `analytics_win.dll` was not being included in Windows builds or available during Play Mode when the Firebase Analytics module was present. The following modifications were made: - Modified `editor/app/src/DllLocationPatcher.cs`: - Added logic to `OnPostProcessBuild` to copy `analytics_win.dll` from the project root to the build's plugin directory (`_Data/Plugins/`) when building for StandaloneWindows or StandaloneWindows64, but only if the Firebase Analytics module is detected and the DLL exists. - Created `editor/app/src/AnalyticsPlayModeSetup.cs`: - This new editor script subscribes to `EditorApplication.playModeStateChanged`. - When entering Play Mode on a Windows editor, it checks for the Firebase Analytics module and the existence of `analytics_win.dll` in the project root. - If both conditions are met, it copies `analytics_win.dll` to `Assets/Plugins/` to make it available during Play Mode. These changes ensure that `analytics_win.dll` is correctly placed for both Windows builds and Play Mode sessions, facilitating proper Firebase Analytics functionality on the Windows platform. --- editor/app/src/AnalyticsPlayModeSetup.cs | 43 ++++++++++++++++++++++++ editor/app/src/DllLocationPatcher.cs | 22 ++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 editor/app/src/AnalyticsPlayModeSetup.cs diff --git a/editor/app/src/AnalyticsPlayModeSetup.cs b/editor/app/src/AnalyticsPlayModeSetup.cs new file mode 100644 index 000000000..9573d425b --- /dev/null +++ b/editor/app/src/AnalyticsPlayModeSetup.cs @@ -0,0 +1,43 @@ +using System; +using System.IO; +using UnityEditor; +using UnityEngine; + +namespace Firebase.Editor { + +[InitializeOnLoad] +internal static class AnalyticsPlayModeSetup { + private const string SourceDllPath = "./analytics_win.dll"; + private const string DestinationDir = "Assets/Plugins/"; + private const string DestinationDllName = "analytics_win.dll"; + + static AnalyticsPlayModeSetup() { + EditorApplication.playModeStateChanged += OnPlayModeStateChanged; + } + + private static void OnPlayModeStateChanged(PlayModeStateChange state) { + if (state == PlayModeStateChange.EnteredPlayMode) { + if (Application.platform == RuntimePlatform.WindowsEditor) { + Type firebaseAnalyticsType = Type.GetType("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics"); + if (firebaseAnalyticsType != null) { + if (File.Exists(SourceDllPath)) { + try { + Directory.CreateDirectory(DestinationDir); + string destinationDllPath = Path.Combine(DestinationDir, DestinationDllName); + File.Copy(SourceDllPath, destinationDllPath, true); + Debug.Log("Firebase Analytics: Copied " + DestinationDllName + " to " + DestinationDir + " for Play Mode."); + AssetDatabase.Refresh(); + } catch (Exception e) { + Debug.LogError("Firebase Analytics: Error copying " + DestinationDllName + " for Play Mode: " + e.Message); + } + } else { + // Optional: Log if source DLL is not found, as it might be expected if Analytics is not used. + // Debug.LogWarning("Firebase Analytics: Source DLL " + SourceDllPath + " not found. Skipping Play Mode setup."); + } + } + } + } + } +} + +} // namespace Firebase.Editor diff --git a/editor/app/src/DllLocationPatcher.cs b/editor/app/src/DllLocationPatcher.cs index 70687f871..6ac6200d6 100644 --- a/editor/app/src/DllLocationPatcher.cs +++ b/editor/app/src/DllLocationPatcher.cs @@ -91,6 +91,28 @@ internal static void OnPostProcessDllLocation( } } + [PostProcessBuildAttribute(BUILD_ORDER_PATCH_PROJECT)] + internal static void OnPostProcessBuildWindowsAnalytics( + BuildTarget buildTarget, string pathToBuiltProject) { + if (buildTarget == BuildTarget.StandaloneWindows || + buildTarget == BuildTarget.StandaloneWindows64) { + Type firebaseAnalyticsType = Type.GetType("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics"); + if (firebaseAnalyticsType != null) { + string sourceDllPath = "./analytics_win.dll"; + if (System.IO.File.Exists(sourceDllPath)) { + string destinationDirectory = Path.Combine( + Path.GetDirectoryName(pathToBuiltProject), + Path.GetFileNameWithoutExtension(pathToBuiltProject) + "_Data", + "Plugins"); + System.IO.Directory.CreateDirectory(destinationDirectory); + string destinationDllPath = Path.Combine(destinationDirectory, "analytics_win.dll"); + System.IO.File.Copy(sourceDllPath, destinationDllPath, true); + Debug.Log("Firebase Analytics: Copied analytics_win.dll to build plugins directory."); + } + } + } + } + internal static void CopyLibrary( string srcFolder, string dstFolder, string prefix, string extension) { Debug.Log("Post process to patch App." + extension + "'s location"); From 7f94742aaa7a80172265e42d0e4e10438828a9d4 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 19:43:49 +0000 Subject: [PATCH 2/6] refactor: Use shared constants and add error handling for Analytics DLL copy This commit addresses feedback from the previous review: - Created `FirebaseAnalyticsEditorConstants.cs` to store shared constants for: - `DllName` ("analytics_win.dll") - `DllSourcePath` ("./analytics_win.dll") - `AnalyticsTypeFullName` ("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics") - Updated `editor/app/src/DllLocationPatcher.cs`: - Replaced hardcoded strings with the new shared constants. - Wrapped file I/O operations (directory creation and DLL copy for Windows builds) in a try-catch block to handle potential exceptions (e.g., IOExceptions, UnauthorizedAccessException) and log specific errors. - Updated `editor/app/src/AnalyticsPlayModeSetup.cs`: - Replaced hardcoded strings and local constants with the new shared constants. - Wrapped file I/O operations (directory creation and DLL copy for Play Mode) in a try-catch block to handle potential exceptions and log specific errors. These changes improve maintainability by centralizing critical strings and enhance robustness by ensuring that file operation errors during build post-processing or Play Mode setup are caught and logged gracefully. --- editor/app/src/AnalyticsPlayModeSetup.cs | 16 ++++++------- editor/app/src/DllLocationPatcher.cs | 24 +++++++++++-------- .../src/FirebaseAnalyticsEditorConstants.cs | 23 ++++++++++++++++++ 3 files changed, 44 insertions(+), 19 deletions(-) create mode 100644 editor/app/src/FirebaseAnalyticsEditorConstants.cs diff --git a/editor/app/src/AnalyticsPlayModeSetup.cs b/editor/app/src/AnalyticsPlayModeSetup.cs index 9573d425b..538fb2335 100644 --- a/editor/app/src/AnalyticsPlayModeSetup.cs +++ b/editor/app/src/AnalyticsPlayModeSetup.cs @@ -7,9 +7,7 @@ namespace Firebase.Editor { [InitializeOnLoad] internal static class AnalyticsPlayModeSetup { - private const string SourceDllPath = "./analytics_win.dll"; private const string DestinationDir = "Assets/Plugins/"; - private const string DestinationDllName = "analytics_win.dll"; static AnalyticsPlayModeSetup() { EditorApplication.playModeStateChanged += OnPlayModeStateChanged; @@ -18,21 +16,21 @@ static AnalyticsPlayModeSetup() { private static void OnPlayModeStateChanged(PlayModeStateChange state) { if (state == PlayModeStateChange.EnteredPlayMode) { if (Application.platform == RuntimePlatform.WindowsEditor) { - Type firebaseAnalyticsType = Type.GetType("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics"); + Type firebaseAnalyticsType = Type.GetType(FirebaseAnalyticsEditorConstants.AnalyticsTypeFullName); if (firebaseAnalyticsType != null) { - if (File.Exists(SourceDllPath)) { + if (File.Exists(FirebaseAnalyticsEditorConstants.DllSourcePath)) { try { Directory.CreateDirectory(DestinationDir); - string destinationDllPath = Path.Combine(DestinationDir, DestinationDllName); - File.Copy(SourceDllPath, destinationDllPath, true); - Debug.Log("Firebase Analytics: Copied " + DestinationDllName + " to " + DestinationDir + " for Play Mode."); + string destinationDllPath = Path.Combine(DestinationDir, FirebaseAnalyticsEditorConstants.DllName); + File.Copy(FirebaseAnalyticsEditorConstants.DllSourcePath, destinationDllPath, true); + Debug.Log("Firebase Analytics: Copied " + FirebaseAnalyticsEditorConstants.DllName + " to " + DestinationDir + " for Play Mode."); AssetDatabase.Refresh(); } catch (Exception e) { - Debug.LogError("Firebase Analytics: Error copying " + DestinationDllName + " for Play Mode: " + e.Message); + Debug.LogError("Firebase Analytics: Error copying " + FirebaseAnalyticsEditorConstants.DllName + " for Play Mode: " + e.Message); } } else { // Optional: Log if source DLL is not found, as it might be expected if Analytics is not used. - // Debug.LogWarning("Firebase Analytics: Source DLL " + SourceDllPath + " not found. Skipping Play Mode setup."); + // Debug.LogWarning("Firebase Analytics: Source DLL " + FirebaseAnalyticsEditorConstants.DllSourcePath + " not found. Skipping Play Mode setup."); } } } diff --git a/editor/app/src/DllLocationPatcher.cs b/editor/app/src/DllLocationPatcher.cs index 6ac6200d6..72bce92cf 100644 --- a/editor/app/src/DllLocationPatcher.cs +++ b/editor/app/src/DllLocationPatcher.cs @@ -96,18 +96,22 @@ internal static void OnPostProcessBuildWindowsAnalytics( BuildTarget buildTarget, string pathToBuiltProject) { if (buildTarget == BuildTarget.StandaloneWindows || buildTarget == BuildTarget.StandaloneWindows64) { - Type firebaseAnalyticsType = Type.GetType("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics"); + Type firebaseAnalyticsType = Type.GetType(FirebaseAnalyticsEditorConstants.AnalyticsTypeFullName); if (firebaseAnalyticsType != null) { - string sourceDllPath = "./analytics_win.dll"; + string sourceDllPath = FirebaseAnalyticsEditorConstants.DllSourcePath; if (System.IO.File.Exists(sourceDllPath)) { - string destinationDirectory = Path.Combine( - Path.GetDirectoryName(pathToBuiltProject), - Path.GetFileNameWithoutExtension(pathToBuiltProject) + "_Data", - "Plugins"); - System.IO.Directory.CreateDirectory(destinationDirectory); - string destinationDllPath = Path.Combine(destinationDirectory, "analytics_win.dll"); - System.IO.File.Copy(sourceDllPath, destinationDllPath, true); - Debug.Log("Firebase Analytics: Copied analytics_win.dll to build plugins directory."); + try { + string destinationDirectory = Path.Combine( + Path.GetDirectoryName(pathToBuiltProject), + Path.GetFileNameWithoutExtension(pathToBuiltProject) + "_Data", + "Plugins"); + System.IO.Directory.CreateDirectory(destinationDirectory); + string destinationDllPath = Path.Combine(destinationDirectory, FirebaseAnalyticsEditorConstants.DllName); + System.IO.File.Copy(sourceDllPath, destinationDllPath, true); + Debug.Log("Firebase Analytics: Copied " + FirebaseAnalyticsEditorConstants.DllName + " to build plugins directory."); + } catch (System.Exception e) { + Debug.LogError("Firebase Analytics: Error copying " + FirebaseAnalyticsEditorConstants.DllName + " for build: " + e.Message); + } } } } diff --git a/editor/app/src/FirebaseAnalyticsEditorConstants.cs b/editor/app/src/FirebaseAnalyticsEditorConstants.cs new file mode 100644 index 000000000..4021b7da9 --- /dev/null +++ b/editor/app/src/FirebaseAnalyticsEditorConstants.cs @@ -0,0 +1,23 @@ +// Copyright 2024 Google LLC +// +// 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 Firebase.Editor { + +internal static class FirebaseAnalyticsEditorConstants { + public const string DllName = "analytics_win.dll"; + public const string DllSourcePath = "./" + DllName; + public const string AnalyticsTypeFullName = "Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics"; +} + +} From 949ac29164cbf798504ec854877c7e051c3971b2 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 19:59:49 +0000 Subject: [PATCH 3/6] fix: Correct Play Mode DLL copy path for analytics_win.dll This commit corrects the destination path for `analytics_win.dll` when copied during Play Mode setup on Windows. Previously, the DLL was copied to `Assets/Plugins/`. This has been changed to the project root (`./`). Copying to the project root ensures that the native DLL can be found by the Unity editor executable when using P/Invoke, which typically searches the application's directory. Changes in `editor/app/src/AnalyticsPlayModeSetup.cs`: - The destination directory for copying `analytics_win.dll` in Play Mode is now `"./"` (the project root). - The corresponding log message has been updated. - Removed the `AssetDatabase.Refresh()` call, as it's not necessary for this type of DLL handling in the editor. The build-time copy location in `DllLocationPatcher.cs` remains unchanged as it was already correct for standalone builds. --- editor/app/src/AnalyticsPlayModeSetup.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/editor/app/src/AnalyticsPlayModeSetup.cs b/editor/app/src/AnalyticsPlayModeSetup.cs index 538fb2335..daa5308dd 100644 --- a/editor/app/src/AnalyticsPlayModeSetup.cs +++ b/editor/app/src/AnalyticsPlayModeSetup.cs @@ -7,7 +7,7 @@ namespace Firebase.Editor { [InitializeOnLoad] internal static class AnalyticsPlayModeSetup { - private const string DestinationDir = "Assets/Plugins/"; + private const string DestinationDir = "./"; static AnalyticsPlayModeSetup() { EditorApplication.playModeStateChanged += OnPlayModeStateChanged; @@ -20,11 +20,10 @@ private static void OnPlayModeStateChanged(PlayModeStateChange state) { if (firebaseAnalyticsType != null) { if (File.Exists(FirebaseAnalyticsEditorConstants.DllSourcePath)) { try { - Directory.CreateDirectory(DestinationDir); + Directory.CreateDirectory(DestinationDir); // Should be benign for "./" string destinationDllPath = Path.Combine(DestinationDir, FirebaseAnalyticsEditorConstants.DllName); File.Copy(FirebaseAnalyticsEditorConstants.DllSourcePath, destinationDllPath, true); - Debug.Log("Firebase Analytics: Copied " + FirebaseAnalyticsEditorConstants.DllName + " to " + DestinationDir + " for Play Mode."); - AssetDatabase.Refresh(); + Debug.Log("Firebase Analytics: Copied " + FirebaseAnalyticsEditorConstants.DllName + " to project root for Play Mode."); } catch (Exception e) { Debug.LogError("Firebase Analytics: Error copying " + FirebaseAnalyticsEditorConstants.DllName + " for Play Mode: " + e.Message); } From 8b402ea0880f382e6f39e5b584035959c373a4ef Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:34:41 +0000 Subject: [PATCH 4/6] fix: Prevent self-copy of analytics_win.dll in Play Mode This commit refines the logic in `AnalyticsPlayModeSetup.cs` to correctly handle the scenario where `analytics_win.dll` (the source) is already located in the project root (the destination for Play Mode). Previously, if the DLL was in the project root, the `File.Copy` operation would attempt to copy the file onto itself, resulting in an `IOException`. Changes in `editor/app/src/AnalyticsPlayModeSetup.cs`: - Before attempting to copy the DLL for Play Mode: - The full canonical paths of the source and destination are now compared. - If the source and destination paths are identical (i.e., the DLL is already in the project root), the copy operation is skipped, and an informational message is logged. - The file copy (with its try-catch block) only proceeds if the source and destination paths are different. This prevents an unnecessary `IOException` and ensures the setup is cleaner when the DLL is already correctly placed for Play Mode. --- editor/app/src/AnalyticsPlayModeSetup.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/editor/app/src/AnalyticsPlayModeSetup.cs b/editor/app/src/AnalyticsPlayModeSetup.cs index daa5308dd..a19281630 100644 --- a/editor/app/src/AnalyticsPlayModeSetup.cs +++ b/editor/app/src/AnalyticsPlayModeSetup.cs @@ -19,6 +19,15 @@ private static void OnPlayModeStateChanged(PlayModeStateChange state) { Type firebaseAnalyticsType = Type.GetType(FirebaseAnalyticsEditorConstants.AnalyticsTypeFullName); if (firebaseAnalyticsType != null) { if (File.Exists(FirebaseAnalyticsEditorConstants.DllSourcePath)) { + string fullSourcePath = Path.GetFullPath(FirebaseAnalyticsEditorConstants.DllSourcePath); + // string destinationDirectory = "./"; // This is DestinationDir + string fullDestinationPath = Path.GetFullPath(Path.Combine(DestinationDir, FirebaseAnalyticsEditorConstants.DllName)); + + if (fullSourcePath.Equals(fullDestinationPath, StringComparison.OrdinalIgnoreCase)) { + Debug.Log("Firebase Analytics: " + FirebaseAnalyticsEditorConstants.DllName + " is already in the project root. No copy needed for Play Mode."); + return; + } + try { Directory.CreateDirectory(DestinationDir); // Should be benign for "./" string destinationDllPath = Path.Combine(DestinationDir, FirebaseAnalyticsEditorConstants.DllName); From 7d38c425fee15ae3578ea422cbb18bf58cf4b079 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 21:04:36 +0000 Subject: [PATCH 5/6] fix: Add .asmdef for editor scripts to resolve Mac build error This commit introduces `Firebase.Editor.App.asmdef` in the `editor/app/src/` directory. The purpose of this assembly definition file is to: 1. Define a distinct assembly named `Firebase.Editor.App` for the editor scripts located in `editor/app/src/` (including `DllLocationPatcher.cs`, `AnalyticsPlayModeSetup.cs`, and `FirebaseAnalyticsEditorConstants.cs`). 2. Ensure this assembly is compiled exclusively for the Unity Editor environment by setting `includePlatforms: ["Editor"]`. 3. Improve code organization and compilation consistency across different operating systems. This change directly addresses a build error reported on Mac (`CS0103: The name 'FirebaseAnalyticsEditorConstants' does not exist in the current context`), which occurred because the editor scripts were not being compiled into a clearly defined assembly, leading to symbol resolution issues on that platform. The new .asmdef file ensures that all relevant editor scripts are compiled together, making `FirebaseAnalyticsEditorConstants` accessible to other scripts within the same `Firebase.Editor.App` assembly during editor script compilation on all platforms. --- editor/app/src/Firebase.Editor.App.asmdef | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 editor/app/src/Firebase.Editor.App.asmdef diff --git a/editor/app/src/Firebase.Editor.App.asmdef b/editor/app/src/Firebase.Editor.App.asmdef new file mode 100644 index 000000000..b485f59e3 --- /dev/null +++ b/editor/app/src/Firebase.Editor.App.asmdef @@ -0,0 +1,16 @@ +{ + "name": "Firebase.Editor.App", + "rootNamespace": "Firebase.Editor", + "references": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} From 13aba5b84093582affa212b35f4aeafb15262fcf Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 21:10:11 +0000 Subject: [PATCH 6/6] Based on your feedback, I've reverted some recent changes to simplify the file structure and address a potential build error you encountered on Mac. Specifically, I have: 1. **Removed `.asmdef` from `editor/app/src/`**: The editor scripts in this directory will now be compiled into the default editor assembly. 2. **Removed `FirebaseAnalyticsEditorConstants.cs` and reverted its usage**: * `editor/app/src/DllLocationPatcher.cs` now uses hardcoded strings for DLL names, paths, and type lookups. * `editor/app/src/AnalyticsPlayModeSetup.cs` now uses hardcoded strings for DLL names, paths, and type lookups. The goal here is to make things simpler and resolve the Mac build error (`CS0103: The name 'FirebaseAnalyticsEditorConstants' does not exist in the current context`) by removing the file that seemed to be causing the issue. If the build error continues on your Mac, I'll investigate further with this simplified setup. --- editor/app/src/AnalyticsPlayModeSetup.cs | 20 ++++++++-------- editor/app/src/DllLocationPatcher.cs | 10 ++++---- editor/app/src/Firebase.Editor.App.asmdef | 16 ------------- .../src/FirebaseAnalyticsEditorConstants.cs | 23 ------------------- 4 files changed, 15 insertions(+), 54 deletions(-) delete mode 100644 editor/app/src/Firebase.Editor.App.asmdef delete mode 100644 editor/app/src/FirebaseAnalyticsEditorConstants.cs diff --git a/editor/app/src/AnalyticsPlayModeSetup.cs b/editor/app/src/AnalyticsPlayModeSetup.cs index a19281630..83aa55c2a 100644 --- a/editor/app/src/AnalyticsPlayModeSetup.cs +++ b/editor/app/src/AnalyticsPlayModeSetup.cs @@ -16,29 +16,29 @@ static AnalyticsPlayModeSetup() { private static void OnPlayModeStateChanged(PlayModeStateChange state) { if (state == PlayModeStateChange.EnteredPlayMode) { if (Application.platform == RuntimePlatform.WindowsEditor) { - Type firebaseAnalyticsType = Type.GetType(FirebaseAnalyticsEditorConstants.AnalyticsTypeFullName); + Type firebaseAnalyticsType = Type.GetType("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics"); if (firebaseAnalyticsType != null) { - if (File.Exists(FirebaseAnalyticsEditorConstants.DllSourcePath)) { - string fullSourcePath = Path.GetFullPath(FirebaseAnalyticsEditorConstants.DllSourcePath); + if (File.Exists("./analytics_win.dll")) { + string fullSourcePath = Path.GetFullPath("./analytics_win.dll"); // string destinationDirectory = "./"; // This is DestinationDir - string fullDestinationPath = Path.GetFullPath(Path.Combine(DestinationDir, FirebaseAnalyticsEditorConstants.DllName)); + string fullDestinationPath = Path.GetFullPath(Path.Combine(DestinationDir, "analytics_win.dll")); if (fullSourcePath.Equals(fullDestinationPath, StringComparison.OrdinalIgnoreCase)) { - Debug.Log("Firebase Analytics: " + FirebaseAnalyticsEditorConstants.DllName + " is already in the project root. No copy needed for Play Mode."); + Debug.Log("Firebase Analytics: analytics_win.dll is already in the project root. No copy needed for Play Mode."); return; } try { Directory.CreateDirectory(DestinationDir); // Should be benign for "./" - string destinationDllPath = Path.Combine(DestinationDir, FirebaseAnalyticsEditorConstants.DllName); - File.Copy(FirebaseAnalyticsEditorConstants.DllSourcePath, destinationDllPath, true); - Debug.Log("Firebase Analytics: Copied " + FirebaseAnalyticsEditorConstants.DllName + " to project root for Play Mode."); + string destinationDllPath = Path.Combine(DestinationDir, "analytics_win.dll"); + File.Copy("./analytics_win.dll", destinationDllPath, true); + Debug.Log("Firebase Analytics: Copied analytics_win.dll to project root for Play Mode."); } catch (Exception e) { - Debug.LogError("Firebase Analytics: Error copying " + FirebaseAnalyticsEditorConstants.DllName + " for Play Mode: " + e.Message); + Debug.LogError("Firebase Analytics: Error copying analytics_win.dll for Play Mode: " + e.Message); } } else { // Optional: Log if source DLL is not found, as it might be expected if Analytics is not used. - // Debug.LogWarning("Firebase Analytics: Source DLL " + FirebaseAnalyticsEditorConstants.DllSourcePath + " not found. Skipping Play Mode setup."); + // Debug.LogWarning("Firebase Analytics: Source DLL ./analytics_win.dll not found. Skipping Play Mode setup."); } } } diff --git a/editor/app/src/DllLocationPatcher.cs b/editor/app/src/DllLocationPatcher.cs index 72bce92cf..12cf6a053 100644 --- a/editor/app/src/DllLocationPatcher.cs +++ b/editor/app/src/DllLocationPatcher.cs @@ -96,9 +96,9 @@ internal static void OnPostProcessBuildWindowsAnalytics( BuildTarget buildTarget, string pathToBuiltProject) { if (buildTarget == BuildTarget.StandaloneWindows || buildTarget == BuildTarget.StandaloneWindows64) { - Type firebaseAnalyticsType = Type.GetType(FirebaseAnalyticsEditorConstants.AnalyticsTypeFullName); + Type firebaseAnalyticsType = Type.GetType("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics"); if (firebaseAnalyticsType != null) { - string sourceDllPath = FirebaseAnalyticsEditorConstants.DllSourcePath; + string sourceDllPath = "./analytics_win.dll"; if (System.IO.File.Exists(sourceDllPath)) { try { string destinationDirectory = Path.Combine( @@ -106,11 +106,11 @@ internal static void OnPostProcessBuildWindowsAnalytics( Path.GetFileNameWithoutExtension(pathToBuiltProject) + "_Data", "Plugins"); System.IO.Directory.CreateDirectory(destinationDirectory); - string destinationDllPath = Path.Combine(destinationDirectory, FirebaseAnalyticsEditorConstants.DllName); + string destinationDllPath = Path.Combine(destinationDirectory, "analytics_win.dll"); System.IO.File.Copy(sourceDllPath, destinationDllPath, true); - Debug.Log("Firebase Analytics: Copied " + FirebaseAnalyticsEditorConstants.DllName + " to build plugins directory."); + Debug.Log("Firebase Analytics: Copied analytics_win.dll to build plugins directory."); } catch (System.Exception e) { - Debug.LogError("Firebase Analytics: Error copying " + FirebaseAnalyticsEditorConstants.DllName + " for build: " + e.Message); + Debug.LogError("Firebase Analytics: Error copying analytics_win.dll for build: " + e.Message); } } } diff --git a/editor/app/src/Firebase.Editor.App.asmdef b/editor/app/src/Firebase.Editor.App.asmdef deleted file mode 100644 index b485f59e3..000000000 --- a/editor/app/src/Firebase.Editor.App.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "Firebase.Editor.App", - "rootNamespace": "Firebase.Editor", - "references": [], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} diff --git a/editor/app/src/FirebaseAnalyticsEditorConstants.cs b/editor/app/src/FirebaseAnalyticsEditorConstants.cs deleted file mode 100644 index 4021b7da9..000000000 --- a/editor/app/src/FirebaseAnalyticsEditorConstants.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2024 Google LLC -// -// 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 Firebase.Editor { - -internal static class FirebaseAnalyticsEditorConstants { - public const string DllName = "analytics_win.dll"; - public const string DllSourcePath = "./" + DllName; - public const string AnalyticsTypeFullName = "Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics"; -} - -}