diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 09bd897ee2..8c356dab99 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -40,7 +40,7 @@ jobs: name: ${{ matrix.BENCHMARK_NAME }} steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - name: Run ${{ matrix.BENCHMARK_NAME }} working-directory: ${{ env.BENCHMARKS_PATH }} run: dotnet run --exporters json --configuration Release --filter '*${{ matrix.BENCHMARK_NAME }}*' diff --git a/.github/workflows/code-ql.yml b/.github/workflows/code-ql.yml index cb76dd9018..14d6e5221a 100644 --- a/.github/workflows/code-ql.yml +++ b/.github/workflows/code-ql.yml @@ -34,6 +34,6 @@ jobs: - uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - run: dotnet build - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c47027c72a..3aef0558f1 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -46,7 +46,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/configure-pages@v3 - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - run: dotnet tool restore - run: dotnet build - uses: actions/setup-node@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9da7ac82da..89e52f42d2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - run: dotnet tool restore - run: dotnet csharpier --check . # don't run dotnet format for whitespace formatting as this is done by csharpier diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 452fa6308c..6d47f74a99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,10 @@ on: description: 'The created version' value: ${{ jobs.release.outputs.version }} +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + jobs: release: runs-on: ubuntu-latest @@ -28,7 +32,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - uses: actions/setup-node@v3 with: node-version: '18' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5a272a03fb..47221f5c58 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,13 +22,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - run: dotnet run --project ./samples/Riok.Mapperly.Sample test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - run: dotnet build /p:TreatWarningsAsErrors=true - run: dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover - uses: codecov/codecov-action@v3 @@ -39,7 +39,7 @@ jobs: steps: - uses: actions/checkout@v4 - run: sudo apt update && sudo apt -y install zipmerge # zipmerge is used to merge the multi target nupkg - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - run: dotnet tool restore - run: RELEASE_VERSION="0.0.1-dev.$GITHUB_RUN_ID" ./build/package.sh - uses: actions/upload-artifact@v3 @@ -56,7 +56,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 - run: dotnet tool restore - uses: actions/download-artifact@v3 with: @@ -72,6 +72,7 @@ jobs: container: image: alpine:3.17 strategy: + fail-fast: false matrix: dotnet: - '8.0' @@ -84,7 +85,7 @@ jobs: - run: apk add --no-cache bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib # delete global.json since we want to use custom versions here - run: rm global.json - - uses: actions/setup-dotnet@v3.2.0 + - uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ matrix.dotnet }} - run: dotnet --list-sdks diff --git a/Directory.Build.props b/Directory.Build.props index 5f80726258..1212b92c88 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - net7.0 + net8.0 true embedded enable diff --git a/benchmarks/Riok.Mapperly.Benchmarks/Riok.Mapperly.Benchmarks.csproj b/benchmarks/Riok.Mapperly.Benchmarks/Riok.Mapperly.Benchmarks.csproj index 4a85b40f98..1403a7b9e4 100644 --- a/benchmarks/Riok.Mapperly.Benchmarks/Riok.Mapperly.Benchmarks.csproj +++ b/benchmarks/Riok.Mapperly.Benchmarks/Riok.Mapperly.Benchmarks.csproj @@ -8,11 +8,11 @@ - - - - - + + + + + diff --git a/build/package.sh b/build/package.sh index 546a98d229..d676f54122 100755 --- a/build/package.sh +++ b/build/package.sh @@ -5,7 +5,7 @@ set -Eeuo pipefail # pack a nupkg for each roslyn version that is supported by Mapperly # and merge them together into one nupkg -roslyn_versions=('4.0' '4.4' '4.5') +roslyn_versions=('4.0' '4.4' '4.5' '4.7') RELEASE_VERSION=${RELEASE_VERSION:-"0.0.1-dev.$(date +%s)"} RELEASE_NOTES=${RELEASE_NOTES:-''} diff --git a/docs/docs/configuration/generated-source.mdx b/docs/docs/configuration/generated-source.mdx index f65f7ed483..781d16fc1d 100644 --- a/docs/docs/configuration/generated-source.mdx +++ b/docs/docs/configuration/generated-source.mdx @@ -35,7 +35,7 @@ dotnet build /p:EmitCompilerGeneratedFiles=true By default the files are written to `{BaseIntermediateOutpath}/generated/{Assembly}/Riok.Mapperly/{GeneratedFile}`. -With `BaseIntermediateOutpath` for example being `obj/Debug/net7.0`. +With `BaseIntermediateOutpath` for example being `obj/Debug/net8.0`. The output path can be customized via the `CompilerGeneratedFilesOutputPath` property. This can be used to check the generated files into VCS. diff --git a/docs/prebuild.ts b/docs/prebuild.ts index dd7204ffa8..d1ba454319 100644 --- a/docs/prebuild.ts +++ b/docs/prebuild.ts @@ -95,7 +95,7 @@ async function buildSamples(): Promise { const projectFilesToCopy = ['CarMapper.cs', 'Car.cs', 'CarDto.cs']; const generatedMapperFile = join( sampleProject, - 'obj/Debug/net7.0/generated/Riok.Mapperly/Riok.Mapperly.MapperGenerator/CarMapper.g.cs', + 'obj/Debug/net8.0/generated/Riok.Mapperly/Riok.Mapperly.MapperGenerator/CarMapper.g.cs', ); // Copy generated mapper to target dir diff --git a/global.json b/global.json index 7aed64df9d..d1f845ad62 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.200", + "version": "8.0.100-rc.1.23455.8", "rollForward": "latestPatch" } } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index e9f4bdaa58..58dfc2f477 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -12,7 +12,7 @@ (a lot of features get polyfilled by Meziantou.Polyfill) however we need to be careful with the available features! --> - 11 + preview diff --git a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/IDelegateUserMapping.cs b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/IDelegateUserMapping.cs index 7fe53e337b..4533eb3c97 100644 --- a/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/IDelegateUserMapping.cs +++ b/src/Riok.Mapperly/Descriptors/Mappings/UserMappings/IDelegateUserMapping.cs @@ -9,10 +9,4 @@ public interface IDelegateUserMapping : IUserMapping /// Gets the delegate mapping or null if none is set (yet). /// INewInstanceMapping? DelegateMapping { get; } - - /// - /// Sets the delegate mapping. - /// - /// The mapping. - void SetDelegateMapping(INewInstanceMapping mapping); } diff --git a/src/Riok.Mapperly/Riok.Mapperly.Roslyn4.7.props b/src/Riok.Mapperly/Riok.Mapperly.Roslyn4.7.props new file mode 100644 index 0000000000..1135a89bf8 --- /dev/null +++ b/src/Riok.Mapperly/Riok.Mapperly.Roslyn4.7.props @@ -0,0 +1,11 @@ + + + + $(DefineConstants);ROSLYN4_4_OR_GREATER + + + + + + + diff --git a/test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj b/test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj index 4a817150f7..a44887c1d7 100644 --- a/test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj +++ b/test/Riok.Mapperly.IntegrationTests/Riok.Mapperly.IntegrationTests.csproj @@ -2,7 +2,7 @@ - net7.0 + net8.0 $(MapperlyIntegrationTestsTargetFramework) true @@ -11,6 +11,8 @@ disable + preview + 9.0 @@ -34,8 +36,8 @@ - - + + diff --git a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.ProjectionShouldTranslateToQuery_NET8_0.verified.sql b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.ProjectionShouldTranslateToQuery_NET8_0.verified.sql index c4165c0956..72f45b9142 100644 --- a/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.ProjectionShouldTranslateToQuery_NET8_0.verified.sql +++ b/test/Riok.Mapperly.IntegrationTests/_snapshots/ProjectionMapperTest.ProjectionShouldTranslateToQuery_NET8_0.verified.sql @@ -1,17 +1,15 @@ -SELECT "o"."CtorValue", "o"."IntValue", "o"."IntInitOnlyValue", "o"."RequiredValue", "o"."StringValue", "o"."RenamedStringValue", "i"."IdValue", CASE - WHEN "i0"."IdValue" IS NOT NULL THEN "i0"."IdValue" - ELSE 0 -END, CASE +SELECT "o"."CtorValue", "o"."IntValue", "o"."IntInitOnlyValue", "o"."RequiredValue", "o"."StringValue", "o"."RenamedStringValue", "i"."IdValue", "i0"."IdValue", CASE WHEN "t"."IntValue" IS NOT NULL THEN "t"."IntValue" ELSE 0 -END, "t"."IntValue" IS NOT NULL, "t"."IntValue", "t0"."IntValue" IS NOT NULL, "t0"."IntValue", COALESCE("o"."StringNullableTargetNotNullable", ''), "o0"."IntValue", "o0"."CtorValue", "o0"."DateTimeValueTargetDateOnly", "o0"."DateTimeValueTargetTimeOnly", "o0"."EnumName", "o0"."EnumRawValue", "o0"."EnumReverseStringValue", "o0"."EnumStringValue", "o0"."EnumValue", "o0"."FlatteningIdValue", "o0"."IgnoredIntValue", "o0"."IgnoredStringValue", "o0"."IntInitOnlyValue", "o0"."ManuallyMapped", "o0"."NestedNullableIntValue", "o0"."NestedNullableTargetNotNullableIntValue", "o0"."NullableFlatteningIdValue", "o0"."NullableUnflatteningIdValue", "o0"."RecursiveObjectIntValue", "o0"."RenamedStringValue", "o0"."RequiredValue", "o0"."StringNullableTargetNotNullable", "o0"."StringValue", "o0"."SubObjectSubIntValue", "o0"."UnflatteningIdValue", "i0"."IdValue", "i1"."SubIntValue", "t1"."IntValue", "t1"."TestObjectProjectionIntValue", "t2"."IntValue", CAST("o"."EnumValue" AS INTEGER), CAST("o"."EnumName" AS INTEGER), CAST("o"."EnumRawValue" AS INTEGER), "o"."EnumStringValue", "o"."EnumReverseStringValue", "i1"."SubIntValue" IS NOT NULL, "i1"."BaseIntValue", date("o"."DateTimeValueTargetDateOnly"), "o"."DateTimeValueTargetTimeOnly", "o"."ManuallyMapped" +END, "t"."IntValue" IS NOT NULL, "t"."IntValue", "t0"."IntValue" IS NOT NULL, "t0"."IntValue", COALESCE("o"."StringNullableTargetNotNullable", ''), "o0"."Id", "o0"."CtorValue", "o0"."DateTimeValueTargetDateOnly", "o0"."DateTimeValueTargetTimeOnly", "o0"."EnumName", "o0"."EnumRawValue", "o0"."EnumReverseStringValue", "o0"."EnumStringValue", "o0"."EnumValue", "o0"."FlatteningIdValue", "o0"."IgnoredIntValue", "o0"."IgnoredStringValue", "o0"."IntInitOnlyValue", "o0"."IntValue", "o0"."ManuallyMapped", "o0"."NestedNullableIntValue", "o0"."NestedNullableTargetNotNullableIntValue", "o0"."NullableFlatteningIdValue", "o0"."NullableUnflatteningIdValue", "o0"."RecursiveObjectId", "o0"."RenamedStringValue", "o0"."RequiredValue", "o0"."StringNullableTargetNotNullable", "o0"."StringValue", "o0"."SubObjectSubIntValue", "o0"."UnflatteningIdValue", "o"."Id", "i1"."SubIntValue", "t1"."IntValue", "t1"."TestObjectProjectionId", "t2"."IntValue", CAST("o"."EnumValue" AS INTEGER), CAST("o"."EnumName" AS INTEGER), CAST("o"."EnumRawValue" AS INTEGER), "o"."EnumStringValue", "o"."EnumReverseStringValue", "i1"."SubIntValue" IS NOT NULL, "i1"."BaseIntValue", date("o"."DateTimeValueTargetDateOnly"), "o"."DateTimeValueTargetTimeOnly", "o"."ManuallyMapped", "t3"."Id", "t3"."OtherValue", "t3"."TestObjectProjectionId", "t3"."Value" FROM "Objects" AS "o" INNER JOIN "IdObject" AS "i" ON "o"."FlatteningIdValue" = "i"."IdValue" LEFT JOIN "IdObject" AS "i0" ON "o"."NullableFlatteningIdValue" = "i0"."IdValue" LEFT JOIN "TestObjectNested" AS "t" ON "o"."NestedNullableIntValue" = "t"."IntValue" LEFT JOIN "TestObjectNested" AS "t0" ON "o"."NestedNullableTargetNotNullableIntValue" = "t0"."IntValue" -LEFT JOIN "Objects" AS "o0" ON "o"."IntValue" = "o0"."RecursiveObjectIntValue" +LEFT JOIN "Objects" AS "o0" ON "o"."Id" = "o0"."RecursiveObjectId" LEFT JOIN "InheritanceSubObject" AS "i1" ON "o"."SubObjectSubIntValue" = "i1"."SubIntValue" -LEFT JOIN "TestObjectNested" AS "t1" ON "o"."IntValue" = "t1"."TestObjectProjectionIntValue" -LEFT JOIN "TestObjectNested" AS "t2" ON "o"."IntValue" = "t2"."TestObjectProjectionIntValue" -ORDER BY "o"."IntValue", "i"."IdValue", "i0"."IdValue", "t"."IntValue", "t0"."IntValue", "o0"."IntValue", "i1"."SubIntValue", "t1"."IntValue" \ No newline at end of file +LEFT JOIN "TestObjectNested" AS "t1" ON "o"."Id" = "t1"."TestObjectProjectionId" +LEFT JOIN "TestObjectNested" AS "t2" ON "o"."Id" = "t2"."TestObjectProjectionId" +LEFT JOIN "TestObjectProjectionEnumValue" AS "t3" ON "o"."Id" = "t3"."TestObjectProjectionId" +ORDER BY "o"."Id", "i"."IdValue", "i0"."IdValue", "t"."IntValue", "t0"."IntValue", "o0"."Id", "i1"."SubIntValue", "t1"."IntValue", "t2"."IntValue" \ No newline at end of file diff --git a/test/Riok.Mapperly.Templates.Tests/PreserveReferenceHandlerTest.cs b/test/Riok.Mapperly.Templates.Tests/PreserveReferenceHandlerTest.cs index 9ff7055b79..8b02d837fc 100644 --- a/test/Riok.Mapperly.Templates.Tests/PreserveReferenceHandlerTest.cs +++ b/test/Riok.Mapperly.Templates.Tests/PreserveReferenceHandlerTest.cs @@ -10,7 +10,7 @@ public class PreserveReferenceHandlerTest [Fact] public void EmptyReferenceHandlerShouldReturnFalse() { - _handler.TryGetReference(new MyObj(), out MyDto _).Should().BeFalse(); + _handler.TryGetReference(new MyObj(), out MyDto? _).Should().BeFalse(); } [Fact] diff --git a/test/Riok.Mapperly.Tests/Riok.Mapperly.Tests.csproj b/test/Riok.Mapperly.Tests/Riok.Mapperly.Tests.csproj index ab1f229429..47198094a6 100644 --- a/test/Riok.Mapperly.Tests/Riok.Mapperly.Tests.csproj +++ b/test/Riok.Mapperly.Tests/Riok.Mapperly.Tests.csproj @@ -1,7 +1,7 @@ - +