mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-14 07:29:12 +08:00
check requirements only for specified switches
This commit is contained in:
parent
e1caeb879a
commit
f58652fc28
@ -60,18 +60,18 @@ $cmder_root = Resolve-Path "$PSScriptRoot\.."
|
|||||||
. "$PSScriptRoot\utils.ps1"
|
. "$PSScriptRoot\utils.ps1"
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
Push-Location -Path $saveTo
|
|
||||||
$sources = Get-Content $sourcesPath | Out-String | Convertfrom-Json
|
|
||||||
|
|
||||||
# Get the version string
|
|
||||||
$version = Get-VersionStr
|
|
||||||
|
|
||||||
# Check for requirements
|
# Check for requirements
|
||||||
Ensure-Exists $sourcesPath
|
Ensure-Exists $sourcesPath
|
||||||
Ensure-Executable "7z"
|
Ensure-Executable "7z"
|
||||||
Ensure-Executable "msbuild"
|
|
||||||
|
# Get the vendor sources
|
||||||
|
$sources = Get-Content $sourcesPath | Out-String | Convertfrom-Json
|
||||||
|
|
||||||
|
Push-Location -Path $saveTo
|
||||||
New-Item -Type Directory -Path (Join-Path $saveTo "/tmp/") -ErrorAction SilentlyContinue >$null
|
New-Item -Type Directory -Path (Join-Path $saveTo "/tmp/") -ErrorAction SilentlyContinue >$null
|
||||||
|
|
||||||
|
$vend = $pwd
|
||||||
|
|
||||||
# Preserve modified (by user) ConEmu setting file
|
# Preserve modified (by user) ConEmu setting file
|
||||||
if ($config -ne "") {
|
if ($config -ne "") {
|
||||||
$ConEmuXml = Join-Path $saveTo "conemu-maximus5\ConEmu.xml"
|
$ConEmuXml = Join-Path $saveTo "conemu-maximus5\ConEmu.xml"
|
||||||
@ -83,14 +83,13 @@ if ($config -ne "") {
|
|||||||
} else { $ConEmuXml = "" }
|
} else { $ConEmuXml = "" }
|
||||||
|
|
||||||
# Kill ssh-agent.exe if it is running from the $env:cmder_root we are building
|
# 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)) {
|
foreach ($ssh_agent in $(Get-Process ssh-agent -ErrorAction SilentlyContinue)) {
|
||||||
if ([string]$($ssh_agent.path) -match [string]$cmder_root.replace('\','\\')) {
|
if ([string]$($ssh_agent.path) -Match [string]$cmder_root.replace('\','\\')) {
|
||||||
Write-Verbose $("Stopping " + $ssh_agent.path + "!")
|
Write-Verbose $("Stopping " + $ssh_agent.path + "!")
|
||||||
Stop-Process $ssh_agent.id
|
Stop-Process $ssh_agent.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$vend = $pwd
|
|
||||||
foreach ($s in $sources) {
|
foreach ($s in $sources) {
|
||||||
Write-Verbose "Getting vendored $($s.name) $($s.version)..."
|
Write-Verbose "Getting vendored $($s.name) $($s.version)..."
|
||||||
|
|
||||||
@ -105,11 +104,12 @@ foreach ($s in $sources) {
|
|||||||
if ((Get-Childitem $s.name).Count -eq 1) {
|
if ((Get-Childitem $s.name).Count -eq 1) {
|
||||||
Flatten-Directory($s.name)
|
Flatten-Directory($s.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write current version to .cmderver file, for later.
|
# Write current version to .cmderver file, for later.
|
||||||
"$($s.version)" | Out-File "$($s.name)/.cmderver"
|
"$($s.version)" | Out-File "$($s.name)/.cmderver"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restore user configuration
|
# Restore ConEmu user configuration
|
||||||
if ($ConEmuXml -ne "") {
|
if ($ConEmuXml -ne "") {
|
||||||
Write-Verbose "Restore '$ConEmuXmlSave' to '$ConEmuXml'"
|
Write-Verbose "Restore '$ConEmuXmlSave' to '$ConEmuXml'"
|
||||||
Copy-Item $ConEmuXmlSave $ConEmuXml
|
Copy-Item $ConEmuXmlSave $ConEmuXml
|
||||||
@ -118,12 +118,22 @@ if ($ConEmuXml -ne "") {
|
|||||||
Pop-Location
|
Pop-Location
|
||||||
|
|
||||||
if ($Compile) {
|
if ($Compile) {
|
||||||
|
# Check for requirements
|
||||||
|
Ensure-Executable "msbuild"
|
||||||
|
|
||||||
|
# Get the version string
|
||||||
|
$version = Get-VersionStr
|
||||||
|
|
||||||
Push-Location -Path $launcher
|
Push-Location -Path $launcher
|
||||||
Create-RC $version ($launcher + '\src\version.rc2');
|
Create-RC $version ($launcher + '\src\version.rc2')
|
||||||
# https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
|
|
||||||
|
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
|
msbuild CmderLauncher.vcxproj /t:Clean,Build /p:configuration=Release /m
|
||||||
|
|
||||||
if ($LastExitCode -ne 0) {
|
if ($LastExitCode -ne 0) {
|
||||||
throw "MSBuild failed to build the executable."
|
throw "MSBuild failed to build the launcher executable."
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Verbose "Successfully built Cmder v$version!"
|
Write-Verbose "Successfully built Cmder v$version!"
|
||||||
@ -141,16 +151,16 @@ if($Compile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Put vendor\cmder.sh in /etc/profile.d so it runs when we start bash or mintty
|
# 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") ) ) {
|
if ( (Test-Path $($saveTo + "git-for-windows/etc/profile.d") ) ) {
|
||||||
Write-Verbose "Adding cmder.sh /etc/profile.d"
|
Write-Verbose "Adding cmder.sh /etc/profile.d"
|
||||||
Copy-Item $($SaveTo + "cmder.sh") $($SaveTo + "git-for-windows/etc/profile.d/cmder.sh")
|
Copy-Item $($saveTo + "cmder.sh") $($saveTo + "git-for-windows/etc/profile.d/cmder.sh")
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace /etc/profile.d/git-prompt.sh with cmder lambda prompt so it runs when we start bash or mintty
|
# Replace /etc/profile.d/git-prompt.sh with cmder lambda prompt so it runs when we start bash or mintty
|
||||||
if ( !(Test-Path $($SaveTo + "git-for-windows/etc/profile.d/git-prompt.sh.bak") ) ) {
|
if ( !(Test-Path $($saveTo + "git-for-windows/etc/profile.d/git-prompt.sh.bak") ) ) {
|
||||||
Write-Verbose "Replacing /etc/profile.d/git-prompt.sh with our git-prompt.sh"
|
Write-Verbose "Replacing /etc/profile.d/git-prompt.sh with our git-prompt.sh"
|
||||||
Move-Item $($SaveTo + "git-for-windows/etc/profile.d/git-prompt.sh") $($SaveTo + "git-for-windows/etc/profile.d/git-prompt.sh.bak")
|
Move-Item $($saveTo + "git-for-windows/etc/profile.d/git-prompt.sh") $($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")
|
Copy-Item $($saveTo + "git-prompt.sh") $($saveTo + "git-for-windows/etc/profile.d/git-prompt.sh")
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host -ForegroundColor green "All good and done!"
|
Write-Host -ForegroundColor green "All good and done!"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
Creates default archives for cmder
|
Creates default archives for cmder
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
.\build -verbose
|
.\pack.ps1 -verbose
|
||||||
|
|
||||||
Creates default archives for cmder with plenty of information
|
Creates default archives for cmder with plenty of information
|
||||||
.NOTES
|
.NOTES
|
||||||
|
Loading…
Reference in New Issue
Block a user