-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored mod creation to use a file tree of templates. #4134
Conversation
In a future PR could we allow specifying our own template? atm I copy paste a template and hope I remembered to change all file names + contents of files |
Should we move LangVersion to the tMLMod.targets too? I believe a modder should still be able to override it in their mod's csproj, but an issue we have right now is that modders are seeing suggestions in VS for language versions that the ingame complier does not support. I know there is a pr for doing it through dotnet itself, but even then we'd want to make sure that only the highest supported lang version is the default. |
24bebf1
to
d2bb31b
Compare
I've done that now, with it explicitly set to |
Will this be able to easily remove |
Yes, here's the code to insert even: // Remove the analyzer package, since our targets file now handles all that.
RemoveNodes(itemGroups.Elements("PackageReference").Where(
e => e.Attribute("Include")?.Value == "tModLoader.CodeAssist"
)); EDIT: This is now a part of the PR, with the PackageReference moved into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this is an excellent change. I've provided some factoring feedback.
This PR should not change the templates. It makes it really hard to review. Please split template changes into an additional 1 or 2 PRs (2 if there are changes that have to be done both before and after this PR).
patches/tModLoader/Terraria/ModLoader/Assets/AssemblyResourcesContentSource.cs
Show resolved
Hide resolved
patches/tModLoader/Terraria/ModLoader/Templates/Properties/launchSettings.json
Outdated
Show resolved
Hide resolved
patches/tModLoader/Terraria/ModLoader/Templates/Properties/launchSettings.json
Outdated
Show resolved
Hide resolved
patches/tModLoader/Terraria/ModLoader/Templates/{{ModName}}.csproj
Outdated
Show resolved
Hide resolved
patches/tModLoader/Terraria/ModLoader/Templates/{{ModName}}.csproj
Outdated
Show resolved
Hide resolved
90dfa90
to
454247d
Compare
* Refactored mod creation to use a file tree of templates. * Upgrade .csproj files via XML edits when possible. * Include TargetFramework & PlatformTarget in 'tMLMod.targets'. * Add LangVersion to .targets, remove old ones from csproj files. * Major code & design improvements. * Slightly less convoluted XElement matching. * Even less convoluted XML Linq. * Reduce template .csproj. * One less line for TML .csproj. * Made TemplateParameters a ref type. * Fixed and reduced launchSettings.json template. * Handled some SourceManagement feedback. * Finish addressing SourceManagement flow feedback. * Auto-remove 'tModLoader.CodeAssist' from csproj files, since it's now in targets. * Updated for .NET 8. * Use .bak extension for csproj backup * No file scoped namespaces yet. Link to stable branch and wiki. * Fix template files not being embedded * Fixed regressions in CollectCsprojModifications. * Don't remove conditional item & property groups. * Fix ResetCsprojFile --------- Co-authored-by: Chicken-Bones <mehvids@gmail.com> Co-authored-by: JavidPack <javidpack@gmail.com>
To assist two+ active PRs (#2472 and #4037), this one does the following:
Terraria.ModLoader.Core.SourceManagement
class.TargetFramework
andPlatformTarget
from default.csproj
files, putting it intotModLoader.targets
tMLMod.targets
instead.Content.Items
namespace and folder.Default mod template changes:
launchSettings.json
, uses tabs now.ExampleSword.png
, which is nicer to look at. A tooltip has also been added, to immediately showcase how to make multiline strings in HJSON..cs
files now use file-scoped namespaces. The item template's code had its comments updated, and had magic numbers replaced with ID classes in a few lines.description.txt
:->
Questionable notes:
AssemblyResourcesContentSource
, because of it rather annoyingly crashing the game whenever it encountered a.cs
+.png
pair.