-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_src.sh
28 lines (25 loc) · 1.18 KB
/
build_src.sh
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
#!/bin/bash
echo "Copying module files"
mkdir -p ./build/csinterp/node_modules/
cp -r ./node_modules/antlr4/src/antlr4/ ./build/csinterp/node_modules/
echo Converting C# Builtin Libraries into Typescript
generatedBuiltinCSharpLibraryPath=./src/generated-builtinCSharpLibraries
if [ -d $generatedBuiltinCSharpLibraryPath ]; then
rm -r $generatedBuiltinCSharpLibraryPath
fi
mkdir $generatedBuiltinCSharpLibraryPath
for csharpLibrary in "./BuiltinCSharpLibraries/*.cs"; do
csharpFileName=$(basename $csharpLibrary)
destinationFile="$generatedBuiltinCSharpLibraryPath/$csharpFileName.ts"
echo "// This is a generated file. Do not edit this file directly." >> $destinationFile
echo "// Edit the C# source file ../../BuiltinCSharpLibraries/$csharpFileName then use the build script to regenerate this file." >> $destinationFile
echo "const csharpCode = \`" >> $destinationFile
csharpCodeContent=$(cat $csharpLibrary)
echo $csharpCodeContent >> $destinationFile
echo "\`;" >> $destinationFile
echo "export default csharpCode;" >> $destinationFile
echo " Converted $csharpFileName into $destinationFile"
done
echo Building TypeScript
npm run build_src
echo Build complete