Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 9566c4e

Browse files
committed
Merge branch 'mattleibow/ci-merge-gen' into AndroidX
2 parents 22db002 + 3b8ed0b commit 9566c4e

16 files changed

+3269
-22
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ docs/
99
generated/
1010
**/scriptcs_packages/
1111
tmp/
12+
util/binderator/
1213

1314
*.xam
1415
*.DS_Store
@@ -33,5 +34,3 @@ Details.md
3334
*.commit
3435
cake.sh
3536
**/.mfractor/**
36-
37-
util/

azure-pipelines.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
displayName: 'Build NuGets'
2929
# Publish the artifacts
3030
- task: PublishBuildArtifacts@1
31-
displayName: 'Publish Unsigned NuGets'
31+
displayName: 'Publish unsigned artifacts'
3232
inputs:
3333
pathToPublish: '$(Build.SourcesDirectory)/output'
3434
artifactName: 'nuget'
@@ -41,6 +41,12 @@ jobs:
4141
# Build the libraries and packages
4242
- powershell: .\build.ps1 --target=ci --settings_skipverification=true --verbosity=$(VERBOSITY)
4343
displayName: 'Build everything'
44+
# Publish the artifacts
45+
- task: PublishBuildArtifacts@1
46+
displayName: 'Publish Windows artifacts'
47+
inputs:
48+
pathToPublish: '$(Build.SourcesDirectory)/output'
49+
artifactName: 'windows_output'
4450

4551
# only sign the packages when running on Windows, and using the private server which has the certificates
4652
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:

build.cake

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// Tools needed by cake addins
2-
#tool nuget:?package=ILRepack&version=2.0.13
32
#tool nuget:?package=Cake.MonoApiTools&version=3.0.1
4-
//#tool nuget:?package=Microsoft.DotNet.BuildTools.GenAPI&version=1.0.0-beta-00081
53
#tool nuget:?package=vswhere
64

75
// Cake Addins
@@ -45,8 +43,11 @@ if (IsRunningOnWindows ()) {
4543
}
4644
var MONODROID_PATH = MONODROID_BASE_PATH.Combine(ANDROID_SDK_VERSION);
4745

46+
var ANDROIDX_MAPPER_EXE = MakeAbsolute ((FilePath)$"util/AndroidXMapper/AndroidXMapper/bin/{BUILD_CONFIG}/net47/AndroidXMapper.exe");
47+
4848
Information ("MONODROID_BASE_PATH: {0}", MONODROID_BASE_PATH);
4949
Information ("MONODROID_PATH: {0}", MONODROID_PATH);
50+
Information ("ANDROIDX_MAPPER_EXE: {0}", ANDROIDX_MAPPER_EXE);
5051

5152
// You shouldn't have to configure anything below here
5253
// ######################################################
@@ -159,8 +160,6 @@ Task("samples")
159160
});
160161
});
161162

162-
Task("nuget-fat");
163-
164163
Task("nuget-validation")
165164
.Does(() =>
166165
{
@@ -201,6 +200,18 @@ Task("nuget-validation")
201200

202201
});
203202

203+
Task ("androidxmapper")
204+
.Does (() =>
205+
{
206+
MSBuild (
207+
"./util/AndroidXMapper/AndroidXMapper.sln", c => {
208+
c.Configuration = BUILD_CONFIG;
209+
c.MaxCpuCount = 0;
210+
c.Verbosity = VERBOSITY;
211+
c.Restore = true;
212+
});
213+
});
214+
204215
Task ("diff")
205216
.IsDependentOn ("merge")
206217
.Does (() =>
@@ -210,6 +221,7 @@ Task ("diff")
210221
MONODROID_PATH,
211222
};
212223

224+
EnsureDirectoryExists("./output/");
213225
MonoApiInfo ("./output/AndroidX.Merged.dll", "./output/api-info.xml", new MonoApiInfoToolSettings {
214226
SearchPaths = SEARCH_DIRS
215227
});
@@ -224,32 +236,46 @@ Task ("diff")
224236
MonoApiMarkdown ("./output/api-info.previous.xml", "./output/api-info.xml", "./output/api-diff.md");
225237
});
226238

227-
Task ("merge")
228-
.IsDependentOn ("libs")
239+
Task ("generate-mapping")
240+
.IsDependentOn ("androidxmapper")
241+
.IsDependentOn ("merge")
242+
.IsDependentOn ("diff")
229243
.Does (() =>
230244
{
231245
EnsureDirectoryExists("./output/");
246+
DownloadFile (BASE_API_INFO_URL, "./output/api-info.previous.xml");
232247

233-
if (FileExists ("./output/AndroidX.Merged.dll"))
234-
DeleteFile ("./output/AndroidX.Merged.dll");
248+
var result = StartProcess(ANDROIDX_MAPPER_EXE,
249+
$"generate -v " +
250+
$" -s " + MakeAbsolute((FilePath)"./output/api-info.previous.xml") +
251+
$" -x " + MakeAbsolute((FilePath)"./output/api-info.xml") +
252+
$" -j " + MakeAbsolute((FilePath)"./util/AndroidXMapper/Resources/androidx-class-mapping.csv") +
253+
$" -m " + MakeAbsolute((FilePath)"./util/AndroidXMapper/Resources/override-mapping.csv") +
254+
$" -o " + MakeAbsolute((FilePath)"./output/androidx-mapping.csv"));
255+
if (result != 0)
256+
throw new Exception($"The androidxmapper failed with error code {result}.");
257+
});
235258

259+
Task ("merge")
260+
.IsDependentOn ("androidxmapper")
261+
.IsDependentOn ("libs")
262+
.Does (() =>
263+
{
236264
var allDlls = GetFiles ($"./generated/*/bin/{BUILD_CONFIG}/{TF_MONIKER}/Xamarin.*.dll");
237-
238265
var mergeDlls = allDlls
239266
.GroupBy(d => new FileInfo(d.FullPath).Name)
240267
.Select(g => g.FirstOrDefault())
241268
.ToList();
242269

243-
Information("Merging: \n - {0}", string.Join("\n - ", mergeDlls));
244-
245-
ILRepack ("./output/AndroidX.Merged.dll", mergeDlls.First(), mergeDlls.Skip(1), new ILRepackSettings {
246-
CopyAttrs = true,
247-
AllowMultiple = true,
248-
//TargetKind = ILRepack.TargetKind.Dll,
249-
Libs = new List<DirectoryPath> {
250-
MONODROID_PATH
251-
},
252-
});
270+
EnsureDirectoryExists("./output/");
271+
var result = StartProcess(ANDROIDX_MAPPER_EXE,
272+
$"merge" +
273+
$" -a {string.Join(" -a ", mergeDlls)} " +
274+
$" -o " + MakeAbsolute((FilePath)"./output/AndroidX.Merged.dll") +
275+
$" -s \"{MONODROID_PATH}\" " +
276+
$" --inject-assemblyname");
277+
if (result != 0)
278+
throw new Exception($"The androidxmapper failed with error code {result}.");
253279
});
254280

255281
Task ("ci-setup")
@@ -300,6 +326,7 @@ Task ("ci")
300326
.IsDependentOn ("binderate")
301327
.IsDependentOn ("nuget")
302328
.IsDependentOn ("nuget-validation")
329+
.IsDependentOn ("generate-mapping")
303330
.IsDependentOn ("diff")
304331
.IsDependentOn ("samples");
305332

0 commit comments

Comments
 (0)