simplify wheel building
This commit is contained in:
parent
daf9ca5e5e
commit
0cbb60169c
13
BUILD.bazel
13
BUILD.bazel
|
@ -1,3 +1,5 @@
|
|||
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
||||
|
||||
config_setting(
|
||||
name = "release",
|
||||
values = {
|
||||
|
@ -26,5 +28,16 @@ alias(
|
|||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_tar(
|
||||
name = "dist",
|
||||
srcs = [
|
||||
"//pylib/anki:wheel",
|
||||
"//qt/aqt:wheel",
|
||||
],
|
||||
mode = "0644",
|
||||
package_dir = "bazel-dist",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
# for version info
|
||||
exports_files(["defs.bzl"])
|
||||
|
|
|
@ -64,12 +64,19 @@ If you'd like to contribute translations, please see <https://translating.ankiwe
|
|||
|
||||
## Building redistributable wheels
|
||||
|
||||
Run the following commands to create Python packages that can be redistributed
|
||||
Run the following command to create Python packages that can be redistributed
|
||||
and installed:
|
||||
|
||||
On Mac/Linux:
|
||||
|
||||
```
|
||||
bazel build -c opt //pylib/anki:wheel
|
||||
bazel build -c opt //qt/aqt:wheel
|
||||
./scripts/build
|
||||
```
|
||||
|
||||
On Windows:
|
||||
|
||||
```
|
||||
.\scripts\build.bat
|
||||
```
|
||||
|
||||
The generated wheel paths will be printed as the build completes.
|
||||
|
@ -79,9 +86,11 @@ Follow the steps in the "Pre-built Python wheels" section above, but replace the
|
|||
"pip install aqt" line with something like:
|
||||
|
||||
```
|
||||
pip install /path/to/anki.whl /path/to/aqt.whl
|
||||
pip install --upgrade bazel-dist/*.whl
|
||||
```
|
||||
|
||||
On Windows you'll need to list out the filenames manually.
|
||||
|
||||
## Running tests
|
||||
|
||||
From inside the source folder:
|
||||
|
|
|
@ -124,6 +124,7 @@ py_wheel(
|
|||
"pylib",
|
||||
],
|
||||
version = anki_version,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":anki_pkg"],
|
||||
)
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ py_wheel(
|
|||
"qt",
|
||||
],
|
||||
version = anki_version,
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":aqt_pkg",
|
||||
],
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
test -e WORKSPACE || (
|
||||
echo "Run from project root"
|
||||
exit 1
|
||||
)
|
||||
|
||||
rm -rf bazel-dist
|
||||
bazel build -c opt dist
|
||||
tar xvf bazel-bin/dist.tar
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
|
||||
if not exist WORKSPACE (
|
||||
echo Run from project root
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
rd /s /q bazel-dist
|
||||
|
||||
call .\bazel build -k -c opt dist --color=yes
|
||||
:: repeat on failure
|
||||
IF %ERRORLEVEL% NEQ 0 call .\bazel build -k -c opt dist --color=yes
|
||||
|
||||
tar xvf bazel-bin\dist.tar
|
Loading…
Reference in New Issue