3 releases (breaking)

Uses new Rust 2021

0.3.0 Apr 12, 2022
0.2.0 Apr 5, 2022
0.1.0 Feb 15, 2022

#765 in Cryptography

Download history 9/week @ 2022-08-11 9/week @ 2022-08-18 8/week @ 2022-08-25 8/week @ 2022-09-01 19/week @ 2022-09-08 5/week @ 2022-09-15 12/week @ 2022-09-22 12/week @ 2022-09-29 9/week @ 2022-10-06 8/week @ 2022-10-13 7/week @ 2022-10-20 11/week @ 2022-10-27 16/week @ 2022-11-03 11/week @ 2022-11-10 12/week @ 2022-11-17 10/week @ 2022-11-24

51 downloads per month
Used in xbuild

Apache-2.0 OR MIT

90KB
500 lines

xbuild

xbuild is a build tool for rust and rust/flutter projects with support for cross compiling and publishing to all major stores. The goal of xbuild is making native app development as easy as web development.

Getting started

Install xbuild:

cargo install xbuild

Create a new project:

x new helloworld

tree helloworld
helloworld
├── api.rsh
├── build.rs
├── Cargo.toml
├── lib
   └── main.dart
├── pubspec.yaml
├── rust-toolchain.toml
└── src
    ├── lib.rs
    └── main.rs

2 directories, 8 files

List connected devices:

x devices
host                                              Linux               linux x64           Arch Linux 5.16.10-arch1-1
adb:16ee50bc                                      FP4                 android arm64       Android 11 (API 30)
imd:55abbd4b70af4353bdea2595bbddcac4a2b7891a      David’s iPhone      ios arm64           iPhone OS 15.3.1

Build or run on a device:

x build --device adb:16ee50bc
[1/9] Fetch flutter repo [SKIPPED]
[2/9] Fetch precompiled artefacts
[2/9] Fetch precompiled artefacts [7ms]
[3/9] Run pub get [SKIPPED]
[4/9] Build rust
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
[4/9] Build rust [112ms]
[5/9] Build classes.dex [SKIPPED]
[6/9] Build flutter assets [2ms]
[7/9] Build kernel_blob.bin [SKIPPED]
[8/9] Build aot snapshot [SKIPPED]
[9/9] Create apk [4316ms]

x

Scope and limitations of xbuild

Flutter plugins won't be supported.

Cross compiling release builds is currently not possible because dart/flutter lack support for cross compiling aot snapshots

Android

  • Building Android app bundles is not implemented yet (#6).

Windows

  • Msix packaging has not been implemented yet (#33).

Troubleshooting

Command not found

x doctor should let you know if there are any external tools missing.

x doctor
--------------------clang/llvm toolchain--------------------
clang                13.0.1              /usr/bin/clang
clang++              13.0.1              /usr/bin/clang++
llvm-ar              unknown             /usr/bin/llvm-ar
llvm-lib             unknown             /usr/bin/llvm-lib
lld                  13.0.1              /usr/bin/lld
lld-link             13.0.1              /usr/bin/lld-link
lldb                 13.0.1              /usr/bin/lldb
lldb-server          unknown             /usr/bin/lldb-server

----------------------------misc----------------------------
cargo                1.60.0              /usr/bin/cargo
git                  2.35.1              /usr/bin/git
flutter              2.10.4              /usr/bin/flutter

--------------------------android---------------------------
adb                  1.0.41              /opt/android-sdk/platform-tools/adb
javac                11.0.15             /usr/bin/javac
java                 11.0.15             /usr/bin/java

----------------------------ios-----------------------------
idevice_id           1.3.0-83-g5b8c9a8   /usr/bin/idevice_id
ideviceinfo          1.3.0-83-g5b8c9a8   /usr/bin/ideviceinfo
ideviceinstaller     1.1.1               /usr/bin/ideviceinstaller
ideviceimagemounter  1.3.0-83-g5b8c9a8   /usr/bin/ideviceimagemounter
idevicedebug         1.3.0-83-g5b8c9a8   /usr/bin/idevicedebug

---------------------------linux----------------------------
mksquashfs           4.5.1               /usr/bin/mksquashfs

---------------------------macos----------------------------
hdiutil              not found

error: failed to run custom build command for glib-sys v0.14.0

This means that gtk3-dev is not installed. Install gtk3-dev package to fix the problem.

No devices found with name or id matching 'linux'.

Run flutter config --enable-linux-desktop.

Dart Error: Can't load Kernel binary: Invalid SDK hash.

This happens when flutter attach and x use different flutter versions. To fix this run x update in your project folder and git checkout stable && git pull in your flutter sdk.

Generating apple signing key/certificate

See apple_codesign_certificate_management for further information.

Generating mobile provisioning profiles

Without an apple developer account there is no cross platform way of generating mobile provisioning profiles. You can either figure out how to generate it using xcode or cook.

License

Apache-2.0 OR MIT

Dependencies

~10MB
~213K SLoC