com.elestrago.unity.package-tools 2.3.0 → 2.5.1

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 CHANGED
@@ -2,6 +2,43 @@
2
2
 
3
3
  ---
4
4
 
5
+ ## [2.5.1](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.5.1)
6
+
7
+ ### Changed
8
+
9
+ - Broadened `unity-package-release` skill triggers to cover generic commit phrasings such as "commit all changes".
10
+
11
+ ---
12
+
13
+ ## [2.5.0](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.5.0)
14
+
15
+ ### Added
16
+
17
+ - Added `examples` section to `unity-package-docs` driven by `[CreateAssetMenu]`/`[MenuItem]`/public-static API entry points, one chunk per entry under `Documentation~/examples/`.
18
+
19
+ ### Changed
20
+
21
+ - Made `CommandLineTools`, `GitTools`, `PackageInitializeTemplates`, `PackageInitializeUtil`, and `GitTools.Run` non-public so the supported entry points are `CIUtils.Generate` and `Tools/PackageTools/Init Package`.
22
+
23
+ ### Removed
24
+
25
+ - Removed `samples` section from `unity-package-docs` (replaced by `examples`).
26
+
27
+ ### Fixed
28
+
29
+ - Fixed `unity-package-docs` scanner missing expression-bodied methods (`... => Body();`).
30
+ - Fixed broken nested-type anchor references in `Documentation~/manual.md` (e.g. `PackageManifestConfig.CopyEntry`).
31
+
32
+ ---
33
+
34
+ ## [2.4.0](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.4.0)
35
+
36
+ ### Added
37
+
38
+ - Added `unity-package-release` skill sample for cutting `V-{version}` release commits.
39
+
40
+ ---
41
+
5
42
  ## [2.3.0](https://gitlab.com/elestrago-pkg/package-tool/-/tags/2.3.0)
6
43
 
7
44
  ### Added
@@ -0,0 +1,41 @@
1
+ <!-- generated by unity-package-docs; safe to regenerate -->
2
+
3
+ # Package Tool — Example: CIUtils.Generate
4
+
5
+ **Kind:** static-method
6
+
7
+ **Entry point:** [CIUtils](../api.md#ciutils)
8
+
9
+ **Declared at:** `Assets/Package/PackageTool/Editor/CIUtils.cs:65`
10
+
11
+ ## What it does
12
+
13
+ The CI entry point. Reads `id=<guid>[,<guid>...]`, `version=<semver>`, `preview=<bool>`, and `generateversionconstants=<bool>` from the command line (case-insensitive `key=value` pairs), filters the [PackageManifestConfig](../api.md#packagemanifestconfig) assets to process, optionally overrides each config's `packageVersion`, optionally runs [CodeGenTools.GenerateVersionConstants](../api.md#codegentools), and exports the package source via [FileTools.CreateOrUpdatePackageSource](../api.md#filetools). Wraps the work in `LockReloadAssemblies` + `StartAssetEditing` to avoid mid-export refreshes.
14
+
15
+ ## Snippet
16
+
17
+ ```bash
18
+ # Headless build — call from CI after PrepareDll has fixed plugin flags.
19
+ "$UNITY_PATH" \
20
+ -batchmode \
21
+ -quit \
22
+ -projectPath "$PROJECT_PATH" \
23
+ -executeMethod PackageTool.CIUtils.Generate \
24
+ -id ea4351b5-3f49-4afc-8996-ec7b9eb43204 \
25
+ -version 2.4.1 \
26
+ -generateversionconstants true \
27
+ -logFile -
28
+ ```
29
+
30
+ ```csharp
31
+ // Or invoke directly from an editor script — Generate() reads -id / -version /
32
+ // -generateversionconstants from Environment.GetCommandLineArgs itself.
33
+ PackageTool.CIUtils.Generate();
34
+ ```
35
+
36
+ ## Observable effect
37
+
38
+ - `Release/<packageName>/` is created or updated with the exported package layout (sources, package.json, README, CHANGELOG, LICENSE, Samples~, Documentation~).
39
+ - `Release/package.json` is rewritten with the version, dependencies, and samples block derived from the config.
40
+ - If `generateversionconstants=true`, a new `VersionConstants.cs` is emitted at the configured path before export.
41
+ - Console prints `[Package Tools]` lines summarizing what was processed; the editor does not exit (unlike `PrepareDll`).
@@ -0,0 +1,47 @@
1
+ <!-- generated by unity-package-docs; safe to regenerate -->
2
+
3
+ # Package Tool — Example: Create a PackageManifestConfig
4
+
5
+ **Kind:** create-asset
6
+
7
+ **Entry point:** [PackageManifestConfig](../api.md#packagemanifestconfig)
8
+
9
+ **Declared at:** `Assets/Package/PackageTool/Editor/PackageManifestConfig.cs:37`
10
+
11
+ **Create menu:** `Assets > Create > JCMG/PackageTools/PackageManifestConfig`
12
+
13
+ ## What it does
14
+
15
+ Creates the ScriptableObject that drives every other entry point — package name, version, sources, dependencies, samples, and the destination path the **Export Package Source** inspector button and `CIUtils.Generate` both read. One config asset per Unity package; everything else (CHANGELOG, README, asmdef wiring, exported `package.json`) is derived from its fields.
16
+
17
+ ## Snippet
18
+
19
+ ```csharp
20
+ using PackageTool;
21
+ using UnityEditor;
22
+ using UnityEngine;
23
+
24
+ public static class CreatePackageManifestConfigExample
25
+ {
26
+ [MenuItem("Tools/Examples/Create PackageManifestConfig")]
27
+ public static void Run()
28
+ {
29
+ var config = ScriptableObject.CreateInstance<PackageManifestConfig>();
30
+ config.packageName = "com.example.foo";
31
+ config.displayName = "Example Foo";
32
+ config.packageVersion = "0.1.0";
33
+ config.unityVersion = "2021.3";
34
+ config.sourcePath = "Assets/Package/Foo";
35
+ config.packageDestinationPath = "Release";
36
+
37
+ AssetDatabase.CreateAsset(config, "Assets/PackageManifest/PackageManifestConfig.asset");
38
+ AssetDatabase.SaveAssets();
39
+ }
40
+ }
41
+ ```
42
+
43
+ ## Observable effect
44
+
45
+ - A new asset appears at `Assets/PackageManifest/PackageManifestConfig.asset`.
46
+ - Selecting it in the Project view renders the inspector with **Generate VersionConstants.cs**, **Export Package Source**, and **Export as Legacy Package** buttons.
47
+ - The same `Assets > Create > JCMG/PackageTools/PackageManifestConfig` menu entry yields the same asset interactively if you prefer GUI.
@@ -0,0 +1,30 @@
1
+ <!-- generated by unity-package-docs; safe to regenerate -->
2
+
3
+ # Package Tool — Example: Init Package
4
+
5
+ **Kind:** menu-item
6
+
7
+ **Entry point:** [MenuItems](../api.md#menuitems)
8
+
9
+ **Declared at:** `Assets/Package/PackageTool/Editor/MenuItems.cs:9`
10
+
11
+ **Menu path:** `Tools/PackageTools/Init Package`
12
+
13
+ ## What it does
14
+
15
+ Opens the **Init Package** editor window ([PackageInitializeWindow](../api.md#packageinitializewindow)), which scaffolds a new Unity package: creates `Assets/Package/<scope>/` with `Editor/` (and optionally `Runtime/`), root files (`README.md`, `CAHNGELOG.md`, `LICENSE`), `Documentation~/`, and a sibling `PackageManifestConfig.asset` populated from the form's fields. The internal helpers that do the on-disk work are intentionally not part of the public surface — the window is the supported entry point.
16
+
17
+ ## Snippet
18
+
19
+ ```csharp
20
+ // MenuItems is internal, so other assemblies can't invoke OpenAboutModalDialog
21
+ // directly. Open the window via PackageInitializeWindow.Open(), or use the menu.
22
+ PackageTool.Utils.PackageInitialize.PackageInitializeWindow.Open();
23
+ // Or interactively: Tools > PackageTools > Init Package
24
+ ```
25
+
26
+ ## Observable effect
27
+
28
+ - The **Init Package** editor window opens. Fill in package name, display name, scope, author, license, and unity version, then click **Create**.
29
+ - On Create: `Assets/Package/<scope>/` and `Assets/PackageManifest/PackageManifestConfig.asset` are written; the inspector for the new config asset shows the **Generate VersionConstants.cs** / **Export Package Source** / **Export as Legacy Package** buttons.
30
+ - The project compiles after the next assembly reload.
@@ -0,0 +1,39 @@
1
+ <!-- generated by unity-package-docs; safe to regenerate -->
2
+
3
+ # Package Tool — Example: PrepareDll
4
+
5
+ **Kind:** menu-item
6
+
7
+ **Entry point:** [CIUtils](../api.md#ciutils)
8
+
9
+ **Declared at:** `Assets/Package/PackageTool/Editor/CIUtils.cs:197`
10
+
11
+ **Menu path:** `Tools/PackageTools/PrepareDll`
12
+
13
+ ## What it does
14
+
15
+ Fixes the platform flags on every plugin (`.dll`) under the configured package source before export, so the published package's `PluginImporter` settings match what the Editor needs (no spurious `Any Platform` toggles that would otherwise leak into consumers). When the `CI` environment variable is set, the method calls `EditorApplication.Exit` with code 0 on success or 1 on failure — designed to be the final step of a batch-mode build before the export job moves on.
16
+
17
+ ## Snippet
18
+
19
+ ```bash
20
+ # Run from CI or any shell — replace UNITY_PATH and PROJECT_PATH with your values.
21
+ "$UNITY_PATH" \
22
+ -batchmode \
23
+ -quit \
24
+ -projectPath "$PROJECT_PATH" \
25
+ -executeMethod PackageTool.CIUtils.PrepareDll \
26
+ -logFile -
27
+ # Or interactively: Tools > PackageTools > PrepareDll
28
+ ```
29
+
30
+ ```csharp
31
+ // Same call from an editor script (no Exit when CI env var is unset):
32
+ PackageTool.CIUtils.PrepareDll();
33
+ ```
34
+
35
+ ## Observable effect
36
+
37
+ - Every `.dll` under each `PackageManifestConfig.sourcePath` has its `PluginImporter` flags normalized; meta files are rewritten as a result and may show up in `git status`.
38
+ - Console prints `[Package Tools]` log lines for each plugin touched.
39
+ - In CI (`CI=1` or similar), the editor exits 0 on success or 1 if any plugin processing throws — wire this into your pipeline as the gate before `CIUtils.Generate`.
@@ -0,0 +1,25 @@
1
+ <!-- generated by unity-package-docs; safe to regenerate -->
2
+
3
+ # Package Tool — Examples
4
+
5
+ Short, focused usage examples that exercise this package's public API. Each example is independent and links into the API reference (`api.md`) for the type or member it calls. Snippets are paste-ready and use only public API — copy one into a fresh project to reach the same observable effect.
6
+
7
+ ## Quick start
8
+
9
+ Start with **Create a PackageManifestConfig** to produce the config asset that drives every other entry point, then run **Tools > PackageTools > Init Package** (`init-package`) to scaffold a new package skeleton against it. For automated builds, **CIUtils.Generate** is the batch-mode entry point and **Tools > PackageTools > PrepareDll** (`preparedll`) is the DLL platform-flag fix-up step that typically runs immediately before it.
10
+
11
+ ## Contents
12
+
13
+ | Example | Kind | Entry point |
14
+ |---------|------|-------------|
15
+ | [Create a PackageManifestConfig](examples/create-packagemanifestconfig.md) | create-asset | [PackageManifestConfig](api.md#packagemanifestconfig) |
16
+ | [Init Package](examples/init-package.md) | menu-item | [MenuItems](api.md#menuitems) |
17
+ | [PrepareDll](examples/preparedll.md) | menu-item | [CIUtils](api.md#ciutils) |
18
+ | [CIUtils.Generate](examples/ciutils-generate.md) | static-method | [CIUtils](api.md#ciutils) |
19
+
20
+ This package also ships Unity samples importable from Package Manager → Package Tool → Samples → `Example Sample`, `Claude Skills`. Those samples are not duplicated here — import them via Package Manager if you want the full asset content.
21
+
22
+ ## Notes
23
+
24
+ - The `PackageTool.Tools.*` (`CommandLineTools`, `GitTools`) and `PackageTool.Utils.PackageInitialize.*` (`PackageInitializeTemplates`, `PackageInitializeUtil`) helpers were public in earlier revisions and dropped to `internal` to make the public surface intentional. They still exist and are used by `CIUtils.Generate`/`Init Package` internally; they're just no longer documented as consumer-facing entry points.
25
+ - All entry points listed here are editor-only (single asmdef `Playdarium.PackageTool.Editor`, `includePlatforms: ["Editor"]`); call them from editor scripts or batch mode, not from runtime code.
@@ -64,16 +64,16 @@ Defined at `Assets/Package/PackageTool/Editor/PackageManifestConfig.cs:37`. Crea
64
64
  - **Package json metadata:** `homepage`, `packageName`, `displayName`, `packageVersion`, `unityVersion`, `description`, `category`, `license`, `keywords` (`string[]`), `author` (`Author`), `dependencies` (`Dependency[]`).
65
65
  - **Package content paths:** `sourcePath`, `documentationPath` (default `Documentation~`), `readmePath` (default `README.md`), `changelogPath` (default `CHANGELOG.md`), `licensePath` (default `LICENSE`), `packageIgnorePaths` (`string[]`).
66
66
  - **Export targets:** `packageDestinationPath`, `legacyPackageDestinationPath`.
67
- - **Staging:** `samples` ([`Sample[]`](api.md#sample)), `copyEntries` ([`CopyEntry[]`](api.md#packagemanifestconfigcopyentry)).
67
+ - **Staging:** `samples` ([`Sample[]`](api.md#sample)), `copyEntries` ([`CopyEntry[]`](api.md#packagemanifestconfig-copyentry)).
68
68
  - **Code generation:** `versionConstantsPath`, `versionConstantsNamespace`.
69
69
  - **Hidden:** `_id` (Guid; surfaced via `Id` property; used by `CIUtils.Generate id=<guid>` filtering).
70
70
 
71
71
  Nested `[Serializable]` types, each with a `PropertyDrawer` in `PackageTool.Drawers`:
72
72
 
73
73
  - [`Author`](api.md#author) — `name`, `email`, `url` (`string`).
74
- - [`Dependency`](api.md#packagemanifestconfigdependency) — `packageName`, `packageVersion` (`string`); `IsEmpty()` is true when either is blank.
74
+ - [`Dependency`](api.md#packagemanifestconfig-dependency) — `packageName`, `packageVersion` (`string`); `IsEmpty()` is true when either is blank.
75
75
  - [`Sample`](api.md#sample) — `sourcePath`, `displayName`, `description`, `folderName` (`string`); `IsEmpty()` is true when any of `displayName`/`sourcePath`/`folderName` is blank. Resulting on-disk path is `{packageDestinationPath}/Samples~/{folderName}`.
76
- - [`CopyEntry`](api.md#packagemanifestconfigcopyentry) — `sourcePath`, `destinationPath` (`string`); `IsEmpty()` is true when `sourcePath` is blank. See **Copy Entries staging** below.
76
+ - [`CopyEntry`](api.md#packagemanifestconfig-copyentry) — `sourcePath`, `destinationPath` (`string`); `IsEmpty()` is true when `sourcePath` is blank. See **Copy Entries staging** below.
77
77
 
78
78
  ### Export pipeline
79
79
 
@@ -89,7 +89,7 @@ Nested `[Serializable]` types, each with a `PropertyDrawer` in `PackageTool.Draw
89
89
 
90
90
  ### Copy Entries staging
91
91
 
92
- `copyEntries` is a `PackageManifestConfig` field added in 2.0.12. Each [`CopyEntry`](api.md#packagemanifestconfigcopyentry) names a source path and a destination folder; entries run **first** in the export pipeline (step 4 above) so downstream steps — including the recursive source copy and the `CopySamplesToDirectory` step — can pick up the staged content and ship it into `packageDestinationPath`.
92
+ `copyEntries` is a `PackageManifestConfig` field added in 2.0.12. Each [`CopyEntry`](api.md#packagemanifestconfig-copyentry) names a source path and a destination folder; entries run **first** in the export pipeline (step 4 above) so downstream steps — including the recursive source copy and the `CopySamplesToDirectory` step — can pick up the staged content and ship it into `packageDestinationPath`.
93
93
 
94
94
  **Folder source.** The folder's *content* is merged directly into `destinationPath` (no `destinationPath/{sourceName}` wrapper). Same-named files are overwritten via `File.Copy(..., overwrite: true)`; unrelated files already in the destination are left in place. This is the merge semantics needed to chain into a `Sample` whose `sourcePath` is the same folder.
95
95
 
@@ -30,7 +30,7 @@ namespace PackageTool.Tools
30
30
  /// <summary>
31
31
  /// Helper methods for command-line usage
32
32
  /// </summary>
33
- public static class CommandLineTools
33
+ internal static class CommandLineTools
34
34
  {
35
35
  // Command-Line Delimiters
36
36
  private const string ARGUMENT_DELIMITER_STR = "=";
@@ -65,4 +65,4 @@ namespace PackageTool.Tools
65
65
  return dict;
66
66
  }
67
67
  }
68
- }
68
+ }
@@ -30,11 +30,15 @@ namespace PackageTool.Tools
30
30
  /// <summary>
31
31
  /// Helper methods for retrieving git information
32
32
  /// </summary>
33
- public static class GitTools
33
+ internal static class GitTools
34
34
  {
35
35
  private const string GIT_APPLICATION = "git";
36
36
 
37
- public static string Run(string cmd)
37
+ public static string GetBranch() => Run("rev-parse --abbrev-ref HEAD");
38
+
39
+ public static string GetLongHeadHash() => Run("rev-parse HEAD");
40
+
41
+ private static string Run(string cmd)
38
42
  {
39
43
  // NOTE: This currently expects that you have git included in your PATH.
40
44
  var p = new Process();
@@ -52,15 +56,5 @@ namespace PackageTool.Tools
52
56
 
53
57
  return output;
54
58
  }
55
-
56
- public static string GetBranch()
57
- {
58
- return Run("rev-parse --abbrev-ref HEAD");
59
- }
60
-
61
- public static string GetLongHeadHash()
62
- {
63
- return Run("rev-parse HEAD");
64
- }
65
59
  }
66
- }
60
+ }
@@ -2,7 +2,7 @@ using System;
2
2
 
3
3
  namespace PackageTool.Utils.PackageInitialize
4
4
  {
5
- public static class PackageInitializeTemplates
5
+ internal static class PackageInitializeTemplates
6
6
  {
7
7
  public static string CreateChangelog(string homepage) => @$"# Changelog
8
8
 
@@ -4,7 +4,7 @@ using UnityEngine;
4
4
 
5
5
  namespace PackageTool.Utils.PackageInitialize
6
6
  {
7
- public static class PackageInitializeUtil
7
+ internal static class PackageInitializeUtil
8
8
  {
9
9
  public const string ASSETS_FOLDER_NAME = "Assets";
10
10
  public const string RELEASE_FOLDER_NAME = "Release";
package/README.md CHANGED
@@ -29,7 +29,7 @@ Add the package to `Packages/manifest.json`:
29
29
  }
30
30
  ],
31
31
  "dependencies": {
32
- "com.elestrago.unity.package-tools": "2.3.0"
32
+ "com.elestrago.unity.package-tools": "2.5.1"
33
33
  }
34
34
  }
35
35
  ```
@@ -60,7 +60,7 @@ CIUtils.Generate();
60
60
 
61
61
  - [Manual](Documentation~/manual.md) — concepts and architecture.
62
62
  - [API Reference](Documentation~/api.md) — every public type and member.
63
- - [Samples](Documentation~/samples.md) — how the sample project in this repo uses the package.
63
+ - [Examples](Documentation~/examples.md) — short usage examples for the public API.
64
64
 
65
65
  ## License
66
66