-
Notifications
You must be signed in to change notification settings - Fork 370
Support for Gradle dependencyResolutionManagement RepositoriesMode.PREFER_SETTINGS #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
chkuang-g
commented
Apr 14, 2023
Hi @256p
Thank you so much for contributing this patch for EDM4U!
We are doing very similar things in #610 with some additional touches
- Unity 2022年2月1日 - 2022年2月9日 does not support template variable like
**DIR_UNITYPROJECT**unfortunately. Therefore we added two settings to force EDM4U to always use absolute path. - Unity 2022年2月1日 - 2022年2月9日 also does not have an option to enable custom Gradle settings template. This change automatically copy the template from the engine folder.
Still we appreciate your effort to put together this change for the community. And kudos to you to also add integration tests! The proper fix for this is a bit involved so we spent some time to make sure the experience is right.
I will close this PR for now.
Regards,
Shawn
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
This PR fixes #594 (comment)
Changes influence only builds when main Gradle template patching is enabled.
Changes:
settingsTemplate.gradle/resolve/gradlesettingstemplatereport URL to the analytics. (Not sure if it is needed)The logic of repositories injection depends on the project state:
mainTemplate.gradleandsettingsTemplate.gradleare enabled and mainTemplate patching and settingsTemplate patching in Android Resolver settings are enabled:settingsTemplate.gradlecontainsdependencyResolutionManagementblock withRepositoriesMode.PREFER_SETTINGSorRepositoriesMode.FAIL_ON_PROJECT_REPOS. If the match is successful it would mean that Gradle is configured to read repositories fromsettingsTemplate.gradleand will not read repositories specified inmainTemplate.gradle.settingsTemplate.gradlebeforedependencyResolutionManagementline. Injected repositories are in separatedependencyResolutionManagementblock and look like this:mainTemplate.gradlemainTemplate.gradleandsettingsTemplate.gradleare enabled and mainTemplate patching is enabled but settingsTemplate patching in Android Resolver settings is disabled, Android Resolver will not patchsettingsTemplate.gradlethis will lead to the build fail and the user will need to manage repositories manually.mainTemplate.gradleis enabled and mainTemplate patching and settingsTemplate patching in Android Resolver settings are enabled butsettingsTemplate.gradleis disabled:settingsTemplate.gradleinPlaybackEngines/AndroidPlayer/Tools/GradleTemplatescontainsdependencyResolutionManagementblock. Effectively this will match any Unity version equal to or above the 2022.2 version becausedependencyResolutionManagementwas introduced in the 2022.2 version.2.1. If the previous check didn't match then Android Resolver will work as in the previous versions.
2.2. If the previous check is successful then Android Resolver will enable
settingsTemplate.gradleautomatically (by copying the default template). Decided to do it in such a way because Unity >=2022.2 and <2022年2月10日 uses a settings template for repositories but don't have an option in "Project Settings" to enable a custom settings template. This option appeared only in 2022年2月10日.