Replace makefile.shade with a PowerShell script
cref aspnet/Korebuild#174
This commit is contained in:
parent
a6d611aecd
commit
539903c7cf
|
|
@ -0,0 +1,2 @@
|
||||||
|
@ECHO OFF
|
||||||
|
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build-vsix.ps1' %*; exit $LASTEXITCODE"
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
#requires -version 4
|
||||||
|
param(
|
||||||
|
[string]$MSBuildPath,
|
||||||
|
[string]$Configuration='Debug',
|
||||||
|
[string]$VsixName='Microsoft.VisualStudio.RazorExtension.vsix'
|
||||||
|
)
|
||||||
|
$ErrorActionPreference='Stop'
|
||||||
|
########################
|
||||||
|
# Helpers
|
||||||
|
########################
|
||||||
|
|
||||||
|
function exec($cmd) {
|
||||||
|
$cmdName = [IO.Path]::GetFileName($cmd)
|
||||||
|
Write-Host -ForegroundColor Cyan "> $cmdName $args"
|
||||||
|
& $cmd @args
|
||||||
|
$exitCode = $LASTEXITCODE
|
||||||
|
if($exitCode -ne 0) {
|
||||||
|
throw "'$cmdName $args' failed with exit code: $exitCode"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-BuildConfiguration {
|
||||||
|
if ($env:Configuration) {
|
||||||
|
return $env:Configuration
|
||||||
|
}
|
||||||
|
return $Configuration
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-MSBuildPath {
|
||||||
|
if ($MSBuildPath) {
|
||||||
|
return $MSBuildPath
|
||||||
|
}
|
||||||
|
|
||||||
|
$vsDir=$ENV:VSINSTALLDIR
|
||||||
|
if (!($vsDir)) {
|
||||||
|
$vsDir = Join-Path ${ENV:ProgramFiles(x86)} 'Microsoft Visual Studio/2017*/*'
|
||||||
|
}
|
||||||
|
|
||||||
|
$msbuild = Get-ChildItem $(Join-Path $vsDir 'MSBuild/15.0/bin/MSBuild.exe')
|
||||||
|
|
||||||
|
if (!($msbuild) -or ($msbuild | Measure-Object).Count -ne 1) {
|
||||||
|
throw "MSBuild 15.0 could not be located automatically in '$vsDir'. Use -MSBuildPath to specify its location."
|
||||||
|
}
|
||||||
|
|
||||||
|
return $msbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
########################
|
||||||
|
# Variables
|
||||||
|
########################
|
||||||
|
|
||||||
|
$intermediateDir = Join-Path $PSScriptRoot 'obj'
|
||||||
|
$nugetExePath = Join-Path $intermediateDir 'nuget.exe'
|
||||||
|
$artifactsDir = Join-Path $PSScriptRoot 'artifacts'
|
||||||
|
$buildDir = Join-Path $artifactsDir 'build'
|
||||||
|
$vsixPath = Join-Path $buildDir $VsixName
|
||||||
|
$msbuildDir = Join-Path $artifactsDir 'msbuild'
|
||||||
|
$logPath = Join-Path $msbuildDir 'vsix-msbuild.log'
|
||||||
|
$vsixCsproj = Join-Path $PSScriptRoot 'tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj'
|
||||||
|
$msbuild = Get-MSBuildPath
|
||||||
|
$config = Get-BuildConfiguration
|
||||||
|
|
||||||
|
########################
|
||||||
|
# Main
|
||||||
|
########################
|
||||||
|
|
||||||
|
exec .\build.ps1 initialize
|
||||||
|
|
||||||
|
mkdir $buildDir -ErrorAction Ignore | out-null
|
||||||
|
mkdir $msbuildDir -ErrorAction Ignore | out-null
|
||||||
|
mkdir $intermediateDir -ErrorAction Ignore | out-null
|
||||||
|
|
||||||
|
if (!(Test-Path $nugetExePath))
|
||||||
|
{
|
||||||
|
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v4.0.0-rc4/NuGet.exe" -OutFile "$nugetExePath"
|
||||||
|
}
|
||||||
|
|
||||||
|
exec $nugetExePath restore $vsixCsproj -SolutionDirectory $PSScriptRoot -Verbosity quiet
|
||||||
|
exec $msbuild $vsixCsproj `
|
||||||
|
/v:m `
|
||||||
|
/p:DeployExtension=false `
|
||||||
|
/fl "/flp:v=D;LogFile=$logPath" `
|
||||||
|
/p:TargetVsixContainer=$vsixPath `
|
||||||
|
/p:Configuration=$config
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
<Project>
|
<Project>
|
||||||
|
<!--
|
||||||
|
TODO include VSIX build in default lifecycle builds
|
||||||
|
The .NET Core SDK doesn't currently support Microsoft.VsSDK.targets.
|
||||||
|
-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Solutions Update="..\Razor.sln">
|
<Solutions Update="..\Razor.sln">
|
||||||
<!-- the 'DebugNoVSIX' and 'ReleaseNoVSIX' configurations exclude the VSIX project, which doesn't build with Microsoft.NET.Sdk yet. -->
|
<!-- the 'DebugNoVSIX' and 'ReleaseNoVSIX' configurations exclude the VSIX project, which doesn't build with Microsoft.NET.Sdk yet. -->
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
|
|
||||||
var VERSION='0.1'
|
|
||||||
var FULL_VERSION='0.1'
|
|
||||||
use-standard-lifecycle
|
|
||||||
k-standard-goals
|
|
||||||
|
|
||||||
#restore-nuget-packages target='initialize' if='!IsLinux'
|
|
||||||
exec program='${Path.Combine(Directory.GetCurrentDirectory(), ".build", "nuget.exe")}' commandline='restore'
|
|
||||||
|
|
||||||
#build-vsix-core
|
|
||||||
@{
|
|
||||||
var programFilesx86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
|
|
||||||
// Microsoft Visual Studio\2017
|
|
||||||
var buildToolsDirectory = Path.Combine(programFilesx86, "Microsoft Visual Studio", "2017");
|
|
||||||
if (!Directory.Exists(buildToolsDirectory))
|
|
||||||
{
|
|
||||||
throw new Exception("MSBuild 15.0 installation directory could not be located.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var msBuildDirectory = Directory.EnumerateDirectories(buildToolsDirectory).FirstOrDefault();
|
|
||||||
// If VS 2017 is installed, look for MSBuild under Enterprise \ Professional \ Community directory
|
|
||||||
// If the MSBuild tools are separately installed, look for MSBuild under the BuildTools directory
|
|
||||||
if (msBuildDirectory == null)
|
|
||||||
{
|
|
||||||
throw new Exception("MSBuild 15.0 installation directory could not be located.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var msbuildPath = Path.Combine(msBuildDirectory, "MSBuild", "15.0", "bin", "MSBuild.exe");
|
|
||||||
var toolsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "tooling", "Microsoft.VisualStudio.RazorExtension");
|
|
||||||
var artifactsDirectory = Path.Combine(Directory.GetCurrentDirectory(), "artifacts");
|
|
||||||
Directory.CreateDirectory(artifactsDirectory);
|
|
||||||
var logFilePath = Path.Combine(artifactsDirectory, "msbuild.log");
|
|
||||||
}
|
|
||||||
exec program='${msbuildPath}' commandline='/p:DeployExtension=false /fl /flp:v=D /flp:LogFile=${logFilePath}' workingdir='${toolsDirectory}'
|
|
||||||
|
|
||||||
#build-vsix .initialize .compile .build-vsix-core
|
|
||||||
@{
|
|
||||||
var baseDirectory = Directory.GetCurrentDirectory();
|
|
||||||
var buildPath = Path.Combine(baseDirectory, "artifacts", "build");
|
|
||||||
var vsixPath = Directory.EnumerateFiles(baseDirectory, "*.vsix", SearchOption.AllDirectories).First();
|
|
||||||
File.Copy(vsixPath, Path.Combine(buildPath, Path.GetFileName(vsixPath)));
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue