public static FilePath AndroidPackage (this ICakeContext context, FilePath projectFile, bool sign = false, Action<DotNetBuildSettings> configurator = null)
{
var target = sign ? "SignAndroidPackage" : "PackageForAndroid";
if (!context.FileSystem.Exist (projectFile))
throw new CakeException ("Project File Not Found: " + projectFile.FullPath);
context.DotNetBuild (projectFile, c => {
c.Configuration = "Release";
c.Targets.Add (target);
// Pass along configuration to user for further changes
if (configurator != null)
configurator (c);
});
var searchPattern = projectFile.GetDirectory () + (sign ? "/**/*-Signed.apk" : "/**/*.apk");
// Use the globber to find any .apk files within the tree
return context.Globber
.GetFiles (searchPattern)
.OrderBy (f => new FileInfo (f.FullPath).LastWriteTimeUtc)
.FirstOrDefault ();
}