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
24 changes: 17 additions & 7 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ variables:
InstallerArtifactName: installers
TestAssembliesArtifactName: test-assemblies
NUnitConsoleVersion: 3.9.0
DotNetCoreVersion: 2.1.701
HostedWinVS2019: Hosted Windows 2019 with VS2019
VSEngWinVS2019: VSEng-MicroBuildVS2019

# Stage and Job "display names" are shortened because they are combined to form the name of the corresponding GitHub check.
stages:
Expand Down Expand Up @@ -54,9 +56,9 @@ stages:
submodules: recursive

- task: UseDotNet@2
displayName: install .NET Core 2.1.701
displayName: install .NET Core $(DotNetCoreVersion)
inputs:
version: 2.1.701
version: $(DotNetCoreVersion)

# Update Mono in a separate step since xaprepare uses it as well and it will crash when Mono it runs with is updated
# The 'prepare' step creates the bundle
Expand Down Expand Up @@ -103,9 +105,9 @@ stages:
submodules: recursive

- task: UseDotNet@2
displayName: install .NET Core 2.1.701
displayName: install .NET Core $(DotNetCoreVersion)
inputs:
version: 2.1.701
version: $(DotNetCoreVersion)

- task: DownloadPipelineArtifact@1
inputs:
Expand Down Expand Up @@ -198,13 +200,15 @@ stages:
- job: queue_vsix_signing
displayName: Queue Vsix Signing
dependsOn: mac_build_create_installers
pool: $(XA.Build.Win.Pool)
pool: $(VSEngWinVS2019)
condition: and(eq(dependencies.mac_build_create_installers.result, 'Succeeded'), eq(variables['XA.Commercial.Build'], 'true'), ne(variables['Build.Reason'], 'PullRequest'))
timeoutInMinutes: 45
cancelTimeoutInMinutes: 1
workspace:
clean: all
steps:
- task: xamops.azdevex.lingering-process-task.lingering-process-task@1

- task: JenkinsQueueJob@2
displayName: xamarin vsix codesign - run jenkins job
inputs:
Expand All @@ -226,7 +230,7 @@ stages:
jobs:
- job: win_build_test
displayName: Build and Test
pool: $(XA.Build.Win.Pool)
pool: $(VSEngWinVS2019)
timeoutInMinutes: 360
cancelTimeoutInMinutes: 5
workspace:
Expand All @@ -235,11 +239,17 @@ stages:
AndroidTargetAbiArgs: >-
/p:AndroidSupportedTargetJitAbis=armeabi-v7a:arm64-v8a:x86:x86_64
/p:AndroidSupportedTargetAotAbis=armeabi-v7a:arm64:x86:x86_64:win-armeabi-v7a:win-arm64:win-x86:win-x86_64
JAVA_HOME: '%HOMEDRIVE%%HOMEPATH%\android-toolchain\jdk'
steps:
- checkout: self
submodules: recursive

- task: xamops.azdevex.lingering-process-task.lingering-process-task@1

- task: UseDotNet@2
displayName: install .NET Core $(DotNetCoreVersion)
inputs:
version: $(DotNetCoreVersion)

- task: DownloadPipelineArtifact@1
inputs:
artifactName: $(BundleArtifactName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ steps:
displayName: install xaprepare dependencies

- task: UseDotNet@2
displayName: install .NET Core 2.1.701
displayName: install .NET Core $(DotNetCoreVersion)
inputs:
version: 2.1.701
version: $(DotNetCoreVersion)

# Restore solutions for Xamarin.Android.Tools.sln, Xamarin.Android.sln, and Xamarin.Android-Tests.sln
- task: NuGetCommand@2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,6 @@ protected override void OnCreate (Bundle bundle)
};
var path = Path.Combine ("temp", TestContext.CurrentContext.Test.Name);
using (var builder = CreateDllBuilder (Path.Combine (path, netStandardProject.ProjectName), cleanupOnDispose: false)) {
if (!Directory.Exists (builder.MicrosoftNetSdkDirectory))
Assert.Fail ($"Microsoft.NET.Sdk not found: {builder.MicrosoftNetSdkDirectory}");
using (var ab = CreateApkBuilder (Path.Combine (path, app.ProjectName), cleanupOnDispose: false)) {
builder.RequiresMSBuild =
ab.RequiresMSBuild = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class Builder : IDisposable
{
const string SigSegvError = "Got a SIGSEGV while executing native code";
const string ConsoleLoggerError = "[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: is negative";
static string frameworkSDKRoot = null;

string root;
string buildLogFullPath;
Expand Down Expand Up @@ -117,30 +116,6 @@ public string FrameworkLibDirectory {
}
}

public string MicrosoftNetSdkDirectory {
get {
string path;
if (IsUnix) {
path = FindLatestDotNetSdk (frameworkSDKRoot);
if (!string.IsNullOrEmpty (path))
return path;

return string.Empty;
}
var visualStudioDirectory = TestEnvironment.GetVisualStudioDirectory ();
if (!string.IsNullOrEmpty (visualStudioDirectory)) {
path = Path.Combine (visualStudioDirectory, "MSBuild", "Sdks", "Microsoft.NET.Sdk");
if (File.Exists (Path.Combine (path, "Sdk", "Sdk.props")))
return path;
}
var x86 = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86);
path = Path.Combine (x86, "MSBuild", "Sdks", "Microsoft.NET.Sdk");
if (File.Exists (Path.Combine (path, "Sdk", "Sdk.props")))
return path;
return string.Empty;
}
}

public bool CrossCompilerAvailable (string supportedAbis)
{
var crossCompilerLookup = new Dictionary<string, string> {
Expand Down Expand Up @@ -269,31 +244,6 @@ public Builder ()
BuildLogFile = "build.log";
Console.WriteLine ($"Using {XABuildExe}");
Console.WriteLine ($"Using {(RunningMSBuild ? "msbuild" : "xbuild")}");
if (IsUnix && string.IsNullOrEmpty (frameworkSDKRoot)) {
var psi = new ProcessStartInfo ("msbuild") {
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
WorkingDirectory = Root,
Arguments = $" {Path.Combine (Root, "FrameworkPath.targets")} /v:minimal /nologo",
};
using (var process = Process.Start (psi)) {
process.WaitForExit ();
frameworkSDKRoot = process.StandardOutput.ReadToEnd ().Trim ();
}

//NOTE: some machines aren't returning /msbuild/ on the end
// macOS should be /Library/Frameworks/Mono.framework/Versions/5.18.0/lib/mono/msbuild/
var dir = Path.GetFileName (frameworkSDKRoot.TrimEnd (Path.DirectorySeparatorChar));
if (dir != "msbuild") {
var path = Path.Combine (frameworkSDKRoot, "msbuild");
if (Directory.Exists (path))
frameworkSDKRoot = path;
}
}
if (!string.IsNullOrEmpty (frameworkSDKRoot))
Console.WriteLine ($"Using $(FrameworkSDKRoot): {frameworkSDKRoot}");
}

public void Dispose ()
Expand Down Expand Up @@ -499,34 +449,6 @@ string QuoteFileName (string fileName)
return fileName.Contains (" ") ? $"\"{fileName}\"" : fileName;
}

string FindLatestDotNetSdk (string dotNetPath)
{
if (Directory.Exists (dotNetPath)) {
Version latest = new Version (0,0);
string Sdk = null;
foreach (var dir in Directory.EnumerateDirectories (dotNetPath)) {
var version = GetVersionFromDirectory (dir);
var sdksDir = Path.Combine (dir, "Sdks");
if (!Directory.Exists (sdksDir))
sdksDir = Path.Combine (dir, "bin", "Sdks");
if (version != null && version > latest) {
if (Directory.Exists (sdksDir) && File.Exists (Path.Combine (sdksDir, "Microsoft.NET.Sdk", "Sdk", "Sdk.props"))) {
latest = version;
Sdk = Path.Combine (sdksDir, "Microsoft.NET.Sdk");
}
}
}
return Sdk;
}
return null;
}

static Version GetVersionFromDirectory (string dir)
{
Version v;
Version.TryParse (Path.GetFileName (dir), out v);
return v;
}
}
}

5 changes: 1 addition & 4 deletions src/java-runtime/java-runtime.targets
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,9 @@
AfterTargets="Build"
Inputs="@(_RuntimeOutput->'%(Identity)')"
Outputs="@(_RuntimeOutput->'%(OutputDex)')">
<PropertyGroup>
<_JavaHome Condition=" '$(JAVA_HOME)' == '' And '$(JavaSdkDirectory)' != '' ">JAVA_HOME=$(JavaSdkDirectory)</_JavaHome>
</PropertyGroup>
<Exec
Command="&quot;$(AndroidSdkDirectory)\build-tools\$(XABuildToolsFolder)\dx&quot; --dex --no-strict --output=&quot;%(_RuntimeOutput.OutputDex)&quot; &quot;%(_RuntimeOutput.OutputJar)&quot;"
EnvironmentVariables="$(_JavaHome)"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory)"
/>
</Target>
</Project>