Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .config/dotnet-tools.json

This file was deleted.

3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion .projectversion

This file was deleted.

21 changes: 0 additions & 21 deletions GitVersion.yml

This file was deleted.

1 change: 0 additions & 1 deletion backend/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="GitVersion.MsBuild" Version="6.7.0" />
<PackageVersion Include="ICSharpCode.ILSpyX" Version="10.0.0.8330" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.5" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.5" />
Expand Down
4 changes: 0 additions & 4 deletions backend/ILSpyX.Backend.LSP/ILSpyX.Backend.LSP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="ICSharpCode.ILSpyX"/>
<PackageReference Include="Mono.Cecil"/>
<PackageReference Include="OmniSharp.Extensions.LanguageServer"/>
Expand Down
4 changes: 0 additions & 4 deletions backend/ILSpyX.Backend/ILSpyX.Backend.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="ICSharpCode.ILSpyX"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions"/>
<PackageReference Include="Mono.Cecil"/>
Expand Down
4 changes: 0 additions & 4 deletions backend/version.json

This file was deleted.

3 changes: 0 additions & 3 deletions buildtools/bootstrap

This file was deleted.

5 changes: 4 additions & 1 deletion buildtools/build-backend
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions buildtools/build-vsix
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions buildtools/get-version

This file was deleted.

5 changes: 4 additions & 1 deletion buildtools/publish-backend
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion buildtools/tag-release
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh

RELEASEVERSION=`dotnet dotnet-gitversion -showvariable MajorMinorPatch`
RELEASEVERSION=`buildtools/versionize --next`
git tag v$RELEASEVERSION
145 changes: 145 additions & 0 deletions buildtools/versionize
Original file line number Diff line number Diff line change
@@ -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
Loading