Skip to content

Commit

Permalink
Build & Docker:
Browse files Browse the repository at this point in the history
* Replaced Cake with Nuke
* Moved build scripts, artifacts and packages to /build directory
* New solution Smartstore.Tools.sln (containing Windows specific stuff)
  • Loading branch information
muratcakir committed Feb 7, 2022
1 parent 01b4a59 commit 5b8042b
Show file tree
Hide file tree
Showing 28 changed files with 610 additions and 282 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ LICENSE
README.md


# Build
# -------------------------------------

build/artifacts
build/packages

# App specific
# -------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ logs/
/tools/packages.config*


###########
## Build
###########
build/packages
.nuke/temp

###########
## Symlinks
###########
Expand Down
122 changes: 122 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"definitions": {
"build": {
"type": "object",
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"DebugNoRazorCompile",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Edition": {
"type": "string"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Runtime": {
"type": "string"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Deploy",
"Restore",
"Test",
"Zip"
]
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Deploy",
"Restore",
"Test",
"Zip"
]
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
}
}
}
}
}
4 changes: 4 additions & 0 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "./build.schema.json",
"Solution": "Smartstore.sln"
}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

# Copy solution and source
ARG SOLUTION=Smartstore.Min.sln
ARG SOLUTION=Smartstore.sln
WORKDIR /app
COPY $SOLUTION ./
COPY src/ ./src
COPY test/ ./test

# Create Modules dir if missing
RUN mkdir /app/src/Smartstore.Web/Modules -p -v
Expand Down
244 changes: 0 additions & 244 deletions Smartstore.Min.sln

This file was deleted.

64 changes: 64 additions & 0 deletions Smartstore.Tools.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.Core", "src\Smartstore.Core\Smartstore.Core.csproj", "{163E349C-9F36-4604-8F19-49F43DB1899B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore", "src\Smartstore\Smartstore.csproj", "{2DEC17CE-3292-4F40-AC27-2F17ECABC2B2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4C0385CB-1ABE-4569-AA9D-0C3DCBE44479}"
ProjectSection(SolutionItems) = preProject
src\Smartstore.Modules\module.schema.json = src\Smartstore.Modules\module.schema.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{1DE93C7F-22CE-462C-BB6E-7282F4403F2E}"
ProjectSection(SolutionItems) = preProject
src\Smartstore.Build\Smartstore.Common.props = src\Smartstore.Build\Smartstore.Common.props
src\Smartstore.Build\Smartstore.Common.targets = src\Smartstore.Build\Smartstore.Common.targets
src\Smartstore.Build\Smartstore.Module.props = src\Smartstore.Build\Smartstore.Module.props
src\Smartstore.Build\Smartstore.Module.targets = src\Smartstore.Build\Smartstore.Module.targets
src\Smartstore.Build\Smartstore.Razor.props = src\Smartstore.Build\Smartstore.Razor.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{5135A2B0-95B5-46AD-906A-70A2364B892B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.Packager", "tools\Smartstore.Packager\Smartstore.Packager.csproj", "{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
DebugNoRazorCompile|Any CPU = DebugNoRazorCompile|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{163E349C-9F36-4604-8F19-49F43DB1899B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{163E349C-9F36-4604-8F19-49F43DB1899B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{163E349C-9F36-4604-8F19-49F43DB1899B}.DebugNoRazorCompile|Any CPU.ActiveCfg = Debug|Any CPU
{163E349C-9F36-4604-8F19-49F43DB1899B}.DebugNoRazorCompile|Any CPU.Build.0 = Debug|Any CPU
{163E349C-9F36-4604-8F19-49F43DB1899B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{163E349C-9F36-4604-8F19-49F43DB1899B}.Release|Any CPU.Build.0 = Release|Any CPU
{2DEC17CE-3292-4F40-AC27-2F17ECABC2B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2DEC17CE-3292-4F40-AC27-2F17ECABC2B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DEC17CE-3292-4F40-AC27-2F17ECABC2B2}.DebugNoRazorCompile|Any CPU.ActiveCfg = Debug|Any CPU
{2DEC17CE-3292-4F40-AC27-2F17ECABC2B2}.DebugNoRazorCompile|Any CPU.Build.0 = Debug|Any CPU
{2DEC17CE-3292-4F40-AC27-2F17ECABC2B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2DEC17CE-3292-4F40-AC27-2F17ECABC2B2}.Release|Any CPU.Build.0 = Release|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.DebugNoRazorCompile|Any CPU.ActiveCfg = Debug|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.DebugNoRazorCompile|Any CPU.Build.0 = Debug|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1DE93C7F-22CE-462C-BB6E-7282F4403F2E} = {4C0385CB-1ABE-4569-AA9D-0C3DCBE44479}
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978} = {5135A2B0-95B5-46AD-906A-70A2364B892B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A0A0B995-5D0B-458E-BCC0-1071B76949D1}
EndGlobalSection
EndGlobal
29 changes: 12 additions & 17 deletions Smartstore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore", "src\Smartstore\Smartstore.csproj", "{2DEC17CE-3292-4F40-AC27-2F17ECABC2B2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{E5C1AA43-6B44-4EFA-8DE9-6070EE007CE3}"
ProjectSection(SolutionItems) = preProject
src\Smartstore.Modules\module.schema.json = src\Smartstore.Modules\module.schema.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B3391994-AE0F-4C8C-AE8E-968F6013B4B6}"
EndProject
Expand All @@ -31,12 +34,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.Web.Tests", "tes
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.DevTools", "src\Smartstore.Modules\Smartstore.DevTools\Smartstore.DevTools.csproj", "{62C64D0B-D937-40B2-B89D-198B2409FC84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4C0385CB-1ABE-4569-AA9D-0C3DCBE44479}"
ProjectSection(SolutionItems) = preProject
src\Smartstore.Modules\module.schema.json = src\Smartstore.Modules\module.schema.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{1DE93C7F-22CE-462C-BB6E-7282F4403F2E}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{5135A2B0-95B5-46AD-906A-70A2364B892B}"
ProjectSection(SolutionItems) = preProject
src\Smartstore.Build\Smartstore.Common.props = src\Smartstore.Build\Smartstore.Common.props
src\Smartstore.Build\Smartstore.Common.targets = src\Smartstore.Build\Smartstore.Common.targets
Expand All @@ -45,8 +43,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{1DE93C7F
src\Smartstore.Build\Smartstore.Razor.props = src\Smartstore.Build\Smartstore.Razor.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{5135A2B0-95B5-46AD-906A-70A2364B892B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.ModuleBuilder", "src\Smartstore.Build\Smartstore.ModuleBuilder\src\Smartstore.ModuleBuilder.csproj", "{23B334CE-7FFC-464E-A0A8-FFCB084E8F24}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.Forums", "src\Smartstore.Modules\Smartstore.Forums\Smartstore.Forums.csproj", "{BB9E738C-0785-497F-9391-2B4CA242B567}"
Expand Down Expand Up @@ -81,7 +77,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.Google.MerchantC
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.AmazonPay", "src\Smartstore.Modules\Smartstore.AmazonPay\Smartstore.AmazonPay.csproj", "{6A9FA9E0-029C-4565-BD2E-10A209D78031}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.Packager", "tools\Smartstore.Packager\Smartstore.Packager.csproj", "{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Smartstore.Build", "src\Smartstore.Build\Smartstore.Build\Smartstore.Build.csproj", "{48F4799B-9824-469C-B1A4-7050F85163CA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -258,12 +254,12 @@ Global
{6A9FA9E0-029C-4565-BD2E-10A209D78031}.DebugNoRazorCompile|Any CPU.Build.0 = Debug|Any CPU
{6A9FA9E0-029C-4565-BD2E-10A209D78031}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A9FA9E0-029C-4565-BD2E-10A209D78031}.Release|Any CPU.Build.0 = Release|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.DebugNoRazorCompile|Any CPU.ActiveCfg = Debug|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.DebugNoRazorCompile|Any CPU.Build.0 = Debug|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978}.Release|Any CPU.Build.0 = Release|Any CPU
{48F4799B-9824-469C-B1A4-7050F85163CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{48F4799B-9824-469C-B1A4-7050F85163CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{48F4799B-9824-469C-B1A4-7050F85163CA}.DebugNoRazorCompile|Any CPU.ActiveCfg = Debug|Any CPU
{48F4799B-9824-469C-B1A4-7050F85163CA}.DebugNoRazorCompile|Any CPU.Build.0 = Debug|Any CPU
{48F4799B-9824-469C-B1A4-7050F85163CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{48F4799B-9824-469C-B1A4-7050F85163CA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -276,7 +272,6 @@ Global
{253DECF2-2ECA-4A90-955B-9299CCEC1363} = {82A38DDA-C944-4C15-AF43-86732F8ED15A}
{EAA90B11-ED40-4AB1-8027-45226471F9EE} = {B3391994-AE0F-4C8C-AE8E-968F6013B4B6}
{62C64D0B-D937-40B2-B89D-198B2409FC84} = {E5C1AA43-6B44-4EFA-8DE9-6070EE007CE3}
{1DE93C7F-22CE-462C-BB6E-7282F4403F2E} = {4C0385CB-1ABE-4569-AA9D-0C3DCBE44479}
{23B334CE-7FFC-464E-A0A8-FFCB084E8F24} = {5135A2B0-95B5-46AD-906A-70A2364B892B}
{BB9E738C-0785-497F-9391-2B4CA242B567} = {E5C1AA43-6B44-4EFA-8DE9-6070EE007CE3}
{944E4667-6CA2-4AD6-B9B0-F8E8C7903473} = {E5C1AA43-6B44-4EFA-8DE9-6070EE007CE3}
Expand All @@ -294,7 +289,7 @@ Global
{290CAB7D-A6AD-4605-A59D-91A1921213E2} = {E5C1AA43-6B44-4EFA-8DE9-6070EE007CE3}
{BBB5935F-1E33-4D47-9B3E-7E92F3A4E54A} = {E5C1AA43-6B44-4EFA-8DE9-6070EE007CE3}
{6A9FA9E0-029C-4565-BD2E-10A209D78031} = {E5C1AA43-6B44-4EFA-8DE9-6070EE007CE3}
{4BFFDE97-4EC0-423E-91C6-A202FD0A5978} = {5135A2B0-95B5-46AD-906A-70A2364B892B}
{48F4799B-9824-469C-B1A4-7050F85163CA} = {5135A2B0-95B5-46AD-906A-70A2364B892B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A0A0B995-5D0B-458E-BCC0-1071B76949D1}
Expand Down
7 changes: 7 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:; set -eo pipefail
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
:; ${SCRIPT_DIR}/build.sh "$@"
:; exit $?

@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*
69 changes: 69 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[CmdletBinding()]
Param(
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)

Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"

Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent

###########################################################################
# CONFIGURATION
###########################################################################

$BuildProjectFile = "$PSScriptRoot\src\Smartstore.Build\Smartstore.Build\Smartstore.Build.csproj"
$TempDirectory = "$PSScriptRoot\\.nuke\temp"

$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "Current"

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_MULTILEVEL_LOOKUP = 0

###########################################################################
# EXECUTION
###########################################################################

function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}

# If dotnet CLI is installed globally and it matches requested version, use for execution
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)

# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
$DotNetVersion = $DotNetGlobal.sdk.version
}
}

# Install by channel or version
$DotNetDirectory = "$TempDirectory\dotnet-win"
if (!(Test-Path variable:DotNetVersion)) {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
} else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
}

Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
Loading

0 comments on commit 5b8042b

Please sign in to comment.