Skip to content

Commit 97c577a

Browse files
committed
Use Common paths for Build, Publish and Pack
The new Output paths point to... Build: `~build\{bin,obj}` Restore: `~build\ext` Publish: `~publish\...` Pack: `~packages\{bin,obj}` Also, Fix logic in Update-Header.ps1 to exclude new paths from the list of sources files that works across platforms.
1 parent 556a8b5 commit 97c577a

7 files changed

+52
-9
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
*.userosscache
99
*.sln.docstates
1010

11+
# Working folders
12+
~build/
13+
~publish/
14+
1115
# Build results
1216
[Bb]in/
1317
[Oo]bj/

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Project>
22

3+
<Import Project="Directory.Solution.props" />
4+
35
<PropertyGroup>
46
<RepositoryDirectory>$(MSBuildThisFileDirectory)</RepositoryDirectory>
57
<BuildToolsDirectory>$(RepositoryDirectory)build\</BuildToolsDirectory>
@@ -11,7 +13,6 @@
1113
<When Condition="$(IsCoreProject)">
1214
<PropertyGroup>
1315
<GenerateDocumentationFile>true</GenerateDocumentationFile>
14-
<PackageOutputPath>$(RepositoryDirectory)bin\nupkg</PackageOutputPath>
1516
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
1617
</PropertyGroup>
1718
</When>

Directory.Solution.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<RestoreUseStaticGraphEvaluation>True</RestoreUseStaticGraphEvaluation>
5+
</PropertyGroup>
6+
7+
</Project>

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ jobs:
7272
env:
7373
SignClientUser: $(SignClientUser)
7474
SignClientSecret: $(SignClientSecret)
75-
ArtifactDirectory: bin/nupkg
75+
ArtifactDirectory: ~packages/bin
7676
condition: and(succeeded(), not(eq(variables['Build.Reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], '')))
7777

7878
# Publish build artifacts
79-
- publish: bin/nupkg
79+
- publish: ~packages/bin
8080
artifact: Packages
8181
displayName: Publish package artifacts

build/Community.Toolkit.Common.props

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<Project>
22

3-
<PropertyGroup>
3+
<PropertyGroup Label="Compile">
44
<Features>Strict</Features>
55
<Nullable>Enable</Nullable>
66
<LangVersion>Latest</LangVersion>
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
88
</PropertyGroup>
99

10-
<PropertyGroup>
10+
<PropertyGroup Label="Assembly">
1111
<SignAssembly>true</SignAssembly>
1212
<AssemblyOriginatorKeyFile>$(RepositoryDirectory)toolkit.snk</AssemblyOriginatorKeyFile>
1313
</PropertyGroup>
1414

15-
<PropertyGroup>
15+
<PropertyGroup Label="Project">
1616
<IsTestProject>$(MSBuildProjectName.EndsWith('Tests'))</IsTestProject>
1717
<IsCoreProject Condition="$(IsTestProject)">False</IsCoreProject>
1818
<IsCoreProject Condition="'$(IsCoreProject)' == ''">True</IsCoreProject>
1919
</PropertyGroup>
2020

21-
<PropertyGroup>
21+
<PropertyGroup Label="Build">
2222
<IsPackable>true</IsPackable>
2323
<IsPublishable>true</IsPublishable>
2424
<ContinuousIntegrationBuild>$(TF_BUILD)</ContinuousIntegrationBuild>
@@ -31,4 +31,19 @@
3131
</PackageFile>
3232
</ItemDefinitionGroup>
3333

34+
<PropertyGroup Label="Outputs">
35+
<!-- Common Outputs -->
36+
<BuildDir>~build\</BuildDir>
37+
<PublishDir>~publish\</PublishDir>
38+
<!-- Build Outputs -->
39+
<BaseOutputPath>$(BuildDir)bin\</BaseOutputPath>
40+
<BaseIntermediateOutputPath>$(BuildDir)obj\</BaseIntermediateOutputPath>
41+
<!-- Restore Outputs-->
42+
<MSBuildProjectExtensionsPath>$(BuildDir)ext\</MSBuildProjectExtensionsPath>
43+
<RestoreOutputPath>$(MSBuildProjectExtensionsPath)</RestoreOutputPath>
44+
<!-- Pack Outputs -->
45+
<PackageOutputPath>$(RepositoryDirectory)~packages\bin\</PackageOutputPath>
46+
<NuSpecOutputPath>$(RepositoryDirectory)~packages\obj\</NuSpecOutputPath>
47+
</PropertyGroup>
48+
3449
</Project>

build/Community.Toolkit.Common.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
<PackageFile Include="$(RepositoryDirectory)ThirdPartyNotices.txt" />
2626
</ItemGroup>
2727

28+
<!-- Exclude files and folders from build and publish across all projects -->
29+
<PropertyGroup>
30+
<DefaultItemExcludes>$(BuildDir)**;$(PublishDir)**;$(DefaultItemExcludes)</DefaultItemExcludes>
31+
</PropertyGroup>
32+
2833
<!--
2934
Use 'GenerateNuSpecDependsOn' extensibility point to include custom global assets in the package.
3035
Use 'TargetsForTfmSpecificContentInPackage' extensibility point to include custom TFM-specific assets in the package.

build/Update-Headers.ps1

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Script to Update Header comment in C# sources within this repository.
22

33
# This script duplicates the fuctionality provided by the 'UpdateHeaders' target in Cake script present previously.
4-
# Since, Cake build has been removed, this fuctionality has been implimented here in this PowerShell script.
4+
# Since, Cake build has been removed, this fuctionality has been implemented here in this PowerShell script.
55

66
[CmdletBinding()]
77
Param(
@@ -33,7 +33,18 @@ function Get-SourceFiles ([string]$Path, [string]$Extension) {
3333
$fileFilter = "*.$fileType"
3434
$fileExcludes = "*.g.$fileType", "*.i.$fileType", "*TemporaryGeneratedFile*.$fileType"
3535
$sourceFiles = Get-ChildItem -Path $Path -File -Recurse -Filter $fileFilter -Exclude $fileExcludes
36-
return $sourceFiles.Where({ !($_.FullName.Contains("\bin\") -or $_.FullName.Contains("\obj\")) })
36+
37+
$folderExcludes = "build", "~build", "~publish", "~packages", "bin", "obj"
38+
39+
return $sourceFiles.Where({
40+
foreach ($folder in $folderExcludes) {
41+
$folderPattern = "{0}$folder{0}" -f [IO.Path]::DirectorySeparatorChar
42+
if ($_.FullName.Contains($folderPattern)) {
43+
return $false
44+
}
45+
}
46+
return $true
47+
})
3748
}
3849

3950
# Set Repot Root

0 commit comments

Comments
 (0)