Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public void Constructor_Paths ()
[Test]
public void Constructor_SetValuesFromPath ()
{
if (OS.IsWindows)
Assert.Ignore ("Windows does not look for values in %PATH%");

CreateSdks (out string root, out string jdk, out string ndk, out string sdk);
JdkInfoTests.CreateFauxJdk (jdk, releaseVersion: "1.8.0", releaseBuildNumber: "42", javaVersion: "100.100.100_100");

Expand Down
20 changes: 12 additions & 8 deletions src/Xamarin.Android.Tools.AndroidSdk/Tests/JdkInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,19 @@ internal static void CreateFauxJdk (string dir, string releaseVersion, string re
Directory.CreateDirectory (jli);
Directory.CreateDirectory (jre);


string quote = OS.IsWindows ? "" : "\"";
string java =
$"echo Property settings:{Environment.NewLine}" +
$"echo \" java.home = {dir}\"{Environment.NewLine}" +
$"echo \" java.vendor = Xamarin.Android Unit Tests\"{Environment.NewLine}" +
$"echo \" java.version = {javaVersion}\"{Environment.NewLine}" +
$"echo \" xamarin.multi-line = line the first\"{Environment.NewLine}" +
$"echo \" line the second\"{Environment.NewLine}" +
$"echo \" .\"{Environment.NewLine}";
$"echo {quote} java.home = {dir}{quote}{Environment.NewLine}" +
$"echo {quote} java.vendor = Xamarin.Android Unit Tests{quote}{Environment.NewLine}" +
$"echo {quote} java.version = {javaVersion}{quote}{Environment.NewLine}" +
$"echo {quote} xamarin.multi-line = line the first{quote}{Environment.NewLine}" +
$"echo {quote} line the second{quote}{Environment.NewLine}" +
$"echo {quote} .{quote}{Environment.NewLine}";

if (OS.IsWindows) {
java = $"@echo off{Environment.NewLine}{java}";
}

CreateShellScript (Path.Combine (bin, "jar"), "");
CreateShellScript (Path.Combine (bin, "java"), java);
Expand All @@ -86,7 +90,7 @@ public void DeleteFauxJdk ()

static void CreateShellScript (string path, string contents)
{
if (OS.IsWindows)
if (OS.IsWindows && string.Compare (Path.GetExtension (path), ".dll", true) != 0)
path += ".cmd";
using (var script = new StreamWriter (path)) {
if (!OS.IsWindows) {
Expand Down