Browse Source

make.tcl beginnings of refactor for punk::args support

master
Julian Noble 2 weeks ago
parent
commit
e801304b12
  1. 110
      src/make.tcl

110
src/make.tcl

@ -283,7 +283,7 @@ namespace eval ::punkboot::lib {
} }
if {"::try" ni [info commands ::try]} { if {"::try" ni [info commands ::try]} {
puts stderr "Tcl interpreter possibly too old - 'try' command not found - aborting" puts stderr "Tcl interpreter possibly too old - need at least tcl 8.6 - 'try' command not found - aborting"
exit 1 exit 1
} }
@ -296,8 +296,7 @@ if {"::try" ni [info commands ::try]} {
# and load these in preference to ones that may have been in the interp's tcl::tm::list or auto_path due to environment variables # and load these in preference to ones that may have been in the interp's tcl::tm::list or auto_path due to environment variables
set startdir [pwd] set startdir [pwd]
set scriptdir [file dirname [file normalize [info script]]] #puts "SCRIPTFOLDER: $::punkboot::scriptfolder"
#puts "SCRIPTDIR: $scriptdir"
#we are focussed on pure-tcl libs/modules in bootsupport for now. #we are focussed on pure-tcl libs/modules in bootsupport for now.
#There may be cases where we want to use compiled packages from src/bootsupport/modules_tcl9 etc #There may be cases where we want to use compiled packages from src/bootsupport/modules_tcl9 etc
@ -313,8 +312,8 @@ set bootsupport_library_paths [list]
set this_platform_generic [punkboot::lib::platform_generic] set this_platform_generic [punkboot::lib::platform_generic]
#we always create these lists in order of desired precedence. #we always create these lists in order of desired precedence.
# - this is the same order when adding to auto_path - but will need to be reversed when using tcl:tm::add # - this is the same order when adding to auto_path - but will need to be reversed when using tcl:tm::add
if {[file exists [file join $scriptdir bootsupport]]} { if {[file exists [file join $::punkboot::scriptfolder bootsupport]]} {
set bootsupportdir [file join $scriptdir bootsupport] set bootsupportdir [file join $::punkboot::scriptfolder bootsupport]
puts stderr "Using bootsupport dir $bootsupportdir" puts stderr "Using bootsupport dir $bootsupportdir"
lappend bootsupport_module_paths [file join $bootsupportdir modules_tcl$::tclmajorv] ;#more version-specific modules slightly higher in precedence order lappend bootsupport_module_paths [file join $bootsupportdir modules_tcl$::tclmajorv] ;#more version-specific modules slightly higher in precedence order
@ -323,7 +322,7 @@ if {[file exists [file join $scriptdir bootsupport]]} {
lappend bootsupport_library_paths [file join $bootsupportdir lib_tcl$::tclmajorv/$this_platform_generic] ;#more version-specific pkgs slightly higher in precedence order lappend bootsupport_library_paths [file join $bootsupportdir lib_tcl$::tclmajorv/$this_platform_generic] ;#more version-specific pkgs slightly higher in precedence order
lappend bootsupport_library_paths [file join $bootsupportdir lib] lappend bootsupport_library_paths [file join $bootsupportdir lib]
} else { } else {
puts stderr "No bootsupport dir for script [info script] at [file join $scriptdir bootsupport]" puts stderr "No bootsupport dir for script [info script] at [file join $::punkboot::scriptfolder bootsupport]"
#lappend bootsupport_module_paths [file join $startdir bootsupport modules_tcl$::tclmajorv] #lappend bootsupport_module_paths [file join $startdir bootsupport modules_tcl$::tclmajorv]
#lappend bootsupport_module_paths [file join $startdir bootsupport modules] #lappend bootsupport_module_paths [file join $startdir bootsupport modules]
#lappend bootsupport_library_paths [file join $startdir bootsupport lib_tcl$::tclmajorv/allplatforms] #lappend bootsupport_library_paths [file join $startdir bootsupport lib_tcl$::tclmajorv/allplatforms]
@ -1306,38 +1305,70 @@ proc ::punkboot::punkboot_gethelp {args} {
} }
#todo? process and remove first arg dev os internal (and combinations such as dev-os etc)
##############################################################################################################
##############################################################################################################
##############################################################################################################
set scriptargs $::argv
namespace eval ::punkboot::app {
namespace ensemble create
proc help {args} {
puts "test help"
}
}
namespace eval ::punkboot::app::argdoc {
proc punkboot_subcommands {} {
dict set groups "package" {packages modules libs}
dict set groups "informational" {check info help}
return [punk::args::ensemble_subcommands_definition -groupdict $groups -columns 4 ::punkboot::app]
}
#punk::args::define {
# @id -id punkboot::app
# @cmd -name punkboot::app\
# -summary\
# "Project builder"\
# -help\
# ""
# @form -form help
# @leaders
# subcommand -type "literal(help)"
# @opts
# @values
# what -type string -choices {modules libs shell}
# @form -form modules
# subcommand -type "literal(modules)"
# @form -form libs
# subcommand -type "literal(libs)"
# @form -form shell
# subcommand -type "literal(shell)"
# arg -type any -optional 1 -multiple 1
#}
punk::args::define {
@dynamic
@id -id ::punkboot::app
@cmd -name ::punkboot::app\
-summary\
"Project builder"\
-help\
""
@leaders
${[punkboot::app::argdoc::punkboot_subcommands]}
}
}
namespace eval ::punkboot::app {
proc test {args} {
puts "test"
}
}
set scriptargs $::argv #set argd [punk::args::parse $scriptargs -form 0 withid ::punkboot::app]
punk::args::define {
@id -id punkmake
@cmd -name punkmake\
-summary\
"Project builder"\
-help\
""
@form -form help
@leaders
subcommand -type "literal(help)"
@opts
@values
what -type string -choices {modules libs shell}
@form -form modules
subcommand -type "literal(modules)"
@form -form libs
subcommand -type "literal(libs)"
@form -form shell
subcommand -type "literal(shell)"
arg -type any -optional 1 -multiple 1
}
#set argd [punk::args::parse $scriptargs -form 0 withid punkmake]
###lassign [dict values $argd] leaders opts values received ###lassign [dict values $argd] leaders opts values received
# #
#puts stdout [punk::args::usage -scheme nocolour punkmake] #puts stdout [punk::args::usage -scheme nocolour ::punkboot::app]
#exit 1 #exit 1
@ -1650,6 +1681,8 @@ if {$::punkboot::command eq "shell"} {
#todo - make procs vars etc from this file available? #todo - make procs vars etc from this file available?
puts stderr "punk boot shell not implemented - dropping into ordinary punk shell." puts stderr "punk boot shell not implemented - dropping into ordinary punk shell."
set ::argv [lrange $::argv 1 end]
incr ::argc -1
repl::init repl::init
set replresult [repl::start stdin -title make.tcl] set replresult [repl::start stdin -title make.tcl]
@ -1840,9 +1873,11 @@ if {$::punkboot::command eq "bootsupport"} {
} }
set bootsupport_config $projectroot/src/bootsupport/modules$which/include_modules.config ;# set bootsupport_config $projectroot/src/bootsupport/modules$which/include_modules.config ;#
set bootsupport_modules [list] ;#variable populated by include_modules.config file - initialise empty for each bm folder set bootsupport_modules [list] ;#variable populated by include_modules.config file - initialise empty for each bm folder
set bootsupport_folders [list]
if {[file exists $bootsupport_config]} { if {[file exists $bootsupport_config]} {
set targetroot $projectroot/src/bootsupport/modules$which set targetroot $projectroot/src/bootsupport/modules$which
source $bootsupport_config ;#populate $bootsupport_modules with project-specific list source $bootsupport_config ;#populate $bootsupport_modules with project-specific list
if {![llength $bootsupport_modules]} { if {![llength $bootsupport_modules]} {
puts stderr "bootsupport/modules$which - No local bootsupport modules configured for updating" puts stderr "bootsupport/modules$which - No local bootsupport modules configured for updating"
} else { } else {
@ -1932,6 +1967,11 @@ if {$::punkboot::command eq "bootsupport"} {
$boot_installer destroy $boot_installer destroy
} }
} }
if {![llength $bootsupport_folders]} {
puts stderr "bootsupport/modules$which - No local bootsupport folders configured for updating"
} else {
}
} }
} }
@ -1939,7 +1979,7 @@ if {$::punkboot::command eq "bootsupport"} {
bootsupport_localupdate $projectroot bootsupport_localupdate $projectroot
#if this project has custom project layouts, and there is a bootsupport folder - update their bootsupport #if this project has custom project layouts, and there is a bootsupport folder - update their bootsupport
set layout_bases [list\ set layout_bases [list\
$sourcefolder/project_layouts/custom/_project\ $sourcefolder/project_layouts/custom/_project\

Loading…
Cancel
Save