diff --git a/.changeset/sdk-version-constant.md b/.changeset/sdk-version-constant.md new file mode 100644 index 00000000..85b14e18 --- /dev/null +++ b/.changeset/sdk-version-constant.md @@ -0,0 +1,5 @@ +--- +io.livekit.livekit-sdk: patch +--- + +The SDK version reported to the server is now compiled into the SDK, so it is no longer `"unknown"` when the SDK is copied into `Assets/` or in the first Editor session of a project. The SDK no longer writes `Assets/Resources/LiveKitSdkVersionInfo.txt` into your project; you can delete that file. diff --git a/Editor/PackageVersionEmbedder.cs b/Editor/PackageVersionEmbedder.cs deleted file mode 100644 index a18dd1ad..00000000 --- a/Editor/PackageVersionEmbedder.cs +++ /dev/null @@ -1,31 +0,0 @@ -#if UNITY_EDITOR -using UnityEditor; -using UnityEngine; - -[InitializeOnLoad] -public static class PackageVersionEmbedder -{ - const string PackageName = "io.livekit.livekit-sdk"; - const string ResourcePath = "Assets/Resources"; - const string AssetName = "LiveKitSdkVersionInfo"; - - [InitializeOnLoadMethod] - static void Embed() - { - // FindForAssetPath works with any asset inside the package - var info = UnityEditor.PackageManager.PackageInfo.FindForAssetPath($"Packages/{PackageName}"); - if (info == null) - { - Debug.Log($"Package {PackageName} not found"); - return; - } - - if (!System.IO.Directory.Exists(ResourcePath)) - System.IO.Directory.CreateDirectory(ResourcePath); - - string path = $"{ResourcePath}/{AssetName}.txt"; - System.IO.File.WriteAllText(path, info.version); - AssetDatabase.ImportAsset(path); - } -} -#endif \ No newline at end of file diff --git a/Editor/PackageVersionEmbedder.cs.meta b/Editor/PackageVersionEmbedder.cs.meta deleted file mode 100644 index 1524a23e..00000000 --- a/Editor/PackageVersionEmbedder.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 864f4c2dbee8547188d91281a691e628 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/RELEASING.md b/RELEASING.md index 5681dfbd..c30d4635 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -14,8 +14,11 @@ This file holds what is specific to this repository. Users install the package from its git URL and tag. The tag is the whole release: there is no build job and no registry. -The version is in `package.json` and in the install instructions of -`README.md`. The release PR moves both. Never edit the version by hand. +The version is in `package.json`, in the install instructions of +`README.md`, and in `PackageVersion.Version` +(`Runtime/Scripts/Internal/PackageVersion.cs`), which is reported to the +server when a session connects. The release PR moves all three. Never edit +the version by hand. ## Workflows diff --git a/Runtime/Scripts/Internal/PackageVersion.cs b/Runtime/Scripts/Internal/PackageVersion.cs index 1ab2a91f..978cca34 100644 --- a/Runtime/Scripts/Internal/PackageVersion.cs +++ b/Runtime/Scripts/Internal/PackageVersion.cs @@ -1,13 +1,10 @@ -using UnityEngine; - namespace LiveKit.Internal { public static class PackageVersion { - public static string Get() - { - var asset = Resources.Load("LiveKitSdkVersionInfo"); - return asset != null ? asset.text.Trim() : "unknown"; - } + // Updated by verwalter on each release, together with package.json (see verwalter.toml). + public const string Version = "2.1.1"; + + public static string Get() => Version; } } diff --git a/verwalter.toml b/verwalter.toml index cb8298b6..d61fef53 100644 --- a/verwalter.toml +++ b/verwalter.toml @@ -5,4 +5,5 @@ path = "." versioning.files = [ "package.json", { path = "README.md", regex = '`#v(?\d[^`]*)`' }, + { path = "Runtime/Scripts/Internal/PackageVersion.cs", regex = 'string Version\s*=\s*"(?[^"]+)"' }, ]