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/.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/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/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 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..fe2ec279 100755 --- a/buildtools/build-backend +++ b/buildtools/build-backend @@ -1,3 +1,6 @@ #!/usr/bin/env sh -dotnet build ./backend/ILSpy-backend.sln --configuration Debug +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/build-vsix b/buildtools/build-vsix index cb7027d9..eb0ba132 100755 --- a/buildtools/build-vsix +++ b/buildtools/build-vsix @@ -1,14 +1,14 @@ #!/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 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 -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..041ef1c6 100755 --- a/buildtools/publish-backend +++ b/buildtools/publish-backend @@ -1,3 +1,6 @@ #!/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 --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 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..3442d8ab --- /dev/null +++ b/buildtools/versionize @@ -0,0 +1,145 @@ +#!/usr/bin/env bash +# buildtool: versionize v1.1 + +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 + escape_branch_name "$branch" + fi + else + 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/') + 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) +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