packages.cake 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. using System.Xml.Linq;
  2. public class Packages
  3. {
  4. public List<NuGetPackSettings> NuspecNuGetSettings { get; private set; }
  5. public FilePath[] NugetPackages { get; private set; }
  6. public FilePath[] BinFiles { get; private set; }
  7. public string NugetPackagesDir {get; private set;}
  8. public string SkiaSharpVersion {get; private set; }
  9. public string SkiaSharpLinuxVersion {get; private set; }
  10. public Dictionary<string, IList<Tuple<string,string>>> PackageVersions{get; private set;}
  11. class DependencyBuilder : List<NuSpecDependency>
  12. {
  13. Packages _parent;
  14. public DependencyBuilder(Packages parent)
  15. {
  16. _parent = parent;
  17. }
  18. string GetVersion(string name)
  19. {
  20. return _parent.PackageVersions[name].First().Item1;
  21. }
  22. public DependencyBuilder Dep(string name, params string[] fws)
  23. {
  24. if(fws.Length == 0)
  25. Add(new NuSpecDependency() { Id = name, Version = GetVersion(name) });
  26. foreach(var fw in fws)
  27. Add(new NuSpecDependency() { Id = name, TargetFramework = fw, Version = GetVersion(name) });
  28. return this;
  29. }
  30. public DependencyBuilder Deps(string[] fws, params string[] deps)
  31. {
  32. foreach(var fw in fws)
  33. foreach(var name in deps)
  34. Add(new NuSpecDependency() { Id = name, TargetFramework = fw, Version = GetVersion(name) });
  35. return this;
  36. }
  37. }
  38. public Packages(ICakeContext context, Parameters parameters)
  39. {
  40. // NUGET NUSPECS
  41. context.Information("Getting git modules:");
  42. var ignoredSubModulesPaths = System.IO.File.ReadAllLines(".git/config").Where(m=>m.StartsWith("[submodule ")).Select(m =>
  43. {
  44. var path = m.Split(' ')[1].Trim("\"[] \t".ToArray());
  45. context.Information(path);
  46. return ((DirectoryPath)context.Directory(path)).FullPath;
  47. }).ToList();
  48. var normalizePath = new Func<string, string>(
  49. path => path.Replace(System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar).ToUpperInvariant());
  50. // Key: Package Id
  51. // Value is Tuple where Item1: Package Version, Item2: The *.csproj/*.props file path.
  52. var packageVersions = new Dictionary<string, IList<Tuple<string,string>>>();
  53. PackageVersions = packageVersions;
  54. System.IO.Directory.EnumerateFiles(((DirectoryPath)context.Directory("./build")).FullPath,
  55. "*.props", SearchOption.AllDirectories).ToList().ForEach(fileName =>
  56. {
  57. if (!ignoredSubModulesPaths.Any(i => normalizePath(fileName).Contains(normalizePath(i))))
  58. {
  59. var xdoc = XDocument.Load(fileName);
  60. foreach (var reference in xdoc.Descendants().Where(x => x.Name.LocalName == "PackageReference"))
  61. {
  62. var name = reference.Attribute("Include").Value;
  63. var versionAttribute = reference.Attribute("Version");
  64. var version = versionAttribute != null
  65. ? versionAttribute.Value
  66. : reference.Elements().First(x=>x.Name.LocalName == "Version").Value;
  67. IList<Tuple<string, string>> versions;
  68. packageVersions.TryGetValue(name, out versions);
  69. if (versions == null)
  70. {
  71. versions = new List<Tuple<string, string>>();
  72. packageVersions[name] = versions;
  73. }
  74. versions.Add(Tuple.Create(version, fileName));
  75. }
  76. }
  77. });
  78. context.Information("Checking installed NuGet package dependencies versions:");
  79. packageVersions.ToList().ForEach(package =>
  80. {
  81. var packageVersion = package.Value.First().Item1;
  82. bool isValidVersion = package.Value.All(x => x.Item1 == packageVersion);
  83. if (!isValidVersion)
  84. {
  85. context.Information("Error: package {0} has multiple versions installed:", package.Key);
  86. foreach (var v in package.Value)
  87. {
  88. context.Information("{0}, file: {1}", v.Item1, v.Item2);
  89. }
  90. throw new Exception("Detected multiple NuGet package version installed for different projects.");
  91. }
  92. });
  93. context.Information("Setting NuGet package dependencies versions:");
  94. var SerilogVersion = packageVersions["Serilog"].FirstOrDefault().Item1;
  95. var SplatVersion = packageVersions["Splat"].FirstOrDefault().Item1;
  96. var SpracheVersion = packageVersions["Sprache"].FirstOrDefault().Item1;
  97. var SystemReactiveVersion = packageVersions["System.Reactive"].FirstOrDefault().Item1;
  98. var SystemValueTupleVersion = packageVersions["System.ValueTuple"].FirstOrDefault().Item1;
  99. SkiaSharpVersion = packageVersions["SkiaSharp"].FirstOrDefault().Item1;
  100. SkiaSharpLinuxVersion = packageVersions["Avalonia.Skia.Linux.Natives"].FirstOrDefault().Item1;
  101. var SharpDXVersion = packageVersions["SharpDX"].FirstOrDefault().Item1;
  102. var SharpDXDirect2D1Version = packageVersions["SharpDX.Direct2D1"].FirstOrDefault().Item1;
  103. var SharpDXDirect3D11Version = packageVersions["SharpDX.Direct3D11"].FirstOrDefault().Item1;
  104. var SharpDXDirect3D9Version = packageVersions["SharpDX.Direct3D9"].FirstOrDefault().Item1;
  105. var SharpDXDXGIVersion = packageVersions["SharpDX.DXGI"].FirstOrDefault().Item1;
  106. context.Information("Package: Serilog, version: {0}", SerilogVersion);
  107. context.Information("Package: Splat, version: {0}", SplatVersion);
  108. context.Information("Package: Sprache, version: {0}", SpracheVersion);
  109. context.Information("Package: System.Reactive, version: {0}", SystemReactiveVersion);
  110. context.Information("Package: System.ValueTuple, version: {0}", SystemValueTupleVersion);
  111. context.Information("Package: SkiaSharp, version: {0}", SkiaSharpVersion);
  112. context.Information("Package: Avalonia.Skia.Linux.Natives, version: {0}", SkiaSharpLinuxVersion);
  113. context.Information("Package: SharpDX, version: {0}", SharpDXVersion);
  114. context.Information("Package: SharpDX.Direct2D1, version: {0}", SharpDXDirect2D1Version);
  115. context.Information("Package: SharpDX.Direct3D11, version: {0}", SharpDXDirect3D11Version);
  116. context.Information("Package: SharpDX.Direct3D9, version: {0}", SharpDXDirect3D9Version);
  117. context.Information("Package: SharpDX.DXGI, version: {0}", SharpDXDXGIVersion);
  118. var nugetPackagesDir = System.Environment.GetEnvironmentVariable("NUGET_HOME")
  119. ?? System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("USERPROFILE") ?? System.Environment.GetEnvironmentVariable("HOME"), ".nuget");
  120. NugetPackagesDir = System.IO.Path.Combine(nugetPackagesDir, "packages");
  121. var SetNuGetNuspecCommonProperties = new Action<NuGetPackSettings> ((nuspec) => {
  122. nuspec.Version = parameters.Version;
  123. nuspec.Authors = new [] { "Avalonia Team" };
  124. nuspec.Owners = new [] { "stevenk" };
  125. nuspec.LicenseUrl = new Uri("http://opensource.org/licenses/MIT");
  126. nuspec.ProjectUrl = new Uri("https://github.com/AvaloniaUI/Avalonia/");
  127. nuspec.RequireLicenseAcceptance = false;
  128. nuspec.Symbols = false;
  129. nuspec.NoPackageAnalysis = true;
  130. nuspec.Description = "The Avalonia UI framework";
  131. nuspec.Copyright = "Copyright 2015";
  132. nuspec.Tags = new [] { "Avalonia" };
  133. });
  134. var coreLibraries = new string[][]
  135. {
  136. new [] { "./src/", "Avalonia.Animation", ".dll" },
  137. new [] { "./src/", "Avalonia.Animation", ".xml" },
  138. new [] { "./src/", "Avalonia.Base", ".dll" },
  139. new [] { "./src/", "Avalonia.Base", ".xml" },
  140. new [] { "./src/", "Avalonia.Controls", ".dll" },
  141. new [] { "./src/", "Avalonia.Controls", ".xml" },
  142. new [] { "./src/", "Avalonia.DesignerSupport", ".dll" },
  143. new [] { "./src/", "Avalonia.DesignerSupport", ".xml" },
  144. new [] { "./src/", "Avalonia.Diagnostics", ".dll" },
  145. new [] { "./src/", "Avalonia.Diagnostics", ".xml" },
  146. new [] { "./src/", "Avalonia.Input", ".dll" },
  147. new [] { "./src/", "Avalonia.Input", ".xml" },
  148. new [] { "./src/", "Avalonia.Interactivity", ".dll" },
  149. new [] { "./src/", "Avalonia.Interactivity", ".xml" },
  150. new [] { "./src/", "Avalonia.Layout", ".dll" },
  151. new [] { "./src/", "Avalonia.Layout", ".xml" },
  152. new [] { "./src/", "Avalonia.Logging.Serilog", ".dll" },
  153. new [] { "./src/", "Avalonia.Logging.Serilog", ".xml" },
  154. new [] { "./src/", "Avalonia.Visuals", ".dll" },
  155. new [] { "./src/", "Avalonia.Visuals", ".xml" },
  156. new [] { "./src/", "Avalonia.Styling", ".dll" },
  157. new [] { "./src/", "Avalonia.Styling", ".xml" },
  158. new [] { "./src/", "Avalonia.ReactiveUI", ".dll" },
  159. new [] { "./src/", "Avalonia.Themes.Default", ".dll" },
  160. new [] { "./src/", "Avalonia.Themes.Default", ".xml" },
  161. new [] { "./src/Markup/", "Avalonia.Markup", ".dll" },
  162. new [] { "./src/Markup/", "Avalonia.Markup", ".xml" },
  163. new [] { "./src/Markup/", "Avalonia.Markup.Xaml", ".dll" },
  164. new [] { "./src/Markup/", "Avalonia.Markup.Xaml", ".xml" }
  165. };
  166. var coreLibrariesFiles = coreLibraries.Select((lib) => {
  167. return (FilePath)context.File(lib[0] + lib[1] + "/bin/" + parameters.DirSuffix + "/netstandard2.0/" + lib[1] + lib[2]);
  168. }).ToList();
  169. var coreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => {
  170. return new NuSpecContent {
  171. Source = file.FullPath, Target = "lib/netstandard2.0"
  172. };
  173. });
  174. var win32CoreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => {
  175. return new NuSpecContent {
  176. Source = file.FullPath, Target = "lib/net45"
  177. };
  178. });
  179. var netcoreappCoreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => {
  180. return new NuSpecContent {
  181. Source = file.FullPath, Target = "lib/netcoreapp2.0"
  182. };
  183. });
  184. var net45RuntimePlatformExtensions = new [] {".xml", ".dll"};
  185. var net45RuntimePlatform = net45RuntimePlatformExtensions.Select(libSuffix => {
  186. return new NuSpecContent {
  187. Source = ((FilePath)context.File("./src/Avalonia.DotNetFrameworkRuntime/bin/" + parameters.DirSuffix + "/net461/Avalonia.DotNetFrameworkRuntime" + libSuffix)).FullPath,
  188. Target = "lib/net45"
  189. };
  190. });
  191. var netCoreRuntimePlatformExtensions = new [] {".xml", ".dll"};
  192. var netCoreRuntimePlatform = netCoreRuntimePlatformExtensions.Select(libSuffix => {
  193. return new NuSpecContent {
  194. Source = ((FilePath)context.File("./src/Avalonia.DotNetCoreRuntime/bin/" + parameters.DirSuffix + "/netcoreapp2.0/Avalonia.DotNetCoreRuntime" + libSuffix)).FullPath,
  195. Target = "lib/netcoreapp2.0"
  196. };
  197. });
  198. var nuspecNuGetSettingsCore = new []
  199. {
  200. ///////////////////////////////////////////////////////////////////////////////
  201. // Avalonia
  202. ///////////////////////////////////////////////////////////////////////////////
  203. new NuGetPackSettings()
  204. {
  205. Id = "Avalonia",
  206. Dependencies = new DependencyBuilder(this)
  207. {
  208. new NuSpecDependency() { Id = "Serilog", Version = SerilogVersion },
  209. new NuSpecDependency() { Id = "Splat", Version = SplatVersion },
  210. new NuSpecDependency() { Id = "Sprache", Version = SpracheVersion },
  211. new NuSpecDependency() { Id = "System.Reactive", Version = SystemReactiveVersion },
  212. //.NET Core
  213. new NuSpecDependency() { Id = "System.Threading.ThreadPool", TargetFramework = "netcoreapp2.0", Version = "4.3.0" },
  214. new NuSpecDependency() { Id = "Microsoft.Extensions.DependencyModel", TargetFramework = "netcoreapp2.0", Version = "1.1.0" },
  215. new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netcoreapp2.0", Version = "1.6.0" },
  216. new NuSpecDependency() { Id = "Splat", TargetFramework = "netcoreapp2.0", Version = SplatVersion },
  217. new NuSpecDependency() { Id = "Serilog", TargetFramework = "netcoreapp2.0", Version = SerilogVersion },
  218. new NuSpecDependency() { Id = "Sprache", TargetFramework = "netcoreapp2.0", Version = SpracheVersion },
  219. new NuSpecDependency() { Id = "System.Reactive", TargetFramework = "netcoreapp2.0", Version = SystemReactiveVersion },
  220. }
  221. .Deps(new string[]{null, "netcoreapp2.0"},
  222. "System.ValueTuple", "System.ComponentModel.TypeConverter", "System.ComponentModel.Primitives",
  223. "System.Runtime.Serialization.Primitives", "System.Xml.XmlDocument", "System.Xml.ReaderWriter")
  224. .ToArray(),
  225. Files = coreLibrariesNuSpecContent
  226. .Concat(win32CoreLibrariesNuSpecContent).Concat(net45RuntimePlatform)
  227. .Concat(netcoreappCoreLibrariesNuSpecContent).Concat(netCoreRuntimePlatform)
  228. .ToList(),
  229. BasePath = context.Directory("./"),
  230. OutputDirectory = parameters.NugetRoot
  231. },
  232. ///////////////////////////////////////////////////////////////////////////////
  233. // Avalonia.HtmlRenderer
  234. ///////////////////////////////////////////////////////////////////////////////
  235. new NuGetPackSettings()
  236. {
  237. Id = "Avalonia.HtmlRenderer",
  238. Dependencies = new []
  239. {
  240. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
  241. },
  242. Files = new []
  243. {
  244. new NuSpecContent { Source = "Avalonia.HtmlRenderer.dll", Target = "lib/netstandard2.0" }
  245. },
  246. BasePath = context.Directory("./src/Avalonia.HtmlRenderer/bin/" + parameters.DirSuffix + "/netstandard2.0"),
  247. OutputDirectory = parameters.NugetRoot
  248. }
  249. };
  250. var nuspecNuGetSettingsMobile = new []
  251. {
  252. ///////////////////////////////////////////////////////////////////////////////
  253. // Avalonia.Android
  254. ///////////////////////////////////////////////////////////////////////////////
  255. new NuGetPackSettings()
  256. {
  257. Id = "Avalonia.Android",
  258. Dependencies = new []
  259. {
  260. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
  261. new NuSpecDependency() { Id = "Avalonia.Skia", Version = parameters.Version }
  262. },
  263. Files = new []
  264. {
  265. new NuSpecContent { Source = "Avalonia.Android.dll", Target = "lib/MonoAndroid10" }
  266. },
  267. BasePath = context.Directory("./src/Android/Avalonia.Android/bin/" + parameters.DirSuffix),
  268. OutputDirectory = parameters.NugetRoot
  269. },
  270. ///////////////////////////////////////////////////////////////////////////////
  271. // Avalonia.iOS
  272. ///////////////////////////////////////////////////////////////////////////////
  273. new NuGetPackSettings()
  274. {
  275. Id = "Avalonia.iOS",
  276. Dependencies = new []
  277. {
  278. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
  279. new NuSpecDependency() { Id = "Avalonia.Skia", Version = parameters.Version }
  280. },
  281. Files = new []
  282. {
  283. new NuSpecContent { Source = "Avalonia.iOS.dll", Target = "lib/Xamarin.iOS10" }
  284. },
  285. BasePath = context.Directory("./src/iOS/Avalonia.iOS/bin/" + parameters.DirSuffixIOS),
  286. OutputDirectory = parameters.NugetRoot
  287. }
  288. };
  289. var nuspecNuGetSettingsDesktop = new []
  290. {
  291. ///////////////////////////////////////////////////////////////////////////////
  292. // Avalonia.Win32
  293. ///////////////////////////////////////////////////////////////////////////////
  294. new NuGetPackSettings()
  295. {
  296. Id = "Avalonia.Win32",
  297. Dependencies = new []
  298. {
  299. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
  300. },
  301. Files = new []
  302. {
  303. new NuSpecContent { Source = "Avalonia.Win32/bin/" + parameters.DirSuffix + "/Avalonia.Win32.dll", Target = "lib/net45" },
  304. new NuSpecContent { Source = "Avalonia.Win32.NetStandard/bin/" + parameters.DirSuffix + "/netstandard2.0/Avalonia.Win32.dll", Target = "lib/netstandard2.0" }
  305. },
  306. BasePath = context.Directory("./src/Windows"),
  307. OutputDirectory = parameters.NugetRoot
  308. },
  309. ///////////////////////////////////////////////////////////////////////////////
  310. // Avalonia.Direct2D1
  311. ///////////////////////////////////////////////////////////////////////////////
  312. new NuGetPackSettings()
  313. {
  314. Id = "Avalonia.Direct2D1",
  315. Dependencies = new []
  316. {
  317. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
  318. new NuSpecDependency() { Id = "SharpDX", Version = SharpDXVersion },
  319. new NuSpecDependency() { Id = "SharpDX.Direct2D1", Version = SharpDXDirect2D1Version },
  320. new NuSpecDependency() { Id = "SharpDX.Direct3D11", Version = SharpDXDirect3D11Version },
  321. new NuSpecDependency() { Id = "SharpDX.DXGI", Version = SharpDXDXGIVersion }
  322. },
  323. Files = new []
  324. {
  325. new NuSpecContent { Source = "Avalonia.Direct2D1.dll", Target = "lib/netstandard2.0" }
  326. },
  327. BasePath = context.Directory("./src/Windows/Avalonia.Direct2D1/bin/" + parameters.DirSuffix + "/netstandard2.0"),
  328. OutputDirectory = parameters.NugetRoot
  329. },
  330. ///////////////////////////////////////////////////////////////////////////////
  331. // Avalonia.Gtk
  332. ///////////////////////////////////////////////////////////////////////////////
  333. new NuGetPackSettings()
  334. {
  335. Id = "Avalonia.Gtk",
  336. Dependencies = new []
  337. {
  338. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
  339. },
  340. Files = new []
  341. {
  342. new NuSpecContent { Source = "Avalonia.Gtk.dll", Target = "lib/net45" }
  343. },
  344. BasePath = context.Directory("./src/Gtk/Avalonia.Gtk/bin/" + parameters.DirSuffix),
  345. OutputDirectory = parameters.NugetRoot
  346. },
  347. ///////////////////////////////////////////////////////////////////////////////
  348. // Avalonia.Gtk3
  349. ///////////////////////////////////////////////////////////////////////////////
  350. new NuGetPackSettings()
  351. {
  352. Id = "Avalonia.Gtk3",
  353. Dependencies = new []
  354. {
  355. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
  356. },
  357. Files = new []
  358. {
  359. new NuSpecContent { Source = "Avalonia.Gtk3.dll", Target = "lib/netstandard2.0" }
  360. },
  361. BasePath = context.Directory("./src/Gtk/Avalonia.Gtk3/bin/" + parameters.DirSuffix + "/netstandard2.0"),
  362. OutputDirectory = parameters.NugetRoot
  363. },
  364. ///////////////////////////////////////////////////////////////////////////////
  365. // Avalonia.Cairo
  366. ///////////////////////////////////////////////////////////////////////////////
  367. new NuGetPackSettings()
  368. {
  369. Id = "Avalonia.Cairo",
  370. Dependencies = new []
  371. {
  372. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
  373. },
  374. Files = new []
  375. {
  376. new NuSpecContent { Source = "Avalonia.Cairo.dll", Target = "lib/net45" }
  377. },
  378. BasePath = context.Directory("./src/Gtk/Avalonia.Cairo/bin/" + parameters.DirSuffix),
  379. OutputDirectory = parameters.NugetRoot
  380. },
  381. ///////////////////////////////////////////////////////////////////////////////
  382. // Avalonia.Skia
  383. ///////////////////////////////////////////////////////////////////////////////
  384. new NuGetPackSettings()
  385. {
  386. Id = "Avalonia.Skia",
  387. Dependencies = new []
  388. {
  389. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
  390. new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion },
  391. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version, TargetFramework="netcoreapp2.0" },
  392. new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion, TargetFramework="netcoreapp2.0" },
  393. new NuSpecDependency() { Id = "Avalonia.Skia.Linux.Natives", Version = SkiaSharpLinuxVersion, TargetFramework="netcoreapp2.0" },
  394. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version, TargetFramework="net461" },
  395. new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion, TargetFramework="net461" },
  396. new NuSpecDependency() { Id = "Avalonia.Skia.Linux.Natives", Version = SkiaSharpLinuxVersion, TargetFramework="net461" }
  397. },
  398. Files = new []
  399. {
  400. new NuSpecContent { Source = "Avalonia.Skia.dll", Target = "lib/netstandard2.0" }
  401. },
  402. BasePath = context.Directory("./src/Skia/Avalonia.Skia/bin/" + parameters.DirSuffix + "/netstandard2.0"),
  403. OutputDirectory = parameters.NugetRoot
  404. },
  405. ///////////////////////////////////////////////////////////////////////////////
  406. // Avalonia.Desktop
  407. ///////////////////////////////////////////////////////////////////////////////
  408. new NuGetPackSettings()
  409. {
  410. Id = "Avalonia.Desktop",
  411. Dependencies = new []
  412. {
  413. //Full .NET
  414. new NuSpecDependency() { Id = "Avalonia.Direct2D1", TargetFramework="net45", Version = parameters.Version },
  415. new NuSpecDependency() { Id = "Avalonia.Gtk", TargetFramework="net45", Version = parameters.Version },
  416. new NuSpecDependency() { Id = "Avalonia.Cairo", TargetFramework="net45", Version = parameters.Version },
  417. new NuSpecDependency() { Id = "Avalonia.Win32", TargetFramework="net45", Version = parameters.Version },
  418. new NuSpecDependency() { Id = "Avalonia.Skia", TargetFramework="net45", Version = parameters.Version },
  419. new NuSpecDependency() { Id = "Avalonia.Gtk3", TargetFramework="net45", Version = parameters.Version },
  420. //.NET Core
  421. new NuSpecDependency() { Id = "Avalonia.Win32", TargetFramework="netcoreapp2.0", Version = parameters.Version },
  422. new NuSpecDependency() { Id = "Avalonia.Skia", TargetFramework="netcoreapp2.0", Version = parameters.Version },
  423. new NuSpecDependency() { Id = "Avalonia.Gtk3", TargetFramework="netcoreapp2.0", Version = parameters.Version }
  424. },
  425. Files = new NuSpecContent[]
  426. {
  427. new NuSpecContent { Source = "licence.md", Target = "" }
  428. },
  429. BasePath = context.Directory("./"),
  430. OutputDirectory = parameters.NugetRoot
  431. },
  432. new NuGetPackSettings()
  433. {
  434. Id = "Avalonia.Win32.Interoperability",
  435. Dependencies = new []
  436. {
  437. new NuSpecDependency() { Id = "Avalonia.Win32", Version = parameters.Version },
  438. new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = parameters.Version },
  439. new NuSpecDependency() { Id = "SharpDX.Direct3D9", Version = SharpDXDirect3D9Version },
  440. },
  441. Files = new []
  442. {
  443. new NuSpecContent { Source = "Avalonia.Win32.Interop/bin/" + parameters.DirSuffix + "/Avalonia.Win32.Interop.dll", Target = "lib/net45" }
  444. },
  445. BasePath = context.Directory("./src/Windows"),
  446. OutputDirectory = parameters.NugetRoot
  447. },
  448. ///////////////////////////////////////////////////////////////////////////////
  449. // Avalonia.LinuxFramebuffer
  450. ///////////////////////////////////////////////////////////////////////////////
  451. new NuGetPackSettings()
  452. {
  453. Id = "Avalonia.LinuxFramebuffer",
  454. Dependencies = new []
  455. {
  456. new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
  457. new NuSpecDependency() { Id = "Avalonia.Skia", Version = parameters.Version }
  458. },
  459. Files = new []
  460. {
  461. new NuSpecContent { Source = "Avalonia.LinuxFramebuffer/bin/" + parameters.DirSuffix + "/netstandard2.0/Avalonia.LinuxFramebuffer.dll", Target = "lib/netstandard2.0" }
  462. },
  463. BasePath = context.Directory("./src/Linux/"),
  464. OutputDirectory = parameters.NugetRoot
  465. }
  466. };
  467. NuspecNuGetSettings = new List<NuGetPackSettings>();
  468. NuspecNuGetSettings.AddRange(nuspecNuGetSettingsCore);
  469. NuspecNuGetSettings.AddRange(nuspecNuGetSettingsDesktop);
  470. NuspecNuGetSettings.AddRange(nuspecNuGetSettingsMobile);
  471. NuspecNuGetSettings.ForEach((nuspec) => SetNuGetNuspecCommonProperties(nuspec));
  472. NugetPackages = NuspecNuGetSettings.Select(nuspec => {
  473. return nuspec.OutputDirectory.CombineWithFilePath(string.Concat(nuspec.Id, ".", nuspec.Version, ".nupkg"));
  474. }).ToArray();
  475. BinFiles = NuspecNuGetSettings.SelectMany(nuspec => {
  476. return nuspec.Files.Select(file => {
  477. return ((DirectoryPath)nuspec.BasePath).CombineWithFilePath(file.Source);
  478. });
  479. }).GroupBy(f => f.FullPath).Select(g => g.First()).ToArray();
  480. }
  481. }