|
|
|
@ -290,37 +290,21 @@ if {[file exists $sourcefolder/vendorlib]} {
|
|
|
|
|
README.md\ |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
puts stdout "VENDORLIB: copying from $sourcefolder/vendorlib to $projectroot/lib (if source file changed)" |
|
|
|
|
set resultdict [punkcheck::install $sourcefolder/vendorlib $projectroot/lib -overwrite installedsourcechanged-targets -unpublish_paths $unpublish] |
|
|
|
|
set copied [dict get $resultdict files_copied] |
|
|
|
|
set sources_unchanged [dict get $resultdict sources_unchanged] |
|
|
|
|
puts stdout "--------------------------" |
|
|
|
|
flush stdout |
|
|
|
|
puts stderr "Copied [llength $copied] vendor lib files from src/vendorlib to $projectroot/lib" |
|
|
|
|
foreach f $copied { |
|
|
|
|
puts stdout "COPIED $f" |
|
|
|
|
} |
|
|
|
|
puts stdout "[llength $sources_unchanged] unchanged source files" |
|
|
|
|
puts stdout "--------------------------" |
|
|
|
|
puts stdout [punkcheck::summarize_install_resultdict $resultdict] |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
puts stderr "NOTE: No src/vendorlib folder found." |
|
|
|
|
puts stderr "VENDORLIB: No src/vendorlib folder found." |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if {[file exists $sourcefolder/vendormodules]} { |
|
|
|
|
#install .tm *and other files* |
|
|
|
|
puts stdout "VENDORMODULES: copying from $sourcefolder/vendormodules to $target_modules_base (if source file changed)" |
|
|
|
|
set resultdict [punkcheck::install $sourcefolder/vendormodules $target_modules_base -installer make.tcl -overwrite installedsourcechanged-targets -unpublish_paths {README.md}] |
|
|
|
|
set copied [dict get $resultdict files_copied] |
|
|
|
|
set sources_unchanged [dict get $resultdict sources_unchanged] |
|
|
|
|
puts stdout "--------------------------" |
|
|
|
|
flush stdout |
|
|
|
|
puts stderr "Copied [llength $copied] vendor module files from src/vendormodules to $target_modules_base" |
|
|
|
|
foreach f $copied { |
|
|
|
|
puts stdout "COPIED $f" |
|
|
|
|
} |
|
|
|
|
puts stdout "[llength $sources_unchanged] unchanged source files" |
|
|
|
|
puts stdout "--------------------------" |
|
|
|
|
puts stdout [punkcheck::summarize_install_resultdict $resultdict] |
|
|
|
|
} else { |
|
|
|
|
puts stderr "NOTE: No src/vendormodules folder found." |
|
|
|
|
puts stderr "VENDORMODULES: No src/vendormodules folder found." |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
######################################################## |
|
|
|
@ -354,6 +338,7 @@ foreach layoutinfo $layout_update_list {
|
|
|
|
|
|
|
|
|
|
foreach filepair $pairs { |
|
|
|
|
lassign $filepair srcfile tgtfile |
|
|
|
|
file mkdir [file dirname $tgtfile] |
|
|
|
|
#---------- |
|
|
|
|
$tpl_event targetset_init INSTALL $tgtfile |
|
|
|
|
$tpl_event targetset_addsource $srcfile |
|
|
|
@ -386,8 +371,6 @@ foreach layoutinfo $layout_update_list {
|
|
|
|
|
######################################################## |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#default source module folder is at projectroot/src/modules |
|
|
|
|
#There may be multiple other src module folders at same level (e.g folder not being other special-purpose folder and not matching name vendor* that contains at least one .tm file in its root) |
|
|
|
|
set source_module_folderlist [punk::mix::cli::lib::find_source_module_paths $projectroot] |
|
|
|
@ -403,19 +386,54 @@ foreach src_module_dir $source_module_folderlist {
|
|
|
|
|
|
|
|
|
|
set overwrite "installedsourcechanged-targets" |
|
|
|
|
#set overwrite "ALL-TARGETS" |
|
|
|
|
puts stdout "MODULEFOLDER non_tm_files $src_module_dir - copying to $target_modules_base (if source file changed)" |
|
|
|
|
set resultdict [punkcheck::install_non_tm_files $src_module_dir $target_modules_base -installer make.tcl -overwrite $overwrite -unpublish_paths {README.md}] |
|
|
|
|
set copied [dict get $resultdict files_copied] |
|
|
|
|
set sources_unchanged [dict get $resultdict sources_unchanged] |
|
|
|
|
puts stdout "--------------------------" |
|
|
|
|
flush stdout |
|
|
|
|
puts stderr "Copied [llength $copied] non-tm source files from $src_module_dir to $target_modules_base" |
|
|
|
|
puts stderr "[llength $sources_unchanged] unchanged source files" |
|
|
|
|
flush stderr |
|
|
|
|
puts stdout "--------------------------" |
|
|
|
|
puts stdout [punkcheck::summarize_install_resultdict $resultdict] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
set installername "make.tcl" |
|
|
|
|
|
|
|
|
|
# ---------------------------------------- |
|
|
|
|
if {[punk::repo::is_fossil_root $projectroot]} { |
|
|
|
|
set config [dict create\ |
|
|
|
|
-make-step configure_fossil\ |
|
|
|
|
] |
|
|
|
|
#---------- |
|
|
|
|
set installer [punkcheck::installtrack new $installername $projectroot/.punkcheck] |
|
|
|
|
$installer set_source_target $projectroot $projectroot |
|
|
|
|
|
|
|
|
|
set event [$installer start_event $config] |
|
|
|
|
$event targetset_init VIRTUAL fossil_settings_mainmenu ;#VIRTUAL - since there is no actual target file |
|
|
|
|
set menufile $projectroot/.fossil-custom/mainmenu |
|
|
|
|
$event targetset_addsource $menufile |
|
|
|
|
#---------- |
|
|
|
|
|
|
|
|
|
if {\ |
|
|
|
|
[llength [dict get [$event targetset_source_changes] changed]]\ |
|
|
|
|
} { |
|
|
|
|
$event targetset_started |
|
|
|
|
# -- --- --- --- --- --- |
|
|
|
|
puts stdout "Configuring fossil setting: mainmenu from: $menufile" |
|
|
|
|
if {[catch { |
|
|
|
|
set fd [open $menufile r] |
|
|
|
|
fconfigure $fd -translation binary |
|
|
|
|
set data [read $fd] |
|
|
|
|
close $fd |
|
|
|
|
exec fossil settings mainmenu $data |
|
|
|
|
} errM]} { |
|
|
|
|
$event targetset_end FAILED -note "fossil update failed: $errM" |
|
|
|
|
} else { |
|
|
|
|
$event targetset_end OK |
|
|
|
|
} |
|
|
|
|
# -- --- --- --- --- --- |
|
|
|
|
} else { |
|
|
|
|
puts stderr "." |
|
|
|
|
$event targetset_end SKIPPED |
|
|
|
|
} |
|
|
|
|
$event end |
|
|
|
|
$event destroy |
|
|
|
|
$installer destroy |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
set buildfolder [punk::mix::cli::lib::get_build_workdir $sourcefolder] |
|
|
|
|
if {$buildfolder ne "$sourcefolder/_build"} { |
|
|
|
@ -430,7 +448,8 @@ set rtfolder $sourcefolder/runtime
|
|
|
|
|
set runtimes [glob -nocomplain -dir $rtfolder -types {f x} -tail *] |
|
|
|
|
if {![llength $runtimes]} { |
|
|
|
|
puts stderr "No executable runtimes found in $rtfolder - unable to build any .vfs folders into executables." |
|
|
|
|
exit 2 |
|
|
|
|
puts stderr "Add runtimes to $sourcefolder/runtime if required" |
|
|
|
|
exit 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if {[catch {exec sdx help} errM]} { |
|
|
|
@ -465,6 +484,7 @@ if {[file exists $mapfile]} {
|
|
|
|
|
#drop windows .exe suffix so same config can work cross platform - extension will be re-added if necessary later |
|
|
|
|
set runtime [string range $runtime 0 end-4] |
|
|
|
|
} |
|
|
|
|
if {$runtime ne "-"} { |
|
|
|
|
set runtime_test $runtime |
|
|
|
|
if {"windows" eq $::tcl_platform(platform)} { |
|
|
|
|
set runtime_test $runtime.exe |
|
|
|
@ -473,6 +493,7 @@ if {[file exists $mapfile]} {
|
|
|
|
|
puts stderr "WARNING: Missing runtime file $rtfolder/$runtime_test (line in mapvfs.config: $ln)" |
|
|
|
|
lappend missing $runtime |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
foreach vfs $vfspaths { |
|
|
|
|
if {![file isdirectory [file join $sourcefolder $vfs]]} { |
|
|
|
|
puts stderr "WARNNING: Missing vfs folder [file join $sourcefolder $vfs] specified in mapvfs.config for runtime $runtime" |
|
|
|
@ -511,7 +532,6 @@ if {![llength $vfs_folders]} {
|
|
|
|
|
|
|
|
|
|
set vfs_folder_changes [dict create] ;#cache whether each .vfs folder has changes so we don't re-run tests if building from same .vfs with multiple runtime executables |
|
|
|
|
|
|
|
|
|
set installername "make.tcl" |
|
|
|
|
# -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- |
|
|
|
|
#set runtimefile [lindex $runtimes 0] |
|
|
|
|
foreach runtimefile $runtimes { |
|
|
|
@ -593,7 +613,7 @@ foreach vfs $vfs_folders {
|
|
|
|
|
set runtimes_raw $runtimes |
|
|
|
|
set runtimes [list] |
|
|
|
|
foreach rt $runtimes_raw { |
|
|
|
|
if {![string match *.exe $rt]} { |
|
|
|
|
if {![string match *.exe $rt] && $rt ne "-"} { |
|
|
|
|
set rt $rt.exe |
|
|
|
|
} |
|
|
|
|
lappend runtimes $rt |
|
|
|
@ -615,27 +635,36 @@ foreach vfs $vfs_folders {
|
|
|
|
|
#assert $runtimes is a list of executable names suffixed with .exe if on windows - whether or not specified with .exe in the mapvfs.config |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#todo - non kit based - zipkit? |
|
|
|
|
# $runtimes may now include a dash entry "-" (from mapvfs.config file) |
|
|
|
|
foreach rtname $runtimes { |
|
|
|
|
#rtname of "-" indicates build a kit without a runtime |
|
|
|
|
|
|
|
|
|
#first configured runtime will be the one to use the same name as .vfs folder for output executable. Additional runtimes on this .vfs will need to suffix the runtime name to disambiguate. |
|
|
|
|
#review: This mechanism may not be great for multiplatform builds ? We may be better off consistently combining vfsname and rtname and letting a later platform-specific step choose ones to install in bin with simpler names. |
|
|
|
|
if {$rtname eq "-"} { |
|
|
|
|
set targetkit $vfsname.kit |
|
|
|
|
} else { |
|
|
|
|
if {$::tcl_platform(platform) eq "windows"} { |
|
|
|
|
set targetexe ${vfsname}.exe |
|
|
|
|
set targetkit ${vfsname}.exe |
|
|
|
|
} else { |
|
|
|
|
set targetexe $vfsname |
|
|
|
|
set targetkit $vfsname |
|
|
|
|
} |
|
|
|
|
if {$targetexe in $exe_names_seen} { |
|
|
|
|
if {$targetkit in $exe_names_seen} { |
|
|
|
|
#more than one runtime for this .vfs |
|
|
|
|
set targetexe ${vfsname}_$rtname |
|
|
|
|
set targetkit ${vfsname}_$rtname |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
lappend exe_names_seen $targetexe |
|
|
|
|
lappend exe_names_seen $targetkit |
|
|
|
|
# -- ---------- |
|
|
|
|
set vfs_installer [punkcheck::installtrack new $installername $basedir/.punkcheck] |
|
|
|
|
$vfs_installer set_source_target $sourcefolder $buildfolder |
|
|
|
|
set vfs_event [$vfs_installer start_event {-make-step build_vfs}] |
|
|
|
|
$vfs_event targetset_init INSTALL $buildfolder/$targetexe |
|
|
|
|
$vfs_event targetset_init INSTALL $buildfolder/$targetkit |
|
|
|
|
$vfs_event targetset_addsource $sourcefolder/$vfs |
|
|
|
|
if {$rtname ne "-"} { |
|
|
|
|
$vfs_event targetset_addsource $buildfolder/build_$rtname |
|
|
|
|
} |
|
|
|
|
# -- ---------- |
|
|
|
|
|
|
|
|
|
set changed_unchanged [$vfs_event targetset_source_changes] |
|
|
|
@ -655,9 +684,17 @@ foreach vfs $vfs_folders {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if {[catch { |
|
|
|
|
if {$rtname ne "-"} { |
|
|
|
|
exec sdx wrap $buildfolder/$vfsname.new -vfs $sourcefolder/$vfs -runtime $buildfolder/build_$rtname -verbose |
|
|
|
|
} else { |
|
|
|
|
exec sdx wrap $buildfolder/$vfsname.new -vfs $sourcefolder/$vfs -verbose |
|
|
|
|
} |
|
|
|
|
} result]} { |
|
|
|
|
if {$rtname ne "-"} { |
|
|
|
|
puts stderr "sdx wrap $buildfolder/$vfsname.new -vfs $sourcefolder/$vfs -runtime $buildfolder/build_$rtname -verbose failed with msg: $result" |
|
|
|
|
} else { |
|
|
|
|
puts stderr "sdx wrap $buildfolder/$vfsname.new -vfs $sourcefolder/$vfs -verbose failed with msg: $result" |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
puts stdout "ok - finished sdx" |
|
|
|
|
set separator [string repeat = 40] |
|
|
|
@ -679,6 +716,8 @@ foreach vfs $vfs_folders {
|
|
|
|
|
set pscmd "ps" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#killing process doesn't apply to .kit build |
|
|
|
|
if {$rtname ne "-"} { |
|
|
|
|
if {![catch { |
|
|
|
|
exec $pscmd | grep $vfsname |
|
|
|
|
} still_running]} { |
|
|
|
@ -724,19 +763,20 @@ foreach vfs $vfs_folders {
|
|
|
|
|
} else { |
|
|
|
|
puts stderr "Ok.. no running '$vfsname' processes found" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if {[file exists $buildfolder/$targetexe]} { |
|
|
|
|
puts stderr "deleting existing $buildfolder/$targetexe" |
|
|
|
|
if {[file exists $buildfolder/$targetkit]} { |
|
|
|
|
puts stderr "deleting existing $buildfolder/$targetkit" |
|
|
|
|
if {[catch { |
|
|
|
|
file delete $buildfolder/$targetexe |
|
|
|
|
file delete $buildfolder/$targetkit |
|
|
|
|
} msg]} { |
|
|
|
|
puts stderr "Failed to delete $buildfolder/$targetexe" |
|
|
|
|
puts stderr "Failed to delete $buildfolder/$targetkit" |
|
|
|
|
exit 4 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#WINDOWS filesystem 'tunneling' (file replacement within 15secs) could cause targetexe to copy ctime & shortname metadata from previous file! |
|
|
|
|
#WINDOWS filesystem 'tunneling' (file replacement within 15secs) could cause targetkit to copy ctime & shortname metadata from previous file! |
|
|
|
|
#This is probably harmless - but worth being aware of. |
|
|
|
|
file rename $buildfolder/$vfsname.new $buildfolder/$targetexe |
|
|
|
|
file rename $buildfolder/$vfsname.new $buildfolder/$targetkit |
|
|
|
|
# -- --- --- --- --- --- |
|
|
|
|
$vfs_event targetset_end OK |
|
|
|
|
|
|
|
|
@ -748,36 +788,36 @@ foreach vfs $vfs_folders {
|
|
|
|
|
# -- ---------- |
|
|
|
|
set bin_installer [punkcheck::installtrack new "make.tcl" $deployment_folder/.punkcheck] |
|
|
|
|
$bin_installer set_source_target $buildfolder $deployment_folder |
|
|
|
|
set bin_event [$bin_installer start_event {-make-step final_exe_install}] |
|
|
|
|
$bin_event targetset_init INSTALL $deployment_folder/$targetexe |
|
|
|
|
$bin_event targetset_addsource $buildfolder/$targetexe |
|
|
|
|
set bin_event [$bin_installer start_event {-make-step final_kit_install}] |
|
|
|
|
$bin_event targetset_init INSTALL $deployment_folder/$targetkit |
|
|
|
|
$bin_event targetset_addsource $buildfolder/$targetkit |
|
|
|
|
$bin_event targetset_started |
|
|
|
|
# -- ---------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set delete_failed 0 |
|
|
|
|
if {[file exists $deployment_folder/$targetexe]} { |
|
|
|
|
puts stderr "deleting existing deployed at $deployment_folder/$targetexe" |
|
|
|
|
if {[file exists $deployment_folder/$targetkit]} { |
|
|
|
|
puts stderr "deleting existing deployed at $deployment_folder/$targetkit" |
|
|
|
|
if {[catch { |
|
|
|
|
file delete $deployment_folder/$targetexe |
|
|
|
|
file delete $deployment_folder/$targetkit |
|
|
|
|
} errMsg]} { |
|
|
|
|
puts stderr "deletion of deployed version at $deployment_folder/$targetexe failed: $errMsg" |
|
|
|
|
puts stderr "deletion of deployed version at $deployment_folder/$targetkit failed: $errMsg" |
|
|
|
|
#exit 5 |
|
|
|
|
set delete_failed 1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if {!$delete_failed} { |
|
|
|
|
puts stdout "copying.." |
|
|
|
|
puts stdout "$buildfolder/$targetexe" |
|
|
|
|
puts stdout "$buildfolder/$targetkit" |
|
|
|
|
puts stdout "to:" |
|
|
|
|
puts stdout "$deployment_folder/$targetexe" |
|
|
|
|
puts stdout "$deployment_folder/$targetkit" |
|
|
|
|
after 300 |
|
|
|
|
file copy $buildfolder/$targetexe $deployment_folder/$targetexe |
|
|
|
|
file copy $buildfolder/$targetkit $deployment_folder/$targetkit |
|
|
|
|
# -- ---------- |
|
|
|
|
$bin_event targetset_end OK |
|
|
|
|
# -- ---------- |
|
|
|
|
} else { |
|
|
|
|
$bin_event targetset_end FAILED -note "could not delete |
|
|
|
|
$bin_event targetset_end FAILED -note "could not delete" |
|
|
|
|
} |
|
|
|
|
$bin_event destroy |
|
|
|
|
$bin_installer destroy |
|
|
|
@ -785,7 +825,7 @@ foreach vfs $vfs_folders {
|
|
|
|
|
} else { |
|
|
|
|
set skipped_vfs_build 1 |
|
|
|
|
puts stderr "." |
|
|
|
|
puts stdout "Skipping build for vfs $vfs - no change detected" |
|
|
|
|
puts stdout "Skipping build for vfs $vfs with runtime $rtname - no change detected" |
|
|
|
|
$vfs_event targetset_end SKIPPED |
|
|
|
|
} |
|
|
|
|
$vfs_event destroy |
|
|
|
|