mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 03:12:57 +08:00
Improve the buildscript
This commit is contained in:
parent
3372a0e5a2
commit
57fcdf9a0b
5
.gitignore
vendored
5
.gitignore
vendored
@ -11,8 +11,9 @@
|
|||||||
*.userprefs
|
*.userprefs
|
||||||
|
|
||||||
### Cake ###
|
### Cake ###
|
||||||
tools/*
|
tools/**
|
||||||
!tools/cakebuild.csproj
|
build/tools/**
|
||||||
|
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
bin/[Dd]ebug/
|
bin/[Dd]ebug/
|
||||||
|
14
.vscode/launch.json
vendored
14
.vscode/launch.json
vendored
@ -68,6 +68,20 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"console": "internalConsole"
|
"console": "internalConsole"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Cake: Debug Script",
|
||||||
|
"type": "coreclr",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceRoot}/build/tools/Cake.CoreCLR/0.30.0/Cake.dll",
|
||||||
|
"args": [
|
||||||
|
"${workspaceRoot}/build/build.cake",
|
||||||
|
"--debug",
|
||||||
|
"--verbosity=diagnostic"
|
||||||
|
],
|
||||||
|
"cwd": "${workspaceRoot}/build",
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"externalConsole": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
13
build.ps1
13
build.ps1
@ -41,27 +41,28 @@ Param(
|
|||||||
[switch]$ShowDescription,
|
[switch]$ShowDescription,
|
||||||
[Alias("WhatIf", "Noop")]
|
[Alias("WhatIf", "Noop")]
|
||||||
[switch]$DryRun,
|
[switch]$DryRun,
|
||||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
[Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)]
|
||||||
[string[]]$ScriptArgs
|
[string[]]$ScriptArgs
|
||||||
)
|
)
|
||||||
|
|
||||||
Write-Host "Preparing to run build script..."
|
Write-Host "Preparing to run build script..."
|
||||||
|
|
||||||
# Determine the script root for resolving other paths.
|
# Determine the script root for resolving other paths.
|
||||||
if(!$PSScriptRoot){
|
if(!$PSScriptRoot) {
|
||||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||||
}
|
}
|
||||||
|
|
||||||
# Resolve the paths for resources used for debugging.
|
# Resolve the paths for resources used for debugging.
|
||||||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
|
$BUILD_DIR = Join-Path $PSScriptRoot "build"
|
||||||
$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cakebuild.csproj"
|
$TOOLS_DIR = Join-Path $BUILD_DIR "tools"
|
||||||
|
$CAKE_CSPROJ = Join-Path $BUILD_DIR "cakebuild.csproj"
|
||||||
|
|
||||||
# Install the required tools locally.
|
# Install the required tools locally.
|
||||||
Write-Host "Restoring cake tools..."
|
Write-Host "Restoring cake tools..."
|
||||||
Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" | Out-Null
|
Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" | Out-Null
|
||||||
|
|
||||||
# Find the Cake executable
|
# Find the Cake executable
|
||||||
$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.coreclr/ -Filter Cake.dll -Recurse).FullName
|
$CAKE_EXECUTABLE = (Get-ChildItem -Path "$TOOLS_DIR/cake.coreclr/" -Filter Cake.dll -Recurse).FullName
|
||||||
|
|
||||||
# Build Cake arguments
|
# Build Cake arguments
|
||||||
$cakeArguments = @("$Script");
|
$cakeArguments = @("$Script");
|
||||||
@ -75,5 +76,7 @@ $cakeArguments += $ScriptArgs
|
|||||||
|
|
||||||
# Start Cake
|
# Start Cake
|
||||||
Write-Host "Running build script..."
|
Write-Host "Running build script..."
|
||||||
|
Push-Location -Path $BUILD_DIR
|
||||||
Invoke-Expression "dotnet `"$CAKE_EXECUTABLE`" $cakeArguments"
|
Invoke-Expression "dotnet `"$CAKE_EXECUTABLE`" $cakeArguments"
|
||||||
|
Pop-Location
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
|
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
|
||||||
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2"
|
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2"
|
||||||
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
|
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
|
||||||
|
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// ARGUMENTS
|
// ARGUMENTS
|
||||||
@ -9,30 +10,25 @@
|
|||||||
var target = Argument("target", "Build");
|
var target = Argument("target", "Build");
|
||||||
var configuration = Argument("configuration", "Release");
|
var configuration = Argument("configuration", "Release");
|
||||||
|
|
||||||
var osuSolution = new FilePath("./osu.sln");
|
var rootDirectory = new DirectoryPath("..");
|
||||||
|
var desktopProject = rootDirectory.CombineWithFilePath("osu.Desktop/osu.Desktop.csproj");
|
||||||
|
var solution = rootDirectory.CombineWithFilePath("osu.sln");
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// TASKS
|
// TASKS
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Task("Restore")
|
|
||||||
.Does(() => {
|
|
||||||
DotNetCoreRestore(osuSolution.FullPath);
|
|
||||||
});
|
|
||||||
|
|
||||||
Task("Compile")
|
Task("Compile")
|
||||||
.IsDependentOn("Restore")
|
|
||||||
.Does(() => {
|
.Does(() => {
|
||||||
DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings {
|
DotNetCoreBuild(solution.FullPath, new DotNetCoreBuildSettings {
|
||||||
Configuration = configuration,
|
Configuration = configuration,
|
||||||
NoRestore = true,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Task("Test")
|
Task("Test")
|
||||||
.IsDependentOn("Compile")
|
.IsDependentOn("Compile")
|
||||||
.Does(() => {
|
.Does(() => {
|
||||||
var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll");
|
var testAssemblies = GetFiles(rootDirectory + "/**/*.Tests/bin/**/*.Tests.dll");
|
||||||
|
|
||||||
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
|
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
|
||||||
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
|
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
|
||||||
@ -46,9 +42,7 @@ Task("InspectCode")
|
|||||||
.WithCriteria(IsRunningOnWindows())
|
.WithCriteria(IsRunningOnWindows())
|
||||||
.IsDependentOn("Compile")
|
.IsDependentOn("Compile")
|
||||||
.Does(() => {
|
.Does(() => {
|
||||||
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
|
InspectCode(solution, new InspectCodeSettings {
|
||||||
|
|
||||||
InspectCode(osuSolution, new InspectCodeSettings {
|
|
||||||
CachesHome = "inspectcode",
|
CachesHome = "inspectcode",
|
||||||
OutputFile = "inspectcodereport.xml",
|
OutputFile = "inspectcodereport.xml",
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user