Skip to content

Commit

Permalink
Merge branch 'main' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Mar 13, 2024
2 parents b0238cc + be8dd3a commit 6bcf585
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 62 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v0.9.23

- Allow glob to be interpolated string to facilitate reuse [#165](https://github.com/xonixx/makesure/issues/165)
- Minor improvements and fixes.

## v0.9.22
- Main theme of this release is allowing glob goals to be parameterized [#155](https://github.com/xonixx/makesure/issues/155)
- Support interpolation including parameterized goal params [#153](https://github.com/xonixx/makesure/issues/153)
Expand Down
48 changes: 0 additions & 48 deletions Makesure.md

This file was deleted.

2 changes: 1 addition & 1 deletion Makesurefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# vim: syntax=bash
@options timing

@define NEXT_VERSION '0.9.22'
@define NEXT_VERSION '0.9.23'
@define GOAWK_VERSION '1.25.0'
@define JUST_VERSION '1.3.0'
@define FHTAGN_VERSION 'v0.1.1'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ By default, all scripts inside goals are executed with `bash`. If you want to us

```
$ ./makesure -h
makesure ver. 0.9.22
makesure ver. 0.9.23
Usage: makesure [options...] [-f buildfile] [goals...]
-f,--file buildfile
set buildfile to use (default Makesurefile)
Expand Down
22 changes: 12 additions & 10 deletions makesure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
if command -v gawk >/dev/null;then makesure_awk='gawk -ltime -v Gawk=1';makesure_pre='';else makesure_awk=awk;makesure_pre='function gettimeofday(){}';fi
exec $makesure_awk -v "Version=0.9.22" -v "Prog=$0" "$makesure_pre"'
exec $makesure_awk -v "Version=0.9.23" -v "Prog=$0" "$makesure_pre"'
BEGIN {
Shell="bash"
SupportedShells["bash"]
Expand Down Expand Up @@ -103,7 +103,7 @@ function handleDefine(){
if(NF!=3){
addError("Invalid @define syntax, should be @define VAR_NAME '\''value'\''")
return}
if($2 !~ /^[A-Za-z_][A-Za-z0-9_]*$/){
if($2!~/^[A-Za-z_][A-Za-z0-9_]*$/){
addError("Wrong variable name: '\''"$2"'\''")
return}
if(!($2 in DefineOverrides))
Expand Down Expand Up @@ -143,7 +143,7 @@ function handleGoal(i,goalName){
GoalParams[goalName,GoalParamsCnt[goalName]++]=validateParamName($i)
}else if(NF>2)addError("nothing allowed after goal name")}
function validateParamName(p){
if(p !~ /^[A-Z_][A-Z0-9_]*$/)addError("@param name should match /^[A-Z_][A-Z0-9_]*$/: '\''"p"'\''")
if(p!~/^[A-Z_][A-Z0-9_]*$/)addError("@param name should match /^[A-Z_][A-Z0-9_]*$/: '\''"p"'\''")
return p}
function registerGoal(priv,goalName){
if(""==goalName||"@params"==goalName)
Expand Down Expand Up @@ -180,7 +180,7 @@ function handleGoalGlob(goalName,globAllGoal,globSingle,priv,i,pattern,nfMax,gi,
}else
pattern=$(nfMax=4)
if(NF>nfMax&&"@params"!=$(nfMax+1))
addError("nothing or @params allowed after glob pattern")
addError("nothing or @params allowed after glob pattern")
else if(pattern=="")
addError("absent glob pattern")
else {
Expand Down Expand Up @@ -389,7 +389,7 @@ function shellExec(script,comment,res){
function getMyDir(makesurefilePath){
return executeGetLine("cd \"$(dirname "quoteArg(makesurefilePath)")\";pwd")}
function handleCodeLine(line){
if(!isCodeAllowed()&&line !~ /^[ \t]*#/&&trim(line)!=""){
if(!isCodeAllowed()&&line!~/^[ \t]*#/&&trim(line)!=""){
if(!ShellInPreludeErrorShown++)
addError("Shell code is not allowed outside goals/libs")
}else
Expand Down Expand Up @@ -454,7 +454,7 @@ function instantiate(goal,args,newArgs,i,j,depArg,depArgType,dep,goalNameInstant
copyKey(goal,goalNameInstantiated,ReachedIf)
copyKey(goal,goalNameInstantiated,GoalToLib)
for(i in args)
argsCode=addL(argsCode,i"="quoteArg(args[i]))
argsCode=addL(argsCode,i"="quoteArg(args[i])";export "i)
CodePre[goalNameInstantiated]=addL(CodePre[goalNameInstantiated],argsCode)
if(goalNameInstantiated in ReachedIf)
ReachedIf[goalNameInstantiated]=argsCode"\n"ReachedIf[goalNameInstantiated]}
Expand Down Expand Up @@ -601,7 +601,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w
return"unterminated argument"
if(!inDef&&":"==c&&"-"==substr(line,pos+1,1)){
inDef=1
c=substr(line,pos += 2,1)}
c=substr(line,pos+=2,1)}
if(inDef){
if("}"==c)
break
Expand All @@ -613,7 +613,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w
}else
for(;(c=substr(line,pos+1,1))~/[_A-Za-z0-9]/;pos++)
var=var c
if(var !~ /^[_A-Za-z][_A-Za-z0-9]*$/)
if(var!~/^[_A-Za-z][_A-Za-z0-9]*$/)
return"wrong var: '\''"var"'\''"
w=(w)((val=var in vars?vars[var]:var in vars2?vars2[var]:ENVIRON[var])!=""?val:defVal)
continue}
Expand All @@ -626,7 +626,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w
w=c
while((c=substr(line,++pos,1))!=""&&c!=" "&&c!="\t"){
w=w c}
if(w !~ /^[_A-Za-z0-9@.]+$/)
if(w!~/^[-_A-Za-z0-9@.]+$/)
return"wrong unquoted: '\''"w"'\''"
res[i=+res[-7]++,"quote"]="u"
res[i]=w}}}}
Expand All @@ -639,7 +639,9 @@ function reparseCli(res,i,err){
for(i=NF=0;i in res;i++)
$(++NF)=res[i]
for(i=2;i<=NF;i++)
if("\""==res[i-1,"quote"]&&!("@define"==$1&&3==i||"@depends_on"==$1&&"@args"==$3&&i>3)){
if("\""==res[i-1,"quote"]&&!("@define"==$1&&3==i||
"@depends_on"==$1&&"@args"==$3&&i>3||
"@goal"==$1&&"@glob"==$(i-1))){
addError("Wrong quoting: "$i)
return 0}
return 1}
Expand Down
4 changes: 2 additions & 2 deletions makesure_candidate
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
if command -v gawk >/dev/null;then makesure_awk='gawk -ltime -v Gawk=1';makesure_pre='';else makesure_awk=awk;makesure_pre='function gettimeofday(){}';fi
exec $makesure_awk -v "Version=0.9.22" -v "Prog=$0" "$makesure_pre"'
exec $makesure_awk -v "Version=0.9.23" -v "Prog=$0" "$makesure_pre"'
BEGIN {
Shell="bash"
SupportedShells["bash"]
Expand Down Expand Up @@ -626,7 +626,7 @@ function parseCli_2(line,vars,vars2,res,pos,c,c1,isDoll,q,var,inDef,defVal,val,w
w=c
while((c=substr(line,++pos,1))!=""&&c!=" "&&c!="\t"){
w=w c}
if(w!~/^[_A-Za-z0-9@.]+$/)
if(w!~/^[-_A-Za-z0-9@.]+$/)
return"wrong unquoted: '\''"w"'\''"
res[i=+res[-7]++,"quote"]="u"
res[i]=w}}}}
Expand Down

0 comments on commit 6bcf585

Please sign in to comment.