Jump to content

An msbuild task for automatically generating mod_info.yaml


Recommended Posts

Hello, modders

大家好

https://forums.kleientertainment.com/forums/topic/130712-oni-is-upgrading-to-harmony-20/

As the official wants to upgrade to harmony-20, I have to consider using archived_versions

由于官方想要升级到 harmony-20,我不得不考虑使用 archived_versions

But the advantage of developers is laziness, so I don't want to manage directories manually

但开发者的优点是懒惰,所以我不想手工管理目录

So I submitted a msbuild task to NuGet.org.

所以我提交了一个 msbuild task 到 NuGet.org.

https://www.nuget.org/packages/ONI-ModInfo-Task/

 [ Source Code ]

My mod is using it

我的MOD正在使用它

https://github.com/undancer/oni-mods/blob/feature/%E6%9C%80%E5%90%8E%E7%9A%84%E8%A1%A5%E7%BB%99%E5%8C%85-%E5%85%AC%E5%BC%80%E6%B5%8B%E8%AF%95%E7%89%88/Directory.Build.targets#L51

https://github.com/undancer/oni-mods/blob/feature/%E6%9C%80%E5%90%8E%E7%9A%84%E8%A1%A5%E7%BB%99%E5%8C%85-%E5%85%AC%E5%BC%80%E6%B5%8B%E8%AF%95%E7%89%88/SelectLastCarePackage/SelectLastCarePackage.csproj#L34

I hope you like it.

希望大家喜欢

If you find any problems in use, please let me know in GitHub.

如果大家在使用中发现任何问题,请在GitHub中告诉我.

Link to comment
Share on other sites

Cairath also created a task to do so.

Additionally, it's trivial to roll your own implementation of this.  Here's mine at the moment:

  <!--Create and update the mod_info and mod file.-->
  <Target Name="WriteModInfoFile" BeforeTargets="PreBuildEvent">
    <WriteLinesToFile File="$(TargetDir)\mod_info.yaml" Overwrite="true" Lines=
                      "APIVersion: 2;
                      supportedContent: $(supportedContent);
                      minimumSupportedBuild: $(minimumSupportedBuild);
                      version: &quot;$(Version)&quot;" />

    <PropertyGroup>
      <ModFile>$(TargetDir)\mod.yaml</ModFile>
      <Title Condition=" '$(Configuration)' == 'Debug' ">DEV: $(Title)</Title>
    </PropertyGroup>
    <WriteLinesToFile File="$(ModFile)" Overwrite="true" Lines=
                      "staticID: Aze.$(AssemblyName);
                      description: &quot;$(Description)&quot;" />
    <WriteLinesToFile File="$(ModFile)" Lines="title: &quot;$(Title)&quot;"/>
  </Target>

 

Link to comment
Share on other sites

On 7/8/2021 at 12:13 PM, AzeTheGreat said:

Cairath also created a task to do so.

Additionally, it's trivial to roll your own implementation of this.  Here's mine at the moment:


  <!--Create and update the mod_info and mod file.-->
  <Target Name="WriteModInfoFile" BeforeTargets="PreBuildEvent">
    <WriteLinesToFile File="$(TargetDir)\mod_info.yaml" Overwrite="true" Lines=
                      "APIVersion: 2;
                      supportedContent: $(supportedContent);
                      minimumSupportedBuild: $(minimumSupportedBuild);
                      version: &quot;$(Version)&quot;" />

    <PropertyGroup>
      <ModFile>$(TargetDir)\mod.yaml</ModFile>
      <Title Condition=" '$(Configuration)' == 'Debug' ">DEV: $(Title)</Title>
    </PropertyGroup>
    <WriteLinesToFile File="$(ModFile)" Overwrite="true" Lines=
                      "staticID: Aze.$(AssemblyName);
                      description: &quot;$(Description)&quot;" />
    <WriteLinesToFile File="$(ModFile)" Lines="title: &quot;$(Title)&quot;"/>
  </Target>

 

Thank you for your reply, but if you look at the source code carefully, you will find that my task is not simply to generate mod_info.yaml file, but to automatically generate archived_versions format according to the. And his task is later than mine, and the idea is different. I don't think it's my choice to give up my own code.

Link to comment
Share on other sites

9 hours ago, undancer said:

Thank you for your reply, but if you look at the source code carefully, you will find that my task is not simply to generate mod_info.yaml file, but to automatically generate archived_versions format according to the. And his task is later than mine, and the idea is different. I don't think it's my choice to give up my own code.

Is the task just modifying where the mod's final location to be in the correct folder structure then?

Link to comment
Share on other sites

On 7/15/2021 at 8:13 AM, AzeTheGreat said:

Is the task just modifying where the mod's final location to be in the correct folder structure then?

When usearchivedversions = false, task only generates yaml files without changing the directory structure. When usearchivedversions = true, the directory structure is changed

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...