Skip to content

Commit

Permalink
Merge remote-tracking branch 'libtemplate/main' into libtemplateUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Jul 8, 2024
2 parents 5db1dd3 + ebb586f commit 2db838c
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 59 deletions.
14 changes: 4 additions & 10 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,22 @@
"isRoot": true,
"tools": {
"powershell": {
"version": "7.3.7",
"version": "7.4.3",
"commands": [
"pwsh"
]
},
"dotnet-format": {
"version": "5.1.250801",
"commands": [
"dotnet-format"
]
},
"dotnet-coverage": {
"version": "17.8.6",
"version": "17.11.3",
"commands": [
"dotnet-coverage"
]
},
"nbgv": {
"version": "3.6.133",
"version": "3.6.139",
"commands": [
"nbgv"
]
}
}
}
}
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions
FROM mcr.microsoft.com/dotnet/sdk:7.0.302-jammy
FROM mcr.microsoft.com/dotnet/sdk:8.0.300-jammy

# Installing mono makes `dotnet test` work without errors even for net472.
# But installing it takes a long time, so it's excluded by default.
Expand Down
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ indent_size = 2
# Xml config files
[*.{ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}]
indent_size = 2
indent_style = space

# JSON files
[*.json]
Expand All @@ -40,6 +41,7 @@ indent_size = 4
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_property = true:warning
dotnet_style_qualification_for_method = true:warning
Expand Down
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ updates:
directory: /
schedule:
interval: weekly
ignore:
# This package has unlisted versions on nuget.org that are not supported. Avoid them.
- dependency-name: dotnet-format
versions: ["6.x", "7.x", "8.x"]
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,6 @@ MigrationBackup/

# mac-created file to track user view preferences for a directory
.DS_Store

# Analysis results
*.sarif
Empty file added .prettierrc.yaml
Empty file.
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"ms-dotnettools.csharp",
"k--kato.docomment",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"pflannery.vscode-versionlens",
"davidanson.vscode-markdownlint",
"dotjoshjohnson.xml",
Expand Down
17 changes: 16 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,20 @@
"files.trimFinalNewlines": true,
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableRoslynAnalyzers": true,
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true
"dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true,
"editor.formatOnSave": true,
"[xml]": {
"editor.wordWrap": "off"
},
// Treat these files as Azure Pipelines files
"files.associations": {
"**/azure-pipelines/**/*.yml": "azure-pipelines",
"azure-pipelines.yml": "azure-pipelines"
},
// Use Prettier as the default formatter for Azure Pipelines files.
// Needs to be explicitly configured: https://github.com/Microsoft/azure-pipelines-vscode#document-formatting
"[azure-pipelines]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": false // enable this when they conform
},
}
21 changes: 1 addition & 20 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<RepoRootPath>$(MSBuildThisFileDirectory)</RepoRootPath>
<BaseIntermediateOutputPath>$(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\</BaseIntermediateOutputPath>
<BaseOutputPath Condition=" '$(BaseOutputPath)' == '' ">$(RepoRootPath)bin\$(MSBuildProjectName)\</BaseOutputPath>
<PackageOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\</PackageOutputPath>
<LangVersion>11</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AnalysisLevel>latest</AnalysisLevel>
Expand Down Expand Up @@ -54,23 +54,4 @@
<PackageReleaseNotes Condition="'$(PackageProjectUrl)'!=''">$(PackageProjectUrl)/releases/tag/v$(Version)</PackageReleaseNotes>
</PropertyGroup>
</Target>

<PropertyGroup Condition="'$(IsWpfTempProject)' == ''">
<IsWpfTempProject>false</IsWpfTempProject>
<IsWpfTempProject Condition="$(MSBuildProjectName.EndsWith('_wpftmp'))">true</IsWpfTempProject>
</PropertyGroup>

<!--
Inspired by https://github.com/dotnet/arcade/blob/cbfa29d4e859622ada3d226f90f103f659665d31/src/Microsoft.DotNet.Arcade.Sdk/tools/Workarounds.props#L14-L31
Disable Source Link and Xliff in WPF temp projects to avoid generating non-deterministic file names to obj dir.
The project name is non-deterministic and is included in the Source Link json file name and xlf directory names.
It's also not necessary to generate these assets.
-->
<PropertyGroup Condition="'$(IsWpfTempProject)' == 'true'">
<EnableSourceLink>false</EnableSourceLink>
<EmbedUntrackedSources>false</EmbedUntrackedSources>
<DeterministicSourcePaths>false</DeterministicSourcePaths>
<EnableXlfLocalization>false</EnableXlfLocalization>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<!-- Workaround https://github.com/dotnet/wpf/issues/1718 -->
<EmbedUntrackedSources Condition=" '$(UseWPF)' == 'true' ">false</EmbedUntrackedSources>
<LangVersion Condition="'$(Language)'=='C#'">12</LangVersion>
<LangVersion Condition="'$(Language)'=='VB'">16.9</LangVersion>
</PropertyGroup>

<ItemGroup>
<!-- Avoid compile error about missing namespace when combining ImplicitUsings with .NET Framework target frameworks. -->
<Using Remove="System.Net.Http" Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'" />
Expand Down
14 changes: 6 additions & 8 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- https://learn.microsoft.com/nuget/consume-packages/central-package-management -->
<PropertyGroup>
Expand All @@ -12,17 +13,14 @@
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(TargetRoslynVersion)" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="$(TargetRoslynVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.1" />
<PackageVersion Include="xunit" Version="2.5.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
<PackageVersion Include="xunit" Version="2.8.1" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.139" />
<GlobalPackageReference Include="Nullable" Version="1.3.1" />
<GlobalPackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.507" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<GlobalPackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" />
</ItemGroup>
</Project>
5 changes: 3 additions & 2 deletions azure-pipelines/artifacts/_pipelines.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
[CmdletBinding()]
param (
[string]$ArtifactNameSuffix,
[switch]$StageOnly
[switch]$StageOnly,
[switch]$AvoidSymbolicLinks
)

Function Set-PipelineVariable($name, $value) {
Expand All @@ -24,7 +25,7 @@ Function Test-ArtifactUploaded($artifactName) {
Test-Path "env:$varName"
}

& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% {
& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix -AvoidSymbolicLinks:$AvoidSymbolicLinks |% {
# Set a variable which will out-live this script so that a subsequent attempt to collect and upload artifacts
# will skip this one from a check in the _all.ps1 script.
Set-PipelineVariable "ARTIFACTSTAGED_$($_.Name.ToUpper())" 'true'
Expand Down
16 changes: 14 additions & 2 deletions azure-pipelines/artifacts/_stage_all.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

[CmdletBinding()]
param (
[string]$ArtifactNameSuffix
[string]$ArtifactNameSuffix,
[switch]$AvoidSymbolicLinks
)

$ArtifactStagingFolder = & "$PSScriptRoot/../Get-ArtifactsStagingDirectory.ps1" -CleanIfLocal
Expand All @@ -30,6 +31,12 @@ function Create-SymbolicLink {
} else {
cmd /c "mklink `"$Link`" `"$Target`"" | Out-Null
}

if ($LASTEXITCODE -ne 0) {
# Windows requires admin privileges to create symbolic links
# unless Developer Mode has been enabled.
throw "Failed to create symbolic link at $Link that points to $Target"
}
}

# Stage all artifacts
Expand All @@ -42,7 +49,12 @@ $Artifacts |% {

if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null }
if (Test-Path -PathType Leaf $_.Source) { # skip folders
Create-SymbolicLink -Link (Join-Path $DestinationFolder $Name) -Target $_.Source
$TargetPath = Join-Path $DestinationFolder $Name
if ($AvoidSymbolicLinks) {
Copy-Item -Path $_.Source -Destination $TargetPath
} else {
Create-SymbolicLink -Link $TargetPath -Target $_.Source
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
- template: dotnet.yml
parameters:
RunTests: ${{ parameters.RunTests }}
- script: dotnet format --verify-no-changes --no-restore
displayName: 💅 Verify formatted code
- template: publish-symbols.yml
- ${{ if parameters.RunTests }}:
- template: publish-codecoverage.yml
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": "7.0.302",
"version": "8.0.300",
"rollForward": "patch",
"allowPrerelease": false
}
Expand Down
11 changes: 5 additions & 6 deletions init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ try {
$HeaderColor = 'Green'

$RestoreArguments = @()
if ($Interactive)
{
if ($Interactive) {
$RestoreArguments += '--interactive'
}

Expand All @@ -98,10 +97,10 @@ try {
}

if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) {
dotnet tool restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring dotnet CLI tools."
}
dotnet tool restore @RestoreArguments
if ($lastexitcode -ne 0) {
throw "Failure while restoring dotnet CLI tools."
}
}

& "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars -PrependPath $PrependPath | Out-Null
Expand Down
3 changes: 3 additions & 0 deletions settings.VisualStudio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"textEditor.codeCleanup.profile": "profile1"
}
6 changes: 6 additions & 0 deletions src/AssemblyInfo.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
' Copyright (c) COMPANY-PLACEHOLDER. All rights reserved.
' Licensed under the MIT license. See LICENSE file in the project root for full license information.

Imports System.Runtime.InteropServices

<Assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)>
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- Include and reference README in nuget package, if a README is in the project directory. -->
<PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)AssemblyInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)AssemblyInfo.cs" Condition=" '$(Language)'=='C#' " />
<Compile Include="$(MSBuildThisFileDirectory)AssemblyInfo.vb" Condition=" '$(Language)'=='VB' " />
</ItemGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..))" />
Expand Down
1 change: 1 addition & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..))" />

Expand Down
1 change: 1 addition & 0 deletions test/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..))" />
</Project>

0 comments on commit 2db838c

Please sign in to comment.