Skip to content

Commit

Permalink
Handling empty version suffix during release build.
Browse files Browse the repository at this point in the history
  • Loading branch information
tillig committed Apr 18, 2017
1 parent cec807d commit 2daafa5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Get-DotNetProjectDirectory -RootPath $PSScriptRoot | Restore-DependencyPackages

# Build/package
Write-Message "Building projects and packages"
Get-DotNetProjectDirectory -RootPath $PSScriptRoot\src | Invoke-DotNetPack -PackagesPath $packagesPath -VersionSuffix "$versionSuffix"
Get-DotNetProjectDirectory -RootPath $PSScriptRoot\src | Invoke-DotNetPack -PackagesPath $packagesPath -VersionSuffix $versionSuffix

# Test
Write-Message "Executing unit tests"
Expand Down
6 changes: 6 additions & 0 deletions build/Analyzers.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<RuleSet Name="Autofac Analyzer Rules" Description="Analyzer rules for Autofac assemblies." ToolsVersion="14.0">
<!-- https://github.com/dotnet/roslyn/blob/master/docs/compilers/Rule%20Set%20Format.md -->
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.Usage" RuleNamespace="Microsoft.Usage">
<!-- Implement serialization constructors - false positive when building .NET Core -->
<Rule Id="CA2229" Action="None" />
<!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core -->
<Rule Id="CA2237" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- Prefix local calls with this -->
<Rule Id="SA1101" Action="None" />
Expand Down
2 changes: 1 addition & 1 deletion build/Autofac.Build.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = '.\Autofac.Build.psm1'
ModuleVersion = '0.1.0'
ModuleVersion = '0.2.0'
GUID = '55d3f738-f48f-4497-9b2c-ecd90ec1f978'
Author = 'Autofac Contributors'
CompanyName = 'Autofac'
Expand Down
24 changes: 22 additions & 2 deletions build/Autofac.Build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function Invoke-DotNetPack
$PackagesPath,

[Parameter(Mandatory=$True, ValueFromPipeline=$False)]
[AllowEmptyString()]
[string]
$VersionSuffix = ""
)
Expand All @@ -156,8 +157,27 @@ function Invoke-DotNetPack
{
foreach($Project in $ProjectDirectory)
{
& dotnet build ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix
& dotnet pack ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix --include-symbols --output $PackagesPath
if ($VersionSuffix -eq "")
{
& dotnet build ("""" + $Project.FullName + """") --configuration Release
}
else
{
& dotnet build ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix
}
if ($LASTEXITCODE -ne 0)
{
exit 1
}

if ($VersionSuffix -eq "")
{
& dotnet pack ("""" + $Project.FullName + """") --configuration Release --include-symbols --output $PackagesPath
}
else
{
& dotnet pack ("""" + $Project.FullName + """") --configuration Release --version-suffix $VersionSuffix --include-symbols --output $PackagesPath
}
if ($LASTEXITCODE -ne 0)
{
exit 1
Expand Down

0 comments on commit 2daafa5

Please sign in to comment.