Skip to content

Commit

Permalink
chore: auto create lang nuspec files.
Browse files Browse the repository at this point in the history
  • Loading branch information
NaBian committed Sep 28, 2023
1 parent fc62877 commit 3b2fc5e
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ packages/
build/*
!build/build.cake
!build/build*.nuspec
!build/create_lang_nuspec_file.py
!build/build.ps1
!build/LICENSE
!build/icon.png
Expand Down
59 changes: 59 additions & 0 deletions build/build.Lang.template.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>HandyControl.Lang.{lang}</id>
<version>3.5.0</version>
<title>HandyOrg</title>
<authors>HandyOrg</authors>
<owners>HandyOrg</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="file">LICENSE</license>
<icon>icon.png</icon>
<projectUrl>https://github.com/HandyOrg/HandyControl</projectUrl>
<description>Contains some simple and commonly used WPF controls</description>
<releaseNotes>Changes are detailed at https://github.com/HandyOrg/HandyControl/releases</releaseNotes>
<copyright>Copyright © HandyOrg 2018-2023</copyright>
<tags>WPF C# Control</tags>
<repository type="git" url="https://github.com/HandyOrg/HandyControl" commit="e118ac98ccd1db28f25f66ba2da5c2e029a622a4" />
<dependencies>
<group targetFramework=".NETFramework4.0" />
<group targetFramework=".NETFramework4.5" />
<group targetFramework=".NETFramework4.5.1" />
<group targetFramework=".NETFramework4.5.2" />
<group targetFramework=".NETFramework4.6" />
<group targetFramework=".NETFramework4.6.1" />
<group targetFramework=".NETFramework4.6.2" />
<group targetFramework=".NETFramework4.7" />
<group targetFramework=".NETFramework4.7.1" />
<group targetFramework=".NETFramework4.7.2" />
<group targetFramework=".NETFramework4.8" />
<group targetFramework=".NETFramework4.8.1" />
<group targetFramework=".NETCoreApp3.0" />
<group targetFramework=".NETCoreApp3.1" />
<group targetFramework="net5.0" />
<group targetFramework="net6.0" />
<group targetFramework="net7.0" />
</dependencies>
</metadata>
<files>
<file src="lib\net40\{lang}\HandyControl.resources.dll" target="lib\net40\{lang}\HandyControl.resources.dll" />
<file src="lib\net45\{lang}\HandyControl.resources.dll" target="lib\net45\{lang}\HandyControl.resources.dll" />
<file src="lib\net451\{lang}\HandyControl.resources.dll" target="lib\net451\{lang}\HandyControl.resources.dll" />
<file src="lib\net452\{lang}\HandyControl.resources.dll" target="lib\net452\{lang}\HandyControl.resources.dll" />
<file src="lib\net46\{lang}\HandyControl.resources.dll" target="lib\net46\{lang}\HandyControl.resources.dll" />
<file src="lib\net461\{lang}\HandyControl.resources.dll" target="lib\net461\{lang}\HandyControl.resources.dll" />
<file src="lib\net462\{lang}\HandyControl.resources.dll" target="lib\net462\{lang}\HandyControl.resources.dll" />
<file src="lib\net47\{lang}\HandyControl.resources.dll" target="lib\net47\{lang}\HandyControl.resources.dll" />
<file src="lib\net471\{lang}\HandyControl.resources.dll" target="lib\net471\{lang}\HandyControl.resources.dll" />
<file src="lib\net472\{lang}\HandyControl.resources.dll" target="lib\net472\{lang}\HandyControl.resources.dll" />
<file src="lib\net48\{lang}\HandyControl.resources.dll" target="lib\net48\{lang}\HandyControl.resources.dll" />
<file src="lib\net481\{lang}\HandyControl.resources.dll" target="lib\net481\{lang}\HandyControl.resources.dll" />
<file src="lib\net5.0\{lang}\HandyControl.resources.dll" target="lib\net5.0\{lang}\HandyControl.resources.dll" />
<file src="lib\net6.0\{lang}\HandyControl.resources.dll" target="lib\net6.0\{lang}\HandyControl.resources.dll" />
<file src="lib\net7.0\{lang}\HandyControl.resources.dll" target="lib\net7.0\{lang}\HandyControl.resources.dll" />
<file src="lib\netcoreapp3.0\{lang}\HandyControl.resources.dll" target="lib\netcoreapp3.0\{lang}\HandyControl.resources.dll" />
<file src="lib\netcoreapp3.1\{lang}\HandyControl.resources.dll" target="lib\netcoreapp3.1\{lang}\HandyControl.resources.dll" />
<file src="icon.png" target="icon.png" />
<file src="LICENSE" target="LICENSE" />
</files>
</package>
15 changes: 15 additions & 0 deletions build/create_lang_nuspec_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pathlib import Path


def main():
with open('build.Lang.template.nuspec', 'r', encoding='utf-8') as template_file:
template_content = template_file.read()

resx_file_folder = Path('../src/Shared/HandyControl_Shared/Properties/Langs')
for lang in [path.stem.lstrip('Lang.') for path in resx_file_folder.glob('Lang.*.resx')]:
with open(f'build.Lang.{lang}.nuspec', 'w', encoding='utf-8') as nuspec_file:
nuspec_file.write(template_content.format(lang=lang))


if __name__ == '__main__':
main()

0 comments on commit 3b2fc5e

Please sign in to comment.