Skip to content

Commit 080eaac

Browse files
pjcollinsjonpryor
authored andcommitted
[ci] Remove monodroid provisionator script (#3538)
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2968944&view=logs&s=1afc3bfe-122c-538b-e9ad-2a86c2efcfef&j=96fd57f5-f69e-53c7-3d47-f67e6cf9b93e As of commit 08e0ccb `$(AndroidToolchainDirectory)` is set to `$(HOME)/Library/Android` when executing on macOS Azure Pipelines hosts, and the JDK is installed into `$HOME/Library/Android/jdk`. Export `$JAVA_HOME` on the macOS DevOps build so that it references the JDK that `xaprepare` installs. Additionally, instead of relying on `$JAVA_HOME` or ib JDK tools existing in `$PATH` on macOS, use the value of `$(JavaSdkDirectory)` to provide full paths to JDK tools. If `$(JavaSdkDirectory)` is not set, we set it to `$(AndroidToolchainDirectory)/jdk` which contains the JDK we install. We currently use the monodroid `provisionator` script to install the JDK and select a specific version of Xcode. However, we should no longer need to invoke the `provisionator` script, as we're already installing the Corretto JDK and other dependencies as part of `xaprepare`. Furthermore, we should no longer have a dependency on Xcode 9.2, so the default macOS compiler toolchain works. Finally, making Xcode 9.2 the default breaks notarization, as it is missing the required tools: notarize.rb:85:in `extract_guid': xcrun: error: unable to find utility "altool", not a developer tool or in PATH (NotarizationFailed) from notarize.rb:107:in `run' from notarize.rb:113:in `<main>' xcrun: error: unable to find utility "altool", not a developer tool or in PATH Stop running `provisionator` and use the default Xcode.
1 parent bb7af63 commit 080eaac

File tree

5 files changed

+23
-37
lines changed

5 files changed

+23
-37
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ stages:
9494
variables:
9595
- group: Xamarin Notarization
9696
- name: JAVA_HOME
97-
value: '/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/'
97+
value: '/Users/vsts/Library/Android/jdk/'
9898
steps:
9999
- checkout: self
100100
submodules: recursive
@@ -118,14 +118,6 @@ stages:
118118
env:
119119
GH_AUTH_SECRET: $(Github.Token)
120120

121-
- task: provisionator@2
122-
condition: and(succeeded(), eq(variables['XA.Commercial.Build'], 'true'))
123-
inputs:
124-
provisionator_uri: $(provisionator-uri)
125-
github_token: $(GitHub.Token)
126-
provisioning_script: $(System.DefaultWorkingDirectory)/external/monodroid/build-tools/provisionator/profile.csx
127-
provisioning_extra_args: -vv
128-
129121
- script: make jenkins V=1 CONFIGURATION=$(XA.Build.Configuration) PREPARE_CI=1 PREPARE_AUTOPROVISION=1 PREPARE_ARGS="--bundle-path=$(System.DefaultWorkingDirectory)"
130122
displayName: make jenkins
131123

build-tools/xaprepare/xaprepare/OperatingSystems/OS.cs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,21 @@ abstract class OS : AppObject
4949
/// <summary>
5050
/// Path to <c>javac</c> (full or relative)
5151
/// </summary>
52-
public string JavaCPath { get; set; } = "javac";
52+
public string JavaCPath { get; set; }
5353

5454
/// <summary>
5555
/// Path to <c>jar</c> (full or relative)
5656
/// </summary>
57-
public string JarPath { get; set; } = "jar";
57+
public string JarPath { get; set; }
5858

5959
/// <summary>
6060
/// Path to <c>java</c> (full or relative)
6161
/// </summary>
62-
public string JavaPath { get; set; } = "java";
62+
public string JavaPath { get; set; }
6363

6464
/// <summary>
65-
/// Full path to Java home, defaults to contents of the <c>JAVA_HOME</c> environment variable or an empty
66-
/// string if the variable isn't present.
65+
/// Full path to Java home, set via the <c>$(JavaSdkDirectory)</c> MSBuild property or defaults to
66+
/// <c>$(AndroidToolchainDirectory)/jdk</c>.
6767
/// </summary>
6868
public string JavaHome { get; set; }
6969

@@ -184,7 +184,21 @@ abstract class OS : AppObject
184184
/// Initialize base OS support properties, variables etc. Implementation should perform as little detection of
185185
/// programs etc as possible
186186
/// </summary>
187-
protected abstract bool InitOS ();
187+
protected virtual bool InitOS ()
188+
{
189+
JavaHome = Context.Instance.Properties.GetValue (KnownProperties.JavaSdkDirectory)?.Trim ();
190+
if (String.IsNullOrEmpty (JavaHome)) {
191+
var androidToolchainDirectory = Context.Instance.Properties.GetValue (KnownProperties.AndroidToolchainDirectory)?.Trim ();
192+
JavaHome = Path.Combine (androidToolchainDirectory, "jdk");
193+
}
194+
195+
string extension = IsWindows ? ".exe" : string.Empty;
196+
JavaCPath = Path.Combine (JavaHome, "bin", $"javac{extension}");
197+
JavaPath = Path.Combine (JavaHome, "bin", $"java{extension}");
198+
JarPath = Path.Combine (JavaHome, "bin", $"jar{extension}");
199+
200+
return true;
201+
}
188202

189203
/// <summary>
190204
/// Initialize <see cref="Dependencies"/> for the host OS

build-tools/xaprepare/xaprepare/OperatingSystems/Unix.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ protected Unix (Context context) : base (context)
2020
Architecture = Utilities.GetStringFromStdout ("uname", "-m")?.Trim ();
2121
}
2222

23-
protected override bool InitOS ()
24-
{
25-
JavaHome = Context.Instance.Properties.GetValue (KnownProperties.JavaSdkDirectory);
26-
if (String.IsNullOrEmpty (JavaHome))
27-
JavaHome = Environment.GetEnvironmentVariable ("JAVA_HOME") ?? String.Empty;
28-
29-
return true;
30-
}
31-
3223
protected override void DetectCompilers ()
3324
{
3425
string ccVersion = Utilities.GetStringFromStdout (Configurables.Defaults.DefaultCompiler, "--version");

build-tools/xaprepare/xaprepare/OperatingSystems/Windows.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,9 @@ public override string GetManagedProgramRunner (string programPath)
8787

8888
protected override bool InitOS ()
8989
{
90+
base.InitOS ();
9091
Log.Todo ("gather dependencies here");
9192

92-
JavaHome = Context.Instance.Properties.GetValue ("JavaSdkDirectory")?.Trim ();
93-
if (String.IsNullOrEmpty (JavaHome))
94-
JavaHome = Path.Combine (HomeDirectory, "android-toolchain", "jdk");
95-
96-
JavaCPath = Path.Combine (JavaHome, "bin", "javac.exe");
97-
JavaPath = Path.Combine (JavaHome, "bin", "java.exe");
98-
JarPath = Path.Combine (JavaHome, "bin", "jar.exe");
99-
10093
// This is required by Android SDK which uses a utility to locate Java on Windows
10194
// ($SDK_ROOT/tools/lib/find_java.bat) and that utility, in turn, looks at JAVA_HOME
10295
EnvironmentVariables ["JAVA_HOME"] = JavaHome;

build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ GeneratedFile Get_Configuration_OperatingSystem_props (Context context)
6969
{
7070
const string OutputFileName = "Configuration.OperatingSystem.props";
7171

72-
string javaSdkDirectory = context.Properties.GetValue ("JavaSdkDirectory");
73-
if (String.IsNullOrEmpty (javaSdkDirectory))
74-
javaSdkDirectory = context.OS.JavaHome;
75-
7672
var replacements = new Dictionary<string, string> (StringComparer.Ordinal) {
7773
{ "@OS_NAME@", context.OS.Name ?? String.Empty },
7874
{ "@HOST_OS_FLAVOR@", context.OS.Flavor ?? String.Empty },
@@ -89,7 +85,7 @@ GeneratedFile Get_Configuration_OperatingSystem_props (Context context)
8985
{ "@HOST_CXX32@", context.OS.CXX32 ?? String.Empty },
9086
{ "@HOST_CXX64@", context.OS.CXX64 ?? String.Empty },
9187
{ "@HOST_HOMEBREW_PREFIX@", context.OS.HomebrewPrefix ?? String.Empty },
92-
{ "@JavaSdkDirectory@", javaSdkDirectory ?? String.Empty },
88+
{ "@JavaSdkDirectory@", context.OS.JavaHome },
9389
{ "@javac@", context.OS.JavaCPath },
9490
{ "@java@", context.OS.JavaPath },
9591
{ "@jar@", context.OS.JarPath },

0 commit comments

Comments
 (0)