|
6 | 6 | Note that this script NEEDS TO BE RUN FROM THE ROOT of the project. |
7 | 7 | """ |
8 | 8 | #!/usr/bin/env python3 |
| 9 | +import json |
9 | 10 | import os |
| 11 | +import re |
10 | 12 | import sys |
| 13 | +import subprocess |
| 14 | +import platform |
11 | 15 |
|
12 | | -UTILS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), './Utils')) |
13 | | -sys.path.insert(0, UTILS_DIR) |
14 | | -from general_utils import get_package_version_from_manifest, update_changelog, update_validation_exceptions # nopep8 |
15 | | -from config import getNetcodePackageName, getPackageManifestPath, getPackageValidationExceptionsPath, getPackageChangelogPath # nopep8 |
| 16 | +from Utils.general_utils import get_package_version_from_manifest, update_changelog, update_validation_exceptions # nopep8 |
16 | 17 |
|
17 | | -if __name__ == '__main__': |
18 | | - |
19 | | - ngo_package_name = getNetcodePackageName() |
20 | | - ngo_manifest_path = getPackageManifestPath() |
21 | | - ngo_validation_exceptions_path = getPackageValidationExceptionsPath() |
22 | | - ngo_changelog_path = getPackageChangelogPath() |
23 | | - |
24 | | - if not os.path.exists(ngo_manifest_path): |
25 | | - print(f" Path does not exist: {ngo_manifest_path}") |
26 | | - sys.exit(1) |
27 | | - |
28 | | - if not os.path.exists(ngo_changelog_path): |
29 | | - print(f" Path CHANGELOG does not exist: {ngo_changelog_path}") |
| 18 | +def make_package_release_ready(manifest_path, changelog_path, validation_exceptions_path, package_version): |
| 19 | + |
| 20 | + if not os.path.exists(manifest_path): |
| 21 | + print(f" Path does not exist: {manifest_path}") |
30 | 22 | sys.exit(1) |
31 | 23 |
|
32 | | - ngo_package_version = get_package_version_from_manifest(ngo_manifest_path) |
| 24 | + if not os.path.exists(changelog_path): |
| 25 | + print(f" Path does not exist: {changelog_path}") |
| 26 | + sys.exit(1) |
33 | 27 |
|
34 | | - if ngo_package_version is None: |
35 | | - print(f"Package version not found at {ngo_manifest_path}") |
| 28 | + if package_version is None: |
| 29 | + print(f"Package version not found at {manifest_path}") |
36 | 30 | sys.exit(1) |
37 | 31 |
|
38 | 32 | # Update the ValidationExceptions.json file |
39 | 33 | # with the new package version OR remove it if not a release branch |
40 | | - update_validation_exceptions(ngo_validation_exceptions_path, ngo_package_version) |
| 34 | + update_validation_exceptions(validation_exceptions_path, package_version) |
41 | 35 | # Clean the CHANGELOG and add latest entry |
42 | | - # package version is already know as is always corresponds to current package state |
43 | | - update_changelog(ngo_changelog_path, ngo_package_version) |
| 36 | + # package version is already know as explained in |
| 37 | + # https://github.cds.internal.unity3d.com/unity/dots/pull/14318 |
| 38 | + update_changelog(changelog_path, package_version) |
| 39 | + |
| 40 | + |
| 41 | +if __name__ == '__main__': |
| 42 | + manifest_path = 'com.unity.netcode.gameobjects/package.json' |
| 43 | + changelog_path = 'com.unity.netcode.gameobjects/CHANGELOG.md' |
| 44 | + validation_exceptions_path = 'com.unity.netcode.gameobjects/ValidationExceptions.json' |
| 45 | + package_version = get_package_version_from_manifest(manifest_path) |
| 46 | + |
| 47 | + make_package_release_ready(manifest_path, changelog_path, validation_exceptions_path, package_version) |
0 commit comments