-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from dojoengine/prettify-scripts
chore(scirpts): make scripts prettier and less noisy
- Loading branch information
Showing
3 changed files
with
136 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,56 @@ | ||
#!/bin/bash | ||
|
||
castffi extract --config Bindings/config-extract-linux.json | ||
castffi extract --config Bindings/config-extract-macos.json | ||
castffi extract --config Bindings/config-extract-windows.json | ||
# Print colorful status messages | ||
print_status() { | ||
echo -e "\033[1;34m$1\033[0m" | ||
} | ||
|
||
# Merge platform abstract syntax tree .json files into a cross-platform abstract syntax tree. | ||
castffi merge --inputDirectoryPath Bindings/ast --outputFilePath Bindings/ast/cross-platform.json | ||
print_error() { | ||
echo -e "\033[1;31m$1\033[0m" | ||
} | ||
|
||
./c2cs/artifacts/bin/C2CS.Tool/release/C2CS.Tool generate --config Bindings/config-generate-cs.json | ||
print_success() { | ||
echo -e "\033[1;32m$1\033[0m" | ||
} | ||
|
||
print_status "Extracting platform-specific bindings..." | ||
|
||
# Extract bindings for each platform | ||
castffi extract --config Bindings/config-extract-linux.json > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
print_error "Failed to extract Linux bindings" | ||
exit 1 | ||
fi | ||
|
||
castffi extract --config Bindings/config-extract-macos.json > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
print_error "Failed to extract macOS bindings" | ||
exit 1 | ||
fi | ||
|
||
castffi extract --config Bindings/config-extract-windows.json > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
print_error "Failed to extract Windows bindings" | ||
exit 1 | ||
fi | ||
|
||
print_status "Merging platform bindings..." | ||
|
||
# Merge platform abstract syntax tree .json files | ||
castffi merge --inputDirectoryPath Bindings/ast --outputFilePath Bindings/ast/cross-platform.json > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
print_error "Failed to merge platform bindings" | ||
exit 1 | ||
fi | ||
|
||
print_status "Generating C# bindings..." | ||
|
||
# Generate C# bindings | ||
./c2cs/artifacts/bin/C2CS.Tool/release/C2CS.Tool generate --config Bindings/config-generate-cs.json > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
print_error "Failed to generate C# bindings" | ||
exit 1 | ||
fi | ||
|
||
print_success "✨ Bindings generation complete!" | ||
print_status "Done! 🎮" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,39 @@ | ||
# Get rid of old wasm package | ||
#!/bin/bash | ||
|
||
# Print colorful status messages | ||
print_status() { | ||
echo -e "\033[1;34m$1\033[0m" | ||
} | ||
|
||
print_error() { | ||
echo -e "\033[1;31m$1\033[0m" | ||
} | ||
|
||
print_success() { | ||
echo -e "\033[1;32m$1\033[0m" | ||
} | ||
|
||
print_status "Cleaning old WASM package..." | ||
rm -rf ./Assets/WebGLTemplates/Dojo/TemplateData/dojo.js/* | ||
if [ $? -ne 0 ]; then | ||
print_error "Failed to clean old WASM package" | ||
exit 1 | ||
fi | ||
|
||
# Build the wasm package | ||
print_status "Building WASM package..." | ||
cd ./Bindings/dojo.c | ||
./scripts/build_wasm.sh > /dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
print_error "Failed to build WASM package" | ||
exit 1 | ||
fi | ||
|
||
./scripts/build_wasm.sh | ||
print_status "Copying WASM package to WebGL template..." | ||
cp ./pkg/* ../../Assets/WebGLTemplates/Dojo/TemplateData/dojo.js | ||
if [ $? -ne 0 ]; then | ||
print_error "Failed to copy WASM package" | ||
exit 1 | ||
fi | ||
|
||
# Copy the wasm package to the webgl template | ||
cp ./pkg/* ../../Assets/WebGLTemplates/Dojo/TemplateData/dojo.js | ||
print_success "✨ WASM generation complete!" | ||
print_status "Done! 🎮" |