From 0dc5e91c2fc3350ad74055e1d0b4a089bfaf4c26 Mon Sep 17 00:00:00 2001 From: Andreas Weizel Date: Fri, 17 Apr 2026 01:00:46 +0200 Subject: [PATCH 1/5] Move to simple versioning solution without dependency on GitVersion --- .config/dotnet-tools.json | 12 -- .github/workflows/ci.yml | 3 - GitVersion.yml | 21 --- backend/Directory.Packages.props | 1 - .../ILSpyX.Backend.LSP.csproj | 4 - backend/ILSpyX.Backend/ILSpyX.Backend.csproj | 4 - buildtools/bootstrap | 3 - buildtools/build-backend | 3 +- buildtools/build-vsix | 6 +- buildtools/get-version | 3 - buildtools/publish-backend | 3 +- buildtools/tag-release | 2 +- buildtools/versionize | 140 ++++++++++++++++++ 13 files changed, 148 insertions(+), 57 deletions(-) delete mode 100644 .config/dotnet-tools.json delete mode 100644 GitVersion.yml delete mode 100755 buildtools/bootstrap delete mode 100755 buildtools/get-version create mode 100755 buildtools/versionize diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json deleted file mode 100644 index bbd81492..00000000 --- a/.config/dotnet-tools.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "gitversion.tool": { - "version": "6.3.0", - "commands": [ - "dotnet-gitversion" - ] - } - } -} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a885199f..871f3664 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,9 +48,6 @@ jobs: cache: 'pnpm' cache-dependency-path: vscode-extension/pnpm-lock.yaml - - name: Bootstrap Build Tools - run: buildtools/bootstrap - - name: Publish Backend run: buildtools/publish-backend diff --git a/GitVersion.yml b/GitVersion.yml deleted file mode 100644 index 6a3665c0..00000000 --- a/GitVersion.yml +++ /dev/null @@ -1,21 +0,0 @@ -assembly-versioning-scheme: MajorMinorPatch -assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber ?? 0}' -mode: ContinuousDelivery -next-version: 0.17.0 -tag-pre-release-weight: 10000 -branches: - main: - mode: ContinuousDelivery - label: preview - increment: Minor - track-merge-target: false - regex: ^master$|^main$ - source-branches: - - release - tracks-release-branches: false - is-release-branch: false - is-main-branch: true - pre-release-weight: 0 -ignore: - sha: [] -merge-message-formats: {} diff --git a/backend/Directory.Packages.props b/backend/Directory.Packages.props index 86f5e80e..651cbc6c 100644 --- a/backend/Directory.Packages.props +++ b/backend/Directory.Packages.props @@ -4,7 +4,6 @@ true - diff --git a/backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj b/backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj index 586ec0db..5497b967 100644 --- a/backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj +++ b/backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj @@ -18,10 +18,6 @@ false - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - diff --git a/backend/ILSpyX.Backend/ILSpyX.Backend.csproj b/backend/ILSpyX.Backend/ILSpyX.Backend.csproj index d5f21e64..9171f695 100644 --- a/backend/ILSpyX.Backend/ILSpyX.Backend.csproj +++ b/backend/ILSpyX.Backend/ILSpyX.Backend.csproj @@ -17,10 +17,6 @@ false - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - diff --git a/buildtools/bootstrap b/buildtools/bootstrap deleted file mode 100755 index 41be9a6b..00000000 --- a/buildtools/bootstrap +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -dotnet tool restore \ No newline at end of file diff --git a/buildtools/build-backend b/buildtools/build-backend index dd12d48d..a89756b4 100755 --- a/buildtools/build-backend +++ b/buildtools/build-backend @@ -1,3 +1,4 @@ #!/usr/bin/env sh -dotnet build ./backend/ILSpy-backend.sln --configuration Debug +ASSEMBLYVERSION=`buildtools/versionize --assembly` +dotnet build ./backend/ILSpy-backend.sln --configuration Debug -p:Version=$ASSEMBLYVERSION diff --git a/buildtools/build-vsix b/buildtools/build-vsix index cb7027d9..ba1d7266 100755 --- a/buildtools/build-vsix +++ b/buildtools/build-vsix @@ -1,7 +1,7 @@ #!/usr/bin/env sh -SEMVER=`dotnet dotnet-gitversion -showvariable SemVer` -PRERELEASETAG=`dotnet dotnet-gitversion -showvariable PreReleaseTag` +SEMVER=`buildtools/versionize` +PRERELEASETAG=`buildtools/versionize --type` mkdir ./artifacts @@ -11,4 +11,4 @@ if [[ -n "$PRERELEASETAG" ]]; then npm pkg set preview='true' fi pnpm install -pnpm build:vsix -o ../artifacts/ilspy-vscode-$SEMVER.vsix +pnpm build:vsix -o ../artifacts/ilspy-vscode-$SEMVER.vsix \ No newline at end of file diff --git a/buildtools/get-version b/buildtools/get-version deleted file mode 100755 index b6fc4912..00000000 --- a/buildtools/get-version +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -echo `dotnet dotnet-gitversion -showvariable SemVer` \ No newline at end of file diff --git a/buildtools/publish-backend b/buildtools/publish-backend index 83d4da79..5be4360f 100755 --- a/buildtools/publish-backend +++ b/buildtools/publish-backend @@ -1,3 +1,4 @@ #!/usr/bin/env sh -dotnet publish ./backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj --configuration Release --self-contained false -p:UseAppHost=false -p:CIBuild=true --output ./vscode-extension/bin/ilspy-backend +ASSEMBLYVERSION=`buildtools/versionize --assembly` +dotnet publish ./backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj --configuration Release --self-contained false -p:UseAppHost=false -p:Version=$ASSEMBLYVERSION -p:CIBuild=true --output ./vscode-extension/bin/ilspy-backend diff --git a/buildtools/tag-release b/buildtools/tag-release index c6d50896..51f5718f 100755 --- a/buildtools/tag-release +++ b/buildtools/tag-release @@ -1,4 +1,4 @@ #!/usr/bin/env sh -RELEASEVERSION=`dotnet dotnet-gitversion -showvariable MajorMinorPatch` +RELEASEVERSION=`buildtools/versionize --next` git tag v$RELEASEVERSION \ No newline at end of file diff --git a/buildtools/versionize b/buildtools/versionize new file mode 100755 index 00000000..ade68ac0 --- /dev/null +++ b/buildtools/versionize @@ -0,0 +1,140 @@ +#!/usr/bin/env bash +# buildtool: versionize v1.0 + +get_latest_tag() { + git describe --tags --abbrev=0 --match 'v*' | sort -V | tail -n1 +} + +extract_version() { + echo "$1" | sed 's/^v//' +} + +commits_since_tag() { + local tag=$1 + local commits=$(git rev-list $tag..HEAD --count) + echo "$commits" +} + +current_branch() { + branch=$(git symbolic-ref --short HEAD 2>/dev/null) + if [ $? -eq 0 ]; then + echo $branch + else + echo "" + fi +} + +current_branch_pretag() { + branch=$(git symbolic-ref --short HEAD 2>/dev/null) + if [ $? -eq 0 ]; then + if [[ "$branch" == "master" || "$branch" == "main" ]]; then + echo "preview" + else + echo $branch + fi + else + echo "" + fi +} + +extract_major() { + local version="$1" + local result=$(echo "${version#"v"}" | sed -E 's/([0-9]+)(\..*)?.*/\1/') + if [[ "v$result" == "$version" ]]; then + echo 0 + else + echo $result + fi +} + +extract_minor() { + local version="$1" + local result=$(echo "${version#"v"}" | sed -E 's/[0-9]+\.([0-9]+)(\..*)?.*/\1/') + if [[ "v$result" == "$version" ]]; then + echo 0 + else + echo $result + fi +} + +extract_patch() { + local version="$1" + local result=$(echo "${version#"v"}" | sed -E 's/[0-9]+\.[0-9]+\.([0-9]+)(-.*)?/\1/') + if [[ "v$result" == "$version" ]]; then + echo 0 + else + echo $result + fi +} + +extract_preview_tag() { + local version="$1" + local result=$(echo "${version#"v"}" | sed -E 's/[0-9]+\.[0-9]+(\.[0-9]+)?-(.*)/\2/') + if [[ "v$result" == "$version" ]]; then + echo $(current_branch_pretag) + else + echo $result + fi +} + +latest_tag=$(get_latest_tag) +major=$(extract_major "$latest_tag") +minor=$(extract_minor "$latest_tag") +patch=$(extract_patch "$latest_tag") +pretag=$(extract_preview_tag "$latest_tag") + +if [ -z "$latest_tag" ]; then + echo "No tags found starting with 'v'" + exit 1 +fi + +latest_tag_sha=$(git rev-parse "$latest_tag") +head_sha=$(git rev-parse HEAD) + +# echo "Latest tag: $latest_tag_sha" +# echo "HEAD: $head_sha" +# echo "Major: $major" +# echo "Minor: $minor" +# echo "Patch: $patch" +# echo "Pretag: $pretag" + +package_version="" +assembly_version="" +version_type="" +next_package_version="" + +commits=$(( $(commits_since_tag "$latest_tag") )) + +next_major=$major +next_minor=$minor +next_patch=$patch + +branch=$(current_branch) +next_major=$((major + 1)) +if [[ "$branch" == "master" || "$branch" == "main" ]]; then + next_minor=$((minor + 1)) +else + next_patch=$((patch + 1)) +fi + +if [ $commits -eq 0 ]; then + package_version="${major}.${minor}.${patch}" + next_package_version="${next_major}.${next_minor}.${next_patch}" + assembly_version="${major}.${minor}.${patch}.10000" + version_type="release" +else + package_version="${next_major}.${next_minor}.${next_patch}-${pretag}.${commits}" + next_package_version="${next_major}.${next_minor}.${next_patch}" + assembly_version="${next_major}.${next_minor}.${next_patch}.${commits}" + version_type="preview" +fi + +if [[ "$1" == "--assembly" ]]; then + echo $assembly_version +elif [[ "$1" == "--type" ]]; then + echo $version_type +elif [[ "$1" == "--next" ]]; then + echo $next_package_version +else + echo $package_version +fi \ No newline at end of file From 2fb18fe6541f0efbbbe679e7a8d9986aff88edf8 Mon Sep 17 00:00:00 2001 From: Andreas Weizel Date: Sat, 18 Apr 2026 00:07:12 +0200 Subject: [PATCH 2/5] Clean up old version definition files --- .projectversion | 1 - backend/version.json | 4 ---- 2 files changed, 5 deletions(-) delete mode 100644 .projectversion delete mode 100644 backend/version.json diff --git a/.projectversion b/.projectversion deleted file mode 100644 index 92e0c743..00000000 --- a/.projectversion +++ /dev/null @@ -1 +0,0 @@ -0.16.1 \ No newline at end of file diff --git a/backend/version.json b/backend/version.json deleted file mode 100644 index 4ef4b470..00000000 --- a/backend/version.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "0.1-alpha" -} \ No newline at end of file From 732539c1ff884da53e21fcac3008db6666cd8427 Mon Sep 17 00:00:00 2001 From: Andreas Weizel Date: Sat, 18 Apr 2026 00:08:47 +0200 Subject: [PATCH 3/5] Support versionizing on detached HEADs --- buildtools/versionize | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/buildtools/versionize b/buildtools/versionize index ade68ac0..3442d8ab 100755 --- a/buildtools/versionize +++ b/buildtools/versionize @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# buildtool: versionize v1.0 +# buildtool: versionize v1.1 get_latest_tag() { git describe --tags --abbrev=0 --match 'v*' | sort -V | tail -n1 @@ -30,13 +30,19 @@ current_branch_pretag() { if [[ "$branch" == "master" || "$branch" == "main" ]]; then echo "preview" else - echo $branch + escape_branch_name "$branch" fi else - echo "" + probable_ref=$(git for-each-ref --points-at HEAD --format='%(refname:short)' | head -n1) + escape_branch_name "$probable_ref" fi } +escape_branch_name() { + branch=$1 + echo "${branch//\//-}" +} + extract_major() { local version="$1" local result=$(echo "${version#"v"}" | sed -E 's/([0-9]+)(\..*)?.*/\1/') @@ -110,7 +116,6 @@ next_minor=$minor next_patch=$patch branch=$(current_branch) -next_major=$((major + 1)) if [[ "$branch" == "master" || "$branch" == "main" ]]; then next_minor=$((minor + 1)) else From 6ba116c626eb63b5843a67cb4347913af43410a8 Mon Sep 17 00:00:00 2001 From: Andreas Weizel Date: Sat, 18 Apr 2026 00:09:36 +0200 Subject: [PATCH 4/5] Fix build-vsix script when not running in bash --- buildtools/build-vsix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools/build-vsix b/buildtools/build-vsix index ba1d7266..eb0ba132 100755 --- a/buildtools/build-vsix +++ b/buildtools/build-vsix @@ -7,7 +7,7 @@ mkdir ./artifacts cd ./vscode-extension npm version --git-tag-version false --allow-same-version true -- $SEMVER -if [[ -n "$PRERELEASETAG" ]]; then +if [ -n "$PRERELEASETAG" ]; then npm pkg set preview='true' fi pnpm install From 9f1eb0900d0b529d4cbde21ad36763f7637b910c Mon Sep 17 00:00:00 2001 From: Andreas Weizel Date: Sat, 18 Apr 2026 00:30:30 +0200 Subject: [PATCH 5/5] Improve versioning of output assemblies --- buildtools/build-backend | 6 ++++-- buildtools/publish-backend | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/buildtools/build-backend b/buildtools/build-backend index a89756b4..fe2ec279 100755 --- a/buildtools/build-backend +++ b/buildtools/build-backend @@ -1,4 +1,6 @@ #!/usr/bin/env sh -ASSEMBLYVERSION=`buildtools/versionize --assembly` -dotnet build ./backend/ILSpy-backend.sln --configuration Debug -p:Version=$ASSEMBLYVERSION +ASSEMBLYVERSION=`buildtools/versionize --next` +FULLASSEMBLYVERSION=`buildtools/versionize --assembly` +INFOVERSION=`buildtools/versionize` +dotnet build ./backend/ILSpy-backend.sln --configuration Debug -p:Version=$ASSEMBLYVERSION -p:FileVersion=$FULLASSEMBLYVERSION -p:InformationalVersion=$INFOVERSION diff --git a/buildtools/publish-backend b/buildtools/publish-backend index 5be4360f..041ef1c6 100755 --- a/buildtools/publish-backend +++ b/buildtools/publish-backend @@ -1,4 +1,6 @@ #!/usr/bin/env sh -ASSEMBLYVERSION=`buildtools/versionize --assembly` -dotnet publish ./backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj --configuration Release --self-contained false -p:UseAppHost=false -p:Version=$ASSEMBLYVERSION -p:CIBuild=true --output ./vscode-extension/bin/ilspy-backend +ASSEMBLYVERSION=`buildtools/versionize --next` +FULLASSEMBLYVERSION=`buildtools/versionize --assembly` +INFOVERSION=`buildtools/versionize` +dotnet publish ./backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj --configuration Release --self-contained false -p:UseAppHost=false -p:Version=$ASSEMBLYVERSION -p:FileVersion=$FULLASSEMBLYVERSION -p:InformationalVersion=$INFOVERSION -p:CIBuild=true --output ./vscode-extension/bin/ilspy-backend