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

Build maui.aar on CI #8943

Merged
merged 13 commits into from
Mar 7, 2023
22 changes: 22 additions & 0 deletions eng/cake/dotnet.cake
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,29 @@ Task("dotnet-buildtasks")
throw exception;
});

Task("android-aar")
.Does(() =>
{
var root = "./src/Core/AndroidNative/";

var gradlew = root + "gradlew";
if (IsRunningOnWindows())
gradlew += ".bat";

var exitCode = StartProcess(
MakeAbsolute((FilePath)gradlew),
new ProcessSettings
{
Arguments = $"createAar --rerun-tasks",
WorkingDirectory = root
});
if (exitCode != 0)
throw new Exception("Gradle failed to build maui.aar: " + exitCode);
});

Task("dotnet-build")
.IsDependentOn("dotnet")
.IsDependentOn("android-aar")
.Description("Build the solutions")
.Does(() =>
{
Expand Down Expand Up @@ -270,6 +291,7 @@ Task("dotnet-test")
});

Task("dotnet-pack-maui")
.IsDependentOn("android-aar")
.WithCriteria(RunPackTarget())
.Does(() =>
{
Expand Down
34 changes: 34 additions & 0 deletions eng/pipelines/common/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ steps:
# Setup JDK Paths
- bash: |
echo "##vso[task.setvariable variable=JI_JAVA_HOME]$(JAVA_HOME_11_X64)"
echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_11_X64)"
displayName: 'Setup JDK Paths'
# Configure VS Mac for Xcode
- bash: |
Expand Down Expand Up @@ -121,6 +122,39 @@ steps:
env:
PROVISIONATOR_CHANNEL: ${{ parameters.provisionatorChannel }}

- pwsh: |
if ($env:JAVA_HOME_11_X64) {
$env:JAVA_HOME = $env:JAVA_HOME_11_X64
} else {
$path = (Get-ChildItem $env:ProgramFiles\Microsoft\jdk-11.*\bin\java.exe) | Select-Object -First 1
if ($path -and (Test-Path $path)) {
$env:JAVA_HOME = $path.Directory.Parent.FullName
}
}
if ($env:JAVA_HOME) {
echo "##vso[task.setvariable variable=JAVA_HOME]$env:JAVA_HOME"
echo "JAVA_HOME set to '$env:JAVA_HOME'"
} else {
echo "Unable to set JAVA_HOME"
}
displayName: 'Setup JDK Paths'

- pwsh: |
if ($env:ANDROID_SDK_ROOT) {
echo "ANDROID_SDK_ROOT already set to '$env:ANDROID_SDK_ROOT'"
} else {
if ((Test-Path "${env:ProgramFiles(x86)}\Android\android-sdk")) {
$env:ANDROID_SDK_ROOT = "${env:ProgramFiles(x86)}\Android\android-sdk"
}
if ($env:ANDROID_SDK_ROOT) {
echo "##vso[task.setvariable variable=ANDROID_SDK_ROOT]$env:ANDROID_SDK_ROOT"
echo "ANDROID_SDK_ROOT set to '$env:ANDROID_SDK_ROOT'"
} else {
echo "Unable to set ANDROID_SDK_ROOT"
}
}
displayName: 'Setup ANDROID_SDK_ROOT Paths'

# Prepare Both
- task: UseDotNet@2 # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops
displayName: 'Use .NET SDK 7'
Expand Down