QOL changes to Prebuild and bootstrap

This commit is contained in:
Zontreck 2023-08-23 13:09:17 -07:00
parent 456556261f
commit 70fd8fa0c7
8 changed files with 76 additions and 14 deletions

View file

@ -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

Binary file not shown.

View file

@ -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
}
}

View file

@ -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
/// <value>The version.</value>
public string Version { get; private set; }
public string PrivateAssets { get; private set; }
#endregion
}

View file

@ -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
/// </summary>
public MauiNode MauiSettings { get; private set; } = null;
/// <summary>
/// Marks the visibility for internals
/// </summary>
public InternalsNode InternalsVisible { get; private set; }
/// <summary>
/// Enables Windows forms on a dotnet project.
/// </summary>
public bool UseWindowsForms { get; private set; } = false;
/// <summary>
/// Scans the directory for files
/// </summary>
public bool ScanFiles {get;private set;} = true;
/// <summary>
/// The version of the .NET Framework to compile under
/// </summary>

View file

@ -714,10 +714,12 @@ public abstract class VSGenericTarget : ITarget
ps.WriteLine();
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine($" <TargetFramework>{project.FrameworkVersion.ToString().Replace("_", ".")}</TargetFramework>");
ps.WriteLine(" <TargetFramework>{0}{1}</TargetFramework>", project.FrameworkVersion.ToString().Replace("_", "."), project.UseWindowsForms? "-windows" : "");
ps.WriteLine(" <PreserveCompilationContext>false</PreserveCompilationContext>");
ps.WriteLine(" <OutputType>{0}</OutputType>",
if (!project.UseWindowsForms)
ps.WriteLine(" <OutputType>{0}</OutputType>",
project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
else ps.WriteLine(" <OutputType>WinExe</OutputType>");
ps.WriteLine(" <GenerateAssemblyInfo>false</GenerateAssemblyInfo>");
if (project.FrameworkVersion == FrameworkVersion.netstandard2_0)
ps.WriteLine(" <RuntimeFrameworkVersion>5.0.0</RuntimeFrameworkVersion>");
@ -725,10 +727,13 @@ public abstract class VSGenericTarget : ITarget
ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
ps.WriteLine(" <Deterministic>true</Deterministic>");
//ps.WriteLine(" <EnableDefaultCompileItems>false</EnableDefaultCompileItems>");
if (project.UseWindowsForms)
ps.WriteLine(" <UseWindowsForms>true</UseWindowsForms>");
ps.WriteLine(" <ProduceReferenceAssembly>false</ProduceReferenceAssembly>");
if (!solution.Options.UseDepsFile)
ps.WriteLine(" <GenerateDependencyFile>false</GenerateDependencyFile>");
if (listFiles)
if (!project.ScanFiles)
ps.WriteLine(" <EnableDefaultItems>false</EnableDefaultItems>");
if (project.CopyLocalLockFileAssemblies)
@ -743,6 +748,7 @@ public abstract class VSGenericTarget : ITarget
}
}
if(project.Nullable)
ps.WriteLine($" <Nullable>{project.NullableStr}</Nullable>");
@ -858,12 +864,18 @@ public abstract class VSGenericTarget : ITarget
{
ps.WriteLine(" <ItemGroup>");
foreach (var pack in project.PackageReferences)
ps.WriteLine(" <PackageReference Include=\"{0}\" Version=\"{1}\" />",
pack.Name, pack.Version);
ps.WriteLine(" <PackageReference Include=\"{0}\" Version=\"{1}\" {2}/>",
pack.Name, pack.Version, pack.PrivateAssets != "" ? $"PrivateAssets=\"{pack.PrivateAssets}\"" : "");
ps.WriteLine(" </ItemGroup>");
ps.WriteLine();
}
if (project.InternalsVisible != null)
{
ps.WriteLine(" <ItemGroup>");
ps.WriteLine($" <InternalsVisibleTo Include=\"{project.InternalsVisible.Name}\"/>");
ps.WriteLine(" </ItemGroup>");
}
// 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(" <EmbeddedResource Include=\"{0}\">", file);
ps.WriteLine(" <EmbeddedResource Update=\"{0}\">", 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(" <Generator>ResXFileCodeGenerator</Generator>");
ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name));
ps.WriteLine(" <SubType>" + subType + "</SubType>");
//ps.WriteLine(" <SubType>" + subType + "</SubType>");
}
ps.WriteLine(" </EmbeddedResource>");
if (File.Exists(Helper.NormalizePath(autogen_name)))
{
ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name);
ps.WriteLine(" <Compile Update=\"{0}\">", autogen_name);
//ps.WriteLine(" <DesignTime>True</DesignTime>");
// 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(" <AutoGen>True</AutoGen>");
ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath));
ps.WriteLine(" <DesignTime>True</DesignTime>");
}
ps.WriteLine(" </Compile>");

View file

@ -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:

View file

@ -6,7 +6,7 @@
type="Exe"
rootNamespace="Prebuild"
startupObject="Prebuild.Prebuild"
version="2.0.9"
version="2.0.10"
>
<Author>Matthew Holmes (matthew@wildfiregames.com)</Author>
<Author>Dan Moorehead (dan05a@gmail.com)</Author>
@ -47,8 +47,5 @@
<Match pattern="App.ico" buildAction="EmbeddedResource" />
<Match path="data" pattern="prebuild-1.10.xsd" buildAction="EmbeddedResource" />
<Match path="data" pattern="autotools.xml" buildAction="EmbeddedResource" />
<Match pattern="*.cs" recurse="true">
<Exclude name="obj" pattern="obj" />
</Match>
</Files>
</Project>