Skip to content

Commit 8bcea64

Browse files
committed
Only generate local maven repo for .srcaar
If the repo specified in Dependencies.xml contains .aar, there is no need to generate local maven repo for them but just need to inject repo to mainTemplate.gradle using the original path. Change-Id: Ibbf66f2a505c633376c453ed4db989372b3f7384
1 parent 7d84e3b commit 8bcea64

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

source/AndroidResolver/src/GradleTemplateResolver.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ private static bool CopySrcAars(ICollection<Dependency> dependencies) {
9595
// Copy each .srcaar file to .aar while configuring the plugin importer to ignore the
9696
// file.
9797
foreach (var aar in LocalMavenRepository.FindAarsInLocalRepos(dependencies)) {
98+
// Only need to copy for .srcaar
99+
if (Path.GetExtension(aar).CompareTo(".srcaar") != 0) {
100+
continue;
101+
}
102+
98103
var aarPath = aar;
99104
if (FileUtils.IsUnderPackageDirectory(aar)) {
100105
var logicalPackagePath = FileUtils.GetPackageDirectory(aar,

source/AndroidResolver/src/PlayServicesResolver.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,10 +2000,17 @@ internal static IList<string> GradleMavenReposLines(ICollection<Dependency> depe
20002000
foreach (var repoAndSources in GetRepos(dependencies: dependencies)) {
20012001
string repoUri;
20022002
if (repoAndSources.Key.StartsWith(projectFileUri)) {
2003-
var repoPath = repoAndSources.Key.Substring(projectFileUri.Length + 1);
2004-
repoPath = FileUtils.PosixPathSeparators(
2003+
var relativePath = repoAndSources.Key.Substring(projectFileUri.Length + 1);
2004+
// Convert "Assets", "Packages/packageid", or
2005+
// "Library/PackageCache/packageid@version" prefix to local maven repo
2006+
// path. Note that local maven repo path only exists if the original repo
2007+
// path contains .srcaar.
2008+
var repoPath = FileUtils.PosixPathSeparators(
20052009
FileUtils.ReplaceBaseAssetsOrPackagesFolder(
2006-
repoPath, GooglePlayServices.SettingsDialog.LocalMavenRepoDir));
2010+
relativePath, GooglePlayServices.SettingsDialog.LocalMavenRepoDir));
2011+
if (!Directory.Exists(repoPath)) {
2012+
repoPath = relativePath;
2013+
}
20072014

20082015
// If "Export Gradle Project" setting is enabled, gradle project expects
20092016
// absolute path.

0 commit comments

Comments
 (0)