-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makesurefile
175 lines (137 loc) · 4.33 KB
/
Makesurefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# vim: syntax=bash
@define NEXT_VERSION='0.3.7'
@define REPO='xonixx/intellij-awk'
@goal default
@depends_on installed_bwk
@depends_on installed_gawk51
@goal folder_created @params D @private
@reached_if [[ -d "$D" ]]
mkdir "$D"
@goal soft_folder_created @private
@depends_on folder_created @args 'soft'
@goal installed_bwk
@reached_if [[ -f soft/bwk ]]
@depends_on soft_folder_created
echo
echo "Fetching BWK..."
echo
cd "soft"
wget https://github.com/onetrueawk/awk/archive/refs/heads/master.tar.gz -Obwk.tar.gz
tar xzvf bwk.tar.gz
rm bwk.tar.gz
echo
echo "Compile BWK..."
echo
cd "awk-master"
make
mv a.out ../bwk
cd ..
./bwk --version
rm -r awk-master
@goal installed_gawk51
@reached_if [[ -f soft/gawk51 ]]
@depends_on soft_folder_created
echo
echo "Fetching Gawk-5.1.0..."
echo
cd "soft"
G=gawk-5.1.0.tar.gz
wget "http://git.savannah.gnu.org/cgit/gawk.git/snapshot/$G"
tar xzvf "$G"
rm "$G"
echo
echo "Compile Gawk-5.1.0..."
echo
cd "gawk-5.1.0"
./configure && make && make check
mv gawk ../gawk51
cd ..
./gawk51 --version
rm -r "gawk-5.1.0"
@goal gh_installed @private
@reached_if command -v gh >/dev/null
echo "You need to install gh first: https://cli.github.com/"
exit 1
@goal gh_release
@depends_on gh_installed
@doc 'publish Github release (draft)'
releaseTag="v$NEXT_VERSION"
echo
echo "Will publish a draft release for $releaseTag ..."
echo
fail () {
echo >&2 "$@"
exit 1
}
milestoneId=$(gh api -X GET "repos/$REPO/milestones" --jq '.[] | select(.title=="'$NEXT_VERSION'").number')
if [[ -z $milestoneId ]]
then
fail "Unable to determine milestoneId by release version"
fi
echo "Milestone ID : $milestoneId"
# notesStr="Issues in release: https://github.com/$REPO/milestone/$milestoneId?closed=1"
# Let's take for notes the latest record from change log (in build.gradle)
# Let's make sure the version there is correct
notesStr=$(awk '
/changeNotes.set\(/ { Started=1; next }
Started
/<\/p>/ { exit 0 }
' build.gradle)
echo "Notes: $notesStr"
awk -v notesStr="$notesStr" -v NEXT_VERSION="$NEXT_VERSION" '
BEGIN {
if (index(notesStr,NEXT_VERSION)>0) exit 0
print "Wrong version in notes, should be " NEXT_VERSION
print "Make sure you did not forget to add latest change note!"
exit 1
}
'
gh release create "$releaseTag" \
--title "$releaseTag" \
--notes "$notesStr" \
--draft
echo "Please don't forget to open the release draft, edit it as needed and PUBLISH!"
@goal githubTests
@doc 'Run tests with Github actions'
./gradlew clean lexer parser compileJava compileTestJava test
@goal std.awk_variables
@depends_on std.awk_variables_ @args 'User_002dmodified.html'
@depends_on std.awk_variables_ @args 'Auto_002dset.html'
@goal std.awk_functions
@depends_on document_processed @args 'Numeric-Functions.html'
@depends_on std.awk_string
@depends_on document_processed @args 'I_002fO-Functions.html'
@depends_on document_processed @args 'Time-Functions.html'
@depends_on document_processed @args 'Bitwise-Functions.html'
@depends_on document_processed @args 'Type-Functions.html'
@depends_on document_processed @args 'I18N-Functions.html'
@depends_on std.awk_exit
@depends_on std.awk_printf
@goal std.awk
@doc 'generates std.awk file used for documentation (Ctrl-Q)'
{
echo 'BEGIN {'
./makesure std.awk_variables -s
echo '}'
./makesure std.awk_functions -s
} > src/main/resources/std.awk
@goal document_processed @params F @private
@depends_on document_downloaded @args F
awk -f gen_std.awk temp/"$F"
@goal document_downloaded @params F @private
@depends_on folder_created @args 'temp'
@reached_if [[ -f "temp/$F" ]]
curl --fail https://www.gnu.org/software/gawk/manual/html_node/"$F" -o temp/"$F"
@goal std.awk_string @private
@depends_on document_downloaded @args 'String-Functions.html'
@depends_on document_downloaded @args 'Control-Letters.html'
@depends_on document_downloaded @args 'Format-Modifiers.html'
awk -f gen_std.awk temp/String-Functions.html
@goal std.awk_variables_ @params F @private
@depends_on document_downloaded @args F
awk -v Vars=1 -f gen_std.awk temp/"$F"
@goal std.awk_exit @private
@depends_on document_downloaded @args 'Exit-Statement.html'
awk -v Stmt=exit -f gen_std.awk temp/Exit-Statement.html
@goal std.awk_printf @private
awk -v Stmt=printf -f gen_std.awk