From 60376ae510c04aa4508365993643d5cec1d2b9f1 Mon Sep 17 00:00:00 2001 From: Trung Nguyen <57174311+trungnt2910@users.noreply.github.com> Date: Sun, 29 May 2022 15:55:50 +0700 Subject: [PATCH] feat: GtkSharp net6 workload (#351) * feat: GtkSharp net6 workload * feat(Workload): GtkSharp template packs * chore: Support .NET SDK 6.0.300 And also changed the build script to target SDK bands. * build: Workload install and uninstall targets --- CakeScripts/TargetEnvironment.cake | 211 ++++++++++++++++++ Source/Directory.Build.props | 12 + Source/Libs/Directory.Build.props | 14 +- Source/Libs/GtkSharp.snk | Bin 0 -> 596 bytes Source/Workload/Directory.Build.props | 22 ++ .../GtkSharp.NET.Sdk.Gtk.csproj | 60 +++++ .../WorkloadManifest.in.json | 39 ++++ .../WorkloadManifest.targets | 7 + .../Workload/GtkSharp.Ref/GtkSharp.Ref.csproj | 20 ++ .../GtkSharp.Runtime/GtkSharp.Runtime.csproj | 20 ++ .../Workload/GtkSharp.Sdk/GtkSharp.Sdk.csproj | 58 +++++ .../Workload/GtkSharp.Sdk/Sdk/Sdk.in.targets | 66 ++++++ .../GtkSharp.Workload.Template.CSharp.csproj | 47 ++++ .../.template.config/template.in.json | 29 +++ .../GtkNamespace.csproj | 15 ++ .../GtkSharp.Application.CSharp/MainWindow.cs | 35 +++ .../MainWindow.glade | 46 ++++ .../GtkSharp.Application.CSharp/Program.cs | 23 ++ .../.template.config/template.json | 33 +++ .../GtkSharp.Dialog.CSharp/Gtk_Dialog.cs | 24 ++ .../GtkSharp.Dialog.CSharp/Gtk_Dialog.glade | 51 +++++ .../.template.config/template.json | 33 +++ .../GtkSharp.Widget.CSharp/Gtk_Widget.cs | 16 ++ .../GtkSharp.Widget.CSharp/Gtk_Widget.glade | 11 + .../.template.config/template.json | 33 +++ .../GtkSharp.Window.CSharp/Gtk_Window.cs | 16 ++ .../GtkSharp.Window.CSharp/Gtk_Window.glade | 11 + .../GtkSharp.Workload.Template.FSharp.csproj | 47 ++++ .../.template.config/template.in.json | 29 +++ .../GtkNamespace.fsproj | 24 ++ .../GtkSharp.Application.FSharp/MainWindow.fs | 24 ++ .../MainWindow.glade | 46 ++++ .../GtkSharp.Application.FSharp/Program.fs | 18 ++ .../.template.config/template.json | 33 +++ .../GtkSharp.Dialog.FSharp/Gtk_Dialog.fs | 13 ++ .../GtkSharp.Dialog.FSharp/Gtk_Dialog.glade | 51 +++++ .../.template.config/template.json | 33 +++ .../GtkSharp.Widget.FSharp/Gtk_Widget.fs | 8 + .../GtkSharp.Widget.FSharp/Gtk_Widget.glade | 11 + .../.template.config/template.json | 33 +++ .../GtkSharp.Window.FSharp/Gtk_Window.fs | 8 + .../GtkSharp.Window.FSharp/Gtk_Window.glade | 11 + .../GtkSharp.Workload.Template.VBNet.csproj | 47 ++++ .../.template.config/template.in.json | 29 +++ .../GtkNamespace.vbproj | 19 ++ .../MainWindow.glade | 46 ++++ .../GtkSharp.Application.VBNet/MainWindow.vb | 37 +++ .../GtkSharp.Application.VBNet/Program.vb | 21 ++ .../.template.config/template.json | 33 +++ .../GtkSharp.Dialog.VBNet/Gtk_Dialog.glade | 51 +++++ .../GtkSharp.Dialog.VBNet/Gtk_Dialog.vb | 27 +++ .../.template.config/template.json | 33 +++ .../GtkSharp.Widget.VBNet/Gtk_Widget.glade | 11 + .../GtkSharp.Widget.VBNet/Gtk_Widget.vb | 20 ++ .../.template.config/template.json | 33 +++ .../GtkSharp.Window.VBNet/Gtk_Window.glade | 11 + .../GtkSharp.Window.VBNet/Gtk_Window.vb | 20 ++ Source/Workload/Shared/Common.targets | 12 + Source/Workload/Shared/Frameworks.targets | 42 ++++ Source/Workload/Shared/ReplaceText.targets | 20 ++ Source/Workload/Shared/Templates.targets | 14 ++ Source/Workload/global.json | 5 + Source/Workload/nuget.config | 7 + build.cake | 99 ++++++++ 64 files changed, 1974 insertions(+), 4 deletions(-) create mode 100644 CakeScripts/TargetEnvironment.cake create mode 100644 Source/Directory.Build.props create mode 100644 Source/Libs/GtkSharp.snk create mode 100644 Source/Workload/Directory.Build.props create mode 100644 Source/Workload/GtkSharp.NET.Sdk.Gtk/GtkSharp.NET.Sdk.Gtk.csproj create mode 100644 Source/Workload/GtkSharp.NET.Sdk.Gtk/WorkloadManifest.in.json create mode 100644 Source/Workload/GtkSharp.NET.Sdk.Gtk/WorkloadManifest.targets create mode 100644 Source/Workload/GtkSharp.Ref/GtkSharp.Ref.csproj create mode 100644 Source/Workload/GtkSharp.Runtime/GtkSharp.Runtime.csproj create mode 100644 Source/Workload/GtkSharp.Sdk/GtkSharp.Sdk.csproj create mode 100644 Source/Workload/GtkSharp.Sdk/Sdk/Sdk.in.targets create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/GtkSharp.Workload.Template.CSharp.csproj create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/.template.config/template.in.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/Program.cs create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs create mode 100644 Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/GtkSharp.Workload.Template.FSharp.csproj create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.in.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/Program.fs create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs create mode 100644 Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/GtkSharp.Workload.Template.VBNet.csproj create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/.template.config/template.in.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/Program.vb create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/.template.config/template.json create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.glade create mode 100644 Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb create mode 100644 Source/Workload/Shared/Common.targets create mode 100644 Source/Workload/Shared/Frameworks.targets create mode 100644 Source/Workload/Shared/ReplaceText.targets create mode 100644 Source/Workload/Shared/Templates.targets create mode 100644 Source/Workload/global.json create mode 100644 Source/Workload/nuget.config diff --git a/CakeScripts/TargetEnvironment.cake b/CakeScripts/TargetEnvironment.cake new file mode 100644 index 000000000..811351fae --- /dev/null +++ b/CakeScripts/TargetEnvironment.cake @@ -0,0 +1,211 @@ +#addin "nuget:?package=Microsoft.Win32.Registry&version=5.0.0" +using System; +using D = System.IO.Directory; +using F = System.IO.File; +using P = System.IO.Path; +using Pr = System.Diagnostics.Process; +using PSI = System.Diagnostics.ProcessStartInfo; +using R = Microsoft.Win32.Registry; +using RI = System.Runtime.InteropServices.RuntimeInformation; +using Z = System.IO.Compression.ZipFile; + +class TargetEnvironment +{ + public static string DotNetInstallPath { get; private set; } + public static string DotNetInstalledWorkloadsMetadataPath { get; private set; } + public static string DotNetInstallerTypeMetadataPath { get; private set; } + public static string DotNetManifestPath { get; private set; } + public static string DotNetPacksPath { get; private set; } + public static string DotNetTemplatePacksPath { get; private set; } + + public static string DotNetCliPath { get; private set; } + public static string DotNetCliFeatureBand { get; private set; } + + static TargetEnvironment() + { + DotNetInstallPath = Environment.GetEnvironmentVariable("DOTNET_ROOT"); + if (DotNetInstallPath == null) + { + if (OperatingSystem.IsWindows()) + { + DotNetInstallPath = P.Combine(Environment.GetEnvironmentVariable("ProgramFiles"), "dotnet"); + } + else if (OperatingSystem.IsLinux()) + { + DotNetInstallPath = "/usr/share/dotnet"; + } + else if (OperatingSystem.IsMacOS()) + { + DotNetInstallPath = "/usr/local/share/dotnet"; + } + } + + DotNetCliPath = P.Combine(DotNetInstallPath, "dotnet"); + + var proc = Pr.Start(new PSI() + { + FileName = DotNetCliPath, + Arguments = "--version", + RedirectStandardOutput = true, + }); + + proc.WaitForExit(); + + DotNetCliFeatureBand = proc.StandardOutput.ReadToEnd().Trim(); + DotNetCliFeatureBand = DotNetCliFeatureBand.Substring(0, DotNetCliFeatureBand.Length - 2) + "00"; + + DotNetInstalledWorkloadsMetadataPath = P.Combine(DotNetInstallPath, "metadata", "workloads", DotNetCliFeatureBand, "InstalledWorkloads"); + DotNetInstallerTypeMetadataPath = P.Combine(DotNetInstallPath, "metadata", "workloads", DotNetCliFeatureBand, "InstallerType"); + DotNetManifestPath = P.Combine(DotNetInstallPath, "sdk-manifests", DotNetCliFeatureBand); + DotNetPacksPath = P.Combine(DotNetInstallPath, "packs"); + DotNetTemplatePacksPath = P.Combine(DotNetInstallPath, "template-packs"); + } + + public static void RegisterInstalledWorkload(string workloadName) + { + D.CreateDirectory(DotNetInstalledWorkloadsMetadataPath); + F.WriteAllText(P.Combine(DotNetInstalledWorkloadsMetadataPath, workloadName), string.Empty); + if (F.Exists(P.Combine(DotNetInstallerTypeMetadataPath, "msi"))) + { + //HKLM:\SOFTWARE\Microsoft\dotnet\InstalledWorkloads\Standalone\x64\6.0.300\gtk + + // TODO: Check for other Windows architectures (x86 and arm64) + var archString = RI.OSArchitecture.ToString().ToLower(); + + var hklm = R.LocalMachine; + var software = hklm.CreateSubKey("SOFTWARE"); + var microsoft = software.CreateSubKey("Microsoft"); + var dotnet = microsoft.CreateSubKey("dotnet"); + var installedWorkloads = dotnet.CreateSubKey("InstalledWorkloads"); + var standalone = installedWorkloads.CreateSubKey("Standalone"); + var arch = standalone.CreateSubKey(archString); + var version = arch.CreateSubKey(DotNetCliFeatureBand); + var workload = version.CreateSubKey(workloadName); + + workload.Close(); + version.Close(); + arch.Close(); + standalone.Close(); + installedWorkloads.Close(); + dotnet.Close(); + microsoft.Close(); + software.Close(); + hklm.Close(); + } + } + + public static void UnregisterInstalledWorkload(string workloadName) + { + F.Delete(P.Combine(DotNetInstalledWorkloadsMetadataPath, workloadName)); + if (F.Exists(P.Combine(DotNetInstallerTypeMetadataPath, "msi"))) + { + var archString = RI.OSArchitecture.ToString().ToLower(); + + var hklm = R.LocalMachine; + var software = hklm.CreateSubKey("SOFTWARE"); + var microsoft = software.CreateSubKey("Microsoft"); + var dotnet = microsoft.CreateSubKey("dotnet"); + var installedWorkloads = dotnet.CreateSubKey("InstalledWorkloads"); + var standalone = installedWorkloads.CreateSubKey("Standalone"); + var arch = standalone.CreateSubKey(archString); + var version = arch.CreateSubKey(DotNetCliFeatureBand); + + version.DeleteSubKey(workloadName, false); + + version.Close(); + arch.Close(); + standalone.Close(); + installedWorkloads.Close(); + dotnet.Close(); + microsoft.Close(); + software.Close(); + hklm.Close(); + } + } + + public static void InstallManifests(string manifestName, string manifestPackPath) + { + var targetDirectory = P.Combine(DotNetManifestPath, manifestName); + var tempDirectory = P.Combine(targetDirectory, "temp"); + + // Delete existing installations to avoid conflict. + if (D.Exists(targetDirectory)) + { + D.Delete(targetDirectory, true); + } + + // Also creates the target + D.CreateDirectory(tempDirectory); + + Z.ExtractToDirectory(manifestPackPath, tempDirectory); + var tempDataDirectory = P.Combine(tempDirectory, "data"); + + foreach (var filePath in D.GetFiles(tempDataDirectory)) + { + var targetFilePath = P.Combine(targetDirectory, P.GetFileName(filePath)); + F.Copy(filePath, targetFilePath, true); + } + + D.Delete(tempDirectory, true); + } + + public static void UninstallManifests(string manifestName) + { + var targetDirectory = P.Combine(DotNetManifestPath, manifestName); + if (D.Exists(targetDirectory)) + { + D.Delete(targetDirectory, true); + } + } + + public static void InstallPack(string name, string version, string packPath) + { + var targetDirectory = P.Combine(DotNetPacksPath, name, version); + + if (D.Exists(targetDirectory)) + { + D.Delete(targetDirectory, true); + } + + D.CreateDirectory(targetDirectory); + + Z.ExtractToDirectory(packPath, targetDirectory); + } + + public static void UninstallPack(string name, string version) + { + var packInstallDirectory = P.Combine(DotNetPacksPath, name); + + var targetDirectory = P.Combine(packInstallDirectory, version); + if (D.Exists(targetDirectory)) + { + D.Delete(targetDirectory, true); + } + + // Clean up the template if no other verions exist. + try + { + D.Delete(packInstallDirectory, false); + } + catch (System.IO.IOException) + { + // Silently fail. Mostly because the directory is not empty (there are other verions installed). + } + } + + public static void InstallTemplatePack(string packName, string packPath) + { + D.CreateDirectory(DotNetTemplatePacksPath); + var targetPath = P.Combine(DotNetTemplatePacksPath, packName); + F.Copy(packPath, targetPath, true); + } + + public static void UninstallTemplatePack(string packName) + { + var targetPath = P.Combine(DotNetTemplatePacksPath, packName); + if (F.Exists(targetPath)) + { + F.Delete(targetPath); + } + } +} \ No newline at end of file diff --git a/Source/Directory.Build.props b/Source/Directory.Build.props new file mode 100644 index 000000000..fa2214edd --- /dev/null +++ b/Source/Directory.Build.props @@ -0,0 +1,12 @@ + + + <_GtkSharpNetVersion>6.0 + <_GtkSharpSourceDirectory>$(MSBuildThisFileDirectory) + <_GtkSharpBuildOutputDirectory>$(MSBuildThisFileDirectory)..\BuildOutput\ + + + + https://github.com/GtkSharp/GtkSharp + https://github.com/GtkSharp/GtkSharp + + \ No newline at end of file diff --git a/Source/Libs/Directory.Build.props b/Source/Libs/Directory.Build.props index 4a9335642..c3762d1ca 100644 --- a/Source/Libs/Directory.Build.props +++ b/Source/Libs/Directory.Build.props @@ -1,9 +1,15 @@ + + - net6.0;netstandard2.0 + net$(_GtkSharpNetVersion);netstandard2.0 true - https://github.com/GtkSharp/GtkSharp - https://github.com/GtkSharp/GtkSharp - ..\..\..\BuildOutput\$(Configuration) + $(_GtkSharpBuildOutputDirectory)\$(Configuration) + + True + $(MSBuildThisFileDirectory)\GtkSharp.snk \ No newline at end of file diff --git a/Source/Libs/GtkSharp.snk b/Source/Libs/GtkSharp.snk new file mode 100644 index 0000000000000000000000000000000000000000..54d626f05f520bd8f2108dac84896f482ed97dfd GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097Pe4uib0+Mx-zn@3|0{)}gK!`1YxTUwJ z+pY%70gaR-oaMr1JSa{o-NfEDM}pKY7UI;rOx&p&TKTC^m6zJn_6<^HBllB0@L`%OycP%dV?@DS{TtQEWR=mEF>*x~ht~*jkZL z0i46gw4|YJcB$`b<45+9t5^c0BecK8)c*_95yF@EzVM+N#R61+Y8b+7+BF3TqoGF! ztuW7MdYx%`5U|7CT1H8^9kL6QrjEEh6w>r-)n;z3a1^afkUva0{a0cLLCj{j!d#(V zOSf?uPp;8(uuKOEt#R&I6q0QEW=Zj1h z$L%^}o_UECtEpujWYbSh3cy(T0E0eWlnaOz3CHx$7U+DdrLN9-h%CeT{OmLc2VfeD zB7@|u!!ZC%_-p!Dg^rs??)$))O-a3~w}t0`UmKDUxyQqE*y!(jx6#7nNhpc~uj3UH iv8UZ48EKbZrj)wz$mlUaNBA`2z5yeB)(uLV1T + + + + <_GtkSharpVersion>$([System.Text.RegularExpressions.Regex]::Match($(Version), '(\d+)\.(\d+)')) + <_GtkSharpTfm>net$(_GtkSharpNetVersion)-gtk + <_GtkSharpFullTfm>net$(_GtkSharpNetVersion)-gtk$(_GtkSharpVersion) + <_GtkSharpManifestVersionBand Condition=" '$(_GtkSharpManifestVersionBand)' == '' ">6.0.300 + + $(_GtkSharpBuildOutputDirectory)WorkloadPacks\$(Configuration)\$(MSBuildProjectName)\$(Version) + + + + + + + + Icon.png + GtkSharp Contributors + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.NET.Sdk.Gtk/GtkSharp.NET.Sdk.Gtk.csproj b/Source/Workload/GtkSharp.NET.Sdk.Gtk/GtkSharp.NET.Sdk.Gtk.csproj new file mode 100644 index 000000000..ed37fbe7e --- /dev/null +++ b/Source/Workload/GtkSharp.NET.Sdk.Gtk/GtkSharp.NET.Sdk.Gtk.csproj @@ -0,0 +1,60 @@ + + + + + + $(PackageId).Manifest-$(_GtkSharpManifestVersionBand) + GtkSharp workload manifest + + + + + <_GtkSharpVersionMajorMinorPatch>$([System.Text.RegularExpressions.Regex]::Match($(Version), '(\d+)\.(\d+).(\d+)')) + <_GtkSharpManifestVersion>$(Version.Replace('$(_GtkSharpVersionMajorMinorPatch).', '$(_GtkSharpVersionMajorMinorPatch)-rev.')) + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.NET.Sdk.Gtk/WorkloadManifest.in.json b/Source/Workload/GtkSharp.NET.Sdk.Gtk/WorkloadManifest.in.json new file mode 100644 index 000000000..ec7760f0b --- /dev/null +++ b/Source/Workload/GtkSharp.NET.Sdk.Gtk/WorkloadManifest.in.json @@ -0,0 +1,39 @@ +{ + "version": "@GTKSHARPMANIFESTVERSION@", + "workloads": { + "gtk": { + "description": ".NET SDK workload for building GtkSharp applications.", + "packs": [ + "GtkSharp.Sdk", + "GtkSharp.Ref", + "GtkSharp.Runtime" + ] + } + }, + "packs": { + "GtkSharp.Sdk": { + "kind": "sdk", + "version": "@VERSION@" + }, + "GtkSharp.Ref": { + "kind": "framework", + "version": "@VERSION@" + }, + "GtkSharp.Runtime": { + "kind": "framework", + "version": "@VERSION@" + }, + "GtkSharp.Workload.Template.CSharp": { + "kind": "template", + "version": "@VERSION@" + }, + "GtkSharp.Workload.Template.FSharp": { + "kind": "template", + "version": "@VERSION@" + }, + "GtkSharp.Workload.Template.VBNet": { + "kind": "template", + "version": "@VERSION@" + } + } + } \ No newline at end of file diff --git a/Source/Workload/GtkSharp.NET.Sdk.Gtk/WorkloadManifest.targets b/Source/Workload/GtkSharp.NET.Sdk.Gtk/WorkloadManifest.targets new file mode 100644 index 000000000..451e6089d --- /dev/null +++ b/Source/Workload/GtkSharp.NET.Sdk.Gtk/WorkloadManifest.targets @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Ref/GtkSharp.Ref.csproj b/Source/Workload/GtkSharp.Ref/GtkSharp.Ref.csproj new file mode 100644 index 000000000..f6c5f8f0e --- /dev/null +++ b/Source/Workload/GtkSharp.Ref/GtkSharp.Ref.csproj @@ -0,0 +1,20 @@ + + + + + + + GtkSharp targeting pack + + + + + + <_PackageFiles Include="@(None)" PackagePath="ref\$(_GtkSharpFullTfm)" TargetPath="ref\$(_GtkSharpFullTfm)" /> + + + + + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Runtime/GtkSharp.Runtime.csproj b/Source/Workload/GtkSharp.Runtime/GtkSharp.Runtime.csproj new file mode 100644 index 000000000..fd8d3e4fd --- /dev/null +++ b/Source/Workload/GtkSharp.Runtime/GtkSharp.Runtime.csproj @@ -0,0 +1,20 @@ + + + + + + + GtkSharp runtime pack + + + + + + <_PackageFiles Include="@(None)" PackagePath="lib\$(_GtkSharpFullTfm)" TargetPath="lib\$(_GtkSharpFullTfm)" /> + + + + + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Sdk/GtkSharp.Sdk.csproj b/Source/Workload/GtkSharp.Sdk/GtkSharp.Sdk.csproj new file mode 100644 index 000000000..39aeb9465 --- /dev/null +++ b/Source/Workload/GtkSharp.Sdk/GtkSharp.Sdk.csproj @@ -0,0 +1,58 @@ + + + + + + GtkSharp SDK. Enabled via the net6.0-gtk TFM. + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Sdk/Sdk/Sdk.in.targets b/Source/Workload/GtkSharp.Sdk/Sdk/Sdk.in.targets new file mode 100644 index 000000000..482221298 --- /dev/null +++ b/Source/Workload/GtkSharp.Sdk/Sdk/Sdk.in.targets @@ -0,0 +1,66 @@ + + + + + + + + + + + + <_DefaultTargetPlatformVersion>@GTKSHARPVERSION@ + + + + true + $(_DefaultTargetPlatformVersion) + + + + + + + + + + + + + + + + + + + <_IsGtkDefined>$([System.Text.RegularExpressions.Regex]::IsMatch('$(DefineConstants.Trim())', '(^|;)GTK($|;)')) + GTK;$(DefineConstants) + + + + + true + win-x64 + win-x86 + linux-x64 + linux-x86 + osx-x64 + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/GtkSharp.Workload.Template.CSharp.csproj b/Source/Workload/GtkSharp.Workload.Template.CSharp/GtkSharp.Workload.Template.CSharp.csproj new file mode 100644 index 000000000..56a58047d --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/GtkSharp.Workload.Template.CSharp.csproj @@ -0,0 +1,47 @@ + + + + + + GTK templates for CSharp + A set of C# templates for your .NET GTK Application. Installed with the GtkSharp .NET workload. + + + + <_GtkSharpTemplateContent Include="content\**" /> + <_GtkSharpTemplateContent Remove="**\*.in.*" /> + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/.template.config/template.in.json b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/.template.config/template.in.json new file mode 100644 index 000000000..e79099cb4 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/.template.config/template.in.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "GUI App" + ], + "name": "Gtk Application", + "identity": "GtkSharp.Application.CSharp", + "groupIdentity": "GtkSharp.Application", + "shortName": "gtk", + "tags": { + "language": "C#", + "type": "project" + }, + "sourceName": "GtkNamespace", + "preferNameDirectory": true, + "symbols": { + "targetframework": { + "type": "parameter", + "description": "The target framework for the project.", + "defaultValue": "net@GTKSHARPNETVERSION@-gtk", + "replaces": "$(FrameworkParameter)" + } + }, + "primaryOutputs": [ + { "path": "GtkNamespace.csproj" } + ] +} diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj new file mode 100644 index 000000000..25cdc1cb3 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/GtkNamespace.csproj @@ -0,0 +1,15 @@ + + + + WinExe + $(FrameworkParameter) + + + + + + %(Filename)%(Extension) + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs new file mode 100644 index 000000000..a6fc08a26 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.cs @@ -0,0 +1,35 @@ +using System; +using Gtk; +using UI = Gtk.Builder.ObjectAttribute; + +namespace GtkNamespace +{ + class MainWindow : Window + { + [UI] private Label _label1 = null; + [UI] private Button _button1 = null; + + private int _counter; + + public MainWindow() : this(new Builder("MainWindow.glade")) { } + + private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow")) + { + builder.Autoconnect(this); + + DeleteEvent += Window_DeleteEvent; + _button1.Clicked += Button1_Clicked; + } + + private void Window_DeleteEvent(object sender, DeleteEventArgs a) + { + Application.Quit(); + } + + private void Button1_Clicked(object sender, EventArgs a) + { + _counter++; + _label1.Text = "Hello World! This button has been clicked " + _counter + " time(s)."; + } + } +} diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.glade b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.glade new file mode 100644 index 000000000..a13c41b20 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/MainWindow.glade @@ -0,0 +1,46 @@ + + + + + False + Example Window + 480 + 240 + + + True + False + 4 + 4 + 4 + 4 + vertical + + + True + False + Hello World! + + + True + True + 0 + + + + + Click me! + True + False + True + + + False + True + 1 + + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/Program.cs b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/Program.cs new file mode 100644 index 000000000..56195ab62 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Application.CSharp/Program.cs @@ -0,0 +1,23 @@ +using System; +using Gtk; + +namespace GtkNamespace +{ + class Program + { + [STAThread] + public static void Main(string[] args) + { + Application.Init(); + + var app = new Application("org.GtkNamespace.GtkNamespace", GLib.ApplicationFlags.None); + app.Register(GLib.Cancellable.Current); + + var win = new MainWindow(); + app.AddWindow(win); + + win.Show(); + Application.Run(); + } + } +} diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/.template.config/template.json new file mode 100644 index 000000000..1c053e4fa --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Dialog", + "identity": "GtkSharp.Dialog.CSharp", + "groupIdentity": "GtkSharp.Dialog", + "shortName": "gtkdialog", + "tags": { + "language": "C#", + "type": "item" + }, + "sourceName": "Gtk_Dialog", + "primaryOutputs": [ + { + "path": "Gtk_Dialog.cs" + }, + { + "path": "Gtk_Dialog.glade" + } + ], + "defaultName": "Gtk_Dialog", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs new file mode 100644 index 000000000..5f7d60f10 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.cs @@ -0,0 +1,24 @@ +using System; +using Gtk; +using UI = Gtk.Builder.ObjectAttribute; + +namespace GtkNamespace +{ + class Gtk_Dialog : Dialog + { + public Gtk_Dialog() : this(new Builder("Gtk_Dialog.glade")) { } + + private Gtk_Dialog(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Dialog")) + { + builder.Autoconnect(this); + DefaultResponse = ResponseType.Cancel; + + Response += Dialog_Response; + } + + private void Dialog_Response(object o, ResponseArgs args) + { + Hide(); + } + } +} diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.glade b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.glade new file mode 100644 index 000000000..8cc7c549a --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Dialog.CSharp/Gtk_Dialog.glade @@ -0,0 +1,51 @@ + + + + + False + 320 + 260 + dialog + + + False + vertical + 2 + + + False + end + + + + + + gtk-close + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + + + + + button1 + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/.template.config/template.json new file mode 100644 index 000000000..8d903c00c --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Widget", + "identity": "GtkSharp.Widget.CSharp", + "groupIdentity": "GtkSharp.Widget", + "shortName": "gtkwidget", + "tags": { + "language": "C#", + "type": "item" + }, + "sourceName": "Gtk_Widget", + "primaryOutputs": [ + { + "path": "Gtk_Widget.cs" + }, + { + "path": "Gtk_Widget.glade" + } + ], + "defaultName": "Gtk_Widget", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs new file mode 100644 index 000000000..88c911502 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.cs @@ -0,0 +1,16 @@ +using System; +using Gtk; +using UI = Gtk.Builder.ObjectAttribute; + +namespace GtkNamespace +{ + public class Gtk_Widget : Box + { + public Gtk_Widget() : this(new Builder("Gtk_Widget.glade")) { } + + private Gtk_Widget(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Widget")) + { + builder.Autoconnect(this); + } + } +} diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.glade b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.glade new file mode 100644 index 000000000..7a1be14d1 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Widget.CSharp/Gtk_Widget.glade @@ -0,0 +1,11 @@ + + + + + True + False + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/.template.config/template.json new file mode 100644 index 000000000..56f3766b1 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Window", + "identity": "GtkSharp.Window.CSharp", + "groupIdentity": "GtkSharp.Window", + "shortName": "gtkwindow", + "tags": { + "language": "C#", + "type": "item" + }, + "sourceName": "Gtk_Window", + "primaryOutputs": [ + { + "path": "Gtk_Window.cs" + }, + { + "path": "Gtk_Window.glade" + } + ], + "defaultName": "Gtk_Window", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs new file mode 100644 index 000000000..2b863d03c --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.cs @@ -0,0 +1,16 @@ +using System; +using Gtk; +using UI = Gtk.Builder.ObjectAttribute; + +namespace GtkNamespace +{ + class Gtk_Window : Window + { + public Gtk_Window() : this(new Builder("Gtk_Window.glade")) { } + + private Gtk_Window(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Window")) + { + builder.Autoconnect(this); + } + } +} diff --git a/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.glade b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.glade new file mode 100644 index 000000000..44e554e80 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.CSharp/content/GtkSharp.Window.CSharp/Gtk_Window.glade @@ -0,0 +1,11 @@ + + + + + False + Gtk_Window + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/GtkSharp.Workload.Template.FSharp.csproj b/Source/Workload/GtkSharp.Workload.Template.FSharp/GtkSharp.Workload.Template.FSharp.csproj new file mode 100644 index 000000000..464850538 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/GtkSharp.Workload.Template.FSharp.csproj @@ -0,0 +1,47 @@ + + + + + + GTK templates for FSharp + A set of F# templates for your .NET GTK Application. Installed with the GtkSharp .NET workload. + + + + <_GtkSharpTemplateContent Include="content\**" /> + <_GtkSharpTemplateContent Remove="**\*.in.*" /> + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.in.json b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.in.json new file mode 100644 index 000000000..66ff5781f --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/.template.config/template.in.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "GUI App" + ], + "name": "Gtk Application", + "identity": "GtkSharp.Application.FSharp", + "groupIdentity": "GtkSharp.Application", + "shortName": "gtk", + "tags": { + "language": "F#", + "type": "project" + }, + "sourceName": "GtkNamespace", + "preferNameDirectory": true, + "symbols": { + "targetframework": { + "type": "parameter", + "description": "The target framework for the project.", + "defaultValue": "net@GTKSHARPNETVERSION@-gtk", + "replaces": "$(FrameworkParameter)" + } + }, + "primaryOutputs": [ + { "path": "GtkNamespace.fsproj" } + ] +} diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj new file mode 100644 index 000000000..e24d76353 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/GtkNamespace.fsproj @@ -0,0 +1,24 @@ + + + + Exe + $(FrameworkParameter) + + + + + + + + + + + %(Filename)%(Extension) + + + + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs new file mode 100644 index 000000000..03ffbc5d7 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.fs @@ -0,0 +1,24 @@ +namespace GtkNamespace + +open Gtk + +type MainWindow (builder : Builder) as this = + inherit Window(builder.GetRawOwnedObject("MainWindow")) + + let mutable _label1 : Label = null + let mutable _button1 : Button = null + let mutable _counter = 0; + + do + _label1 <- builder.GetObject("_label1") :?> Label + _button1 <- builder.GetObject("_button1") :?> Button + + this.DeleteEvent.Add(fun _ -> + Application.Quit() + ) + _button1.Clicked.Add(fun _ -> + _counter <- _counter + 1 + _label1.Text <- "Hello World! This button has been clicked " + _counter.ToString() + " time(s)." + ) + + new() = new MainWindow(new Builder("MainWindow.glade")) diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.glade b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.glade new file mode 100644 index 000000000..a13c41b20 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/MainWindow.glade @@ -0,0 +1,46 @@ + + + + + False + Example Window + 480 + 240 + + + True + False + 4 + 4 + 4 + 4 + vertical + + + True + False + Hello World! + + + True + True + 0 + + + + + Click me! + True + False + True + + + False + True + 1 + + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/Program.fs b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/Program.fs new file mode 100644 index 000000000..037050ae1 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Application.FSharp/Program.fs @@ -0,0 +1,18 @@ +namespace GtkNamespace +module Program = + + open Gtk + + [] + let main argv = + Application.Init() + + let app = new Application("org.GtkNamespace.GtkNamespace", GLib.ApplicationFlags.None) + app.Register(GLib.Cancellable.Current) |> ignore; + + let win = new MainWindow() + app.AddWindow(win) + + win.Show() + Application.Run() + 0 diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/.template.config/template.json new file mode 100644 index 000000000..82d90535a --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Dialog", + "identity": "GtkSharp.Dialog.FSharp", + "groupIdentity": "GtkSharp.Dialog", + "shortName": "gtkdialog", + "tags": { + "language": "F#", + "type": "item" + }, + "sourceName": "Gtk_Dialog", + "primaryOutputs": [ + { + "path": "Gtk_Dialog.fs" + }, + { + "path": "Gtk_Dialog.glade" + } + ], + "defaultName": "Gtk_Dialog", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs new file mode 100644 index 000000000..7e52fb76e --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.fs @@ -0,0 +1,13 @@ +namespace GtkNamespace + +open Gtk + +type Gtk_Dialog (builder : Builder) as this = + inherit Dialog(builder.GetRawOwnedObject("Gtk_Dialog")) + do + this.DefaultResponse <- ResponseType.Cancel; + this.Response.Add(fun _ -> + this.Hide(); + ) + + new() = new Gtk_Dialog(new Builder("Gtk_Dialog.glade")) diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.glade b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.glade new file mode 100644 index 000000000..8cc7c549a --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Dialog.FSharp/Gtk_Dialog.glade @@ -0,0 +1,51 @@ + + + + + False + 320 + 260 + dialog + + + False + vertical + 2 + + + False + end + + + + + + gtk-close + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + + + + + button1 + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/.template.config/template.json new file mode 100644 index 000000000..53dd6eb65 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Widget", + "identity": "GtkSharp.Widget.FSharp", + "groupIdentity": "GtkSharp.Widget", + "shortName": "gtkwidget", + "tags": { + "language": "F#", + "type": "item" + }, + "sourceName": "Gtk_Widget", + "primaryOutputs": [ + { + "path": "Gtk_Widget.fs" + }, + { + "path": "Gtk_Widget.glade" + } + ], + "defaultName": "Gtk_Widget", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs new file mode 100644 index 000000000..2812ea947 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.fs @@ -0,0 +1,8 @@ +namespace GtkNamespace + +open Gtk + +type Gtk_Widget (builder : Builder) = + inherit Box(builder.GetRawOwnedObject("Gtk_Widget")) + + new() = new Gtk_Widget(new Builder("Gtk_Widget.glade")) diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.glade b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.glade new file mode 100644 index 000000000..7a1be14d1 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Widget.FSharp/Gtk_Widget.glade @@ -0,0 +1,11 @@ + + + + + True + False + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/.template.config/template.json new file mode 100644 index 000000000..0d43a621d --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Window", + "identity": "GtkSharp.Window.FSharp", + "groupIdentity": "GtkSharp.Window", + "shortName": "gtkwindow", + "tags": { + "language": "F#", + "type": "item" + }, + "sourceName": "Gtk_Window", + "primaryOutputs": [ + { + "path": "Gtk_Window.fs" + }, + { + "path": "Gtk_Window.glade" + } + ], + "defaultName": "Gtk_Window", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs new file mode 100644 index 000000000..a4f3fc885 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.fs @@ -0,0 +1,8 @@ +namespace GtkNamespace + +open Gtk + +type Gtk_Window (builder : Builder) = + inherit Window(builder.GetRawOwnedObject("Gtk_Window")) + + new() = new Gtk_Window(new Builder("Gtk_Window.glade")) diff --git a/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.glade b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.glade new file mode 100644 index 000000000..44e554e80 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.FSharp/content/GtkSharp.Window.FSharp/Gtk_Window.glade @@ -0,0 +1,11 @@ + + + + + False + Gtk_Window + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/GtkSharp.Workload.Template.VBNet.csproj b/Source/Workload/GtkSharp.Workload.Template.VBNet/GtkSharp.Workload.Template.VBNet.csproj new file mode 100644 index 000000000..ba4b8e680 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/GtkSharp.Workload.Template.VBNet.csproj @@ -0,0 +1,47 @@ + + + + + + GTK templates for Visual Basic + A set of Visual Basic templates for your .NET GTK Application. Installed with the GtkSharp .NET workload. + + + + <_GtkSharpTemplateContent Include="content\**" /> + <_GtkSharpTemplateContent Remove="**\*.in.*" /> + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/.template.config/template.in.json b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/.template.config/template.in.json new file mode 100644 index 000000000..dc48e9a2e --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/.template.config/template.in.json @@ -0,0 +1,29 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "GUI App" + ], + "name": "Gtk Application", + "identity": "GtkSharp.Application.VBNet", + "groupIdentity": "GtkSharp.Application", + "shortName": "gtk", + "tags": { + "language": "VB", + "type": "project" + }, + "sourceName": "GtkNamespace", + "preferNameDirectory": true, + "symbols": { + "targetframework": { + "type": "parameter", + "description": "The target framework for the project.", + "defaultValue": "net@GTKSHARPNETVERSION@-gtk", + "replaces": "$(FrameworkParameter)" + } + }, + "primaryOutputs": [ + { "path": "GtkNamespace.vbproj" } + ] +} diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj new file mode 100644 index 000000000..491e8f7af --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/GtkNamespace.vbproj @@ -0,0 +1,19 @@ + + + + WinExe + $(FrameworkParameter) + + + + + + %(Filename)%(Extension) + + + + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.glade b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.glade new file mode 100644 index 000000000..a13c41b20 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.glade @@ -0,0 +1,46 @@ + + + + + False + Example Window + 480 + 240 + + + True + False + 4 + 4 + 4 + 4 + vertical + + + True + False + Hello World! + + + True + True + 0 + + + + + Click me! + True + False + True + + + False + True + 1 + + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb new file mode 100644 index 000000000..5a1f6fa05 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/MainWindow.vb @@ -0,0 +1,37 @@ +Imports System +Imports Gtk +Imports UI = Gtk.Builder.ObjectAttribute + +Namespace GtkNamespace + Public Class MainWindow + Inherits Window + + Private _counter = 0 + Private _label1 As Label + Private _button1 As Button + + Public Sub New (builder as Builder) + MyBase.New(builder.GetRawOwnedObject("MainWindow")) + + builder.Autoconnect (Me) + + AddHandler MyBase.DeleteEvent, AddressOf Window_Delete + AddHandler _button1.Clicked, AddressOf Button1_Clicked + End Sub + + Public Sub New () + Me.New(new Builder("MainWindow.glade")) + End Sub + + Private Sub Window_Delete (ByVal sender As Object, ByVal a As DeleteEventArgs) + Application.Quit () + a.RetVal = true + End Sub + + Private Sub Button1_Clicked (ByVal sender As Object, ByVal a As EventArgs) + _counter += 1 + _label1.Text = "Hello World! This button has been clicked " + _counter.ToString() + " time(s)." + End Sub + + End Class +End Namespace diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/Program.vb b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/Program.vb new file mode 100644 index 000000000..627f2b08a --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Application.VBNet/Program.vb @@ -0,0 +1,21 @@ +Imports System +Imports Gtk + +Namespace GtkNamespace + Public Class MainClass + + Public Shared Sub Main () + Application.Init () + + Dim app as new Application ("org.GtkNamespace.GtkNamespace", GLib.ApplicationFlags.None) + app.Register (GLib.Cancellable.Current) + + Dim win as new MainWindow () + app.AddWindow (win) + + win.Show () + Application.Run () + End Sub + + End Class +End Namespace diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/.template.config/template.json new file mode 100644 index 000000000..701219110 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Dialog", + "identity": "GtkSharp.Dialog.VBNet", + "groupIdentity": "GtkSharp.Dialog", + "shortName": "gtkdialog", + "tags": { + "language": "VB", + "type": "item" + }, + "sourceName": "Gtk_Dialog", + "primaryOutputs": [ + { + "path": "Gtk_Dialog.vb" + }, + { + "path": "Gtk_Dialog.glade" + } + ], + "defaultName": "Gtk_Dialog", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.glade b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.glade new file mode 100644 index 000000000..8cc7c549a --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.glade @@ -0,0 +1,51 @@ + + + + + False + 320 + 260 + dialog + + + False + vertical + 2 + + + False + end + + + + + + gtk-close + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + + + + + button1 + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb new file mode 100644 index 000000000..e4b15f60b --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Dialog.VBNet/Gtk_Dialog.vb @@ -0,0 +1,27 @@ +Imports System +Imports Gtk +Imports UI = Gtk.Builder.ObjectAttribute + +Namespace GtkNamespace + Public Class Gtk_Dialog + Inherits Dialog + + Public Sub New (builder as Builder) + MyBase.New (builder.GetRawOwnedObject("Gtk_Dialog")) + + builder.Autoconnect (Me) + DefaultResponse = ResponseType.Cancel + + AddHandler MyBase.Response, AddressOf Dialog_OnResponse + End Sub + + Public Sub New () + Me.New (new Builder ("Gtk_Dialog.glade")) + End Sub + + Private Sub Dialog_OnResponse (ByVal sender As Object, ByVal args As ResponseArgs) + Hide () + End Sub + + End Class +End Namespace diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/.template.config/template.json new file mode 100644 index 000000000..f80ede244 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Widget", + "identity": "GtkSharp.Widget.VBNet", + "groupIdentity": "GtkSharp.Widget", + "shortName": "gtkwidget", + "tags": { + "language": "VB", + "type": "item" + }, + "sourceName": "Gtk_Widget", + "primaryOutputs": [ + { + "path": "Gtk_Widget.vb" + }, + { + "path": "Gtk_Widget.glade" + } + ], + "defaultName": "Gtk_Widget", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.glade b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.glade new file mode 100644 index 000000000..7a1be14d1 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.glade @@ -0,0 +1,11 @@ + + + + + True + False + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb new file mode 100644 index 000000000..359a413e7 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Widget.VBNet/Gtk_Widget.vb @@ -0,0 +1,20 @@ +Imports System +Imports Gtk +Imports UI = Gtk.Builder.ObjectAttribute + +Namespace GtkNamespace + Public Class Gtk_Widget + Inherits Box + + Public Sub New (builder as Builder) + MyBase.New (builder.GetRawOwnedObject("Gtk_Widget")) + + builder.Autoconnect (Me) + End Sub + + Public Sub New () + Me.New (new Builder("Gtk_Widget.glade")) + End Sub + + End Class +End Namespace diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/.template.config/template.json b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/.template.config/template.json new file mode 100644 index 000000000..74ff39a48 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/.template.config/template.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "GtkSharp Contributors", + "classifications": [ + "Gtk", + "UI" + ], + "name": "Gtk Window", + "identity": "GtkSharp.Window.VBNet", + "groupIdentity": "GtkSharp.Window", + "shortName": "gtkwindow", + "tags": { + "language": "VB", + "type": "item" + }, + "sourceName": "Gtk_Window", + "primaryOutputs": [ + { + "path": "Gtk_Window.vb" + }, + { + "path": "Gtk_Window.glade" + } + ], + "defaultName": "Gtk_Window", + "symbols": { + "namespace": { + "description": "Namespace for the generated files", + "replaces": "GtkNamespace", + "type": "parameter" + } + } +} \ No newline at end of file diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.glade b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.glade new file mode 100644 index 000000000..44e554e80 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.glade @@ -0,0 +1,11 @@ + + + + + False + Gtk_Window + + + + + diff --git a/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb new file mode 100644 index 000000000..2e0b365f4 --- /dev/null +++ b/Source/Workload/GtkSharp.Workload.Template.VBNet/content/GtkSharp.Window.VBNet/Gtk_Window.vb @@ -0,0 +1,20 @@ +Imports System +Imports Gtk +Imports UI = Gtk.Builder.ObjectAttribute + +Namespace GtkNamespace + Public Class Gtk_Window + Inherits Window + + Public Sub New (builder as Builder) + MyBase.New (builder.GetRawOwnedObject("Gtk_Window")) + + builder.Autoconnect (Me) + End Sub + + Public Sub New () + Me.New (new Builder ("Gtk_Window.glade")) + End Sub + + End Class +End Namespace diff --git a/Source/Workload/Shared/Common.targets b/Source/Workload/Shared/Common.targets new file mode 100644 index 000000000..6cf9bab29 --- /dev/null +++ b/Source/Workload/Shared/Common.targets @@ -0,0 +1,12 @@ + + + netstandard2.0 + DotnetPlatform + $(MSBuildProjectName) + true + false + false + false + $(NoWarn);NU5100;NU5128;NU5130;NU5131 + + \ No newline at end of file diff --git a/Source/Workload/Shared/Frameworks.targets b/Source/Workload/Shared/Frameworks.targets new file mode 100644 index 000000000..d4d824cdb --- /dev/null +++ b/Source/Workload/Shared/Frameworks.targets @@ -0,0 +1,42 @@ + + + + <_FrameworkListFile Condition=" !$(MSBuildProjectName.Contains('.Runtime')) " Include="$(IntermediateOutputPath)FrameworkList.xml" /> + <_FrameworkListFile Condition=" !$(MSBuildProjectName.Contains('.Ref')) " Include="$(IntermediateOutputPath)RuntimeList.xml" /> + + + + + + + + false + + + + + + <_RootAttribute Include="Name" Value="GtkSharp" /> + <_RootAttribute Include="TargetFrameworkIdentifier" Value=".NETCoreApp" /> + <_RootAttribute Include="TargetFrameworkVersion" Value="6.0" /> + <_RootAttribute Include="FrameworkName" Value="$(MSBuildProjectName.Replace('.Ref','').Replace('.Runtime',''))" /> + <_AssemblyFiles Include="@(_PackageFiles)" Condition=" '%(_PackageFiles.Extension)' == '.dll' and '%(_PackageFiles.SubFolder)' == '' " /> + <_Classifications Include="@(_AssemblyFiles->'%(FileName)%(Extension)'->Distinct())" Profile="GTK" /> + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Workload/Shared/ReplaceText.targets b/Source/Workload/Shared/ReplaceText.targets new file mode 100644 index 000000000..d1c0ab978 --- /dev/null +++ b/Source/Workload/Shared/ReplaceText.targets @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Workload/Shared/Templates.targets b/Source/Workload/Shared/Templates.targets new file mode 100644 index 000000000..a09ce8cd0 --- /dev/null +++ b/Source/Workload/Shared/Templates.targets @@ -0,0 +1,14 @@ + + + + Template + $(MSBuildProjectName) + netstandard2.0 + true + false + false + false + NU5128 + + + \ No newline at end of file diff --git a/Source/Workload/global.json b/Source/Workload/global.json new file mode 100644 index 000000000..0beb2f501 --- /dev/null +++ b/Source/Workload/global.json @@ -0,0 +1,5 @@ +{ + "msbuild-sdks": { + "Microsoft.Build.NoTargets": "3.3.0" + } +} \ No newline at end of file diff --git a/Source/Workload/nuget.config b/Source/Workload/nuget.config new file mode 100644 index 000000000..42c64aefb --- /dev/null +++ b/Source/Workload/nuget.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/build.cake b/build.cake index 0b9c6d7c9..07c17daf3 100644 --- a/build.cake +++ b/build.cake @@ -1,5 +1,6 @@ #load CakeScripts\GAssembly.cake #load CakeScripts\Settings.cake +#load CakeScripts\TargetEnvironment.cake #addin "Cake.FileHelpers&version=5.0.0" #addin "Cake.Incubator&version=7.0.0" @@ -13,6 +14,7 @@ var configuration = Argument("Configuration", "Release"); var msbuildsettings = new DotNetMSBuildSettings(); var list = new List(); +var supportedVersionBands = new List() {"6.0.100", "6.0.200", "6.0.300"}; // TASKS @@ -128,6 +130,33 @@ Task("PackageNuGet") DotNetPack(gassembly.Csproj, settings); }); +Task("PackageWorkload") + .IsDependentOn("Build") + .Does(() => +{ + var packSettings = new DotNetPackSettings + { + MSBuildSettings = msbuildsettings, + Configuration = configuration, + OutputDirectory = "BuildOutput/NugetPackages", + // Some of the nugets here depend on output generated during build. + NoBuild = false + }; + + DotNetPack("Source/Workload/GtkSharp.Workload.Template.CSharp/GtkSharp.Workload.Template.CSharp.csproj", packSettings); + DotNetPack("Source/Workload/GtkSharp.Workload.Template.FSharp/GtkSharp.Workload.Template.FSharp.csproj", packSettings); + DotNetPack("Source/Workload/GtkSharp.Workload.Template.VBNet/GtkSharp.Workload.Template.VBNet.csproj", packSettings); + DotNetPack("Source/Workload/GtkSharp.Ref/GtkSharp.Ref.csproj", packSettings); + DotNetPack("Source/Workload/GtkSharp.Runtime/GtkSharp.Runtime.csproj", packSettings); + DotNetPack("Source/Workload/GtkSharp.Sdk/GtkSharp.Sdk.csproj", packSettings); + + foreach (var band in supportedVersionBands) + { + packSettings.MSBuildSettings = packSettings.MSBuildSettings.WithProperty("_GtkSharpManifestVersionBand", band); + DotNetPack("Source/Workload/GtkSharp.NET.Sdk.Gtk/GtkSharp.NET.Sdk.Gtk.csproj", packSettings); + } +}); + Task("PackageTemplates") .IsDependentOn("Init") .Does(() => @@ -144,11 +173,81 @@ Task("PackageTemplates") DotNetPack("Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.csproj", settings); }); +const string manifestName = "GtkSharp.NET.Sdk.Gtk"; +var manifestPack = $"{manifestName}.Manifest-{TargetEnvironment.DotNetCliFeatureBand}.{Settings.Version}.nupkg"; +var manifestPackPath = $"BuildOutput/NugetPackages/{manifestPack}"; + +var packNames = new List() +{ + "GtkSharp.Ref", + "GtkSharp.Runtime", + "GtkSharp.Sdk" +}; + +var templateLanguages = new List() +{ + "CSharp", + "FSharp", + "VBNet" +}; + +Task("InstallWorkload") + .IsDependentOn("PackageWorkload") + .IsDependentOn("PackageTemplates") + .Does(() => +{ + Console.WriteLine($"Installing workload for SDK version {TargetEnvironment.DotNetCliFeatureBand}, at {TargetEnvironment.DotNetInstallPath}"); + Console.WriteLine($"Installing manifests to {TargetEnvironment.DotNetManifestPath}"); + TargetEnvironment.InstallManifests(manifestName, manifestPackPath); + Console.WriteLine($"Installing packs to {TargetEnvironment.DotNetPacksPath}"); + foreach (var name in packNames) + { + Console.WriteLine($"Installing {name}"); + var pack = $"{name}.{Settings.Version}.nupkg"; + var packPath = $"BuildOutput/NugetPackages/{pack}"; + TargetEnvironment.InstallPack(name, Settings.Version, packPath); + } + Console.WriteLine($"Installing templates to {TargetEnvironment.DotNetTemplatePacksPath}"); + foreach (var language in templateLanguages) + { + Console.WriteLine($"Installing {language} templates"); + var pack = $"GtkSharp.Workload.Template.{language}.{Settings.Version}.nupkg"; + var packPath = $"BuildOutput/NugetPackages/{pack}"; + TargetEnvironment.InstallTemplatePack(pack, packPath); + } + Console.WriteLine($"Registering \"gtk\" installed workload..."); + TargetEnvironment.RegisterInstalledWorkload("gtk"); +}); + +Task("UninstallWorkload") + .Does(() => +{ + Console.WriteLine($"Uninstalling workload for SDK version {TargetEnvironment.DotNetCliFeatureBand}, at {TargetEnvironment.DotNetInstallPath}"); + Console.WriteLine($"Removing manifests from {TargetEnvironment.DotNetManifestPath}"); + TargetEnvironment.UninstallManifests(manifestName); + Console.WriteLine($"Removing packs from {TargetEnvironment.DotNetPacksPath}"); + foreach (var name in packNames) + { + Console.WriteLine($"Removing {name}"); + TargetEnvironment.UninstallPack(name, Settings.Version); + } + Console.WriteLine($"Removing templates from {TargetEnvironment.DotNetTemplatePacksPath}"); + foreach (var language in templateLanguages) + { + Console.WriteLine($"Removing {language} templates"); + var pack = $"GtkSharp.Workload.Template.{language}.{Settings.Version}.nupkg"; + TargetEnvironment.UninstallTemplatePack(pack); + } + Console.WriteLine($"Unregistering \"gtk\" installed workload..."); + TargetEnvironment.UnregisterInstalledWorkload("gtk"); +}); + // TASK TARGETS Task("Default") .IsDependentOn("Build") .IsDependentOn("PackageNuGet") + .IsDependentOn("PackageWorkload") .IsDependentOn("PackageTemplates"); // EXECUTION