Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
[submodule "external/xamarin-android-tools"]
path = external/xamarin-android-tools
url = https://github.com/xamarin/xamarin-android-tools
branch = main
branch = jonp-provide-valiation-details
2 changes: 1 addition & 1 deletion external/xamarin-android-tools
7 changes: 7 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ public override bool RunTask ()

JavaSdkPath = MonoAndroidHelper.GetJdkInfo (this.CreateTaskLogger (), JavaSdkPath, minVersion, maxVersion)?.HomePath;

if (Directory.Exists (AndroidSdkPath)) {
Log.LogDebugMessage ($"# jonp: AndroidSdkPath={AndroidSdkPath}; contents");
foreach (var p in Directory.EnumerateFileSystemEntries (AndroidSdkPath, "*", SearchOption.AllDirectories)) {
Log.LogDebugMessage ("# jonp: {p}");
}
}

MonoAndroidHelper.RefreshSupportedVersions (ReferenceAssemblyPaths);

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,28 @@ public void InstallAndroidDependenciesTest ()
// We need to grab the latest API level *before* changing env vars
var apiLevel = AndroidSdkResolver.GetMaxInstalledPlatform ();
var old = Environment.GetEnvironmentVariable ("ANDROID_SDK_PATH");
var _configPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "xbuild", "monodroid-config.xml");
bool haveConfigPath = File.Exists (_configPath);
try {
string sdkPath = Path.Combine (Root, "temp", TestName, "android-sdk");
Environment.SetEnvironmentVariable ("ANDROID_SDK_PATH", sdkPath);
if (Directory.Exists (sdkPath))
Directory.Delete (sdkPath, true);
Directory.CreateDirectory (sdkPath);
TestContext.Out.WriteLine ($"[TESTLOG] InstallAndroidDependenciesTest: empty sdkPath size? {string.Join (", ", Directory.EnumerateFileSystemEntries (sdkPath, "*", SearchOption.AllDirectories))}");
var proj = new XamarinAndroidApplicationProject {
TargetSdkVersion = apiLevel.ToString (),
};
using (var b = CreateApkBuilder ()) {
b.CleanupAfterSuccessfulBuild = false;
string defaultTarget = b.Target;
TestContext.Out.WriteLine ($"[TESTLOG] InstallAndroidDependenciesTest: before build sdkPath size? {string.Join (", ", Directory.EnumerateFileSystemEntries (sdkPath, "*", SearchOption.AllDirectories))}");
b.Target = "InstallAndroidDependencies";
Assert.IsTrue (b.Build (proj, parameters: new string [] {
"AcceptAndroidSDKLicenses=true",
"AndroidManifestType=GoogleV2", // Need GoogleV2 so we can install API-32
}), "InstallAndroidDependencies should have succeeded.");
TestContext.Out.WriteLine ($"[TESTLOG] InstallAndroidDependenciesTest: after build sdkPath size? {string.Join (", ", Directory.EnumerateFileSystemEntries (sdkPath, "*", SearchOption.AllDirectories))}");
b.Target = defaultTarget;
Assert.IsTrue (b.Build (proj, true), "build should have succeeded.");
Assert.IsTrue (b.LastBuildOutput.ContainsText ($"Output Property: _AndroidSdkDirectory={sdkPath}"), "_AndroidSdkDirectory was not set to new SDK path.");
Expand All @@ -47,6 +52,7 @@ public void InstallAndroidDependenciesTest ()
} finally {
Environment.SetEnvironmentVariable ("ANDROID_SDK_PATH", old);
}
throw new Exception ($"# jonp: deliberate test failure! File.Exist(\"{_configPath}\")? {haveConfigPath}");
}

[Test]
Expand Down