Browse Source

template layouts

master
Julian Noble 12 months ago
parent
commit
f16733c0cc
  1. 1
      src/modules/punk/mix/templates/layouts/minimal/.fossil-custom/mainmenu
  2. 1
      src/modules/punk/mix/templates/layouts/minimal/.fossil-settings/crlf-glob
  3. 10
      src/modules/punk/mix/templates/layouts/minimal/.fossil-settings/ignore-glob
  4. 1
      src/modules/punk/mix/templates/layouts/minimal/.fossil-settings/manifest
  5. 1
      src/modules/punk/mix/templates/layouts/project/.fossil-custom/mainmenu
  6. 1
      src/modules/punk/mix/templates/layouts/project/.fossil-settings/crlf-glob
  7. 8
      src/modules/punk/mix/templates/layouts/project/.fossil-settings/ignore-glob
  8. 1
      src/modules/punk/mix/templates/layouts/project/.fossil-settings/manifest
  9. 3
      src/modules/punk/mix/templates/layouts/project/src/doc/include/changes.inc
  10. 25
      src/modules/punk/mix/templates/layouts/project/src/doc/include/changes_0.1.inc
  11. 18
      src/modules/punk/mix/templates/layouts/project/src/doc/include/feedback.inc
  12. 2
      src/modules/punk/mix/templates/layouts/project/src/doc/include/general.inc
  13. 3
      src/modules/punk/mix/templates/layouts/project/src/doc/include/punkshell.inc
  14. 2
      src/modules/punk/mix/templates/layouts/project/src/doc/include/welcome.inc
  15. 3
      src/modules/punk/mix/templates/layouts/project/src/doc/main.man
  16. 13
      src/modules/punk/mix/templates/layouts/project/src/doc/project_changes.man
  17. 15
      src/modules/punk/mix/templates/layouts/project/src/doc/project_intro.man
  18. 262
      src/modules/punk/mix/templates/layouts/project/src/make.tcl
  19. 102
      src/modules/punk/mix/templates/layouts/project/src/mixtemplates/modules/template_module-0.0.1.tm
  20. 12
      src/modules/punk/mix/templates/layouts/project/src/runtime/mapvfs.config
  21. 2
      src/modules/punk/mix/templates/layouts/project/src/sample.vfs/lib/app-sample/pkgIndex.tcl
  22. 16
      src/modules/punk/mix/templates/layouts/project/src/sample.vfs/lib/app-sample/sample.tcl
  23. 4
      src/modules/punk/mix/templates/layouts/project/src/sample.vfs/lib/app-sampleshell/pkgIndex.tcl
  24. 222
      src/modules/punk/mix/templates/layouts/project/src/sample.vfs/lib/app-sampleshell/repl.tcl
  25. 46
      src/modules/punk/mix/templates/layouts/project/src/sample.vfs/main.tcl

1
src/modules/punk/mix/templates/layouts/minimal/.fossil-custom/mainmenu

@ -7,6 +7,7 @@ Forum /forum {@2 3 4 5 6} wideonly
Chat /chat C wideonly
Tickets /ticket r wideonly
Wiki /wiki j wideonly
Doc /doc/tip/src/embedded/md/toc.md * {}
Download /download * {}
Admin /setup {a s} desktoponly
Logout /logout L wideonly

1
src/modules/punk/mix/templates/layouts/minimal/.fossil-settings/crlf-glob

@ -0,0 +1 @@
src/embedded/*

10
src/modules/punk/mix/templates/layouts/minimal/.fossil-settings/ignore-glob

@ -3,6 +3,8 @@ bin
lib
#The directory for compiled/built Tcl modules
modules
#The buildsuites output folder
builds
#Temporary files e.g from tests
tmp
@ -27,3 +29,11 @@ tcl*.exe
*.swp
todo.txt
zig-cache
zig-out
release
debug
build
build-*
docgen_tmp

1
src/modules/punk/mix/templates/layouts/minimal/.fossil-settings/manifest

@ -0,0 +1 @@
rut

1
src/modules/punk/mix/templates/layouts/project/.fossil-custom/mainmenu

@ -7,6 +7,7 @@ Forum /forum {@2 3 4 5 6} wideonly
Chat /chat C wideonly
Tickets /ticket r wideonly
Wiki /wiki j wideonly
Doc /doc/tip/src/embedded/md/toc.md * {}
Download /download * {}
Admin /setup {a s} desktoponly
Logout /logout L wideonly

1
src/modules/punk/mix/templates/layouts/project/.fossil-settings/crlf-glob

@ -0,0 +1 @@
src/embedded/*

8
src/modules/punk/mix/templates/layouts/project/.fossil-settings/ignore-glob

@ -29,3 +29,11 @@ tcl*.exe
*.swp
todo.txt
zig-cache
zig-out
release
debug
build
build-*
docgen_tmp

1
src/modules/punk/mix/templates/layouts/project/.fossil-settings/manifest

@ -0,0 +1 @@
rut

3
src/modules/punk/mix/templates/layouts/project/src/doc/include/changes.inc

@ -0,0 +1,3 @@
[section Changes]
[include changes_0.1.inc]

25
src/modules/punk/mix/templates/layouts/project/src/doc/include/changes_0.1.inc

@ -0,0 +1,25 @@
[subsection {Changes for version 0.1}]
[vset punkshell_project https://www.gitea1.intx.com.au/jn/punkshell]
This release 0.1 of project %project%
[para] In detail:
[list_begin enumerated]
[comment {- - -- --- ----- -------- ------------- ---------------------}]
[enum] %project% requires Tcl 8.6 or higher. Tcl 8.5 or less is not
supported.
[comment {- - -- --- ----- -------- ------------- ---------------------}]
[comment {Please consider retaining a link to PunkShell to support the project}]
[enum] This project uses [uri [vset punkshell_project] {PunkShell}] as a deployment management and documentation tool.
[comment {- - -- --- ----- -------- ------------- ---------------------}]
[para] Summary
[list_begin enumerated]
[enum] feature 1
[enum] feature 2
[list_end]
[comment {- - -- --- ----- -------- ------------- ---------------------}]
[list_end]

18
src/modules/punk/mix/templates/layouts/project/src/doc/include/feedback.inc

@ -0,0 +1,18 @@
[comment {-*- tcl -*- --- !doctools --- manpage}]
[comment {- - -- --- ----- -------- ------------- ---------------------}]
[section {Bugs, Ideas, Feedback}]
[vset project_tracker https://example.com/tracker]
[vset project_email dev@example.com]
This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such at the
[uri [vset project_tracker] {%project% tracker}].
Please also report any ideas for enhancements you may have for either
package and/or documentation.
Contact: [uri [vset project_email] [vset project_email]]

2
src/modules/punk/mix/templates/layouts/project/src/doc/include/general.inc

@ -2,5 +2,5 @@
[comment {- -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---}]
[moddesc {%project% - a Tcl project}]
[category {unspecified}]
[keywords {keyword1 keyword2}]
[keywords module %project%]
[require Tcl 8.6]

3
src/modules/punk/mix/templates/layouts/project/src/doc/include/punkshell.inc

@ -0,0 +1,3 @@
[comment {Please consider retaining a link to PunkShell to support the project}]
[vset punkshell_project https://www.gitea1.intx.com.au/jn/punkshell]
[para] This project uses [uri [vset punkshell_project] {PunkShell}] as a deployment management and documentation tool.

2
src/modules/punk/mix/templates/layouts/project/src/doc/include/welcome.inc

@ -2,5 +2,5 @@
[comment {- -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---}]
[include welcome_basic.inc]
[para] Please read the document [term {%project% - Introduction to %project%}],
[para] Please read the document [term {Introduction to %project%}],
if you have not done so already, to get an overview of the whole system.

3
src/modules/punk/mix/templates/layouts/project/src/doc/main.man

@ -9,5 +9,8 @@
This document is the reference to all commands provided by %project%
[include include/feedback.inc]
[comment {Please consider retaining a link to PunkShell to support the project}]
[include include/punkshell.inc]
[manpage_end]

13
src/modules/punk/mix/templates/layouts/project/src/doc/project_changes.man

@ -0,0 +1,13 @@
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin project_changes n 8]
[include include/general.inc]
[titledesc {%project% Changes}]
[description]
[include include/welcome_basic.inc]
[para]
This document provides an overview of the changes [package %project%]
underwent from version to version.
[include include/changes.inc]
[include include/feedback.inc]
[manpage_end]

15
src/modules/punk/mix/templates/layouts/project/src/doc/project_intro.man

@ -0,0 +1,15 @@
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin project_intro n 8]
[include include/general.inc]
[titledesc {Introduction to %project%}]
[description]
[include include/welcome_basic.inc]
[para]
Introduction to %project%
[include include/feedback.inc]
[comment {Please consider retaining a link to PunkShell to support the project}]
[include include/punkshell.inc]
[manpage_end]

262
src/modules/punk/mix/templates/layouts/project/src/make.tcl

@ -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,13 +484,15 @@ 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]
}
set runtime_test $runtime
if {"windows" eq $::tcl_platform(platform)} {
set runtime_test $runtime.exe
}
if {![file exists [file join $rtfolder $runtime_test]]} {
puts stderr "WARNING: Missing runtime file $rtfolder/$runtime_test (line in mapvfs.config: $ln)"
lappend missing $runtime
if {$runtime ne "-"} {
set runtime_test $runtime
if {"windows" eq $::tcl_platform(platform)} {
set runtime_test $runtime.exe
}
if {![file exists [file join $rtfolder $runtime_test]]} {
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]]} {
@ -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 {$::tcl_platform(platform) eq "windows"} {
set targetexe ${vfsname}.exe
if {$rtname eq "-"} {
set targetkit $vfsname.kit
} else {
set targetexe $vfsname
}
if {$targetexe in $exe_names_seen} {
#more than one runtime for this .vfs
set targetexe ${vfsname}_$rtname
if {$::tcl_platform(platform) eq "windows"} {
set targetkit ${vfsname}.exe
} else {
set targetkit $vfsname
}
if {$targetkit in $exe_names_seen} {
#more than one runtime for this .vfs
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
$vfs_event targetset_addsource $buildfolder/build_$rtname
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 {
exec sdx wrap $buildfolder/$vfsname.new -vfs $sourcefolder/$vfs -runtime $buildfolder/build_$rtname -verbose
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]} {
puts stderr "sdx wrap $buildfolder/$vfsname.new -vfs $sourcefolder/$vfs -runtime $buildfolder/build_$rtname -verbose failed with msg: $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]
@ -678,65 +715,68 @@ foreach vfs $vfs_folders {
} else {
set pscmd "ps"
}
if {![catch {
exec $pscmd | grep $vfsname
} still_running]} {
puts stdout "found $vfsname instances still running\n"
set count_killed 0
foreach ln [split $still_running \n] {
puts stdout " $ln"
if {$::tcl_platform(platform) eq "windows"} {
set pid [lindex $ln 1]
if {$forcekill} {
set killcmd [list taskkill /F /PID $pid]
#killing process doesn't apply to .kit build
if {$rtname ne "-"} {
if {![catch {
exec $pscmd | grep $vfsname
} still_running]} {
puts stdout "found $vfsname instances still running\n"
set count_killed 0
foreach ln [split $still_running \n] {
puts stdout " $ln"
if {$::tcl_platform(platform) eq "windows"} {
set pid [lindex $ln 1]
if {$forcekill} {
set killcmd [list taskkill /F /PID $pid]
} else {
set killcmd [list taskkill /PID $pid]
}
} else {
set killcmd [list taskkill /PID $pid]
set pid [lindex $ln 0]
#review!
if {$forcekill} {
set killcmd [list kill -9 $pid]
} else {
set killcmd [list kill $pid]
}
}
} else {
set pid [lindex $ln 0]
#review!
if {$forcekill} {
set killcmd [list kill -9 $pid]
puts stdout " pid: $pid (attempting to kill now using '$killcmd')"
if {[catch {
exec {*}$killcmd
} errMsg]} {
puts stderr "$killcmd returned an error:"
puts stderr $errMsg
puts stderr "(try '[info script] -k' option to force kill)"
exit 4
} else {
set killcmd [list kill $pid]
puts stderr "$killcmd ran without error"
incr count_killed
}
}
puts stdout " pid: $pid (attempting to kill now using '$killcmd')"
if {[catch {
exec {*}$killcmd
} errMsg]} {
puts stderr "$killcmd returned an error:"
puts stderr $errMsg
puts stderr "(try '[info script] -k' option to force kill)"
exit 4
} else {
puts stderr "$killcmd ran without error"
incr count_killed
if {$count_killed > 0} {
puts stderr "\nKilled $count_killed processes. Waiting a short time before attempting to delete executable"
after 1000
}
} else {
puts stderr "Ok.. no running '$vfsname' processes found"
}
if {$count_killed > 0} {
puts stderr "\nKilled $count_killed processes. Waiting a short time before attempting to delete executable"
after 1000
}
} 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

102
src/modules/punk/mix/templates/layouts/project/src/mixtemplates/modules/template_module-0.0.1.tm

@ -1,52 +1,52 @@
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'pmix make' or src/make.tcl to update from <pkg>-buildversion.txt
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# (C) %year%
#
# @@ Meta Begin
# Application %pkg% 999999.0a1.0
# Meta platform tcl
# Meta license %license%
# @@ Meta End
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Requirements
##e.g package require frobz
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
namespace eval %pkg% {
}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Ready
package provide %pkg% [namespace eval %pkg% {
variable pkg %pkg%
variable version
set version 999999.0a1.0
}]
# -*- tcl -*-
# Maintenance Instruction: leave the 999999.xxx.x as is and use 'pmix make' or src/make.tcl to update from <pkg>-buildversion.txt
#
# Please consider using a BSD or MIT style license for greatest compatibility with the Tcl ecosystem.
# Code using preferred Tcl licenses can be eligible for inclusion in Tcllib, Tklib and the punk package repository.
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
# (C) %year%
#
# @@ Meta Begin
# Application %pkg% 999999.0a1.0
# Meta platform tcl
# Meta license %license%
# @@ Meta End
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Requirements
##e.g package require frobz
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
namespace eval %pkg% {
}
# ++ +++ +++ +++ +++ +++ +++ +++ +++ +++ +++
## Ready
package provide %pkg% [namespace eval %pkg% {
variable pkg %pkg%
variable version
set version 999999.0a1.0
}]
return

12
src/modules/punk/mix/templates/layouts/project/src/runtime/mapvfs.config

@ -0,0 +1,12 @@
##single line per runtime executable. Name of runtime followed by list of .vfs folders with path relative to src folder.
##if runtime has no entry - it will only match a .vfs folder with a matching filename e.g runtime1.exe runtime1.vfs
##Use a runtime with a name of dash (-) to build a .kit file from the .vfs folder using no runtime
##examples:
#- myproject.vfs
## will produce myproject.kit
#tclkit86bi.exe project1.vfs project2.vfs
## will produce executables project1.exe & project2.exe (on windows) or project1 & project2 on other platforms
#tclkit87bi.exe project1.vfs
## will produce project1_tclkit87bi.exe or project1_tclkit87bi because the project1 name was already taken above
##
## All kits whether directly executable or not will deploy to the projects /bin folder

2
src/modules/punk/mix/templates/layouts/project/src/sample.vfs/lib/app-sample/pkgIndex.tcl

@ -1 +1 @@
package ifneeded app-sample 0.1 [list source [file join $dir sample.tcl]]
package ifneeded app-sample 0.1 [list source [file join $dir sample.tcl]]

16
src/modules/punk/mix/templates/layouts/project/src/sample.vfs/lib/app-sample/sample.tcl

@ -1,8 +1,8 @@
namespace eval sample {
proc main {} {
puts stdout "[namespace current] argc $::argc argv $::argv"
puts stdout "[namespace current] done"
}
main
}
package provide app-sample 0.1
namespace eval sample {
proc main {} {
puts stdout "[namespace current] argc $::argc argv $::argv"
puts stdout "[namespace current] done"
}
main
}
package provide app-sample 0.1

4
src/modules/punk/mix/templates/layouts/project/src/sample.vfs/lib/app-sampleshell/pkgIndex.tcl

@ -1,2 +1,2 @@
package ifneeded app-sampleshell 0.1 [list source [file join $dir repl.tcl]]
package ifneeded app-sampleshell 0.1 [list source [file join $dir repl.tcl]]

222
src/modules/punk/mix/templates/layouts/project/src/sample.vfs/lib/app-sampleshell/repl.tcl

@ -1,111 +1,111 @@
package provide app-punk 1.0
#punk linerepl launcher
#------------------------------------------------------------------------------
#Module loading
#------------------------------------------------------------------------------
#If the current directory contains .tm files when the punk repl starts - then it will attempt to preference them
# - but first add our other known relative modules paths - as it won't make sense to use current directory as a modulpath if it's an ancestor of one of these..
set original_tm_list [tcl::tm::list]
tcl::tm::remove {*}$original_tm_list
#tm list first added end up later in the list - and then override earlier ones if version the same - so add pwd-relative 1st to give higher priority
#1
if {[file exists [pwd]/modules]} {
catch {tcl::tm::add [pwd]/modules}
}
#2)
if {[string match "*.vfs/*" [info script]]} {
#src/xxx.vfs/lib/app-punk/repl.tcl
#we assume if calling directly into .vfs that the user would prefer to use src/modules - so go up 4 levels
set modulefolder [file dirname [file dirname [file dirname [file dirname [info script]]]]]/modules
} else {
# .../bin/punkXX.exe look for ../modules (i.e modules folder at same level as bin folder)
set modulefolder [file dirname [file dirname [info nameofexecutable]]]/modules
}
if {[file exists $modulefolder]} {
tcl::tm::add $modulefolder
} else {
puts stderr "Warning unable to find module folder at: $modulefolder"
}
#libs are appended to end - so add higher prioriy libraries last (opposite to modules)
#auto_path - add exe-relative after exe-relative path
set libfolder [file dirname [file dirname [info nameofexecutable]]]/lib
if {[file exists $libfolder]} {
lappend ::auto_path $libfolder
}
if {[file exists [pwd]/lib]} {
lappend ::auto_path [pwd]/lib
}
#2)
#now add current dir (if no conflict with above)
set currentdir_modules [glob -nocomplain -dir [pwd] -type f -tail *.tm]
set tcl_core_packages [list tcl::zlib zlib tcl::oo TclOO tcl::tommath tcl::zipfs Tcl Tk]
if {[llength $currentdir_modules]} {
#only forget all *unloaded* package names if we are started in a .tm containing folder
foreach pkg [package names] {
if {$pkg in $tcl_core_packages} {
continue
}
if {![llength [package versions $pkg]]} {
#puts stderr "Got no versions for pkg $pkg"
continue
}
if {![string length [package provide $pkg]]} {
package forget $pkg
}
}
catch {tcl::tm::add [pwd]}
}
#puts stdout "$::auto_path"
package require Thread
#These are strong dependencies
# - the repl requires Threading and punk,shellfilter,shellrun to call and display properly.
# tm list already indexed - need 'package forget' to find modules based on current tcl::tm::list
set required [list\
shellfilter
shellrun\
punk\
]
catch {
foreach pkg $required {
package forget $pkg
package require $pkg
}
}
#restore module paths
set tm_list_now [tcl::tm::list]
foreach p $original_tm_list {
if {$p ni $tm_list_now} {
#the prior tm paths go to the head of the list.
#They are processed first.. but an item of same version later in the list will override one at the head.
tcl::tm::add $p
}
}
#------------------------------------------------------------------------------
foreach pkg $required {
package require $pkg
}
package require punk::repl
repl::start stdin
package provide app-punk 1.0
#punk linerepl launcher
#------------------------------------------------------------------------------
#Module loading
#------------------------------------------------------------------------------
#If the current directory contains .tm files when the punk repl starts - then it will attempt to preference them
# - but first add our other known relative modules paths - as it won't make sense to use current directory as a modulpath if it's an ancestor of one of these..
set original_tm_list [tcl::tm::list]
tcl::tm::remove {*}$original_tm_list
#tm list first added end up later in the list - and then override earlier ones if version the same - so add pwd-relative 1st to give higher priority
#1
if {[file exists [pwd]/modules]} {
catch {tcl::tm::add [pwd]/modules}
}
#2)
if {[string match "*.vfs/*" [info script]]} {
#src/xxx.vfs/lib/app-punk/repl.tcl
#we assume if calling directly into .vfs that the user would prefer to use src/modules - so go up 4 levels
set modulefolder [file dirname [file dirname [file dirname [file dirname [info script]]]]]/modules
} else {
# .../bin/punkXX.exe look for ../modules (i.e modules folder at same level as bin folder)
set modulefolder [file dirname [file dirname [info nameofexecutable]]]/modules
}
if {[file exists $modulefolder]} {
tcl::tm::add $modulefolder
} else {
puts stderr "Warning unable to find module folder at: $modulefolder"
}
#libs are appended to end - so add higher prioriy libraries last (opposite to modules)
#auto_path - add exe-relative after exe-relative path
set libfolder [file dirname [file dirname [info nameofexecutable]]]/lib
if {[file exists $libfolder]} {
lappend ::auto_path $libfolder
}
if {[file exists [pwd]/lib]} {
lappend ::auto_path [pwd]/lib
}
#2)
#now add current dir (if no conflict with above)
set currentdir_modules [glob -nocomplain -dir [pwd] -type f -tail *.tm]
set tcl_core_packages [list tcl::zlib zlib tcl::oo TclOO tcl::tommath tcl::zipfs Tcl Tk]
if {[llength $currentdir_modules]} {
#only forget all *unloaded* package names if we are started in a .tm containing folder
foreach pkg [package names] {
if {$pkg in $tcl_core_packages} {
continue
}
if {![llength [package versions $pkg]]} {
#puts stderr "Got no versions for pkg $pkg"
continue
}
if {![string length [package provide $pkg]]} {
package forget $pkg
}
}
catch {tcl::tm::add [pwd]}
}
#puts stdout "$::auto_path"
package require Thread
#These are strong dependencies
# - the repl requires Threading and punk,shellfilter,shellrun to call and display properly.
# tm list already indexed - need 'package forget' to find modules based on current tcl::tm::list
set required [list\
shellfilter
shellrun\
punk\
]
catch {
foreach pkg $required {
package forget $pkg
package require $pkg
}
}
#restore module paths
set tm_list_now [tcl::tm::list]
foreach p $original_tm_list {
if {$p ni $tm_list_now} {
#the prior tm paths go to the head of the list.
#They are processed first.. but an item of same version later in the list will override one at the head.
tcl::tm::add $p
}
}
#------------------------------------------------------------------------------
foreach pkg $required {
package require $pkg
}
package require punk::repl
repl::start stdin

46
src/modules/punk/mix/templates/layouts/project/src/sample.vfs/main.tcl

@ -1,23 +1,23 @@
if {[catch {package require starkit}]} {
#presumably running the xxx.vfs/main.tcl script using a non-starkit tclsh that doesn't have starkit lib available.. lets see if we can move forward anyway
lappend ::auto_path [file join [file dirname [info script]] lib]
} else {
starkit::startup
}
#when run as a tclkit - the exe is mounted as a dir and Tcl's auto_execok doesn't find it
set thisexe [file tail [info nameofexecutable]]
set thisexeroot [file rootname $thisexe]
set ::auto_execs($thisexeroot) [info nameofexecutable]
if {$thisexe ne $thisexeroot} {
set ::auto_execs($thisexe) [info nameofexecutable]
}
if {[llength $::argv]} {
package require app-sample
} else {
package require app-sampleshell
repl::start stdin
}
if {[catch {package require starkit}]} {
#presumably running the xxx.vfs/main.tcl script using a non-starkit tclsh that doesn't have starkit lib available.. lets see if we can move forward anyway
lappend ::auto_path [file join [file dirname [info script]] lib]
} else {
starkit::startup
}
#when run as a tclkit - the exe is mounted as a dir and Tcl's auto_execok doesn't find it
set thisexe [file tail [info nameofexecutable]]
set thisexeroot [file rootname $thisexe]
set ::auto_execs($thisexeroot) [info nameofexecutable]
if {$thisexe ne $thisexeroot} {
set ::auto_execs($thisexe) [info nameofexecutable]
}
if {[llength $::argv]} {
package require app-sample
} else {
package require app-sampleshell
repl::start stdin
}

Loading…
Cancel
Save