Skip to content

Commit

Permalink
[ci] Use new DevDiv/android-platform-support repo (#9539)
Browse files Browse the repository at this point in the history
Bumps external components to https://devdiv.visualstudio.com/DevDiv/_git/android-platform-support/commit/cdef164e7eef35128f74fa1f3ecbd7a878953a43

A new android-platform-support Azure Repo has been created in the DevDiv
project containing library code from the xamarin/androidtools,
xamarin/monodroid, and xamarin/android-sdk-installer repos.

The build has been updated to build and package all required closed
source components from the new Azure Repo.
  • Loading branch information
pjcollins authored Nov 24, 2024
1 parent 8068ca2 commit 96b0a73
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .external
Original file line number Diff line number Diff line change
@@ -1 +1 @@
xamarin/monodroid:main@62976287a5392ccc17ffff10bcafdc3cecedc89b
DevDiv/android-platform-support:release/9.0.1xx@c22e86517918f75cdf147b12252361d90c6577bd
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ apk-sizes-*.txt
*.binlog
*.ProjectImports.zip
*~
external/android-platform-support/
external/monodroid/
external/mono/
tests/api-compatibility/reference/*/*.dll
Expand Down
8 changes: 4 additions & 4 deletions build-tools/automation/azure-pipelines-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ resources:
name: xamarin/yaml-templates
ref: refs/heads/main
endpoint: xamarin
- repository: monodroid
type: github
name: xamarin/monodroid
endpoint: xamarin
- repository: android-platform-support
type: git
name: DevDiv/android-platform-support
ref: refs/heads/main
- repository: maui
type: github
name: dotnet/maui
Expand Down
11 changes: 5 additions & 6 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ resources:
name: xamarin/sdk-insertions
ref: refs/heads/main
endpoint: xamarin
- repository: monodroid
type: github
name: xamarin/monodroid
- repository: android-platform-support
type: git
name: DevDiv/android-platform-support
ref: refs/heads/main
endpoint: xamarin
- repository: maui
type: github
name: dotnet/maui
Expand Down Expand Up @@ -90,7 +89,7 @@ extends:
sourceRepositoriesToScan:
include:
- ${{ if ne(variables['System.PullRequest.IsFork'], 'True') }}:
- repository: monodroid
- repository: android-platform-support
exclude:
- repository: yaml-templates
- repository: maui
Expand Down Expand Up @@ -161,7 +160,7 @@ extends:
testName: Mono.Android.NET_Tests-Debug
project: tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj
testResultsFiles: TestResult-Mono.Android.NET_Tests-Debug.xml
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.apk
artifactSource: bin/TestDebug/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.apk
artifactFolder: $(DotNetTargetFramework)-Debug

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
Expand Down
8 changes: 2 additions & 6 deletions build-tools/automation/yaml-templates/build-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,12 @@ stages:
- checkout: maui

- ${{ if ne(variables['System.PullRequest.IsFork'], 'True') }}:
- checkout: monodroid
- checkout: android-platform-support
clean: true
submodules: recursive
path: s/xamarin-android/external/monodroid
path: s/xamarin-android/external/android-platform-support
persistCredentials: true

- script: rm -rf external/monodroid/external/xamarin-android
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-android
displayName: delete external xamarin-android submodule

- script: make prepare-external-git-dependencies PREPARE_CI=1 CONFIGURATION=$(XA.Build.Configuration)
workingDirectory: $(System.DefaultWorkingDirectory)/xamarin-android
displayName: make prepare-external-git-dependencies
Expand Down
19 changes: 2 additions & 17 deletions build-tools/automation/yaml-templates/commercial-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,11 @@ steps:
- checkout: maui

- ${{ if ne(variables['System.PullRequest.IsFork'], 'True') }}:
# Clone 'monodroid' without submodules
- checkout: monodroid
clean: true
path: s/xamarin-android/external/monodroid

# Tell git to ignore the 'xamarin-android' submodule, which is large and unneeded
- script: git config submodule."external/xamarin-android".update none
workingDirectory: xamarin-android/external/monodroid
displayName: Ignore XA submodule

# Clone 'monodroid' with the rest of the submodules
- checkout: monodroid
- checkout: android-platform-support
submodules: recursive
path: s/xamarin-android/external/monodroid
path: s/xamarin-android/external/android-platform-support
persistCredentials: true

- script: rm -rf external/monodroid/external/xamarin-android
workingDirectory: ${{ parameters.xaSourcePath }}
displayName: delete legacy xamarin-android submodule

- script: make prepare-external-git-dependencies PREPARE_CI=1 CONFIGURATION=$(XA.Build.Configuration)
workingDirectory: ${{ parameters.xaSourcePath }}
displayName: make prepare-external-git-dependencies
Expand Down
2 changes: 1 addition & 1 deletion build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<LibExtension Condition=" '$(HostOS)' == 'Windows' ">dll</LibExtension>
<UseCommercialInstallerName Condition="'$(UseCommercialInstallerName)' == ''">False</UseCommercialInstallerName>
<_HasCommercialFiles Condition="Exists('$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Common.Debugging.targets')">True</_HasCommercialFiles>
<_MonoDroidPath Condition=" '$(_MonoDroidPath)' == '' ">..\..\external\monodroid</_MonoDroidPath>
<_MonoDroidPath Condition=" '$(_MonoDroidPath)' == '' ">..\..\external\android-platform-support</_MonoDroidPath>
</PropertyGroup>
<Target Name="_FindFrameworkDirs">
<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions build-tools/scripts/BuildEverything.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ ifeq ($(PREPARE_CI_PR)$(PREPARE_CI),00)
else
$(MAKE) prepare
endif
ifneq ("$(wildcard $(topdir)/external/monodroid/Makefile)","")
cd $(topdir)/external/monodroid && ./configure --with-xamarin-android='$(topdir)'
$(call DOTNET_BINLOG,build-commercial) $(SOLUTION) -t:BuildExternal
ifneq ("$(wildcard $(topdir)/external/android-platform-support/src/Xamarin.Android.Build.Debugging.Tasks/Xamarin.Android.Build.Debugging.Tasks.csproj)","")
$(call SYSTEM_DOTNET_BINLOG,build-commercial,msbuild) $(SOLUTION) -t:BuildExternal
endif
$(MAKE) leeroy

Expand Down
4 changes: 2 additions & 2 deletions build-tools/scripts/DotNet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

<Target Name="BuildExternal">
<Exec
Command="&quot;$(DotNetPreviewTool)&quot; build monodroid.proj -c $(Configuration) -p:XamarinAndroidSourcePath=$(_Root) -p:DebuggingToolsOutputDirectory=$(MicrosoftAndroidSdkOutDir) -p:CompatTargetsOutputDirectory=$(XAInstallPrefix)xbuild/Novell -bl:$(_BinlogPathPrefix)-build-monodroid.binlog"
WorkingDirectory="$(_Root)external\monodroid"
Command="&quot;$(DotNetPreviewTool)&quot; build monodroid.proj -c $(Configuration) -p:XamarinAndroidSourcePath=$(_Root) -p:XAIntegrationBuild=true -bl:$(_BinlogPathPrefix)-build-monodroid.binlog"
WorkingDirectory="$(_Root)external\android-platform-support\build-tools"
/>
</Target>

Expand Down
2 changes: 1 addition & 1 deletion build-tools/scripts/msbuild.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ endef

# $(call DOTNET_BINLOG,name,build=$(DOTNET_VERB),dotnet=$(DOTNET_TOOL))
define DOTNET_BINLOG
$(if $(3),,PATH="$(DOTNET_ROOT):$(PATH)") $(if $(3),$(3),$(DOTNET_TOOL)) $(if $(2),$(2),$(DOTNET_VERB)) -c $(CONFIGURATION) -v:n $(MSBUILD_ARGS) \
$(if $(3),,PATH="$(DOTNET_ROOT):$(PATH)") $(if $(3),$(3),$(DOTNET_TOOL)) $(if $(2),$(2),$(DOTNET_VERB)) -p:Configuration=$(CONFIGURATION) -v:n $(MSBUILD_ARGS) \
-bl:"$(dir $(realpath $(firstword $(MAKEFILE_LIST))))/bin/Build$(CONFIGURATION)/msbuild-`date +%Y%m%dT%H%M%S`-$(1).binlog"
endef

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ protected override async Task<bool> Execute (Context context)
};
foreach (ExternalGitDependency egd in externalDependencies) {
Log.StatusLine ($" {context.Characters.Bullet} {egd.Name}");

var egdUrl = await GetGitHubURL (egd, git);
string destDir = Path.Combine (Configurables.Paths.ExternalGitDepsDestDir, egd.Name);
if (!Directory.Exists (destDir)) {
var egdUrl = await GetGitHubURL (egd, git);
if (egd.Owner == "DevDiv") {
egdUrl = GetDevDivUrl (egd);
}
Log.StatusLine ($" {context.Characters.Link} cloning from {egd.Owner}/{egd.Name}");
if (!await git.Clone (egdUrl, destDir)) {
Log.ErrorLine ($"Failed to clone {egd.Name}");
Expand All @@ -49,22 +51,20 @@ protected override async Task<bool> Execute (Context context)
continue;
}

//
// Commented out for now because we only have monodroid in .external and its submodules are updated
// elsewhere and there's no need to duplicate the (time-consuming) work. However, it might be a good
// idea to re-enable this code for the benefit of future .external additions (and, possibly, monodroid
// itself after its integration code is updated to not initialize submodules)
//
string gitModules = Path.Combine (destDir, ".gitmodules");
if (!Utilities.FileExists (gitModules))
continue;

// string gitModules = Path.Combine (destDir, ".gitmodules");
// if (!Utilities.FileExists (gitModules))
// continue;
Log.StatusLine ($" {context.Characters.Bullet} updating submodules");
if (!await git.SubmoduleUpdate (destDir)) {
Log.ErrorLine ($"Failed to update submodules for {egd.Name}");
failed = true;
}

// Log.StatusLine ($" {context.Characters.Bullet} updating submodules");
// if (!await git.SubmoduleUpdate (destDir)) {
// Log.ErrorLine ($"Failed to update submodules for {egd.Name}");
// failed = true;
// }
if (failed) {
Log.WarningLine ($"If an attempt to clone or update a private repo failed you may need to refresh your credentials."
+ $" Please install https://github.com/microsoft/artifacts-credprovider, or navigate to {egdUrl} and click the 'Generate Git Credentials' button and attempt to clone manually.");
}
}

return !failed;
Expand All @@ -83,5 +83,10 @@ async Task<string> GetGitHubURL (ExternalGitDependency egd, GitRunner git)
}
}
}

string GetDevDivUrl (ExternalGitDependency egd)
{
return $"https://devdiv.visualstudio.com/{egd.Owner}/_git/{egd.Name}";
}
}
}

0 comments on commit 96b0a73

Please sign in to comment.