-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.env
108 lines (93 loc) · 2.6 KB
/
.env
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
#!/bin/bash
function s4j_workdir() {
local DIR=$(pwd)
while [ ! -z "$DIR" ] && [ ! -f "$DIR/.gitpod.yml" ]; do
DIR="${DIR%\/*}"
done
echo $DIR
}
alias s4jwd="s4j_workdir"
function s4j_cp() {
cp="$(s4j_workdir)/libs/*"
cp="$cp:$(s4j_workdir)/libs/linux-amd64/*)"
cp="$cp:$(s4j_workdir)/libs/windows-amd64/*)"
cp="$cp:."
echo $cp
}
alias s4jcp="sj4_cp"
function s4j_build() {
pushd $(s4jwd)
ant -f resources/build.xml
popd
}
alias s4jb="s4j_build"
function s4j_diff_docs() {
diff -d <(tree $(s4j_workdir)/docs/en/) <(tree $(s4j_workdir)/docs/de/)
}
alias s4jdd="s4j_diff_docs"
function s4j_lint_docs() {
find $(s4j_workdir)/docs/en/book -type f -print | xargs grep "construction"
find $(s4j_workdir)/docs/de/book -type f -print | xargs grep "construction"
}
alias s4jld="s4j_lint_docs"
function s4j_compile() {
rm -rf $(s4j_workdir)/bin
# compile code
javac -cp "$(s4j_cp)" $(find . -name '*.java') -d "$(s4j_workdir)/bin"
# extract natives
for native_jar in $(find ./libs/*/* -name "*.jar")
do
unzip -o -q $native_jar "natives/*" -d $(s4j_workdir)/bin
done
# copy data
cp $(s4j_workdir)/data/* $(s4j_workdir)/bin
# copy other files
pushd $(s4j_workdir)/examples/java
find . ! -name '*.java' | cpio -pdm $(s4j_workdir)/bin
popd
pushd $(s4j_workdir)/examples/reference
find . ! -name '*.java' | cpio -pdm $(s4j_workdir)/bin
popd
}
alias s4jc="s4j_compile"
function s4j_extract_natives() {
rm -rf $(s4j_workdir)/bin
# extract natives
for native_jar in $(find ./libs/*/* -name "*.jar")
do
unzip -o -q $native_jar "natives/*" -d $(s4j_workdir)/bin
done
}
alias s4en="s4j_extract_natives"
function s4j_examples_run() {
pushd examples;
java_file_path=$(find . -name "*.java" -type f -exec grep -lr "main" {} \; | fzf)
java_file_path=$(echo $java_file_path | tr "/" ".")
java_file_path=${java_file_path:2}
java_file_path=${java_file_path%.java}
echo $java_file_path
java -cp $(s4j_cp) $java_file_path
popd;
}
alias s4jer="s4j_examples_run"
function s4j_examples_run_all() {
cp=$(s4j_cp)
for f in $(find ./examples/reference -name "*.class")
do
java_file=${f##*/}
java_dir=${f%/*}
java_name="${java_file%.*}"
java -cp "$cp:bin" $java_name
done
}
alias s4jera="s4j_examples_run_all"
function s4j_examples_copy_to_documentation() {
root=$(s4j_workdir)
folder=$root/docs/$1/public/reference/
rm -rf $folder
mkdir $folder
pushd ./examples/reference
find . -name "*.gif" | cpio -pdm $folder
popd
}
alias s4jecd="s4j_examples_copy_to_documentation"