|
|
|
@ -109,12 +109,19 @@ namespace eval punk::mix::cli {
|
|
|
|
|
} else { |
|
|
|
|
puts stderr "warning: Missing $projectdir/src/README.md" |
|
|
|
|
} |
|
|
|
|
#todo - tag substitutions in src/doc tree |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd $projectdir |
|
|
|
|
|
|
|
|
|
foreach m $opt_modules { |
|
|
|
|
newmodule $m -project $projectname -type $opt_type -force $opt_force |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#generate www/man/md output in 'embedded' folder which should be checked into repo for online documentation |
|
|
|
|
cd $projectdir/src |
|
|
|
|
Kettle doc |
|
|
|
|
|
|
|
|
|
cd $projectdir |
|
|
|
|
if {![file exists $projectdir/_FOSSIL_]} { |
|
|
|
|
set first_fossil 1 |
|
|
|
@ -246,7 +253,7 @@ namespace eval punk::mix::cli {
|
|
|
|
|
set sourcefolder $startdir |
|
|
|
|
} |
|
|
|
|
if {([file tail $sourcefolder] ne "src") || (![file exists $sourcefolder/make.tcl])} { |
|
|
|
|
puts stderr "mix make must be run from src folder containing make.tcl - unable to proceed" |
|
|
|
|
puts stderr "mix make must be run from src folder containing make.tcl - unable to proceed (cwd: [pwd])" |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
#use run so that stdout visible as it goes |
|
|
|
@ -261,11 +268,137 @@ namespace eval punk::mix::cli {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc Kettle {args} { |
|
|
|
|
tailcall kettle_call lib {*}$args |
|
|
|
|
} |
|
|
|
|
proc KettleShell {args} { |
|
|
|
|
tailcall kettle_call shell {*}$args |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc kettle_call {calltype args} { |
|
|
|
|
if {$calltype ni [list lib shell]} { |
|
|
|
|
error "pmix kettle_call 1st argument must be one of: 'lib' for direct use of kettle module or 'shell' to call as separate process" |
|
|
|
|
} |
|
|
|
|
if {$calltype eq "shell"} { |
|
|
|
|
set kettleappfile [file dirname [info nameofexecutable]]/kettle |
|
|
|
|
set kettlebatfile [file dirname [info nameofexecutable]]/kettle.bat |
|
|
|
|
|
|
|
|
|
if {(![file exists $kettleappfile]) && (![file exists $kettlebatfile])} { |
|
|
|
|
error "pmix kettle_call unable to find installed kettle application file '$kettleappfile' (or '$kettlebatfile' if on windows)" |
|
|
|
|
} |
|
|
|
|
if {[file exists $kettleappfile]} { |
|
|
|
|
set kettlescript $kettleappfile |
|
|
|
|
} |
|
|
|
|
if {$::tcl_platform(platform) eq "windows"} { |
|
|
|
|
if {[file exists $kettlebatfile]} { |
|
|
|
|
set kettlescript $kettlebatfile |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
set startdir [pwd] |
|
|
|
|
if {![file exists $startdir/build.tcl]} { |
|
|
|
|
error "pmix kettle must be run from a folder containing build.tcl (cwd: [pwd])" |
|
|
|
|
} |
|
|
|
|
if {[catch {package present kettle}]} { |
|
|
|
|
puts stdout "Loading kettle package - may be delay on first load ..." |
|
|
|
|
package require kettle |
|
|
|
|
} |
|
|
|
|
set first [lindex $args 0] |
|
|
|
|
if {[string match @* $first]} { |
|
|
|
|
error "pmix kettle doesn't support special operations - try calling tclsh kettle directly" |
|
|
|
|
} |
|
|
|
|
if {$first eq "-f"} { |
|
|
|
|
set args [lassign $args __ path] |
|
|
|
|
} else { |
|
|
|
|
set path $startdir/build.tcl |
|
|
|
|
} |
|
|
|
|
set opts [list] |
|
|
|
|
|
|
|
|
|
if {[lindex $args 0] eq "-trace"} { |
|
|
|
|
set args [lrange $args 1 end] |
|
|
|
|
lappend opts --verbose on |
|
|
|
|
} |
|
|
|
|
set goals [list] |
|
|
|
|
|
|
|
|
|
if {$calltype eq "lib"} { |
|
|
|
|
file mkdir ~/.kettle |
|
|
|
|
set dotfile ~/.kettle/config |
|
|
|
|
if {[file exists $dotfile] && |
|
|
|
|
[file isfile $dotfile] && |
|
|
|
|
[file readable $dotfile]} { |
|
|
|
|
::kettle io trace {Loading dotfile $dotfile ...} |
|
|
|
|
set args [list {*}[::kettle path cat $dotfile] {*}$args] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#hardcoded kettle option names (::kettle option names) - retrieved using kettle::option names |
|
|
|
|
#This is done so we don't have to load kettle lib for shell call (both loading as module and running shell are annoyingly SLOW) |
|
|
|
|
#REVIEW - needs to be updated to keep in sync with kettle. |
|
|
|
|
set knownopts [list\ |
|
|
|
|
--exec-prefix --bin-dir --lib-dir --prefix --man-dir --html-dir --markdown-dir --include-dir \ |
|
|
|
|
--ignore-glob --dry --verbose --machine --color --state --config --with-shell --log \ |
|
|
|
|
--log-append --log-mode --with-dia --constraints --file --limitconstraints --tmatch --notfile --single --valgrind --tskip --repeats \ |
|
|
|
|
--iters --collate --match --rmatch --with-doc-destination --with-git --target --test-include \ |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
while {[llength $args]} { |
|
|
|
|
set o [lindex $args 0] |
|
|
|
|
switch -glob -- $o { |
|
|
|
|
--* { |
|
|
|
|
#instead of using: kettle option known |
|
|
|
|
if {$o ni $knownopts} { |
|
|
|
|
error "Unable to process unknown option $o." {} [list KETTLE (pmix)] |
|
|
|
|
} |
|
|
|
|
lappend opts $o [lindex $args 1] |
|
|
|
|
#::kettle::option set $o [lindex $args 1] |
|
|
|
|
set args [lrange $args 2 end] |
|
|
|
|
} |
|
|
|
|
default { |
|
|
|
|
lappend goals $o |
|
|
|
|
set args [lrange $args 1 end] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if {![llength $goals]} { |
|
|
|
|
lappend goals help |
|
|
|
|
} |
|
|
|
|
if {"--prefix" ni [dict keys $opts]} { |
|
|
|
|
dict set opts --prefix [file dirname $startdir] |
|
|
|
|
} |
|
|
|
|
if {$calltype eq "lib"} { |
|
|
|
|
::kettle status clear |
|
|
|
|
::kettle::option::set @kettle $startdir |
|
|
|
|
foreach {o v} $opts { |
|
|
|
|
::kettle option set $o $v |
|
|
|
|
} |
|
|
|
|
::kettle option set @srcscript $path |
|
|
|
|
::kettle option set @srcdir [file dirname $path] |
|
|
|
|
::kettle option set @goals $goals |
|
|
|
|
::source $path |
|
|
|
|
puts stderr "recipes: [::kettle recipe names]" |
|
|
|
|
::kettle recipe run {*}[::kettle option get @goals] |
|
|
|
|
|
|
|
|
|
set state [::kettle option get --state] |
|
|
|
|
if {$state ne {}} { |
|
|
|
|
puts stderr "saving kettle state: $state" |
|
|
|
|
::kettle status save $state |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
#shell |
|
|
|
|
puts stdout "Running external kettle process with args: $opts $goals" |
|
|
|
|
run -n tclsh $kettlescript -f $path {*}$opts {*}$goals |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc libexample {} { |
|
|
|
|
set result [lib::libfunc1 test] |
|
|
|
|
return $result |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#proc libexample {} { |
|
|
|
|
# set result [lib::libfunc1 test] |
|
|
|
|
# return $result |
|
|
|
|
#} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace eval lib { |
|
|
|
|
proc libfunc1 {args} { |
|
|
|
|
return libfunc1-$args |
|
|
|
|