googlesamples / googlesamples/unity-jar-resolver

[Bug] EDM4U generates invalid local Maven repository URIs for project paths containing spaces (Unity 6.4+)

Open
#775 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
371
Avg merge
14h 21m
Merged PRs (30d)
3

Description

### [REQUIRED] Please fill in the following fields:

* Unity editor version: Unity 6000.5.4, also found in 6000.4.11.
* External Dependency Manager version: 1.2.188 and 1.2.187
* Source you installed EDM4U: Unity Package Manager, through OpenUPM
* Features in External Dependency Manager in use: Android Resolver
* Plugins SDK in use: Firebase
* Platform you are using the Unity editor on: macOS, Windows

### [REQUIRED] Please describe the issue here:
Android builds fail with Gradle reporting `Cannot convert URI 'file:///[Project Path]/Assets/GeneratedLocalRepo/Firebase/m2repository' to a file.` when EDM4U patches `settingsTemplate.gradle` with local maven repositories.

For example, when using the Firebase SDK, EDM4U will add this to `settingsTemplate.gradle`:
```gradle
// Android Resolver Repos Start
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
maven {
url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/Firebase/Editor/AppDependencies.xml:25, Assets/Firebase/Editor/AuthDependencies.xml:23, Assets/Firebase/Editor/StorageDependencies.xml:23
}
mavenLocal()
// Android Resolver Repos End
```

If `unityProjectPath` contains spaces, Gradle refuses to build the project. A temporary fix is to escape all spaces using `replace`:
```
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/").replace(" ", "%20")
```

#### Please answer the following, if applicable:
What's the issue repro rate? (eg 100%, 1/5 etc)

100%

What happened? How can we make the problem occur?

If the Unity project's path contains any spaces, and EDM4U patches the project's `settingsTemplate.gradle`, the build will fail for Android on Unity versions using Gradle 9.

Contributor guide

Open the contributing guide

Research direction

Start with the Android Resolver code that patches settingsTemplate.gradle and reproduce the failure using a Unity project whose path contains spaces. Check the generated local Maven repository URI and verify that an Android build succeeds on the affected Unity and Gradle versions without invalid URI errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp, unity
Domain
build-system, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.