mirror of
https://github.com/Ed94/HandmadeHero.git
synced 2025-07-01 19:31:03 -07:00
Some minor cleanup to the build scripts
This commit is contained in:
73
scripts/helpers/incremental_checks.ps1
Normal file
73
scripts/helpers/incremental_checks.ps1
Normal file
@ -0,0 +1,73 @@
|
||||
# This is meant to be used with build.ps1, and is not a standalone script.
|
||||
|
||||
function check-FileForChanges
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$path_file
|
||||
)
|
||||
|
||||
if (-not (Test-Path $path_file -PathType Leaf)) {
|
||||
Write-Error "The provided path is not a valid file: $path_file"
|
||||
return $false
|
||||
}
|
||||
$file_name = Split-Path $path_file -Leaf
|
||||
$path_csv = Join-Path $path_build ($file_name + "_file_hash.csv")
|
||||
|
||||
$csv_file_hash = $null
|
||||
if (Test-Path $path_csv) {
|
||||
$csv_file_hash = Import-Csv $path_csv | Select-Object -ExpandProperty value
|
||||
}
|
||||
|
||||
$current_hash_info = Get-FileHash -Path $path_file -Algorithm MD5
|
||||
$current_file_hash = $current_hash_info.Hash
|
||||
|
||||
# Save the current hash to the CSV
|
||||
[PSCustomObject]@{
|
||||
name = $path_file
|
||||
value = $current_file_hash
|
||||
} | Export-Csv $path_csv -NoTypeInformation
|
||||
|
||||
if ($csv_file_hash -and $csv_file_hash -eq $current_file_hash) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
# Check to see if the module has changed files since the last build
|
||||
function check-ModuleForChanges
|
||||
{
|
||||
param( [string]$path_module, [array]$excludes )
|
||||
|
||||
$module_name = split-path $path_module -leaf
|
||||
$path_csv = Join-Path $path_build ($module_name + "_module_hashes.csv")
|
||||
|
||||
$csv_file_hashes = $null
|
||||
if ( test-path $path_csv ) {
|
||||
$csv_file_hashes = @{}
|
||||
import-csv $path_csv | foreach-object {
|
||||
$csv_file_hashes[ $_.name ] = $_.value
|
||||
}
|
||||
}
|
||||
|
||||
$file_hashes = @{}
|
||||
get-childitem -path $path_module -recurse -file -Exclude $excludes | foreach-object {
|
||||
$id = $_.fullname
|
||||
$hash_info = get-filehash -path $id -Algorithm MD5
|
||||
$file_hashes[ $id ] = $hash_info.Hash
|
||||
}
|
||||
|
||||
$file_hashes.GetEnumerator() | foreach-object { [PSCustomObject]$_ } |
|
||||
export-csv $path_csv -NoTypeInformation
|
||||
|
||||
if ( -not $csv_file_hashes ) { return $true }
|
||||
if ( $csv_file_hashes.Count -ne $file_hashes.Count ) { return $true }
|
||||
|
||||
foreach ( $key in $csv_file_hashes.Keys ) {
|
||||
if ( $csv_file_hashes[ $key ] -ne $file_hashes[ $key ] ) {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
return $false
|
||||
}
|
@ -176,7 +176,6 @@ if ( $vendor -match "clang" )
|
||||
$pdb = $binary -replace '\.(exe|dll)$', "_$(get-random).pdb"
|
||||
|
||||
$compiler_args += @(
|
||||
( $flag_define + 'INTELLISENSE_DIRECTIVES=0' ),
|
||||
$flag_no_color_diagnostics,
|
||||
$flag_exceptions_disabled,
|
||||
$flag_target_arch, $target_arch,
|
||||
@ -230,12 +229,6 @@ if ( $vendor -match "clang" )
|
||||
|
||||
$linker_args += $object
|
||||
return run-linker $linker $binary $linker_args
|
||||
|
||||
# $compiler_args += $unit
|
||||
# $linker_args | ForEach-Object {
|
||||
# $compiler_args += $flag_linker + $_
|
||||
# }
|
||||
# run-compiler $compiler $unit $compiler_args
|
||||
}
|
||||
|
||||
$compiler = 'clang++'
|
||||
@ -305,7 +298,6 @@ if ( $vendor -match "msvc" )
|
||||
|
||||
$compiler_args += @(
|
||||
$flag_nologo,
|
||||
( $flag_define + 'INTELLISENSE_DIRECTIVES=0'),
|
||||
# $flag_all_cpp,
|
||||
$flag_exceptions_disabled,
|
||||
( $flag_define + '_HAS_EXCEPTIONS=0' ),
|
||||
@ -364,11 +356,6 @@ if ( $vendor -match "msvc" )
|
||||
|
||||
$linker_args += $object
|
||||
return run-linker $linker $binary $linker_args
|
||||
|
||||
# $compiler_args += $unit
|
||||
# $compiler_args += $flag_linker
|
||||
# $compiler_args += $linker_args
|
||||
# run-compiler $compiler $unit $compiler_args
|
||||
}
|
||||
|
||||
$compiler = 'cl'
|
Reference in New Issue
Block a user