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

Commit 8b1e032

Browse files
committed
Merge master changes back in
1 parent 77c2749 commit 8b1e032

File tree

1 file changed

+66
-50
lines changed

1 file changed

+66
-50
lines changed

build.cake

Lines changed: 66 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#addin nuget:?package=Cake.Yaml&version=2.0.0
2222
#addin nuget:?package=Cake.Xamarin&version=2.0.1
2323
#addin nuget:?package=Cake.XCode&version=3.0.0
24-
#addin nuget:?package=Cake.Xamarin.Build&version=3.0.3
24+
#addin nuget:?package=Cake.Xamarin.Build&version=3.0.6
2525
#addin nuget:?package=Cake.Compression&version=0.1.4
2626
#addin nuget:?package=Cake.Android.SdkManager&version=2.0.1
2727
#addin nuget:?package=Cake.Android.Adb&version=2.0.4
@@ -71,7 +71,7 @@ var REFERENCE_DOCS_URL = "https://developer.android.com/reference/";
7171
var REFERENCE_DOCS_PACKAGELIST_URL = REFERENCE_DOCS_URL + "android/support/package-list";
7272

7373
// We grab the previous release's api-info.xml to use as a comparison for this build's generated info to make an api-diff
74-
var BASE_API_INFO_URL = "https://github.com/xamarin/AndroidSupportComponents/releases/download/26.1.0/api-info.xml";
74+
var BASE_API_INFO_URL = EnvironmentVariable("MONO_API_INFO_XML_URL") ?? "https://github.com/xamarin/AndroidSupportComponents/releases/download/26.1.0/api-info.xml";
7575

7676
var CPU_COUNT = 1;
7777
var USE_MSBUILD_ON_MAC = true;
@@ -324,7 +324,9 @@ Task ("diff")
324324
"./output/AndroidSupport.api-diff.html");
325325
});
326326

327-
Task ("merge").IsDependentOn ("libs").Does (() =>
327+
Task ("merge")
328+
.IsDependentOn ("libs")
329+
.Does (() =>
328330
{
329331
if (FileExists ("./output/AndroidSupport.Merged.dll"))
330332
DeleteFile ("./output/AndroidSupport.Merged.dll");
@@ -342,29 +344,10 @@ Task ("merge").IsDependentOn ("libs").Does (() =>
342344
});
343345
});
344346

345-
346-
Task ("component-setup").Does (() =>
347-
{
348-
var yamls = GetFiles ("./**/component/component.template.yaml");
349-
350-
foreach (var yaml in yamls) {
351-
var manifestTxt = FileReadText (yaml)
352-
.Replace ("$nuget-version$", NUGET_VERSION)
353-
.Replace ("$version$", COMPONENT_VERSION);
354-
355-
var newYaml = yaml.GetDirectory ().CombineWithFilePath ("component.yaml");
356-
357-
FileWriteText (newYaml, manifestTxt);
358-
}
359-
});
360-
361-
362347
Task ("nuget-setup")
363-
.IsDependentOn ("externals")
364348
.IsDependentOn ("buildtasks")
365349
.Does (() =>
366350
{
367-
368351
Action<FilePath, FilePath> mergeTargetsFiles = (FilePath fromFile, FilePath intoFile) =>
369352
{
370353
// Load the doc to append to, and the doc to append
@@ -420,7 +403,6 @@ Task ("nuget-setup")
420403
mergeTargetsFiles (mergeFile, targetsFile);
421404
}
422405

423-
424406
// Transform all template.nuspec files
425407
var nuspecText = FileReadText(art.PathPrefix + art.ArtifactId + "/nuget/template.nuspec");
426408
//nuspecText = nuspecText.Replace ("$xbdversion$", XBD_VERSION);
@@ -446,34 +428,18 @@ Task ("nuget-setup")
446428
}
447429
});
448430

449-
Task ("nuget")
450-
.IsDependentOn ("libs")
451-
.IsDependentOn ("nuget-setup")
452-
.IsDependentOn ("nuget-base");
453-
454-
Task ("ci")
455-
.IsDependentOn ("ci-setup")
456-
.IsDependentOn ("diff")
457-
.IsDependentOn ("component");
458-
459-
Task ("component")
460-
.IsDependentOn ("libs")
461-
.IsDependentOn ("component-docs")
462-
.IsDependentOn ("component-setup")
463-
.IsDependentOn ("component-base");
464-
465431
Task ("clean")
466432
.IsDependentOn ("clean-base")
467433
.Does (() =>
468434
{
469-
if (FileExists ("./generated.targets"))
470-
DeleteFile ("./generated.targets");
435+
var yamls = GetFiles ("./**/component/component.template.yaml");
471436

472-
if (DirectoryExists ("./externals"))
473-
DeleteDirectory ("./externals", true);
437+
foreach (var yaml in yamls) {
438+
var manifestTxt = FileReadText (yaml)
439+
.Replace ("$nuget-version$", NUGET_VERSION)
440+
.Replace ("$version$", COMPONENT_VERSION);
474441

475-
CleanDirectories ("./**/packages");
476-
});
442+
var newYaml = yaml.GetDirectory ().CombineWithFilePath ("component.yaml");
477443

478444
Task ("ci-setup")
479445
.WithCriteria (!BuildSystem.IsLocalBuild)
@@ -569,11 +535,6 @@ Task ("component-docs")
569535
}
570536
});
571537

572-
Task ("libs")
573-
.IsDependentOn ("buildtasks")
574-
.IsDependentOn ("genapi")
575-
.IsDependentOn ("libs-base");
576-
577538
Task ("genapi")
578539
.IsDependentOn ("externals")
579540
.IsDependentOn ("libs-base")
@@ -661,6 +622,61 @@ Task ("droiddocs")
661622
}
662623
});
663624

625+
Task ("ci-setup")
626+
.WithCriteria (!BuildSystem.IsLocalBuild)
627+
.Does (() =>
628+
{
629+
var buildCommit = "DEV";
630+
var buildNumber = "DEBUG";
631+
var buildTimestamp = DateTime.UtcNow.ToString ();
632+
633+
if (BuildSystem.IsRunningOnJenkins) {
634+
buildNumber = BuildSystem.Jenkins.Environment.Build.BuildTag;
635+
buildCommit = EnvironmentVariable("GIT_COMMIT") ?? buildCommit;
636+
} else if (BuildSystem.IsRunningOnVSTS) {
637+
buildNumber = BuildSystem.TFBuild.Environment.Build.Number;
638+
buildCommit = BuildSystem.TFBuild.Environment.Repository.SourceVersion;
639+
}
640+
641+
ReplaceTextInFiles("./**/source/**/AssemblyInfo.cs", "{BUILD_COMMIT}", buildCommit);
642+
ReplaceTextInFiles("./**/source/**/AssemblyInfo.cs", "{BUILD_NUMBER}", buildNumber);
643+
ReplaceTextInFiles("./**/source/**/AssemblyInfo.cs", "{BUILD_TIMESTAMP}", buildTimestamp);
644+
});
645+
646+
Task ("clean")
647+
.IsDependentOn ("clean-base")
648+
.Does (() =>
649+
{
650+
if (FileExists ("./generated.targets"))
651+
DeleteFile ("./generated.targets");
652+
653+
if (DirectoryExists ("./externals"))
654+
DeleteDirectory ("./externals", true);
655+
656+
CleanDirectories ("./**/packages");
657+
});
658+
659+
Task ("nuget")
660+
.IsDependentOn ("libs")
661+
.IsDependentOn ("nuget-setup")
662+
.IsDependentOn ("nuget-base");
663+
664+
Task ("component")
665+
.IsDependentOn ("nuget")
666+
.IsDependentOn ("component-docs")
667+
.IsDependentOn ("component-base");
668+
669+
Task ("libs")
670+
.IsDependentOn ("externals")
671+
.IsDependentOn ("nuget-setup")
672+
.IsDependentOn ("libs-base")
673+
.IsDependentOn ("genapi");
674+
675+
Task ("ci")
676+
.IsDependentOn ("ci-setup")
677+
.IsDependentOn ("diff")
678+
.IsDependentOn ("component");
679+
664680
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
665681

666682
RunTarget (TARGET);

0 commit comments

Comments
 (0)