Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build props and targets, use net9 SDK #376

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/validate-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pkg
path: out/pkg
path: out/pkg/$env:config
21 changes: 9 additions & 12 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<OutRoot>$(RepoRoot)$([MSBuild]::EnsureTrailingSlash(out/$(SubOutRoot)))</OutRoot>
<ArtifactsPath>$(RepoRoot)$([MSBuild]::EnsureTrailingSlash(out/$(SubOutRoot)))</ArtifactsPath>
<ArtifactsPublishOutputName>pub</ArtifactsPublishOutputName>
<ArtifactsPackageOutputName>pkg</ArtifactsPackageOutputName>
<EngRoot>$(RepoRoot)eng/</EngRoot>
<SrcRoot>$(RepoRoot)src/</SrcRoot>
<BaseOutputPath>$(OutRoot)bin/</BaseOutputPath>
<BaseIntermediateOutputPath>$(OutRoot)obj/$(MSBuildProjectName)/</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)/</IntermediateOutputPath>
<SubOutputPath Condition="'$(SubOutputPath)' == ''">$(MSBuildProjectName)/</SubOutputPath>
<OutputPath>$(BaseOutputPath)$(Configuration)/$([MSBuild]::EnsureTrailingSlash($(SubOutputPath)))</OutputPath>
<PackageOutputPath>$(OutRoot)pkg/</PackageOutputPath>
<SharedRoot>$(SrcRoot)Shared/</SharedRoot>
</PropertyGroup>

<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' == ''">
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild> <!-- GitHub actions -->
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true'">true</ContinuousIntegrationBuild> <!-- Azure Devops -->
</PropertyGroup>

<!-- Signing -->
Expand All @@ -36,9 +38,4 @@
<StrongNamePublicKey>00240000048000009400000006020000002400005253413100040000010001000505410141442095e0b0466df68ac32d158abdf0bd9cf26407d7a9d20b93656530556f23979f20b067628b9baee75fc6bba5c349519585a2852c1843bc61d74c4cbf9d80429cbdcbf609ea70fd62061eb65f40a6c9d505dd71cb119ef51f589a014d3b56159abbc38825fafbd119b6e97ebd9a5f3862a5c06220c680a6ac9eec</StrongNamePublicKey>
</PropertyGroup>

<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' == ''">
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild> <!-- GitHub actions -->
<ContinuousIntegrationBuild Condition="'$(TF_BUILD)' == 'true'">true</ContinuousIntegrationBuild> <!-- Azure Devops -->
</PropertyGroup>

</Project>
36 changes: 2 additions & 34 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,7 @@
</ItemGroup>

<Import Project="$(EngRoot)targets/InternalsVisibleTo.targets" />
<Import Project="$(EngRoot)targets/RepositoryInfo.targets" />
<Import Project="$(EngRoot)targets/SharedFiles.targets" />

<!-- What follows is copied from:https://github.com/Azure/azure-functions-host/blob/dev/eng/build/RepositoryInfo.targets -->
<!-- The following build target allows us to reconstruct source-link information when building in 1ES -->

<!--
The convention for names of Azure DevOps repositories mirrored from GitHub is "{GitHub org name}.{GitHub repository name}".
-->
<PropertyGroup>
<!-- There are quite a few git repo forms:
https://[email protected]/azfunc/internal/_git/azure.azure-functions-host
https://dev.azure.com/azfunc/internal/_git/azure.azure-functions-host
https://azfunc.visualstudio.com/internal/_git/azure.azure-functions-host
[email protected]:v3/azfunc/internal/azure.azure-functions-host
[email protected]:v3/azfunc/internal/azure.azure-functions-host
-->
<!-- Set DisableSourceLinkUrlTranslation to true when building a tool for internal use where sources only come from internal URIs -->
<DisableSourceLinkUrlTranslation Condition="'$(DisableSourceLinkUrlTranslation)' == ''">false</DisableSourceLinkUrlTranslation>
<_TranslateUrlPattern>(https://azfunc%40dev\.azure\.com/azfunc/internal/_git|https://dev\.azure\.com/azfunc/internal/_git|https://azfunc\.visualstudio\.com/internal/_git|azfunc%40vs-ssh\.visualstudio\.com:v3/azfunc/internal|git%40ssh\.dev\.azure\.com:v3/azfunc/internal)/([^/\.]+)\.(.+)</_TranslateUrlPattern>
<_TranslateUrlReplacement>https://github.com/$2/$3</_TranslateUrlReplacement>
</PropertyGroup>

<!-- When building from Azure Devops we update SourceLink to point back to the GitHub repo. -->
<Target Name="_TranslateAzureDevOpsUrlToGitHubUrl"
Condition="'$(DisableSourceLinkUrlTranslation)' == 'false'"
DependsOnTargets="$(SourceControlManagerUrlTranslationTargets)"
BeforeTargets="SourceControlManagerPublishTranslatedUrls">
<PropertyGroup>
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
</PropertyGroup>
<ItemGroup>
<SourceRoot Update="@(SourceRoot)">
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace(%(SourceRoot.ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
</SourceRoot>
</ItemGroup>
</Target>
</Project>
15 changes: 15 additions & 0 deletions eng/targets/Release.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<!-- Common NuGet settings -->
<PropertyGroup>
<Company>Microsoft Corporation</Company>
<Authors>Microsoft</Authors>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<RepositoryUrl>https://github.com/microsoft/durabletask-dotnet</RepositoryUrl>
Expand All @@ -16,6 +17,20 @@
<PackageTags>Microsoft Durable Task Orchestration Workflow Activity Reliable DTFx</PackageTags>
</PropertyGroup>

<!-- Release quality settings -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<!--
This setting makes symbol files (PDBs) available, which is seemingly necessary for having a 'deterministic' build in our NuGet package.
This is recommended for NuGet packages, as per: https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/
The connection to deterministic builds is explored here: https://www.meziantou.net/creating-reproducible-build-in-dotnet.htm
-->
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>1.5.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
Expand Down
12 changes: 11 additions & 1 deletion eng/targets/Release.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@
<PackageReadmeFile Condition="Exists('README.md')">README.md</PackageReadmeFile>
</PropertyGroup>

<PropertyGroup Condition="'$(IsRoslynComponent)' != 'true'">
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IncludeSymbols>true</IncludeSymbols>
</PropertyGroup>

<PropertyGroup>
<!-- FileVersionRevision is expected to be set by the CI. -->
<FileVersion Condition="'$(FileVersionRevision)' != ''">$(VersionPrefix).$(FileVersionRevision)</FileVersion>
</PropertyGroup>

<!-- Embed the SBOM manifest, which is generated as part of the "official" build -->
<ItemGroup Condition="'$(Configuration)'=='Release'">
<ItemGroup Condition="'$(Configuration)' == 'release'">
<Content Include="$(RepoRoot)_manifest/**" Pack="true" PackagePath="content/SBOM">
<Pack>true</Pack>
<PackagePath>content/SBOM</PackagePath>
Expand Down
37 changes: 37 additions & 0 deletions eng/targets/RepositoryInfo.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project>
<!-- What follows is copied from:https://github.com/Azure/azure-functions-host/blob/dev/eng/build/RepositoryInfo.targets -->
<!-- The following build target allows us to reconstruct source-link information when building in 1ES -->

<!--
The convention for names of Azure DevOps repositories mirrored from GitHub is "{GitHub org name}.{GitHub repository name}".
-->
<PropertyGroup>
<!-- There are quite a few git repo forms:
https://[email protected]/azfunc/internal/_git/azure.azure-functions-host
https://dev.azure.com/azfunc/internal/_git/azure.azure-functions-host
https://azfunc.visualstudio.com/internal/_git/azure.azure-functions-host
[email protected]:v3/azfunc/internal/azure.azure-functions-host
[email protected]:v3/azfunc/internal/azure.azure-functions-host
-->
<!-- Set DisableSourceLinkUrlTranslation to true when building a tool for internal use where sources only come from internal URIs -->
<DisableSourceLinkUrlTranslation Condition="'$(DisableSourceLinkUrlTranslation)' == ''">false</DisableSourceLinkUrlTranslation>
<_TranslateUrlPattern>(https://azfunc%40dev\.azure\.com/azfunc/internal/_git|https://dev\.azure\.com/azfunc/internal/_git|https://azfunc\.visualstudio\.com/internal/_git|azfunc%40vs-ssh\.visualstudio\.com:v3/azfunc/internal|git%40ssh\.dev\.azure\.com:v3/azfunc/internal)/([^/\.]+)\.(.+)</_TranslateUrlPattern>
<_TranslateUrlReplacement>https://github.com/$2/$3</_TranslateUrlReplacement>
</PropertyGroup>

<!-- When building from Azure Devops we update SourceLink to point back to the GitHub repo. -->
<Target Name="_TranslateAzureDevOpsUrlToGitHubUrl"
Condition="'$(DisableSourceLinkUrlTranslation)' == 'false'"
DependsOnTargets="$(SourceControlManagerUrlTranslationTargets)"
BeforeTargets="SourceControlManagerPublishTranslatedUrls">
<PropertyGroup>
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace($(ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
</PropertyGroup>
<ItemGroup>
<SourceRoot Update="@(SourceRoot)">
<ScmRepositoryUrl>$([System.Text.RegularExpressions.Regex]::Replace(%(SourceRoot.ScmRepositoryUrl), $(_TranslateUrlPattern), $(_TranslateUrlReplacement)))</ScmRepositoryUrl>
</SourceRoot>
</ItemGroup>
</Target>

</Project>
2 changes: 1 addition & 1 deletion eng/templates/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
inputs:
command: custom
custom: pack
arguments: --no-build $(build_args) $(pack_binlog)
arguments: --no-build $(build_args) $(pack_binlog) -o $(pkg_dir)
projects: $(project)

- template: ci/sign-files.yml@eng
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.102",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
Expand Down
2 changes: 1 addition & 1 deletion samples/AzureFunctionsApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public static void Main()

host.Run();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static IDurableTaskClientBuilder UseBuildTarget<TTarget, TOptions>(this I
where TTarget : DurableTaskClient
where TOptions : DurableTaskClientOptions
{
builder.UseBuildTarget(typeof(TTarget));
builder.UseBuildTarget<TTarget>();
builder.Services.AddOptions<TOptions>(builder.Name)
.PostConfigure<IOptionsMonitor<DurableTaskClientOptions>>((options, baseOptions) =>
{
Expand Down
9 changes: 0 additions & 9 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,9 @@

<!-- Common build settings -->
<PropertyGroup>
<Company>Microsoft Corporation</Company>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>recommended</AnalysisMode>
<SharedRoot>$(SrcRoot)Shared/</SharedRoot>
<!-- This setting makes symbol files (PDBs) available, which is seemingly necessary for having a 'deterministic' build checkmark in our NuGet package.
This is recommended for NuGet packages, as per: https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/
The connection to deterministic builds is explored here: https://www.meziantou.net/creating-reproducible-build-in-dotnet.htm -->
<DebugType>portable</DebugType>
</PropertyGroup>

<Import Project="$(EngRoot)targets/Release.props" />
Expand Down
15 changes: 0 additions & 15 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)../, $(_DirectoryBuildTargetsFile)))/$(_DirectoryBuildTargetsFile)"
Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)../, $(_DirectoryBuildTargetsFile)))' != '' " />

<PropertyGroup Condition="'$(IsRoslynComponent)' != 'true'">
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IncludeSymbols>true</IncludeSymbols>
</PropertyGroup>

<PropertyGroup>
<!-- FileVersionRevision is expected to be set by the CI. -->
<FileVersion Condition="'$(FileVersionRevision)' != ''">$(VersionPrefix).$(FileVersionRevision)</FileVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(EnableStyleCop)' == 'true'">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="All"/>
</ItemGroup>
Expand All @@ -26,7 +12,6 @@
<InternalsVisibleTo Include="Benchmarks" Key="$(StrongNamePublicKey)" />
</ItemGroup>

<Import Project="$(EngRoot)targets/SharedFiles.targets" />
<Import Project="$(EngRoot)targets/Release.targets" />

</Project>
16 changes: 6 additions & 10 deletions src/Generators/DurableTaskSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,9 @@ internal static DurableTaskRegistry AddAllGeneratedTasks(this DurableTaskRegistr

class DurableTaskSyntaxReceiver : ISyntaxContextReceiver
{
readonly List<DurableTaskTypeInfo> orchestrators = new();
readonly List<DurableTaskTypeInfo> activities = new();
readonly List<DurableFunction> durableFunctions = new();

public IReadOnlyList<DurableTaskTypeInfo> Orchestrators => this.orchestrators;
public IReadOnlyList<DurableTaskTypeInfo> Activities => this.activities;
public IReadOnlyList<DurableFunction> DurableFunctions => this.durableFunctions;
public List<DurableTaskTypeInfo> Orchestrators { get; } = [];
public List<DurableTaskTypeInfo> Activities { get; } = [];
public List<DurableFunction> DurableFunctions { get; } = [];

public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
{
Expand All @@ -291,7 +287,7 @@ public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
function != null)
{
Debug.WriteLine($"Adding {function.Kind} function '{function.Name}'");
this.durableFunctions.Add(function);
this.DurableFunctions.Add(function);
return;
}

Expand Down Expand Up @@ -338,13 +334,13 @@ public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
{
if (baseType.Name == "TaskActivity")
{
taskList = this.activities;
taskList = this.Activities;
taskType = baseType;
break;
}
else if (baseType.Name == "TaskOrchestrator")
{
taskList = this.orchestrators;
taskList = this.Orchestrators;
taskType = baseType;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static IDurableTaskWorkerBuilder UseBuildTarget<TTarget, TOptions>(this I
where TTarget : DurableTaskWorker
where TOptions : DurableTaskWorkerOptions
{
builder.UseBuildTarget(typeof(TTarget));
builder.UseBuildTarget<TTarget>();
builder.Services.AddOptions<TOptions>(builder.Name)
.PostConfigure<IOptionsMonitor<DurableTaskWorkerOptions>>((options, baseOptions) =>
{
Expand Down
3 changes: 2 additions & 1 deletion src/Worker/Grpc/GrpcDurableTaskWorker.Processor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using DurableTask.Core.Entities;
using DurableTask.Core.Entities.OperationFormat;
using DurableTask.Core.History;
using Google.Protobuf.Collections;
using Microsoft.DurableTask.Entities;
using Microsoft.DurableTask.Worker.Shims;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -86,7 +87,7 @@ public async Task ExecuteAsync(CancellationToken cancellation)
}
}

static string GetActionsListForLogging(IReadOnlyList<P.OrchestratorAction> actions)
static string GetActionsListForLogging(RepeatedField<P.OrchestratorAction> actions)
{
if (actions.Count == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="../../../src/Shared/AzureManaged/**/*.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../../src/Client/AzureManaged/Client.AzureManaged.csproj" />
<ProjectReference Include="../../TestHelpers/TestHelpers.csproj" />
<ProjectReference Include="$(SrcRoot)Client/AzureManaged/Client.AzureManaged.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<IncludeShared>false</IncludeShared>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
</PropertyGroup>

Expand Down
16 changes: 10 additions & 6 deletions test/Shared/AzureManaged.Tests/Shared.AzureManaged.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IncludeShared>true</IncludeShared>
</PropertyGroup>

<ItemGroup>
<Compile Include="../../../src/Shared/AzureManaged/**/*.cs" />
<Compile Include="../../../src/Shared/Core/Validation/*.cs" />
</ItemGroup>

<ItemGroup>
<!-- Needed for shared section dependencies -->
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Azure.Identity" Version="1.13.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\TestHelpers\TestHelpers.csproj" />
<!-- needed for 'Core' shared section dependency. -->
<ProjectReference Include="$(SrcRoot)Abstractions/Abstractions.csproj" />
</ItemGroup>

<ItemGroup>
<SharedSection Include="AzureManaged" />
<SharedSection Include="Core" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../../src/Worker/AzureManaged/Worker.AzureManaged.csproj" />
<ProjectReference Include="../../TestHelpers/TestHelpers.csproj" />
<ProjectReference Include="$(SrcRoot)Worker/AzureManaged/Worker.AzureManaged.csproj" />
</ItemGroup>

<ItemGroup>
<SharedSection Include="AzureManaged" />
</ItemGroup>
</Project>
Loading