xonixx / makesure Goto Github PK
View Code? Open in Web Editor NEWSimple task/command runner with declarative goals and dependencies
Home Page: https://makesure.dev
License: MIT License
Simple task/command runner with declarative goals and dependencies
Home Page: https://makesure.dev
License: MIT License
See #18
Let's change the behavior to
@goal goal_name @glob *.txt
echo $ITEM $INDEX $TOTAL
Is eqivalent to
@goal [email protected]
echo a.txt 0 2
@goal [email protected]
echo b.txt 1 2
iff
$ ls
a.txt b.txt
Also allowed form
@goal @glob *.txt
echo $ITEM $INDEX $TOTAL
as equivalent for
@goal a.txt
echo a.txt 0 2
@goal b.txt
echo b.txt 1 2
@goal goal_name
@glob FILE *.txt
echo $FILE $FILE_INDEX $FILE_TOTAL
Is eqivalent to
@goal goal_name-a.txt
echo a.txt 0 2
@goal goal_name-b.txt
echo b.txt 1 2
iff
$ ls
a.txt b.txt
See https://www.gnu.org/software/gawk/manual/html_node/Close-Files-And-Pipes.html#index-sidebar-10
$ awk --posix 'BEGIN { (s="echo 123; exit 10") | getline; print; print close(s) }'
123
0
$ awk 'BEGIN { (s="echo 123; exit 10") | getline; print; print close(s) }'
123
2560
$ busybox awk 'BEGIN { (s="echo 123; exit 10") | getline; print; print close(s) }'
123
2560
$ mawk 'BEGIN { (s="echo 123; exit 10") | getline; print; print close(s) }'
123
10
This gives meaningless noise
$ ./makesure
goal 'quickjs_installed' [already satisfied].
goal 'quickjs_installed' took 0.01 s
goal 'build_folder_created' [already satisfied].
goal 'build_folder_created' took 0.01 s
goal 'prepared_for_build' [empty].
goal 'prepared_for_build' took 0.01 s
goal 'built_for_prod' ...
Compiling release build with QuickJS Compiler version 2020-11-08...
-rwxr-xr-x 1 xonix xonix 657K Jan 26 18:57 jsqry
goal 'built_for_prod' took 8.057 s
goal 'tush_installed' [already satisfied].
goal 'tush_installed' took 0.002 s
goal 'tests_executed' ...
TESTS PASSED
goal 'tests_executed' took 0.075 s
goal 'built' [empty].
goal 'built' took 0.001 s
goal 'default' [empty].
goal 'default' took 0.002 s
total time 8.244 s
For Makesurefile
@goal aaa
@doc some description
@goal other_goal
@doc do something important
@goal yet_another_goal
@doc do something even more important
@goal hello
./makesure -l
should show
Available goals:
aaa : some description
other_goal : do something important
yet_another_goal : do something even more important
hello
In continuation of #34
In addition to proposed behavior in #34 let's also generate a root goal that also calls all child goals.
So:
@goal goal_name @glob *.txt
echo $ITEM $INDEX $TOTAL
Is eqivalent to
@goal goal_name
@depends_on [email protected]
@depends_on [email protected]
@goal [email protected]
echo a.txt 0 2
@goal [email protected]
echo b.txt 1 2
iff
$ ls
a.txt b.txt
@private
@private
takes effect on all-goal only. Generated goals are aways private.
Name is not mandatory as now.
Without name let's use glob itself as a name (but only if it doesn't equal to a generated goal name)
@goal @glob *.txt
echo $ITEM $INDEX $TOTAL
Is eqivalent to
@goal *.txt
@depends_on a.txt
@depends_on b.txt
@goal a.txt
echo a.txt 0 2
@goal b.txt
echo b.txt 1 2
Let's make it natural sort order
This implies we should run tests against makesure_stable
Related #26
At the moment there is 2 ways to pass external parameters:
VAR=value ./makesure
./makesure -D VAR=value
Need to understand:
Let's have both approaches in place. Though, with the difference:
@defile A=2
in Makesurefile
always overrides the environment variable with same name (A=1 ./makesure
)@define A=2
is overriden by -D A=1
(./makesure -D A=1
)@define
to export environment variable, for consistency. In this case it just overrides the value of existing environment variable, if present.So final precedence would be (higher priority top):
./makesure -D VAR=1
@define VAR=2
in Makesurefile
VAR=3 ./makesure
Though it's tempting to only rely on environment variables, in this case it also needs that environment variable override the @define
s in build file, to be able to provide more specific config values externally. But this potentially makes a build unpredictable because you can't always control the environment variables.
Needed for #32
@lib lib_name
a() {
echo Hello $1
}
@goal goal_name
@use_lib lib_name
a World
For simplicity can omit name:
@lib
a() {
echo Hello $1
}
@goal goal_name
@use_lib
a World
The same we do for failed goals.
Relates to #50
This is because on Mac date
command doesn't support +%N
.
$ ./makesure
Goal 'tested_stable' has unknown dependency 'test_stable_version1@tests/0_basic.tush':
Makesurefile:312:
$
$ ./makesure -f tests/10_define.sh testA -D A="val with spaces"
bash: line 1: with: command not found
prelude failed
https://www.gnu.org/software/gawk/manual/html_node/Extension-Sample-Time.html
date
invocation.$ date +%s%3N ; AWKLIBPATH="$(pwd)/soft/gawk51_libs" ./soft/gawk51 -ltime 'BEGIN { print int(gettimeofday()*1000) }'
1632408331587
1632408331589
Relates to #28
Use case:
We want to have a tested
goal that depends on a tested_a
and tested_b
so as to have an option to run all tests as well as to run each test separately, tested_a
and tested_b
have fairly similar logic.
Can this be achieved via goal-level @define
s?
dieMsg("Goal '" goal_name "' has unknown dependency '" dep "'") # TODO find a way to provide line reference
It appears that Git bash lacks curl / wget.
Discovered in #21
Come up with a list we support and document.
NEXT_VERSION=1.1.1
in Makesurefile./makesure stable
will generate new stable version based on next versionBenefit: awk code highlighted in own file.
How can we enforce this?
Details in https://github.com/xonixx/makesure/blob/main/docs/DEVELOPER.md#files
Same for -la
To limit a list of goals, essentially do similat to ./makesure -l | grep substr
Goal can fail silently with no output
See #12
The idea:
@goal_glob *.txt
echo $ITEM $INDEX $TOTAL
Is eqivalent to
@goal a.txt
echo a.txt 0 2
@goal b.txt
echo b.txt 1 2
iff
$ ls
a.txt b.txt
Come up with items to optimize.
Most likely due to caching on Github side or in curl.
It takes couple minutes to return new vesrsion.
Related: https://stackoverflow.com/questions/46551413/github-not-update-raw-after-commit
The idea is for ./makesure -l
only show goals intended to be ran by the user. This means we also need -la
switch to list all goals.
Need special care with @goal_glob
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.