Skip to content

Commit

Permalink
azdevops: xamarin#59
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Apr 3, 2019
1 parent c3c9405 commit 704e5b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 27 deletions.
33 changes: 6 additions & 27 deletions tools/devops/build-samples.csx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#load "../../../maccore/tools/devops/external-deps.csx" // this will map the Xcode locations from Azure into our expected locations using symlinks.

using System.Collections.Generic;
using System.IO;
using System.Net;
Expand Down Expand Up @@ -43,42 +45,19 @@ string FindVariable (string variable)
throw new Exception ($"Could not find {variable} in environment nor in the commit's ({commit}) manifest.");
}

string GetVersion (string url)
{
return Regex.Match (mono_package, "[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)?").Value;
}

if (string.IsNullOrEmpty (provision_from_commit)) {
Console.Error.WriteLine ($"Either BUILD_SOURCEVERSION or PROVISION_FROM_COMMIT must be set.");
Environment.Exit (1);
return 1;
}
Console.WriteLine ($"Provisioning from {provision_from_commit}...");

var mono_package = FindVariable ("MIN_MONO_URL");
var xi_package = FindVariable ("XI_PACKAGE");
var xm_package = FindVariable ("XM_PACKAGE");
var sharpie_package = FindVariable ("MIN_SHARPIE_URL");

Console.WriteLine ($"Mono: {mono_package}");
Console.WriteLine ($"Xamarin.iOS: {xi_package}");
Console.WriteLine ($"Xamarin.Mac: {xm_package}");
Console.WriteLine ($"Objective-Sharpie: {sharpie_package}");

Item ("Mono", GetVersion (mono_package))
.Source (mono => mono_package);

Item ("Xamarin.iOS", GetVersion (xi_package))
.Source (xi => xi_package);

Item ("Xamarin.Mac", GetVersion (xm_package))
.Source (xm => xm_package);

Item ("Objective-Sharpie", GetVersion (sharpie_package))
.Source (sharpie => sharpie_package);
InstallPackage ("Mono", FindVariable ("MIN_MONO_URL"));
InstallPackage ("Xamarin.iOS", FindVariable ("XI_PACKAGE"));
InstallPackage ("Xamarin.Mac", FindVariable ("XM_PACKAGE"));
InstallPackage ("Objective-Sharpie", FindVariable ("MIN_SHARPIE_URL"));

// Xcode
#load "../../../maccore/tools/devops/external-deps.csx"
var xcode_path = Path.GetDirectoryName (Path.GetDirectoryName (FindVariable ("XCODE_DEVELOPER_ROOT")));
Exec ($"ln -Fhs {xcode_path} /Applications/Xcode.app");

Expand Down
7 changes: 7 additions & 0 deletions tools/devops/utils.csx
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,10 @@ string FindConfigurationVariable (string variable, string hash = "HEAD")

return null;
}

void InstallPackage (string name, string url)
{
Console.WriteLine ($"Installing {name} from {url}");
var version = Regex.Match (mono_package, "[0-9]+[.][0-9]+[.][0-9]+([.][0-9]+)?").Value;
Item (name, GetVersion (url)).Source (url);
}

0 comments on commit 704e5b2

Please sign in to comment.