.NET: Generate SdkPackageVersions.props from version.py

Ensures that the versions always match the Godot version, albeit following
SemVer 2.0 so inserting a dot between "beta" and the build number.

For "stable" status, we omit the suffix as this would be interpreted as a
pre-release build too.

So we have:

| Godot version  | Nupkg version  |
| -------------- | -------------- |
| 4.0.0-beta     | 4.0.0-beta     |
| 4.0.0-beta2    | 4.0.0-beta.2   |
| 4.0.0-rc1      | 4.0.0-rc.1     |
| 4.0.0-stable   | 4.0.0          |
This commit is contained in:
Rémi Verschelde
2022-09-28 22:51:40 +02:00
parent 38113acf0d
commit 340f62d1ec
4 changed files with 62 additions and 17 deletions

View File

@ -7,15 +7,6 @@ from collections import OrderedDict
from collections.abc import Mapping
from typing import Iterator
# We need to define our own `Action` method to control the verbosity of output
# and whenever we need to run those commands in a subprocess on some platforms.
from SCons import Node
from SCons.Script import Action
from SCons.Script import ARGUMENTS
from SCons.Script import Glob
from SCons.Variables.BoolVariable import _text2bool
from platform_methods import run_in_subprocess
def add_source_files(self, sources, files):
# Convert string to list of absolute paths (including expanding wildcard)
@ -220,6 +211,9 @@ def get_cmdline_bool(option, default):
"""We use `ARGUMENTS.get()` to check if options were manually overridden on the command line,
and SCons' _text2bool helper to convert them to booleans, otherwise they're handled as strings.
"""
from SCons.Script import ARGUMENTS
from SCons.Variables.BoolVariable import _text2bool
cmdline_val = ARGUMENTS.get(option)
if cmdline_val is not None:
return _text2bool(cmdline_val)
@ -703,6 +697,9 @@ def generate_cpp_hint_file(filename):
def glob_recursive(pattern, node="."):
from SCons import Node
from SCons.Script import Glob
results = []
for f in Glob(str(node) + "/*", source=True):
if type(f) is Node.FS.Dir:
@ -913,6 +910,9 @@ def CommandNoCache(env, target, sources, command, **args):
def Run(env, function, short_message, subprocess=True):
from SCons.Script import Action
from platform_methods import run_in_subprocess
output_print = short_message if not env["verbose"] else ""
if not subprocess:
return Action(function, output_print)