Skip to content

Commit 7d84e3b

Browse files
committed
Fix incorrect repo path in mainTemplate.gradle when export gradle project
When Custom Gradle Template and Export Gradle Project setting in Unity are enabled, Android Resolver should inject absolute path to the generated local maven repo. Bug: 158040316 Fixed #366 Change-Id: I0d21705aeb4f7b0dacc58f3be5f26fe9c72c1bd2
1 parent d5c7e5e commit 7d84e3b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

source/AndroidResolver/src/PlayServicesResolver.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,12 +1999,20 @@ internal static IList<string> GradleMavenReposLines(ICollection<Dependency> depe
19991999
new Dictionary<string, List<string>>();
20002000
foreach (var repoAndSources in GetRepos(dependencies: dependencies)) {
20012001
string repoUri;
2002-
if (repoAndSources.Key.StartsWith(projectFileUri) && !exportEnabled) {
2002+
if (repoAndSources.Key.StartsWith(projectFileUri)) {
20032003
var repoPath = repoAndSources.Key.Substring(projectFileUri.Length + 1);
20042004
repoPath = FileUtils.PosixPathSeparators(
20052005
FileUtils.ReplaceBaseAssetsOrPackagesFolder(
20062006
repoPath, GooglePlayServices.SettingsDialog.LocalMavenRepoDir));
2007-
repoUri = String.Format("(unityProjectPath + \"/{0}\")", repoPath);
2007+
2008+
// If "Export Gradle Project" setting is enabled, gradle project expects
2009+
// absolute path.
2010+
if (exportEnabled) {
2011+
repoUri = String.Format("\"{0}\"",
2012+
Path.Combine(projectFileUri, repoPath));
2013+
} else {
2014+
repoUri = String.Format("(unityProjectPath + \"/{0}\")", repoPath);
2015+
}
20082016
} else {
20092017
repoUri = String.Format("\"{0}\"", repoAndSources.Key);
20102018
}

0 commit comments

Comments
 (0)