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

Commit c91b58d

Browse files
committed
Use new build script bootstrapper
1 parent fb97101 commit c91b58d

File tree

5 files changed

+25
-346
lines changed

5 files changed

+25
-346
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ Resource.designer.cs
2727
component.yaml
2828
Details.md
2929
/generated.targets
30+
*.commit

build.cake

Lines changed: 8 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
#tool nuget:?package=ILRepack&version=2.0.10
2-
#tool nuget:?package=XamarinComponent&version=1.1.0.49
3-
#tool nuget:?package=Cake.MonoApiTools&version=1.0.10
4-
#tool nuget:?package=Microsoft.DotNet.BuildTools.GenAPI&version=1.0.0-beta-00081
5-
6-
#addin nuget:?package=Cake.Compression&version=0.1.2
7-
#addin nuget:?package=Cake.Json&version=1.0.2.13
8-
#addin nuget:?package=Cake.XCode&version=2.0.13
9-
#addin nuget:?package=Cake.Xamarin&version=1.3.0.15
10-
#addin nuget:?package=Cake.Xamarin.Build&version=2.0.18
11-
#addin nuget:?package=Cake.FileHelpers&version=1.0.4
12-
#addin nuget:?package=Cake.MonoApiTools&version=1.0.10
1+
// Loads our list of addins from the tools folder
2+
// this assumes using the new bootstrapper build.sh in the root folder
3+
// which downloads the required files
4+
#load "./tools/addins.cake"
135

146
// From Cake.Xamarin.Build, dumps out versions of things
157
LogSystemInfo ();
@@ -286,7 +278,7 @@ Task ("merge").IsDependentOn ("libs").Does (() =>
286278
CopyAttrs = true,
287279
AllowMultiple = true,
288280
//TargetKind = ILRepack.TargetKind.Dll,
289-
Libs = new List<FilePath> {
281+
Libs = new List<DirectoryPath> {
290282
MONODROID_PATH
291283
},
292284
});
@@ -308,93 +300,6 @@ Task ("component-setup").Does (() =>
308300
}
309301
});
310302

311-
Task ("nuget-setup").IsDependentOn ("buildtasks").IsDependentOn ("externals")
312-
.Does (() =>
313-
{
314-
315-
Action<FilePath, FilePath> mergeTargetsFiles = (FilePath fromFile, FilePath intoFile) =>
316-
{
317-
// Load the doc to append to, and the doc to append
318-
var xOrig = System.Xml.Linq.XDocument.Load (MakeAbsolute(intoFile).FullPath);
319-
System.Xml.Linq.XNamespace nsOrig = xOrig.Root.Name.Namespace;
320-
var xMerge = System.Xml.Linq.XDocument.Load (MakeAbsolute(fromFile).FullPath);
321-
System.Xml.Linq.XNamespace nsMerge = xMerge.Root.Name.Namespace;
322-
// Add all the elements under <Project> into the existing file's <Project> node
323-
foreach (var xItemToAdd in xMerge.Element (nsMerge + "Project").Elements ())
324-
xOrig.Element (nsOrig + "Project").Add (xItemToAdd);
325-
326-
xOrig.Save (MakeAbsolute (intoFile).FullPath);
327-
};
328-
329-
var templateText = FileReadText ("./template.targets");
330-
331-
var nugetArtifacts = ARTIFACTS.ToList ();
332-
nugetArtifacts.Add (new ArtifactInfo (SUPPORT_PKG_NAME, "support-v4", "Xamarin.Android.Support.v4", AAR_VERSION, NUGET_VERSION, COMPONENT_VERSION));
333-
334-
foreach (var art in nugetArtifacts) {
335-
336-
var proguardFile = new FilePath(string.Format("./externals/{0}/proguard.txt", art.ArtifactId));
337-
338-
var targetsText = templateText;
339-
var targetsFile = new FilePath(string.Format ("{0}/nuget/{1}.targets", art.ArtifactId, art.NugetId));
340-
FileWriteText (targetsFile, targetsText);
341-
342-
// Transform all .targets files
343-
var xTargets = System.Xml.Linq.XDocument.Load (MakeAbsolute(targetsFile).FullPath);
344-
System.Xml.Linq.XNamespace nsTargets = xTargets.Root.Name.Namespace;
345-
346-
if (FileExists (proguardFile)) {
347-
var projElem = xTargets.Element(nsTargets + "Project");
348-
349-
Information ("Adding {0} to {1}", "proguard.txt", targetsFile);
350-
351-
projElem.Add (new System.Xml.Linq.XElement (nsTargets + "ItemGroup",
352-
new System.Xml.Linq.XElement (nsTargets + "ProguardConfiguration",
353-
new System.Xml.Linq.XAttribute ("Include", "$(MSBuildThisFileDirectory)..\\..\\proguard\\proguard.txt"))));
354-
}
355-
356-
xTargets.Save (MakeAbsolute(targetsFile).FullPath);
357-
358-
// Check for an existing .targets file in this nuget package
359-
// we need to merge the generated one with it if it exists
360-
// nuget only allows one automatic .targets file in the build/ folder
361-
// of the nuget package, which must be named {nuget-package-id}.targets
362-
// so we need to merge them all into one
363-
var mergeFile = new FilePath (art.ArtifactId + "/nuget/merge.targets");
364-
365-
if (FileExists (mergeFile)) {
366-
Information ("merge.targets found, merging into generated file...");
367-
mergeTargetsFiles (mergeFile, targetsFile);
368-
}
369-
370-
371-
// Transform all template.nuspec files
372-
var nuspecText = FileReadText(art.ArtifactId + "/nuget/template.nuspec");
373-
var nuspecFile = new FilePath(art.ArtifactId + "/nuget/" + art.NugetId + ".nuspec");
374-
FileWriteText(nuspecFile, nuspecText);
375-
var xNuspec = System.Xml.Linq.XDocument.Load (MakeAbsolute(nuspecFile).FullPath);
376-
System.Xml.Linq.XNamespace nsNuspec = xNuspec.Root.Name.Namespace;
377-
378-
// Check if we have a proguard.txt file for this artifact and include it in the nuspec if so
379-
if (FileExists (proguardFile)) {
380-
Information ("Adding {0} to {1}", "proguard.txt", nuspecFile);
381-
var filesElems = xNuspec.Root.Descendants (nsNuspec + "files");
382-
383-
if (filesElems != null) {
384-
var filesElem = filesElems.First();
385-
filesElem.Add (new System.Xml.Linq.XElement (nsNuspec + "file",
386-
new System.Xml.Linq.XAttribute(nsNuspec + "src", proguardFile.ToString()),
387-
new System.Xml.Linq.XAttribute(nsNuspec + "target", "proguard/proguard.txt")));
388-
}
389-
}
390-
391-
xNuspec.Save(MakeAbsolute(nuspecFile).FullPath);
392-
}
393-
});
394-
395-
Task ("nuget").IsDependentOn ("nuget-setup").IsDependentOn ("nuget-base").IsDependentOn ("libs");
396-
//Task ("nuget").IsDependentOn ("nuget-base").IsDependentOn ("libs");
397-
398303
Task ("component").IsDependentOn ("component-docs").IsDependentOn ("component-setup").IsDependentOn ("component-base").IsDependentOn ("libs");
399304

400305
Task ("clean").IsDependentOn ("clean-base").Does (() =>
@@ -477,7 +382,7 @@ Task ("component-docs").Does (() =>
477382
});
478383

479384
//Task ("libs").IsDependentOn ("nuget-setup").IsDependentOn ("genapi").IsDependentOn ("libs-base");
480-
Task ("libs").IsDependentOn ("genapi").IsDependentOn ("libs-base");
385+
Task ("libs").IsDependentOn("buildtasks").IsDependentOn ("genapi").IsDependentOn ("libs-base");
481386
//Task ("libs").IsDependentOn ("libs-base");
482387

483388
Task ("genapi").IsDependentOn ("libs-base").IsDependentOn ("externals").Does (() => {
@@ -515,7 +420,7 @@ Task ("genapi").IsDependentOn ("libs-base").IsDependentOn ("externals").Does (()
515420
});
516421
}
517422

518-
DotNetBuild ("./AndroidSupport.TypeForwarders.sln", c => c.Configuration = BUILD_CONFIG);
423+
MSBuild ("./AndroidSupport.TypeForwarders.sln", c => c.Configuration = BUILD_CONFIG);
519424

520425
CopyFile ("./support-v4/source/bin/" + BUILD_CONFIG + "/Xamarin.Android.Support.v4.dll", "./output/Xamarin.Android.Support.v4.dll");
521426
});
@@ -524,7 +429,7 @@ Task ("buildtasks").Does (() =>
524429
{
525430
NuGetRestore ("./support-vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj");
526431

527-
DotNetBuild ("./support-vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj", c => c.Configuration = BUILD_CONFIG);
432+
MSBuild ("./support-vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj", c => c.Configuration = BUILD_CONFIG);
528433
});
529434

530435

build.ps1

Lines changed: 0 additions & 147 deletions
This file was deleted.

0 commit comments

Comments
 (0)