diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1f694f71..8ce77a5b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,3 +1,3 @@ -FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-7.0 +FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-8.0 RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install lts/* && npm install -g cspell 2>&1" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70449dbb..cd7821ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,29 +16,23 @@ jobs: - job: os: macos-11 tests: - framework: net6.0 - sdk: "6.0.417" - sdk-major-minor: "6.0" + framework: net8.0 + sdk: "8.0.100" + sdk-major-minor: "8.0" # current macOS, latest LTS and latest - job: os: macos-12 tests: - framework: net6.0 - sdk: "6.0.417" - sdk-major-minor: "6.0" - - job: - os: macos-12 - tests: - framework: net7.0 - sdk: "7.0.404" - sdk-major-minor: "7.0" + framework: net8.0 + sdk: "8.0.100" + sdk-major-minor: "8.0" # old Linux, latest LTS - job: os: ubuntu-20.04 tests: - framework: net6.0 - sdk: "6.0.417" - sdk-major-minor: "6.0" + framework: net8.0 + sdk: "8.0.100" + sdk-major-minor: "8.0" # current Linux, all - job: os: ubuntu-22.04 @@ -53,26 +47,26 @@ jobs: framework: net7.0 sdk: "7.0.404" sdk-major-minor: "7.0" - # old Windows, latest LTS - job: - os: windows-2019 + os: ubuntu-22.04 tests: - framework: net6.0 - sdk: "6.0.417" - sdk-major-minor: "6.0" - # current Windows, latest LTS and latest + framework: net8.0 + sdk: "8.0.100" + sdk-major-minor: "8.0" + # old Windows, latest LTS - job: - os: windows-2022 + os: windows-2019 tests: - framework: net6.0 - sdk: "6.0.417" - sdk-major-minor: "6.0" + framework: net8.0 + sdk: "8.0.100" + sdk-major-minor: "8.0" + # current Windows, latest LTS and latest - job: os: windows-2022 tests: - framework: net7.0 - sdk: "7.0.404" - sdk-major-minor: "7.0" + framework: net8.0 + sdk: "8.0.100" + sdk-major-minor: "8.0" name: ${{ matrix.job.os }}-sdk-${{ matrix.tests.sdk-major-minor }} runs-on: ${{ matrix.job.os }} steps: @@ -80,7 +74,7 @@ jobs: with: dotnet-version: | ${{ matrix.tests.sdk }} - 7.0.404 + 8.0.100 - run: dotnet --info - run: git --version - uses: actions/checkout@v4.1.1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 380d78c3..c9f4d638 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/setup-dotnet@v4.0.0 with: - dotnet-version: 7.0.404 + dotnet-version: 8.0.100 - uses: actions/checkout@v4.1.1 - env: MINVER_VERSION: ${{ vars.MINVER_VERSION }} diff --git a/.vscode/launch.json b/.vscode/launch.json index d769f426..49e37fa8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": ".NET Launch (console)", "type": "coreclr", "request": "launch", - "program": "${workspaceFolder}/targets/bin/Debug/net7.0/Targets.dll", + "program": "${workspaceFolder}/targets/bin/Debug/net8.0/Targets.dll", "args": [ "default" ], diff --git a/MinVer.Lib/MinVer.Lib.csproj b/MinVer.Lib/MinVer.Lib.csproj index 75122532..cffe0038 100644 --- a/MinVer.Lib/MinVer.Lib.csproj +++ b/MinVer.Lib/MinVer.Lib.csproj @@ -2,12 +2,11 @@ false - net6.0;net7.0 + net6.0;net7.0;net8.0 default - diff --git a/MinVer/MinVer.csproj b/MinVer/MinVer.csproj index 2e46910c..fe8f9fd1 100644 --- a/MinVer/MinVer.csproj +++ b/MinVer/MinVer.csproj @@ -18,7 +18,7 @@ true major true - net6.0;net7.0 + net6.0;net7.0;net8.0 default @@ -29,7 +29,6 @@ - diff --git a/MinVer/build/MinVer.targets b/MinVer/build/MinVer.targets index 6929643c..cdc8b87b 100644 --- a/MinVer/build/MinVer.targets +++ b/MinVer/build/MinVer.targets @@ -11,6 +11,7 @@ high net6.0 net7.0 + net8.0 $(NoWarn);NU5105 diff --git a/MinVerTests.Infra/MinVerCli.cs b/MinVerTests.Infra/MinVerCli.cs index c161b1be..e1048423 100644 --- a/MinVerTests.Infra/MinVerCli.cs +++ b/MinVerTests.Infra/MinVerCli.cs @@ -20,6 +20,9 @@ public static string GetPath(string configuration) => #endif #if NET7_0 Solution.GetFullPath($"minver-cli/bin/{configuration}/net7.0/minver-cli.dll"); +#endif +#if NET8_0 + Solution.GetFullPath($"minver-cli/bin/{configuration}/net8.0/minver-cli.dll"); #endif } } diff --git a/MinVerTests.Infra/MinVerTests.Infra.csproj b/MinVerTests.Infra/MinVerTests.Infra.csproj index 17e20616..d0873b60 100644 --- a/MinVerTests.Infra/MinVerTests.Infra.csproj +++ b/MinVerTests.Infra/MinVerTests.Infra.csproj @@ -2,7 +2,7 @@ false - net6.0;net7.0 + net6.0;net7.0;net8.0 diff --git a/MinVerTests.Infra/Sdk.cs b/MinVerTests.Infra/Sdk.cs index 8250cb35..c7f10d1e 100644 --- a/MinVerTests.Infra/Sdk.cs +++ b/MinVerTests.Infra/Sdk.cs @@ -52,16 +52,16 @@ public static async Task CreateSolution(string path, string[] projectNames, stri } } - public static async Task CreateProject(string path, string configuration = Configuration.Current, bool multiTarget = false) + public static async Task CreateProject(string path, string configuration = Configuration.Current, bool multiTarget = false, bool enableSourceLink = false) { FileSystem.EnsureEmptyDirectory(path); CreateGlobalJsonIfRequired(path); - await CreateProject(path, configuration, "test", multiTarget).ConfigureAwait(false); + await CreateProject(path, configuration, "test", multiTarget, enableSourceLink).ConfigureAwait(false); } - private static async Task CreateProject(string path, string configuration, string name, bool multiTarget = false) + private static async Task CreateProject(string path, string configuration, string name, bool multiTarget = false, bool enableSourceLink = false) { _ = await DotNet($"new classlib --name {name} --output {path}{(multiTarget ? " --langVersion 8.0" : "")}", path).ConfigureAwait(false); @@ -70,21 +70,38 @@ private static async Task CreateProject(string path, string configuration, strin _ = await DotNet($"add package MinVer --source {source} --version {minVerPackageVersion} --package-directory packages", path).ConfigureAwait(false); - if (multiTarget) - { - var project = Path.Combine(path, $"{name}.csproj"); - var lines = await File.ReadAllLinesAsync(project).ConfigureAwait(false); + var project = Path.Combine(path, $"{name}.csproj"); + var lines = await File.ReadAllLinesAsync(project).ConfigureAwait(false); + var editedLines = new List(); - var editedLines = lines - .Select(line => line.Contains("", StringComparison.OrdinalIgnoreCase) - ? line + foreach (var line in lines) + { + if (line.Contains("", StringComparison.OrdinalIgnoreCase)) + { + if (multiTarget) + { + editedLines.Add(line .Replace("TargetFramework", "TargetFrameworks", StringComparison.OrdinalIgnoreCase) - .Replace("", ";netstandard2.1", StringComparison.Ordinal) - : line); - - await File.WriteAllLinesAsync(project, editedLines).ConfigureAwait(false); + .Replace("", ";netstandard2.1", StringComparison.Ordinal)); + } + else + { + editedLines.Add(line); + } + + if (!enableSourceLink) + { + editedLines.Add("false"); + } + } + else + { + editedLines.Add(line); + } } + await File.WriteAllLinesAsync(project, editedLines).ConfigureAwait(false); + _ = await DotNet($"restore --source {source} --packages packages", path).ConfigureAwait(false); } diff --git a/MinVerTests.Lib/MinVerTests.Lib.csproj b/MinVerTests.Lib/MinVerTests.Lib.csproj index 6f6d2bc1..84a5a71a 100644 --- a/MinVerTests.Lib/MinVerTests.Lib.csproj +++ b/MinVerTests.Lib/MinVerTests.Lib.csproj @@ -2,7 +2,7 @@ major - net6.0;net7.0 + net6.0;net7.0;net8.0 diff --git a/MinVerTests.Packages/MinVerTests.Packages.csproj b/MinVerTests.Packages/MinVerTests.Packages.csproj index aa417dcc..a27ea246 100644 --- a/MinVerTests.Packages/MinVerTests.Packages.csproj +++ b/MinVerTests.Packages/MinVerTests.Packages.csproj @@ -2,7 +2,7 @@ major - net7.0 + net8.0 default diff --git a/MinVerTests.Packages/SourceLink.cs b/MinVerTests.Packages/SourceLink.cs index 15c3c0c9..f805c893 100644 --- a/MinVerTests.Packages/SourceLink.cs +++ b/MinVerTests.Packages/SourceLink.cs @@ -14,11 +14,7 @@ public static async Task HasCommitSha() { // arrange var path = MethodBase.GetCurrentMethod().GetTestDirectory(); - await Sdk.CreateProject(path); - - _ = await Sdk.DotNet($"add package Microsoft.SourceLink.GitHub --version 1.1.1 --package-directory packages", path); - _ = await Sdk.DotNet("restore --packages packages", path); - + await Sdk.CreateProject(path,enableSourceLink:true); await Git.Init(path); await Git.Commit(path); var sha = (await Git.GetCommitShas(path)).Single(); diff --git a/global.json b/global.json index 67aa874f..fb5108f3 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "8.0.100", "rollForward": "latestMajor" } } diff --git a/minver-cli/minver-cli.csproj b/minver-cli/minver-cli.csproj index 5b61e768..bc16ab30 100644 --- a/minver-cli/minver-cli.csproj +++ b/minver-cli/minver-cli.csproj @@ -14,14 +14,13 @@ true major MinVer - net6.0;net7.0 + net6.0;net7.0;net8.0 minver default - diff --git a/targets/Program.cs b/targets/Program.cs index f668065b..ddd05a83 100644 --- a/targets/Program.cs +++ b/targets/Program.cs @@ -5,7 +5,7 @@ using static Bullseye.Targets; using static SimpleExec.Command; -var testFx = Environment.GetEnvironmentVariable("MINVER_TESTS_FRAMEWORK") ?? "net7.0"; +var testFx = Environment.GetEnvironmentVariable("MINVER_TESTS_FRAMEWORK") ?? "net8.0"; var testLoggerArgs = new List { "--logger", "\"console;verbosity=normal\"", }; if (Environment.GetEnvironmentVariable("GITHUB_ACTIONS")?.ToUpperInvariant() == "TRUE") diff --git a/targets/Targets.csproj b/targets/Targets.csproj index 5eac51c8..55a3b5ce 100644 --- a/targets/Targets.csproj +++ b/targets/Targets.csproj @@ -4,7 +4,7 @@ false Exe major - net7.0 + net8.0 default