-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build anki web assets from rslib-bridge/anki submodule (#217)
- Loading branch information
Showing
16 changed files
with
186 additions
and
10 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,4 +1,4 @@ | ||
[env] | ||
RSLIB_FTL_ROOT = { value = "ftl/core/l10n.toml", relative = true } | ||
BUILDINFO = { value = "rslib-bridge/buildinfo.txt", relative = true } | ||
BUILDINFO = { value = "rsdroid/build/generated/anki_artifacts/buildinfo.txt", relative = true } | ||
BAZEL = "1" |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
task buildAnkiWebAssets(type: Exec) { | ||
workingDir "$rootDir" | ||
String toolPath = System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows') ? 'tools/web/build-web-assets.ps1' : 'tools/web/build-web-assets.sh' | ||
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) { | ||
commandLine 'PowerShell', '-File', toolPath | ||
} else { | ||
commandLine 'sh', '-c', toolPath | ||
} | ||
} |
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$SRC_DIR = (Get-Item .).FullName | ||
$ROOT_DIR = (Get-Item D:/a/).FullName | ||
$ANKI_SRC = (Get-Item $SRC_DIR/rslib-bridge/anki).FullName | ||
$TEMP_DIR = (Get-Item $ENV:TEMP).FullName | ||
|
||
New-Item -P $SRC_DIR/rsdroid/build/generated/anki_artifacts/web -itemType Directory | ||
$BUILD_DIR = (Get-Item $SRC_DIR/rsdroid/build/generated/anki_artifacts).FullName | ||
|
||
Set-Location -Path $ANKI_SRC | ||
|
||
bazel --output_user_root=$ROOT_DIR/_bzl build -c opt buildinfo.txt --symlink_prefix=$TEMP_DIR/.bazel/ --verbose_failures | ||
Copy-Item -Path $TEMP_DIR/.bazel/bin/buildinfo.txt -Destination $BUILD_DIR/buildinfo.txt -PassThru | ||
|
||
bazel --output_user_root=$ROOT_DIR/_bzl build ts/reviewer/reviewer_extras_bundle --symlink_prefix=$TEMP_DIR/.bazel/ --verbose_failures | ||
Copy-Item -Path $TEMP_DIR/.bazel/bin/ts/reviewer/reviewer_extras_bundle.js -Destination $BUILD_DIR/web -PassThru | ||
|
||
bazel --output_user_root=$ROOT_DIR/_bzl build qt/aqt/data/web/pages --symlink_prefix=$TEMP_DIR/.bazel/ --verbose_failures | ||
Get-Childitem $TEMP_DIR/.bazel/bin/qt/aqt/data/web/pages -Recurse -Include *.html,*.js,*.css | Copy-Item -Destination $BUILD_DIR/web -PassThru | ||
|
||
Copy-Item -Path $ANKI_SRC/cargo/licenses.json -Destination $BUILD_DIR/web/licenses-cargo.json -PassThru | ||
Copy-Item -Path $ANKI_SRC/ts/licenses.json -Destination $BUILD_DIR/web/licenses-ts.json -PassThru |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
# build web assets with anki submodule in rslib-bridge | ||
|
||
# check if bazel exist or not | ||
if ! bazel --version > /dev/null 2>&1; then | ||
echo "bazel: command not found. Please install Bazelisk. Your distro may have it," | ||
echo "or you can fetch the binary from https://github.com/bazelbuild/bazelisk/releases" | ||
echo "and rename it to /usr/local/bin/bazel" | ||
exit 1 | ||
fi | ||
|
||
SRC_DIR=$(pwd) | ||
ANKI_SRC=$SRC_DIR/rslib-bridge/anki | ||
BUILD_DIR=$SRC_DIR/rsdroid/build/generated/anki_artifacts | ||
mkdir -p $BUILD_DIR/web | ||
|
||
# build buildinfo.txt, reviewer_extras_bundle and pages files | ||
cd $ANKI_SRC | ||
|
||
bazel build --symlink_prefix=/tmp/.bazel/ -c opt buildinfo.txt | ||
cp /tmp/.bazel/bin/buildinfo.txt $BUILD_DIR/buildinfo.txt | ||
|
||
bazel build ts/reviewer/reviewer_extras_bundle --symlink_prefix=/tmp/.bazel/ | ||
cp /tmp/.bazel/bin/ts/reviewer/reviewer_extras_bundle.js $BUILD_DIR/web | ||
|
||
bazel build qt/aqt/data/web/pages --symlink_prefix=/tmp/.bazel/ | ||
cp -r /tmp/.bazel/bin/qt/aqt/data/web/pages/* $BUILD_DIR/web | ||
|
||
cp $ANKI_SRC/cargo/licenses.json $BUILD_DIR/web/licenses-cargo.json | ||
cp $ANKI_SRC/ts/licenses.json $BUILD_DIR/web/licenses-ts.json | ||
|
||
chmod -R a+w $BUILD_DIR/web |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# wsl does not support bazel yet https://github.com/bazelbuild/bazel/issues/10941 | ||
echo "Renaming Bash in WSL" | ||
mv.exe "C:/WINDOWS/system32/bash.EXE" "C:/WINDOWS/system32/bash_copy.EXE" | ||
Set-Alias -Name bash -Value "C:/msys64/usr/bin/bash.exe" | ||
$env:BAZEL_SH = "C:/msys64/usr/bin/bash.exe" | ||
[Environment]::SetEnvironmentVariable('BAZEL_SH', 'C:/msys64/usr/bin/bash.exe', 'Machine') |