com.elestrago.unity.package-tools 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CAHNGELOG.md +21 -0
- package/Documentation~/api.md +156 -66
- package/Documentation~/examples/ciutils-exportlegacypackage.md +32 -0
- package/Documentation~/examples/ciutils-exportpackagesource.md +38 -0
- package/Documentation~/examples/ciutils-generate.md +13 -8
- package/Documentation~/examples/ciutils-listconfigs.md +36 -0
- package/Documentation~/examples/packagetoolapi-exportlegacypackage.md +39 -0
- package/Documentation~/examples/packagetoolapi-exportpackagesource.md +40 -0
- package/Documentation~/examples/packagetoolapi-findconfig.md +46 -0
- package/Documentation~/examples/packagetoolapi-generateversionconstants.md +42 -0
- package/Documentation~/examples/packagetoolapi-getconfig.md +37 -0
- package/Documentation~/examples/packagetoolapi-getconfigs.md +36 -0
- package/Documentation~/examples/preparedll.md +1 -1
- package/Documentation~/examples.md +12 -1
- package/Documentation~/manual.md +39 -23
- package/Editor/CIUtils.cs +273 -74
- package/Editor/EditorConstants.cs +21 -1
- package/Editor/Inspectors/PackageManifestConfigInspector.cs +16 -3
- package/Editor/PackageToolApi.cs +141 -0
- package/Editor/PackageToolApi.cs.meta +11 -0
- package/Editor/Tools/CIResultModel.cs +107 -0
- package/Editor/Tools/CIResultModel.cs.meta +11 -0
- package/Editor/Tools/CodeGenTools.cs +8 -2
- package/Editor/Tools/FileTools.cs +76 -46
- package/Editor/Tools/UnityFileTools.cs +16 -2
- package/README.md +17 -8
- package/Samples~/ClaudeSkills/unity-package-docs/SKILL.md +6 -1
- package/package.json +4 -4
package/CAHNGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
+
## [2.5.3](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.5.3)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added `PackageToolApi` with public `ExportPackageSource`, `ExportLegacyPackage`, `GenerateVersionConstants`, and config lookup methods. See `Documentation~/api.md`.
|
|
10
|
+
- Added `CIUtils.ExportPackageSource`, `CIUtils.ExportLegacyPackage`, and `CIUtils.ListConfigs` batch-mode entry points. See `Documentation~/manual.md`.
|
|
11
|
+
- Added `resultpath` and `exitonfinish` command-line keys that write a JSON run report and set the exit code. See `Documentation~/manual.md`.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Changed `package.json` generation to write into the config's `sourcePath`, so the exported legacy `.unityPackage` ships it too.
|
|
16
|
+
- Changed the `id` command-line key to accept a package name or config asset name as well as a config id.
|
|
17
|
+
- Changed `CIUtils.Generate` to exit `1` when an export fails instead of always exiting `0`.
|
|
18
|
+
- Changed the inspector export buttons to call `PackageToolApi` instead of the internal `PackageTool.Tools` helpers.
|
|
19
|
+
|
|
20
|
+
### Removed
|
|
21
|
+
|
|
22
|
+
- Removed the generated `Assets/PackageManifest/Generated/` folder; `package.json` is written to the package source folder instead.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
5
26
|
## [2.5.2](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.5.2)
|
|
6
27
|
|
|
7
28
|
### Fixed
|
package/Documentation~/api.md
CHANGED
|
@@ -22,16 +22,19 @@ Root namespace. Hosts the `PackageManifestConfig` ScriptableObject, the editor c
|
|
|
22
22
|
public static class CIUtils
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
**Source:** `Assets/Package/PackageTool/Editor/CIUtils.cs:
|
|
25
|
+
**Source:** `Assets/Package/PackageTool/Editor/CIUtils.cs:16` (md5: `cd2c4793b021866913ac7e62029e4069`, lines: 446)
|
|
26
26
|
|
|
27
|
-
Continuous-integration API for package tools.
|
|
27
|
+
Continuous-integration API for package tools. Every entry point here is meant to be invoked through Unity's -executeMethod and reads its arguments as key=value command-line pairs.
|
|
28
28
|
|
|
29
29
|
**Members:**
|
|
30
30
|
|
|
31
31
|
| Kind | Name | Signature | Line | Summary |
|
|
32
32
|
|------|------|-----------|------|---------|
|
|
33
|
-
| method | `Generate` | `public static void Generate()` |
|
|
34
|
-
| method | `
|
|
33
|
+
| method | `Generate` | `public static void Generate()` | 73 | Attempts to use zero or more `PackageManifestConfig` assets to generate legacy Unity packages and Unity source. |
|
|
34
|
+
| method | `ListConfigs` | `public static void ListConfigs()` | 196 | Writes every `PackageManifestConfig` in the project to the file passed in the 'resultpath' argument so that callers can discover which selectors are valid. |
|
|
35
|
+
| method | `ExportPackageSource` | `public static void ExportPackageSource()` | 213 | Exports the package source of every selected `PackageManifestConfig`. |
|
|
36
|
+
| method | `ExportLegacyPackage` | `public static void ExportLegacyPackage()` | 218 | Exports every selected `PackageManifestConfig` as a legacy unity package. |
|
|
37
|
+
| method | `PrepareDll` | `public static void PrepareDll()` | 319 | Sets the platform compatibility of every plugin in the source path of the project's `PackageManifestConfig` so that editor assemblies are not shipped as runtime ones. This is a command-line entry point in its own right, so it exits the editor when running on CI. |
|
|
35
38
|
|
|
36
39
|
### EditorConstants
|
|
37
40
|
|
|
@@ -39,7 +42,7 @@ Continuous-integration API for package tools.
|
|
|
39
42
|
internal static class EditorConstants
|
|
40
43
|
```
|
|
41
44
|
|
|
42
|
-
**Source:** `Assets/Package/PackageTool/Editor/EditorConstants.cs:32` (md5: `
|
|
45
|
+
**Source:** `Assets/Package/PackageTool/Editor/EditorConstants.cs:32` (md5: `76bc9384e2a242b10f03867b7015a134`, lines: 145)
|
|
43
46
|
|
|
44
47
|
Internal constants and readonly fields for package tools usage.
|
|
45
48
|
|
|
@@ -54,44 +57,43 @@ Internal constants and readonly fields for package tools usage.
|
|
|
54
57
|
| field | `ASSET_EXTENSION` | `public const string ASSET_EXTENSION` | 41 | |
|
|
55
58
|
| field | `META_EXTENSION` | `public const string META_EXTENSION` | 42 | |
|
|
56
59
|
| field | `META_FORMAT` | `public const string META_FORMAT` | 43 | |
|
|
57
|
-
| field | `
|
|
58
|
-
| field | `
|
|
59
|
-
| field | `
|
|
60
|
-
| field | `
|
|
61
|
-
| field | `
|
|
62
|
-
| field | `
|
|
63
|
-
| field | `
|
|
64
|
-
| field | `
|
|
65
|
-
| field | `
|
|
66
|
-
| field | `
|
|
67
|
-
| field | `
|
|
68
|
-
| field | `
|
|
69
|
-
| field | `
|
|
70
|
-
| field | `
|
|
71
|
-
| field | `
|
|
72
|
-
| field | `
|
|
73
|
-
| field | `
|
|
74
|
-
| field | `
|
|
75
|
-
| field | `
|
|
76
|
-
| field | `
|
|
77
|
-
| field | `
|
|
78
|
-
| field | `
|
|
79
|
-
| field | `
|
|
80
|
-
| field | `
|
|
81
|
-
| field | `
|
|
82
|
-
| field | `
|
|
83
|
-
| field | `
|
|
84
|
-
| field | `
|
|
85
|
-
| field | `
|
|
86
|
-
| field | `
|
|
87
|
-
| field | `
|
|
88
|
-
| field | `
|
|
89
|
-
| field | `
|
|
90
|
-
| field | `
|
|
91
|
-
| field | `
|
|
92
|
-
| field | `
|
|
93
|
-
| field | `
|
|
94
|
-
| field | `SELECT_COPY_DESTINATION_FOLDER_PICKER_TITLE` | `public const string SELECT_COPY_DESTINATION_FOLDER_PICKER_TITLE` | 123 | |
|
|
60
|
+
| field | `UNITY_PACKAGE_NAME_FORMAT` | `public const string UNITY_PACKAGE_NAME_FORMAT` | 44 | |
|
|
61
|
+
| field | `EMPTY_SPACE` | `public const char EMPTY_SPACE` | 45 | |
|
|
62
|
+
| field | `UNDERSCORE` | `public const char UNDERSCORE` | 46 | |
|
|
63
|
+
| field | `GROUP_BOX` | `public const string GROUP_BOX` | 52 | |
|
|
64
|
+
| field | `EDITOR_FOLDER_ICON` | `public const string EDITOR_FOLDER_ICON` | 59 | |
|
|
65
|
+
| field | `EDITOR_FILE_ICON` | `public const string EDITOR_FILE_ICON` | 60 | |
|
|
66
|
+
| field | `PACKAGE_JSON_HEADER` | `public const string PACKAGE_JSON_HEADER` | 63 | |
|
|
67
|
+
| field | `PACKAGE_CONTENT_HEADER` | `public const string PACKAGE_CONTENT_HEADER` | 64 | |
|
|
68
|
+
| field | `PACKAGE_ACTIONS_HEADER` | `public const string PACKAGE_ACTIONS_HEADER` | 65 | |
|
|
69
|
+
| field | `SOURCE_PATHS_HEADER_LABEL` | `public const string SOURCE_PATHS_HEADER_LABEL` | 67 | |
|
|
70
|
+
| field | `SOURCE_PATH_ELEMENT_LABEL_FORMAT` | `public const string SOURCE_PATH_ELEMENT_LABEL_FORMAT` | 68 | |
|
|
71
|
+
| field | `IGNORE_PATHS_HEADER_LABEL` | `public const string IGNORE_PATHS_HEADER_LABEL` | 70 | |
|
|
72
|
+
| field | `KEYWORDS_HEADER_LABEL` | `public const string KEYWORDS_HEADER_LABEL` | 72 | |
|
|
73
|
+
| field | `KEYWORD_ELEMENT_LABEL_FORMAT` | `public const string KEYWORD_ELEMENT_LABEL_FORMAT` | 73 | |
|
|
74
|
+
| field | `DEPENDENCY_HEADER_LABEL` | `public const string DEPENDENCY_HEADER_LABEL` | 75 | |
|
|
75
|
+
| field | `DEPENDENCY_ELEMENT_LABEL_FORMAT` | `public const string DEPENDENCY_ELEMENT_LABEL_FORMAT` | 76 | |
|
|
76
|
+
| field | `GENERATE_VERSION_CONSTANTS_BUTTON_TEXT` | `public const string GENERATE_VERSION_CONSTANTS_BUTTON_TEXT` | 78 | |
|
|
77
|
+
| field | `UPDATE_PACKAGE_BUTTON_TEXT` | `public const string UPDATE_PACKAGE_BUTTON_TEXT` | 85 | |
|
|
78
|
+
| field | `EXPORT_LEGACY_PACKAGE_BUTTON_TEXT` | `public const string EXPORT_LEGACY_PACKAGE_BUTTON_TEXT` | 86 | |
|
|
79
|
+
| field | `SELECT_SOURCE_PATH_FILE_PICKER_TITLE` | `public const string SELECT_SOURCE_PATH_FILE_PICKER_TITLE` | 88 | |
|
|
80
|
+
| field | `SELECT_SOURCE_PATH_PICKER_FOLDER_TITLE` | `public const string SELECT_SOURCE_PATH_PICKER_FOLDER_TITLE` | 89 | |
|
|
81
|
+
| field | `SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE` | `public const string SELECT_PACKAGE_EXPORT_PATH_PICKER_TITLE` | 90 | |
|
|
82
|
+
| field | `SELECT_VERSION_CONSTANTS_PATH_PICKER_TITLE` | `public const string SELECT_VERSION_CONSTANTS_PATH_PICKER_TITLE` | 91 | |
|
|
83
|
+
| field | `SELECT_SAMPLES_PATH_FOLDER_TITLE` | `public const string SELECT_SAMPLES_PATH_FOLDER_TITLE` | 92 | |
|
|
84
|
+
| field | `PROGRESS_BAR_TITLE` | `public const string PROGRESS_BAR_TITLE` | 93 | |
|
|
85
|
+
| field | `PROGRESS_BAR_TITLE_LEGACY` | `public const string PROGRESS_BAR_TITLE_LEGACY` | 94 | |
|
|
86
|
+
| field | `COMPILING_PROGRESS_MESSAGE` | `public const string COMPILING_PROGRESS_MESSAGE` | 95 | |
|
|
87
|
+
| field | `FOLDER_PATH_PICKER_HEIGHT` | `public const float FOLDER_PATH_PICKER_HEIGHT` | 97 | |
|
|
88
|
+
| field | `FOLDER_PATH_PICKER_BUFFER` | `public const float FOLDER_PATH_PICKER_BUFFER` | 98 | |
|
|
89
|
+
| field | `SAMPLES_FOLDER_NAME` | `public const string SAMPLES_FOLDER_NAME` | 135 | |
|
|
90
|
+
| field | `SAMPLES_HEADER_LABEL` | `public const string SAMPLES_HEADER_LABEL` | 136 | |
|
|
91
|
+
| field | `SAMPLES_ELEMENT_LABEL_FORMAT` | `public const string SAMPLES_ELEMENT_LABEL_FORMAT` | 137 | |
|
|
92
|
+
| field | `COPY_ENTRIES_HEADER_LABEL` | `public const string COPY_ENTRIES_HEADER_LABEL` | 139 | |
|
|
93
|
+
| field | `COPY_ENTRY_ELEMENT_LABEL_FORMAT` | `public const string COPY_ENTRY_ELEMENT_LABEL_FORMAT` | 140 | |
|
|
94
|
+
| field | `COPY_ENTRY_SOURCE_LABEL` | `public const string COPY_ENTRY_SOURCE_LABEL` | 141 | |
|
|
95
|
+
| field | `COPY_ENTRY_DESTINATION_LABEL` | `public const string COPY_ENTRY_DESTINATION_LABEL` | 142 | |
|
|
96
|
+
| field | `SELECT_COPY_DESTINATION_FOLDER_PICKER_TITLE` | `public const string SELECT_COPY_DESTINATION_FOLDER_PICKER_TITLE` | 143 | |
|
|
95
97
|
|
|
96
98
|
### MenuItems
|
|
97
99
|
|
|
@@ -101,6 +103,12 @@ internal static class MenuItems
|
|
|
101
103
|
|
|
102
104
|
**Source:** `Assets/Package/PackageTool/Editor/MenuItems.cs:6` (md5: `589a3e2956a9873db82d9d8193237c25`, lines: 11)
|
|
103
105
|
|
|
106
|
+
**Members:**
|
|
107
|
+
|
|
108
|
+
| Kind | Name | Signature | Line | Summary |
|
|
109
|
+
|------|------|-----------|------|---------|
|
|
110
|
+
| method | `OpenAboutModalDialog` | `internal static void OpenAboutModalDialog()` | 9 | |
|
|
111
|
+
|
|
104
112
|
### PackageManifestConfig
|
|
105
113
|
|
|
106
114
|
```csharp
|
|
@@ -160,6 +168,7 @@ Describes a dependency that this package requires.
|
|
|
160
168
|
|------|------|-----------|------|---------|
|
|
161
169
|
| field | `packageName` | `public string packageName` | 48 | The name of the dependent package. |
|
|
162
170
|
| field | `packageVersion` | `public string packageVersion` | 53 | The semantic version of the dependent package in MAJOR.MINOR.PATCH format. |
|
|
171
|
+
| method | `IsEmpty` | `public bool IsEmpty()` | 55 | |
|
|
163
172
|
|
|
164
173
|
### PackageManifestConfig.Author
|
|
165
174
|
|
|
@@ -199,6 +208,7 @@ Describes the samples of this package.
|
|
|
199
208
|
| field | `displayName` | `public string displayName` | 76 | |
|
|
200
209
|
| field | `description` | `public string description` | 77 | |
|
|
201
210
|
| field | `folderName` | `public string folderName` | 78 | |
|
|
211
|
+
| method | `IsEmpty` | `public bool IsEmpty()` | 80 | |
|
|
202
212
|
|
|
203
213
|
### PackageManifestConfig.CopyEntry
|
|
204
214
|
|
|
@@ -217,6 +227,29 @@ Describes a copy operation that mirrors a source file or folder into a destinati
|
|
|
217
227
|
|------|------|-----------|------|---------|
|
|
218
228
|
| field | `sourcePath` | `public string sourcePath` | 94 | |
|
|
219
229
|
| field | `destinationPath` | `public string destinationPath` | 95 | |
|
|
230
|
+
| method | `IsEmpty` | `public bool IsEmpty()` | 97 | |
|
|
231
|
+
|
|
232
|
+
### PackageToolApi
|
|
233
|
+
|
|
234
|
+
```csharp
|
|
235
|
+
public static class PackageToolApi
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Source:** `Assets/Package/PackageTool/Editor/PackageToolApi.cs:13` (md5: `0ffaac5410b567b5776ec8ca264e8b1c`, lines: 141)
|
|
239
|
+
|
|
240
|
+
Public entry points for driving the package tools from other editor code. Every method throws on failure and returns the path of what it produced.
|
|
241
|
+
|
|
242
|
+
**Members:**
|
|
243
|
+
|
|
244
|
+
| Kind | Name | Signature | Line | Summary |
|
|
245
|
+
|------|------|-----------|------|---------|
|
|
246
|
+
| method | `GetConfigs` | `public static PackageManifestConfig[] GetConfigs()` | 18 | Returns all `PackageManifestConfig` assets in the project. |
|
|
247
|
+
| method | `FindConfig` | `public static PackageManifestConfig FindConfig(string selector)` | 26 | Returns the `PackageManifestConfig` matching `selector`, which is compared case-insensitively against the config id, the package name and the asset name, in that order. Returns null when nothing matches and throws when the selector is ambiguous. |
|
|
248
|
+
| method | `FindConfig` | `public static PackageManifestConfig FindConfig(string selector, PackageManifestConfig[] configs)` | 35 | Returns the `PackageManifestConfig` matching `selector` from `configs`. Use this overload to resolve several selectors against a single lookup of the project. |
|
|
249
|
+
| method | `GetConfig` | `public static PackageManifestConfig GetConfig(string selector)` | 63 | Returns the `PackageManifestConfig` matching `selector` and throws when no config matches it. |
|
|
250
|
+
| method | `GenerateVersionConstants` | `public static string GenerateVersionConstants(PackageManifestConfig config)` | 78 | Generates the VersionConstants.cs file for `config` and returns its path, or null when the config has no version constants path set. |
|
|
251
|
+
| method | `ExportPackageSource` | `public static string ExportPackageSource(PackageManifestConfig config, string version = null)` | 94 | Exports the package source of `config` to its `packageDestinationPath` and returns the path of the written package.json. When `version` is set it replaces the version on the config asset before the export. |
|
|
252
|
+
| method | `ExportLegacyPackage` | `public static string ExportLegacyPackage(PackageManifestConfig config, string version = null)` | 112 | Exports `config` as a legacy unity package to its `legacyPackageDestinationPath` and returns the path of the written file. When `version` is set it replaces the version on the config asset before the export. |
|
|
220
253
|
|
|
221
254
|
## `PackageTool.Drawers`
|
|
222
255
|
|
|
@@ -304,7 +337,7 @@ public class SamplePropertyDrawer : PropertyDrawer
|
|
|
304
337
|
internal sealed class PackageManifestConfigInspector : UnityEditor.Editor
|
|
305
338
|
```
|
|
306
339
|
|
|
307
|
-
**Source:** `Assets/Package/PackageTool/Editor/Inspectors/PackageManifestConfigInspector.cs:
|
|
340
|
+
**Source:** `Assets/Package/PackageTool/Editor/Inspectors/PackageManifestConfigInspector.cs:34` (md5: `ea2aafac6ce8a6f797db26221eaf0003`, lines: 448)
|
|
308
341
|
**Attributes:** `[CustomEditor(typeof(PackageManifestConfig))]`
|
|
309
342
|
**Base:** `UnityEditor.Editor`
|
|
310
343
|
|
|
@@ -312,19 +345,68 @@ internal sealed class PackageManifestConfigInspector : UnityEditor.Editor
|
|
|
312
345
|
|
|
313
346
|
| Kind | Name | Signature | Line | Summary |
|
|
314
347
|
|------|------|-----------|------|---------|
|
|
315
|
-
| method | `OnInspectorGUI` | `public override void OnInspectorGUI()` |
|
|
348
|
+
| method | `OnInspectorGUI` | `public override void OnInspectorGUI()` | 127 | |
|
|
316
349
|
|
|
317
350
|
## `PackageTool.Tools`
|
|
318
351
|
|
|
319
352
|
Stateless helpers used during export and code generation: file copy, git probing, command-line parsing, code emission, GUI layout primitives, and the `PackageJsonModel` DTO.
|
|
320
353
|
|
|
354
|
+
### CIResultModel
|
|
355
|
+
|
|
356
|
+
```csharp
|
|
357
|
+
internal sealed class CIResultModel
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**Source:** `Assets/Package/PackageTool/Editor/Tools/CIResultModel.cs:13` (md5: `eb350c4071447903e5aae55a66cbab71`, lines: 107)
|
|
361
|
+
|
|
362
|
+
The outcome of processing a single `PackageManifestConfig` during a command-line run. Serialized to the file passed in the 'resultpath' argument so that callers do not have to parse the Unity log.
|
|
363
|
+
|
|
364
|
+
**Members:**
|
|
365
|
+
|
|
366
|
+
| Kind | Name | Signature | Line | Summary |
|
|
367
|
+
|------|------|-----------|------|---------|
|
|
368
|
+
| method | `CreateForConfig` | `public static CIResultModel CreateForConfig(string selector, PackageManifestConfig config)` | 26 | |
|
|
369
|
+
| method | `CreateFailure` | `public static CIResultModel CreateFailure(string selector, string error)` | 39 | |
|
|
370
|
+
|
|
371
|
+
### CIConfigModel
|
|
372
|
+
|
|
373
|
+
```csharp
|
|
374
|
+
internal sealed class CIConfigModel
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
**Source:** `Assets/Package/PackageTool/Editor/Tools/CIResultModel.cs:53` (md5: `eb350c4071447903e5aae55a66cbab71`, lines: 107)
|
|
378
|
+
|
|
379
|
+
Describes a `PackageManifestConfig` in the project for command-line callers.
|
|
380
|
+
|
|
381
|
+
**Members:**
|
|
382
|
+
|
|
383
|
+
| Kind | Name | Signature | Line | Summary |
|
|
384
|
+
|------|------|-----------|------|---------|
|
|
385
|
+
| method | `CreateFromConfig` | `public static CIConfigModel CreateFromConfig(PackageManifestConfig config)` | 64 | |
|
|
386
|
+
|
|
387
|
+
### CIResultTools
|
|
388
|
+
|
|
389
|
+
```csharp
|
|
390
|
+
internal static class CIResultTools
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Source:** `Assets/Package/PackageTool/Editor/Tools/CIResultModel.cs:83` (md5: `eb350c4071447903e5aae55a66cbab71`, lines: 107)
|
|
394
|
+
|
|
395
|
+
Helper methods for writing command-line result files.
|
|
396
|
+
|
|
397
|
+
**Members:**
|
|
398
|
+
|
|
399
|
+
| Kind | Name | Signature | Line | Summary |
|
|
400
|
+
|------|------|-----------|------|---------|
|
|
401
|
+
| method | `WriteResultFile` | `public static void WriteResultFile<T>(string resultPath, IReadOnlyList<T> results)` | 87 | |
|
|
402
|
+
|
|
321
403
|
### CodeGenTools
|
|
322
404
|
|
|
323
405
|
```csharp
|
|
324
406
|
internal static class CodeGenTools
|
|
325
407
|
```
|
|
326
408
|
|
|
327
|
-
**Source:** `Assets/Package/PackageTool/Editor/Tools/CodeGenTools.cs:36` (md5: `
|
|
409
|
+
**Source:** `Assets/Package/PackageTool/Editor/Tools/CodeGenTools.cs:36` (md5: `05a517ea12ca802914f3001ddd4b9dd2`, lines: 151)
|
|
328
410
|
|
|
329
411
|
Helper methods for code-gen.
|
|
330
412
|
|
|
@@ -332,15 +414,15 @@ Helper methods for code-gen.
|
|
|
332
414
|
|
|
333
415
|
| Kind | Name | Signature | Line | Summary |
|
|
334
416
|
|------|------|-----------|------|---------|
|
|
335
|
-
| method | `GenerateVersionConstants` | `public static
|
|
417
|
+
| method | `GenerateVersionConstants` | `public static string GenerateVersionConstants(PackageManifestConfig config)` | 118 | Writes the VersionConstants.cs file for `config` and returns its path, or null when the config has no output path set. |
|
|
336
418
|
|
|
337
419
|
### CommandLineTools
|
|
338
420
|
|
|
339
421
|
```csharp
|
|
340
|
-
|
|
422
|
+
internal static class CommandLineTools
|
|
341
423
|
```
|
|
342
424
|
|
|
343
|
-
**Source:** `Assets/Package/PackageTool/Editor/Tools/CommandLineTools.cs:33` (md5: `
|
|
425
|
+
**Source:** `Assets/Package/PackageTool/Editor/Tools/CommandLineTools.cs:33` (md5: `f156fd2327465191feb0327c0a335af3`, lines: 68)
|
|
344
426
|
|
|
345
427
|
Helper methods for command-line usage
|
|
346
428
|
|
|
@@ -356,7 +438,7 @@ Helper methods for command-line usage
|
|
|
356
438
|
internal static class FileTools
|
|
357
439
|
```
|
|
358
440
|
|
|
359
|
-
**Source:** `Assets/Package/PackageTool/Editor/Tools/FileTools.cs:38` (md5: `
|
|
441
|
+
**Source:** `Assets/Package/PackageTool/Editor/Tools/FileTools.cs:38` (md5: `724af228e6077a5540ffd4754f2d30d7`, lines: 475)
|
|
360
442
|
|
|
361
443
|
Helper methods for dealing with files/directories
|
|
362
444
|
|
|
@@ -365,11 +447,13 @@ Helper methods for dealing with files/directories
|
|
|
365
447
|
| Kind | Name | Signature | Line | Summary |
|
|
366
448
|
|------|------|-----------|------|---------|
|
|
367
449
|
| method | `ConvertToRelativePath` | `public static string ConvertToRelativePath(string fullFilePath, string referencePath)` | 46 | Converts `fullFilePath` into a relative file path from `referencePath`. |
|
|
368
|
-
| method | `CreateOrUpdatePackageSource` | `public static void CreateOrUpdatePackageSource(PackageManifestConfig packageManifest)` |
|
|
369
|
-
| method | `
|
|
370
|
-
| method | `
|
|
371
|
-
| method | `
|
|
372
|
-
| method | `
|
|
450
|
+
| method | `CreateOrUpdatePackageSource` | `public static void CreateOrUpdatePackageSource(PackageManifestConfig packageManifest)` | 60 | Creates or updates the existing package contents of `PackageManifestConfig` `packageManifest`. Failures are logged rather than thrown; callers that need to know the outcome should use `CreateOrUpdatePackageSourceOrThrow` instead. |
|
|
451
|
+
| method | `CreateOrUpdatePackageSourceOrThrow` | `public static string CreateOrUpdatePackageSourceOrThrow(PackageManifestConfig packageManifest)` | 79 | Creates or updates the existing package contents of `PackageManifestConfig` `packageManifest` and returns the path of the written package.json in the destination folder. Any failure is thrown to the caller. |
|
|
452
|
+
| method | `WritePackageJsonToSource` | `public static string WritePackageJsonToSource(PackageManifestConfig packageManifest)` | 151 | Writes the generated package.json of `packageManifest` into its `sourcePath` and imports it so a meta file is created for it. Returns the project-relative asset path of the written file. |
|
|
453
|
+
| method | `CopyDocumentationToDirectory` | `public static void CopyDocumentationToDirectory(PackageManifestConfig packageManifest)` | 183 | |
|
|
454
|
+
| method | `CopyEntriesToProject` | `public static void CopyEntriesToProject(PackageManifestConfig packageManifest)` | 236 | Stages each configured `CopyEntry` into the project before the rest of the export runs. A folder source replaces the destination's contents — the destination is wiped first, then the source tree is copied in. The exception is a blank destination, which resolves to the project root and merges instead (same-named files overwritten, unrelated files left alone) to avoid wiping the repo. A file source overwrites `destination/{filename}`. A non-blank destination that does not yet exist is created. Missing sources log a warning and are skipped. |
|
|
455
|
+
| method | `IsFile` | `public static bool IsFile(string path)` | 370 | Returns true if the `path` is for a file, otherwise false. |
|
|
456
|
+
| method | `GetAllFilesRecursively` | `internal static IEnumerable<string> GetAllFilesRecursively(string folderPath)` | 458 | Recursive find all files starting at root folder at path `folderPath` and return a list of absolute paths to those files. |
|
|
373
457
|
|
|
374
458
|
### GUILayoutTools
|
|
375
459
|
|
|
@@ -394,10 +478,10 @@ Helper methods for Unity Editor GUI.
|
|
|
394
478
|
### GitTools
|
|
395
479
|
|
|
396
480
|
```csharp
|
|
397
|
-
|
|
481
|
+
internal static class GitTools
|
|
398
482
|
```
|
|
399
483
|
|
|
400
|
-
**Source:** `Assets/Package/PackageTool/Editor/Tools/GitTools.cs:33` (md5: `
|
|
484
|
+
**Source:** `Assets/Package/PackageTool/Editor/Tools/GitTools.cs:33` (md5: `342265cbd96cf42e8b182eafccd76bf4`, lines: 60)
|
|
401
485
|
|
|
402
486
|
Helper methods for retrieving git information
|
|
403
487
|
|
|
@@ -405,9 +489,8 @@ Helper methods for retrieving git information
|
|
|
405
489
|
|
|
406
490
|
| Kind | Name | Signature | Line | Summary |
|
|
407
491
|
|------|------|-----------|------|---------|
|
|
408
|
-
| method | `
|
|
409
|
-
| method | `
|
|
410
|
-
| method | `GetLongHeadHash` | `public static string GetLongHeadHash()` | 61 | |
|
|
492
|
+
| method | `GetBranch` | `public static string GetBranch()` | 37 | |
|
|
493
|
+
| method | `GetLongHeadHash` | `public static string GetLongHeadHash()` | 39 | |
|
|
411
494
|
|
|
412
495
|
### PackageJsonModel
|
|
413
496
|
|
|
@@ -478,7 +561,7 @@ Helper methods for the Package Manifest Tools
|
|
|
478
561
|
internal static class UnityFileTools
|
|
479
562
|
```
|
|
480
563
|
|
|
481
|
-
**Source:** `Assets/Package/PackageTool/Editor/Tools/UnityFileTools.cs:
|
|
564
|
+
**Source:** `Assets/Package/PackageTool/Editor/Tools/UnityFileTools.cs:37` (md5: `3781c83065550e95be5e13cc681a57ea`, lines: 146)
|
|
482
565
|
|
|
483
566
|
Helper methods for dealing with files/directories in the Unity Assets folder.
|
|
484
567
|
|
|
@@ -486,7 +569,7 @@ Helper methods for dealing with files/directories in the Unity Assets folder.
|
|
|
486
569
|
|
|
487
570
|
| Kind | Name | Signature | Line | Summary |
|
|
488
571
|
|------|------|-----------|------|---------|
|
|
489
|
-
| method | `CompileLegacyPackage` | `public static
|
|
572
|
+
| method | `CompileLegacyPackage` | `public static string CompileLegacyPackage(PackageManifestConfig config)` | 45 | Gather all of the files/folders for the package and export them to the pre-defined location at `legacyPackageDestinationPath`. Returns the path of the exported unity package. |
|
|
490
573
|
|
|
491
574
|
## `PackageTool.Utils.PackageInitialize`
|
|
492
575
|
|
|
@@ -495,18 +578,25 @@ The `Init Package` flow — `EditorWindow`, scaffold logic, and template strings
|
|
|
495
578
|
### PackageInitializeTemplates
|
|
496
579
|
|
|
497
580
|
```csharp
|
|
498
|
-
|
|
581
|
+
internal static class PackageInitializeTemplates
|
|
499
582
|
```
|
|
500
583
|
|
|
501
|
-
**Source:** `Assets/Package/PackageTool/Editor/Utils/PackageInitialize/PackageInitializeTemplates.cs:5` (md5: `
|
|
584
|
+
**Source:** `Assets/Package/PackageTool/Editor/Utils/PackageInitialize/PackageInitializeTemplates.cs:5` (md5: `5ff8dced4d4df349b62061f1a44b705b`, lines: 109)
|
|
585
|
+
|
|
586
|
+
**Members:**
|
|
587
|
+
|
|
588
|
+
| Kind | Name | Signature | Line | Summary |
|
|
589
|
+
|------|------|-----------|------|---------|
|
|
590
|
+
| method | `CreateChangelog` | `public static string CreateChangelog(string homepage)` | 7 | |
|
|
591
|
+
| method | `CreateLicense` | `public static string CreateLicense(string authorName)` | 87 | |
|
|
502
592
|
|
|
503
593
|
### PackageInitializeUtil
|
|
504
594
|
|
|
505
595
|
```csharp
|
|
506
|
-
|
|
596
|
+
internal static class PackageInitializeUtil
|
|
507
597
|
```
|
|
508
598
|
|
|
509
|
-
**Source:** `Assets/Package/PackageTool/Editor/Utils/PackageInitialize/PackageInitializeUtil.cs:7` (md5: `
|
|
599
|
+
**Source:** `Assets/Package/PackageTool/Editor/Utils/PackageInitialize/PackageInitializeUtil.cs:7` (md5: `98c365daad6bf5c335a9a73365be76b6`, lines: 106)
|
|
510
600
|
|
|
511
601
|
**Members:**
|
|
512
602
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!-- generated by unity-package-docs; safe to regenerate -->
|
|
2
|
+
|
|
3
|
+
# Package Tool — Example: CIUtils.ExportLegacyPackage
|
|
4
|
+
|
|
5
|
+
**Kind:** static-method
|
|
6
|
+
|
|
7
|
+
**Entry point:** [CIUtils](../api.md#ciutils)
|
|
8
|
+
|
|
9
|
+
**Declared at:** `Assets/Package/PackageTool/Editor/CIUtils.cs:218`
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
Batch-mode entry point that exports only the legacy `.unitypackage`, delegating to [PackageToolApi.ExportLegacyPackage](../api.md#packagetoolapi). It takes the same arguments as [CIUtils.ExportPackageSource](../api.md#ciutils) and writes the same result file, so a caller can distribute a `.unitypackage` without also rebuilding the UPM layout. The exported archive includes the generated `package.json`, so importing it into a project yields a valid package manifest.
|
|
14
|
+
|
|
15
|
+
## Snippet
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
"$UNITY_PATH" \
|
|
19
|
+
-batchmode \
|
|
20
|
+
-quit \
|
|
21
|
+
-projectPath "$PROJECT_PATH" \
|
|
22
|
+
-executeMethod PackageTool.CIUtils.ExportLegacyPackage \
|
|
23
|
+
id=com.elestrago.unity.package-tools \
|
|
24
|
+
resultpath=/tmp/package-tool-result.json \
|
|
25
|
+
-logFile -
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Observable effect
|
|
29
|
+
|
|
30
|
+
- `<legacyPackageDestinationPath>/<DisplayName>_v<version>.unityPackage` is written.
|
|
31
|
+
- `/tmp/package-tool-result.json` reports `legacyPackagePath` for each processed config.
|
|
32
|
+
- The editor exits `0`/`1` when the `CI` environment variable is set or `exitonfinish=true` is passed.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!-- generated by unity-package-docs; safe to regenerate -->
|
|
2
|
+
|
|
3
|
+
# Package Tool — Example: CIUtils.ExportPackageSource
|
|
4
|
+
|
|
5
|
+
**Kind:** static-method
|
|
6
|
+
|
|
7
|
+
**Entry point:** [CIUtils](../api.md#ciutils)
|
|
8
|
+
|
|
9
|
+
**Declared at:** `Assets/Package/PackageTool/Editor/CIUtils.cs:213`
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
Batch-mode entry point that exports only the package source — the headless counterpart of the **Export Package Source** inspector button, and the one to reach for when a tool outside Unity (a script, an MCP server, a release job) needs to trigger an export. It reads `id`, `version`, `generateversionconstants`, `resultpath` and `exitonfinish` as `key=value` command-line pairs, delegates the work to [PackageToolApi.ExportPackageSource](../api.md#packagetoolapi), and writes a JSON report before exiting. Unlike [CIUtils.Generate](../api.md#ciutils), a selector that matches no config is a failure here, not a warning.
|
|
14
|
+
|
|
15
|
+
## Snippet
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# The id selector accepts a config guid, the package name, or the config asset name.
|
|
19
|
+
"$UNITY_PATH" \
|
|
20
|
+
-batchmode \
|
|
21
|
+
-quit \
|
|
22
|
+
-projectPath "$PROJECT_PATH" \
|
|
23
|
+
-executeMethod PackageTool.CIUtils.ExportPackageSource \
|
|
24
|
+
id=com.elestrago.unity.package-tools \
|
|
25
|
+
version=2.6.0 \
|
|
26
|
+
resultpath=/tmp/package-tool-result.json \
|
|
27
|
+
-logFile -
|
|
28
|
+
|
|
29
|
+
# => [{"selector":"com.elestrago.unity.package-tools","configId":"…","success":true,
|
|
30
|
+
# "packageSourcePath":"Release/package.json","error":null}]
|
|
31
|
+
cat /tmp/package-tool-result.json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Observable effect
|
|
35
|
+
|
|
36
|
+
- `Release/` (the config's `packageDestinationPath`) is rebuilt with the exported package layout.
|
|
37
|
+
- `/tmp/package-tool-result.json` holds one [CIResultModel](../api.md#ciresultmodel) entry per selector, with the written paths or the error message.
|
|
38
|
+
- The editor exits `0` on success and `1` on failure when the `CI` environment variable is set or `exitonfinish=true` is passed; the result file is always written first.
|
|
@@ -6,30 +6,33 @@
|
|
|
6
6
|
|
|
7
7
|
**Entry point:** [CIUtils](../api.md#ciutils)
|
|
8
8
|
|
|
9
|
-
**Declared at:** `Assets/Package/PackageTool/Editor/CIUtils.cs:
|
|
9
|
+
**Declared at:** `Assets/Package/PackageTool/Editor/CIUtils.cs:73`
|
|
10
10
|
|
|
11
11
|
## What it does
|
|
12
12
|
|
|
13
|
-
The CI entry point. Reads `id=<
|
|
13
|
+
The CI entry point, and the one the GitLab pipeline calls. Reads `id=<selector>[,<selector>...]`, `version=<semver>`, `preview=<bool>`, `generateversionconstants=<bool>`, `resultpath=<file>` and `exitonfinish=<bool>` from the command line (case-insensitive `key=value` pairs), resolves the [PackageManifestConfig](../api.md#packagemanifestconfig) assets to process, optionally overrides each config's `packageVersion`, and exports **both** the legacy package and the package source through [PackageToolApi](../api.md#packagetoolapi) for every config that has the matching output path set. Use [CIUtils.ExportPackageSource](../api.md#ciutils) or [CIUtils.ExportLegacyPackage](../api.md#ciutils) when only one of the two outputs is wanted. Wraps the work in `LockReloadAssemblies` + `StartAssetEditing` to avoid mid-export refreshes.
|
|
14
14
|
|
|
15
15
|
## Snippet
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
# Headless build — call from CI after PrepareDll has fixed plugin flags.
|
|
19
|
+
# Arguments are key=value pairs; the id selector takes a guid, a package name or an asset name.
|
|
19
20
|
"$UNITY_PATH" \
|
|
20
21
|
-batchmode \
|
|
21
22
|
-quit \
|
|
22
23
|
-projectPath "$PROJECT_PATH" \
|
|
23
24
|
-executeMethod PackageTool.CIUtils.Generate \
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
id=com.elestrago.unity.package-tools \
|
|
26
|
+
version=2.4.1 \
|
|
27
|
+
generateversionconstants=true \
|
|
28
|
+
resultpath=/tmp/package-tool-result.json \
|
|
27
29
|
-logFile -
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
```csharp
|
|
31
|
-
// Or invoke directly from an editor script — Generate() reads
|
|
32
|
-
//
|
|
33
|
+
// Or invoke directly from an editor script — Generate() reads id / version /
|
|
34
|
+
// generateversionconstants from Environment.GetCommandLineArgs itself. To pass explicit
|
|
35
|
+
// arguments instead, call PackageToolApi.ExportPackageSource(config, version).
|
|
33
36
|
PackageTool.CIUtils.Generate();
|
|
34
37
|
```
|
|
35
38
|
|
|
@@ -38,4 +41,6 @@ PackageTool.CIUtils.Generate();
|
|
|
38
41
|
- `Release/<packageName>/` is created or updated with the exported package layout (sources, package.json, README, CHANGELOG, LICENSE, Samples~, Documentation~).
|
|
39
42
|
- `Release/package.json` is rewritten with the version, dependencies, and samples block derived from the config.
|
|
40
43
|
- If `generateversionconstants=true`, a new `VersionConstants.cs` is emitted at the configured path before export.
|
|
41
|
-
-
|
|
44
|
+
- `<legacyPackageDestinationPath>/<DisplayName>_v<version>.unityPackage` is written when the config sets a legacy destination.
|
|
45
|
+
- When `resultpath` is passed, a JSON array of [CIResultModel](../api.md#ciresultmodel) entries records what each config produced.
|
|
46
|
+
- Console prints `[Package Tools]` lines summarizing what was processed; the editor exits `0`/`1` when the `CI` environment variable is set or `exitonfinish=true` is passed.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!-- generated by unity-package-docs; safe to regenerate -->
|
|
2
|
+
|
|
3
|
+
# Package Tool — Example: CIUtils.ListConfigs
|
|
4
|
+
|
|
5
|
+
**Kind:** static-method
|
|
6
|
+
|
|
7
|
+
**Entry point:** [CIUtils](../api.md#ciutils)
|
|
8
|
+
|
|
9
|
+
**Declared at:** `Assets/Package/PackageTool/Editor/CIUtils.cs:196`
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
Batch-mode discovery step: writes every [PackageManifestConfig](../api.md#packagemanifestconfig) in the project to the file named by `resultpath` as an array of [CIConfigModel](../api.md#ciconfigmodel) entries. Run it first from a tool that drives the exports headlessly — it reports the id, package name, asset name, version and output paths of each config, which is exactly the set of values the `id=` selector accepts.
|
|
14
|
+
|
|
15
|
+
## Snippet
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
"$UNITY_PATH" \
|
|
19
|
+
-batchmode \
|
|
20
|
+
-quit \
|
|
21
|
+
-projectPath "$PROJECT_PATH" \
|
|
22
|
+
-executeMethod PackageTool.CIUtils.ListConfigs \
|
|
23
|
+
resultpath=/tmp/package-tool-configs.json \
|
|
24
|
+
-logFile -
|
|
25
|
+
|
|
26
|
+
# => [{"id":"ea4351b5-…","name":"PackageManifestConfig",
|
|
27
|
+
# "packageName":"com.elestrago.unity.package-tools","packageVersion":"2.5.2",
|
|
28
|
+
# "sourcePath":"Assets/Package/PackageTool","packageDestinationPath":"Release", …}]
|
|
29
|
+
cat /tmp/package-tool-configs.json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Observable effect
|
|
33
|
+
|
|
34
|
+
- `/tmp/package-tool-configs.json` lists every config in the project; nothing is exported and no asset is modified.
|
|
35
|
+
- The console prints `[Package Tools] Listing [N] configs in project.`
|
|
36
|
+
- The editor exits `0` when the `CI` environment variable is set or `exitonfinish=true` is passed.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!-- generated by unity-package-docs; safe to regenerate -->
|
|
2
|
+
|
|
3
|
+
# Package Tool — Example: PackageToolApi.ExportLegacyPackage
|
|
4
|
+
|
|
5
|
+
**Kind:** static-method
|
|
6
|
+
|
|
7
|
+
**Entry point:** [PackageToolApi](../api.md#packagetoolapi)
|
|
8
|
+
|
|
9
|
+
**Declared at:** `Assets/Package/PackageTool/Editor/PackageToolApi.cs:112`
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
Exports the package as a legacy `.unitypackage` into the config's `legacyPackageDestinationPath` and returns the written file path. This is the programmatic equivalent of the **Export as Legacy Package** inspector button. The exported archive contains the package source, the documentation copies, and the generated `package.json`, so a project that imports the `.unitypackage` gets a valid manifest along with the code. Throws when the config has no `legacyPackageDestinationPath`.
|
|
14
|
+
|
|
15
|
+
## Snippet
|
|
16
|
+
|
|
17
|
+
```csharp
|
|
18
|
+
using PackageTool;
|
|
19
|
+
using UnityEditor;
|
|
20
|
+
using UnityEngine;
|
|
21
|
+
|
|
22
|
+
internal static class LegacyExportExample
|
|
23
|
+
{
|
|
24
|
+
[MenuItem("Tools/Examples/Export Legacy Package")]
|
|
25
|
+
private static void Export()
|
|
26
|
+
{
|
|
27
|
+
var config = PackageToolApi.GetConfig("com.elestrago.unity.package-tools");
|
|
28
|
+
var unityPackagePath = PackageToolApi.ExportLegacyPackage(config);
|
|
29
|
+
|
|
30
|
+
Debug.Log($"Exported legacy package to {unityPackagePath}");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Observable effect
|
|
36
|
+
|
|
37
|
+
- `<legacyPackageDestinationPath>/<DisplayName>_v<version>.unityPackage` is written (spaces in the display name become underscores).
|
|
38
|
+
- `Assets/Package/PackageTool/package.json` is regenerated and imported before the export so the manifest is part of the archive.
|
|
39
|
+
- README, CHANGELOG, LICENSE and `Documentation~/` are refreshed inside the package source folder before the archive is built.
|