Description
[READ] For Firebase Unity SDK issues, please report to Firebase Unity Sample
Once you've read this section and determined that your issue is appropriate for this repository, please delete this section.
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2020.3.12f1
- External Dependency Manager version: HEAD
- Source you installed EDM4U: _____ (.unitypackage or Unity Package Manager)
- Features in External Dependency Manager in use: _____ (Android Resolver, iOS Resolver, VersionHandler, etc.)
- Plugins SDK in use: _____ (Firebase, Admob, Facebook, etc.)
- Platform you are using the Unity editor on: Windows (Mac, Windows, or Linux)
[REQUIRED] Please describe the issue here:
The base issue is:
PS D:\unity-jar-resolver> .\gradlew.bat build
> Configure project :
INFO: Could not find files for the given pattern(s).
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\unity-jar-resolver\build.gradle' line: 55
* What went wrong:
A problem occurred evaluating root project 'playServicesResolver'.
> Unity editor executable (UNITY_EXE) not found
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
PS D:\unity-jar-resolver>
It's possible to get past this by changing:
List<String> defaultUnityPaths =
[(OperatingSystem.UNKNOWN): ["Unity"],
(OperatingSystem.MAC_OSX):
["/Applications/Unity/Unity.app/Contents/MacOS/Unity"] +
(new FileNameFinder()).getFileNames(
"/", "Applications/Unity/Hub/Editor/*/Unity.app/Contents/MacOS/Unity"),
(OperatingSystem.WINDOWS):
["\\Program Files\\Unity\\Editor\\Unity.exe"] +
(new FileNameFinder()).getFileNames(
"\\", "Program Files\\Unity\\Hub\\Editor\\*\\Editor\\Unity.exe"),
(OperatingSystem.LINUX): ["/opt/Unity/Editor/Unity"]][operatingSystem]
to:
List<String> defaultUnityPaths =
[(OperatingSystem.UNKNOWN): ["Unity"],
(OperatingSystem.MAC_OSX):
["/Applications/Unity/Unity.app/Contents/MacOS/Unity"] +
(new FileNameFinder()).getFileNames(
"/", "Applications/Unity/Hub/Editor/*/Unity.app/Contents/MacOS/Unity"),
(OperatingSystem.WINDOWS):
["\\Program Files\\Unity\\Editor\\Unity.exe"] +
(new FileNameFinder()).getFileNames(
"\\Program Files\\Unity\\Hub\\Editor\\", "*\\Editor\\Unity.exe"),
(OperatingSystem.LINUX): ["/opt/Unity/Editor/Unity"]][operatingSystem]
(this fixes the wildcard search for the Unity editor installed via the Unity Hub).
if (unityExe == null || !unityExe.exists()) {
unityExe = findFileInPath(unityExe.name)
}
should also be changed to
if (unityExe == null || !unityExe.exists()) {
unityExe = findFileInPath(new File(defaultUnityPaths[0]).name)
}
(I don't think this should ever be really useful, but it does actually check for Unity.exe if unityExe is null, which is part of the if statement. It does feel a bit hacky).
Also, the way "Editor" is removed is incorrect. In groovy, the -
operation will remove the first match, and if you install Unity via the Unity Hub then your path will look something like "Unity/Hub/Editor/Unity/Editor" (the wrong Editor will get removed).
change:
File unityRootDir = findFileProperty(
"UNITY_DIR", new File(unityExe.parentFile.absolutePath -
unityExeParentPath), true)
to
String unityExeAbsolutePath = unityExe.parentFile.absolutePath;
Integer indexWhereUnityExeParentPathStarts = unityExeAbsolutePath.lastIndexOf(unityExeParentPath);
String unityDir = unityExeAbsolutePath[0..indexWhereUnityExeParentPathStarts-1];
File unityRootDir = findFileProperty("UNITY_DIR", new File(unityDir), true)
In newer versions of Unity, they ship mono.exe
rather than mono.bat
. You can fix this with:
monoExe = getFileFromPropertyOrFileTree(
"MONO_EXE", false, {
unityRootDirTree.matching {
include (operatingSystem == OperatingSystem.WINDOWS ?
"**/bin/mono.bat" : "**/bin/mono")
exclude unitySearchDirExcludes
}
})
to
monoExe = getFileFromPropertyOrFileTree(
"MONO_EXE", false, {
unityRootDirTree.matching {
include (operatingSystem == OperatingSystem.WINDOWS ?
["**/bin/mono.bin", "**/bin/mono.exe"] : "**/bin/mono")
exclude unitySearchDirExcludes
}
})
Finally, nunit-console2.bat
doesn't ship with newer Unity's. Maybe you can fix it with:
nunitConsoleExe = getFileFromPropertyOrFileTree(
"NUNIT_CONSOLE_EXE", false, {
unityRootDirTree.matching {
include (operatingSystem == OperatingSystem.WINDOWS ?
"**/bin/nunit-console2.bat" :
"**/nunit-console2")
exclude unitySearchDirExcludes
}
})
to
nunitConsoleExe = getFileFromPropertyOrFileTree(
"NUNIT_CONSOLE_EXE", false, {
unityRootDirTree.matching {
include (operatingSystem == OperatingSystem.WINDOWS ?
["**/bin/nunit-console2.bat", "**/bin/nunit-console.bat"] :
"**/nunit-console2")
exclude unitySearchDirExcludes
}
})
Unfortunately, with all these changes I cannot get the project building. I get an error in XBuild that I don't know enough to debug:
> Task :compileVersionHandler FAILED
>>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<
XBuild Engine Version 4.0
Mono, Version 5.11.0.0
Copyright (C) 2005-2013 Various Mono authors
Build started 6/24/2021 4:55:03 PM.
__________________________________________________
Project "C:\Projects\unity-jar-resolver\source\ExternalDependencyManager.sln" (VersionHandler target(s)):
Target ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Target VersionHandler:
Project "C:\Projects\unity-jar-resolver\source\VersionHandler\VersionHandler.csproj" (default target(s)):
Target PrepareForBuild:
Configuration: Debug Platform: AnyCPU
Target GenerateSatelliteAssemblies:
No input files were specified for target GenerateSatelliteAssemblies, skipping.
Done building project "C:\Projects\unity-jar-resolver\source\VersionHandler\VersionHandler.csproj".-- FAILED
Task "MSBuild" execution -- FAILED
Done building target "VersionHandler" in project "C:\Projects\unity-jar-resolver\source\ExternalDependencyManager.sln".-- FAILED
Done building project "C:\Projects\unity-jar-resolver\source\ExternalDependencyManager.sln".-- FAILED
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.5829964
which is why I'm submitting this as a bug report rather than a patch. Here is a full patch of my working copy so far:
diff --git a/build.gradle b/build.gradle
index 264ff51..b4acdfc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -39,17 +39,21 @@ project.ext {
(OperatingSystem.WINDOWS):
["\\Program Files\\Unity\\Editor\\Unity.exe"] +
(new FileNameFinder()).getFileNames(
- "\\", "Program Files\\Unity\\Hub\\Editor\\*\\Editor\\Unity.exe"),
+ "\\Program Files\\Unity\\Hub\\Editor\\", "*\\Editor\\Unity.exe"),
(OperatingSystem.LINUX): ["/opt/Unity/Editor/Unity"]][operatingSystem]
// Search for the Unity editor executable.
// The Unity editor is required to package the plug-in.
+ logger.info('Unity paths: {}', defaultUnityPaths);
for (defaultUnityPath in defaultUnityPaths) {
unityExe = findFileProperty("UNITY_EXE", new File(defaultUnityPath), false)
- if (unityExe != null && unityExe.exists()) break;
+ if (unityExe != null && unityExe.exists()) {
+ logger.info('{} exists! {}', unityExe, unityExe.exists());
+ break;
+ }
}
if (unityExe == null || !unityExe.exists()) {
- unityExe = findFileInPath(unityExe.name)
+ unityExe = findFileInPath(new File(defaultUnityPaths[0]).name)
}
if (unityExe == null) {
throw new StopActionException("Unity editor executable (UNITY_EXE) not " +
@@ -64,9 +68,12 @@ project.ext {
(OperatingSystem.MAC_OSX): "Unity.app/Contents/MacOS",
(OperatingSystem.WINDOWS): "Editor",
(OperatingSystem.LINUX): "Editor"][operatingSystem]
- File unityRootDir = findFileProperty(
- "UNITY_DIR", new File(unityExe.parentFile.absolutePath -
- unityExeParentPath), true)
+ logger.info('unityExeParentPath: {}', unityExeParentPath);
+ String unityExeAbsolutePath = unityExe.parentFile.absolutePath;
+ Integer indexWhereUnityExeParentPathStarts = unityExeAbsolutePath.lastIndexOf(unityExeParentPath);
+ String unityDir = unityExeAbsolutePath[0..indexWhereUnityExeParentPathStarts-1];
+ logger.info('test path: {}', unityDir);
+ File unityRootDir = findFileProperty("UNITY_DIR", new File(unityDir), true)
if (unityRootDir == null) {
throw new StopActionException("Unity root directory (UNITY_DIR) not found.")
}
@@ -126,7 +133,7 @@ project.ext {
"MONO_EXE", false, {
unityRootDirTree.matching {
include (operatingSystem == OperatingSystem.WINDOWS ?
- "**/bin/mono.bat" : "**/bin/mono")
+ ["**/bin/mono.bin", "**/bin/mono.exe"] : "**/bin/mono")
exclude unitySearchDirExcludes
}
})
@@ -184,7 +191,7 @@ project.ext {
"NUNIT_CONSOLE_EXE", false, {
unityRootDirTree.matching {
include (operatingSystem == OperatingSystem.WINDOWS ?
- "**/bin/nunit-console2.bat" :
+ ["**/bin/nunit-console2.bat", "**/bin/nunit-console.bat"] :
"**/nunit-console2")
exclude unitySearchDirExcludes
}
@@ -382,6 +389,7 @@ String findProperty(String propertyName, String defaultValue = null) {
*/
File findFileProperty(String propertyName, File defaultValue = null,
Boolean mustExist = false) {
+ logger.info('{} checking {}', propertyName, defaultValue);
String foundFilePath = findProperty(
propertyName, defaultValue != null ? defaultValue.absolutePath : null)
File foundFile = foundFilePath != null ? new File(foundFilePath) : null
@@ -686,6 +694,8 @@ Task createXbuildTask(String taskName, String taskDescription,
File projectToBuild, String target,
Iterable<File> inputFiles, File outputDir,
Iterable<File> outputFiles, Iterable<Task> dependsOn) {
+
+ logger.info('createXbuildTask with target {}', target);
File intermediatesDir = new File(outputDir, "obj")
File binaryOutputDir = new File(outputDir, "bin")
Iterable<File> outputFilesInBinaryOutputDir = outputFiles.collect {
@@ -759,7 +769,7 @@ Task createXbuildTask(String taskName, String taskDescription,
sprintf("/property:OutputPath=%s%s",
binaryOutputDir.absolutePath,
File.separator),
- "/verbosity:quiet",
+ "/verbosity:normal",
projectToBuild.absolutePath])
}
}
Please answer the following, if applicable:
What's the issue repro rate? (eg 100%, 1/5 etc)
What happened? How can we make the problem occur?
This could be a description, log/console output, etc.
If you have a downloadable sample project that reproduces the bug you're reporting, you will
likely receive a faster response on your issue.