add -noVendor flag

This commit is contained in:
David Refoua 2022-10-16 16:10:51 +03:30
parent f58652fc28
commit d94fe86b2a

View File

@ -16,6 +16,10 @@
.\build.ps1 -Compile
Recompile the launcher executable if you have the requisite build tools for C++ installed.
.EXAMPLE
.\build.ps1 -Compile -NoVendor
Skip all downloads and only build launcher.
.EXAMPLE
.\build -verbose
@ -49,6 +53,9 @@ Param(
# Config folder location
[string]$config = "$PSScriptRoot\..\config",
# Using this option will skip all downloads and only build launcher
[switch]$noVendor,
# New launcher if you have MSBuild tools installed
[switch]$Compile
)
@ -60,6 +67,36 @@ $cmder_root = Resolve-Path "$PSScriptRoot\.."
. "$PSScriptRoot\utils.ps1"
$ErrorActionPreference = "Stop"
# Kill ssh-agent.exe if it is running from the $env:cmder_root we are building
foreach ($ssh_agent in $(Get-Process ssh-agent -ErrorAction SilentlyContinue)) {
if ([string]$($ssh_agent.path) -Match [string]$cmder_root.replace('\','\\')) {
Write-Verbose $("Stopping " + $ssh_agent.path + "!")
Stop-Process $ssh_agent.id
}
}
if ($Compile) {
# Check for requirements
Ensure-Executable "msbuild"
# Get the version string
$version = Get-VersionStr
Push-Location -Path $launcher
Create-RC $version ($launcher + '\src\version.rc2')
Write-Verbose "Building the launcher..."
# Referene: https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
msbuild CmderLauncher.vcxproj /t:Clean,Build /p:configuration=Release /m
if ($LastExitCode -ne 0) {
throw "MSBuild failed to build the launcher executable."
}
Pop-Location
}
if (-Not $noVendor) {
# Check for requirements
Ensure-Exists $sourcesPath
Ensure-Executable "7z"
@ -82,14 +119,6 @@ if ($config -ne "") {
} else { $ConEmuXml = "" }
} else { $ConEmuXml = "" }
# Kill ssh-agent.exe if it is running from the $env:cmder_root we are building
foreach ($ssh_agent in $(Get-Process ssh-agent -ErrorAction SilentlyContinue)) {
if ([string]$($ssh_agent.path) -Match [string]$cmder_root.replace('\','\\')) {
Write-Verbose $("Stopping " + $ssh_agent.path + "!")
Stop-Process $ssh_agent.id
}
}
foreach ($s in $sources) {
Write-Verbose "Getting vendored $($s.name) $($s.version)..."
@ -115,41 +144,6 @@ if ($ConEmuXml -ne "") {
Copy-Item $ConEmuXmlSave $ConEmuXml
}
Pop-Location
if ($Compile) {
# Check for requirements
Ensure-Executable "msbuild"
# Get the version string
$version = Get-VersionStr
Push-Location -Path $launcher
Create-RC $version ($launcher + '\src\version.rc2')
Write-Verbose "Building the launcher..."
# Referene: https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
msbuild CmderLauncher.vcxproj /t:Clean,Build /p:configuration=Release /m
if ($LastExitCode -ne 0) {
throw "MSBuild failed to build the launcher executable."
}
else {
Write-Verbose "Successfully built Cmder v$version!"
if ( $Env:APPVEYOR -eq 'True' ) {
Add-AppveyorMessage -Message "Building Cmder v$version was successful." -Category Information
}
if ( $Env:GITHUB_ACTIONS -eq 'true' ) {
Write-Output "::notice title=Build Complete::Building Cmder v$version was successful."
}
}
Pop-Location
} else {
Write-Warning "You are not building a launcher, Use -Compile"
Write-Warning "This cannot be a release. Test build only!"
}
# Put vendor\cmder.sh in /etc/profile.d so it runs when we start bash or mintty
if ( (Test-Path $($saveTo + "git-for-windows/etc/profile.d") ) ) {
Write-Verbose "Adding cmder.sh /etc/profile.d"
@ -163,4 +157,23 @@ if ( !(Test-Path $($saveTo + "git-for-windows/etc/profile.d/git-prompt.sh.bak")
Copy-Item $($saveTo + "git-prompt.sh") $($saveTo + "git-for-windows/etc/profile.d/git-prompt.sh")
}
Pop-Location
}
if (-Not $Compile -Or $noVendor) {
Write-Warning "You are not building the full project, Use -Compile without -noVendor"
Write-Warning "This cannot be a release. Test build only!"
return
}
Write-Verbose "Successfully built Cmder v$version!"
if ( $Env:APPVEYOR -eq 'True' ) {
Add-AppveyorMessage -Message "Building Cmder v$version was successful." -Category Information
}
if ( $Env:GITHUB_ACTIONS -eq 'true' ) {
Write-Output "::notice title=Build Complete::Building Cmder v$version was successful."
}
Write-Host -ForegroundColor green "All good and done!"