diff --git a/ChangeLog b/ChangeLog index 015867d..573bf60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,13 @@ -2023, Tara Piccari +2023, August Tara Piccari * Prebuild updated fully to net7 * Added VS Solution flag to include dep files * Added support for Multi-platform App UI + * Added support for toggling default file scanning, files node no longer automatically indicates this. + * Added support for custom cross-platform compatible scripting/text generation + * Added support for Windows Forms on dotnet 6+ + * Added support for marking internals visible to another namespace + * Added support for PrivateAssets flag on package reference + * Added support for Nullable node 2017, August Ubit Umarov * add Freak Tech patch for prefer32bit default to false diff --git a/bootstrap/prebuild.dll b/bootstrap/prebuild.dll index 995442b..452581d 100644 Binary files a/bootstrap/prebuild.dll and b/bootstrap/prebuild.dll differ diff --git a/source/Prebuild/Core/Nodes/InternalsNode.cs b/source/Prebuild/Core/Nodes/InternalsNode.cs new file mode 100644 index 0000000..530d978 --- /dev/null +++ b/source/Prebuild/Core/Nodes/InternalsNode.cs @@ -0,0 +1,25 @@ +using Prebuild.Core.Attributes; +using Prebuild.Core.Utilities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace Prebuild.Core.Nodes +{ + [DataNode("InternalsVisibleTo")] + public class InternalsNode : DataNode + { + public string Name { get; private set; } + + #region Methods + public override void Parse(XmlNode node) + { + base.Parse(node); + Name = Helper.AttributeValue(node, "name", ""); + } + #endregion + } +} diff --git a/source/Prebuild/Core/Nodes/PackageReferenceNode.cs b/source/Prebuild/Core/Nodes/PackageReferenceNode.cs index 4ff0066..0de442c 100644 --- a/source/Prebuild/Core/Nodes/PackageReferenceNode.cs +++ b/source/Prebuild/Core/Nodes/PackageReferenceNode.cs @@ -57,6 +57,7 @@ public class PackageReferenceNode : DataNode, IComparable { Name = Helper.AttributeValue(node, "name", Name); Version = Helper.AttributeValue(node, "version", Version); + PrivateAssets = Helper.AttributeValue(node, "private", PrivateAssets); } #endregion @@ -79,5 +80,7 @@ public class PackageReferenceNode : DataNode, IComparable /// The version. public string Version { get; private set; } + public string PrivateAssets { get; private set; } + #endregion } \ No newline at end of file diff --git a/source/Prebuild/Core/Nodes/ProjectNode.cs b/source/Prebuild/Core/Nodes/ProjectNode.cs index e335cd8..52e6cc2 100644 --- a/source/Prebuild/Core/Nodes/ProjectNode.cs +++ b/source/Prebuild/Core/Nodes/ProjectNode.cs @@ -186,6 +186,7 @@ public class ProjectNode : DataNode, IComparable ConfigFile = Helper.AttributeValue(node, "configFile", ConfigFile); DesignerFolder = Helper.AttributeValue(node, "designerFolder", DesignerFolder); AssemblyName = Helper.AttributeValue(node, "assemblyName", AssemblyName); + ScanFiles = Helper.ParseBoolean(node, "scanFiles", true); Language = Helper.AttributeValue(node, "language", Language); Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), Type); Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), Runtime); @@ -208,6 +209,7 @@ public class ProjectNode : DataNode, IComparable Guid = new Guid(guid); GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); + UseWindowsForms = Helper.ParseBoolean(node, "winforms", false); DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); if (string.IsNullOrEmpty(AssemblyName)) AssemblyName = Name; @@ -250,6 +252,7 @@ public class ProjectNode : DataNode, IComparable else if (dataNode is TextGenNode) TextGenNodes.Add((TextGenNode)dataNode); else if (dataNode is MauiNode obj) MauiSettings = obj; else if (dataNode is NullableNode) Nullable = true; + else if (dataNode is InternalsNode inObj) InternalsVisible = inObj; } } finally @@ -308,6 +311,21 @@ public class ProjectNode : DataNode, IComparable /// public MauiNode MauiSettings { get; private set; } = null; + /// + /// Marks the visibility for internals + /// + public InternalsNode InternalsVisible { get; private set; } + + /// + /// Enables Windows forms on a dotnet project. + /// + public bool UseWindowsForms { get; private set; } = false; + + /// + /// Scans the directory for files + /// + public bool ScanFiles {get;private set;} = true; + /// /// The version of the .NET Framework to compile under /// diff --git a/source/Prebuild/Core/Targets/VSGenericTarget.cs b/source/Prebuild/Core/Targets/VSGenericTarget.cs index c9abde4..463c627 100644 --- a/source/Prebuild/Core/Targets/VSGenericTarget.cs +++ b/source/Prebuild/Core/Targets/VSGenericTarget.cs @@ -714,10 +714,12 @@ public abstract class VSGenericTarget : ITarget ps.WriteLine(); ps.WriteLine(" "); - ps.WriteLine($" {project.FrameworkVersion.ToString().Replace("_", ".")}"); + ps.WriteLine(" {0}{1}", project.FrameworkVersion.ToString().Replace("_", "."), project.UseWindowsForms? "-windows" : ""); ps.WriteLine(" false"); - ps.WriteLine(" {0}", + if (!project.UseWindowsForms) + ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); + else ps.WriteLine(" WinExe"); ps.WriteLine(" false"); if (project.FrameworkVersion == FrameworkVersion.netstandard2_0) ps.WriteLine(" 5.0.0"); @@ -725,10 +727,13 @@ public abstract class VSGenericTarget : ITarget ps.WriteLine(" {0}", project.AssemblyName); ps.WriteLine(" true"); //ps.WriteLine(" false"); + if (project.UseWindowsForms) + ps.WriteLine(" true"); ps.WriteLine(" false"); if (!solution.Options.UseDepsFile) ps.WriteLine(" false"); - if (listFiles) + + if (!project.ScanFiles) ps.WriteLine(" false"); if (project.CopyLocalLockFileAssemblies) @@ -743,6 +748,7 @@ public abstract class VSGenericTarget : ITarget } } + if(project.Nullable) ps.WriteLine($" {project.NullableStr}"); @@ -858,12 +864,18 @@ public abstract class VSGenericTarget : ITarget { ps.WriteLine(" "); foreach (var pack in project.PackageReferences) - ps.WriteLine(" ", - pack.Name, pack.Version); + ps.WriteLine(" ", + pack.Name, pack.Version, pack.PrivateAssets != "" ? $"PrivateAssets=\"{pack.PrivateAssets}\"" : ""); ps.WriteLine(" "); ps.WriteLine(); } + if (project.InternalsVisible != null) + { + ps.WriteLine(" "); + ps.WriteLine($" "); + ps.WriteLine(" "); + } // Output the ItemGroup for project.References WriteProjectReferencesDotNet(solution, project, ps); @@ -905,7 +917,7 @@ public abstract class VSGenericTarget : ITarget if (subType == SubType.Designer) { - ps.WriteLine(" ", file); + ps.WriteLine(" ", file); var autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; var dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; @@ -919,13 +931,13 @@ public abstract class VSGenericTarget : ITarget { ps.WriteLine(" ResXFileCodeGenerator"); ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); - ps.WriteLine(" " + subType + ""); + //ps.WriteLine(" " + subType + ""); } ps.WriteLine(" "); if (File.Exists(Helper.NormalizePath(autogen_name))) { - ps.WriteLine(" ", autogen_name); + ps.WriteLine(" ", autogen_name); //ps.WriteLine(" True"); // If a parent .cs file exists, link this autogen file to it. Otherwise link @@ -939,6 +951,7 @@ public abstract class VSGenericTarget : ITarget { ps.WriteLine(" True"); ps.WriteLine(" {0}", Path.GetFileName(filePath)); + ps.WriteLine(" True"); } ps.WriteLine(" "); diff --git a/source/Prebuild/Properties/AssemblyInfo.cs b/source/Prebuild/Properties/AssemblyInfo.cs index 2e73f83..a564f3b 100644 --- a/source/Prebuild/Properties/AssemblyInfo.cs +++ b/source/Prebuild/Properties/AssemblyInfo.cs @@ -73,7 +73,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguageAttribute("en-US")] -[assembly: AssemblyVersion("2.0.9.0")] +[assembly: AssemblyVersion("2.0.10.0")] // // Version information for an assembly consists of the following four values: diff --git a/source/Prebuild/prebuild.xml b/source/Prebuild/prebuild.xml index 3b6a29f..3915a48 100644 --- a/source/Prebuild/prebuild.xml +++ b/source/Prebuild/prebuild.xml @@ -6,7 +6,7 @@ type="Exe" rootNamespace="Prebuild" startupObject="Prebuild.Prebuild" - version="2.0.9" + version="2.0.10" > Matthew Holmes (matthew@wildfiregames.com) Dan Moorehead (dan05a@gmail.com) @@ -47,8 +47,5 @@ - - - \ No newline at end of file