Skip to content
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

[tests] Fix test configuration issues with file moves. #15

Merged
Merged
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
32 changes: 20 additions & 12 deletions tests/common/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,31 @@ public static string MonoTouchRootDirectory {
}
}

static string FindConfigFile (string name)
static IEnumerable<string> FindConfigFiles (string name)
{
var dir = Environment.CurrentDirectory;
while (dir != "/") {
var file = Path.Combine (dir, name);
if (File.Exists (file))
return file;
yield return file;
file = Path.Combine (dir, "xamarin-macios", name);
if (File.Exists (file))
yield return file;
dir = Path.GetDirectoryName (dir);
}
return null;
}

static void ParseConfigFiles ()
{
ParseConfigFile (FindConfigFile ("test.config"));
ParseConfigFile (FindConfigFile ("Make.config.local"));
ParseConfigFile (FindConfigFile ("Make.config"));
ParseConfigFiles (FindConfigFiles ("test.config"));
ParseConfigFiles (FindConfigFiles ("Make.config.local"));
ParseConfigFiles (FindConfigFiles ("Make.config"));
}

static void ParseConfigFiles (IEnumerable<string> files)
{
foreach (var file in files)
ParseConfigFile (file);
}

static void ParseConfigFile (string file)
Expand Down Expand Up @@ -148,16 +156,16 @@ static Configuration ()
Console.WriteLine (" INCLUDE_WATCHOS={0}", include_watchos);
}

public static string MaccorePath {
public static string RootPath {
get {
var dir = Environment.CurrentDirectory;
var path = Path.Combine (dir, "maccore");
var path = Path.Combine (dir, "xamarin-macios");
while (!Directory.Exists (path) && path.Length > 3) {
dir = Path.GetDirectoryName (dir);
path = Path.Combine (dir, "maccore");
path = Path.Combine (dir, "xamarin-macios");
}
if (!Directory.Exists (path))
throw new Exception ("Could not find the maccore repo");
throw new Exception ("Could not find the xamarin-macios repo");
return path;
}
}
Expand Down Expand Up @@ -217,13 +225,13 @@ public static string SdkBinDir {

public static string BinDirXI {
get {
return Path.Combine (MaccorePath, "_ios-build", "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current", "bin");
return Path.Combine (RootPath, "_ios-build", "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current", "bin");
}
}

public static string BinDirXM {
get {
return Path.Combine (MaccorePath, "_mac-build", "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current", "bin");
return Path.Combine (RootPath, "_mac-build", "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current", "bin");
}
}

Expand Down