Skip to content

Commit

Permalink
Update crossbow documentation (#146)
Browse files Browse the repository at this point in the history
* Fix install docs

* Fix configuration

* Fix setx

Co-authored-by: David Ackerman <[email protected]>
  • Loading branch information
Adoka3710 and enfipy authored Aug 25, 2022
1 parent 551b1ab commit 36595cf
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 10 deletions.
6 changes: 2 additions & 4 deletions docs/src/crossbow/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

## Сonfiguration through metadata

The easiest way to configure a project is with metadata. Here's an example:
The easiest way to configure a project is with metadata. Here's an example of `Cargo.toml`:

```toml
# Cargo.toml

[package]
name = "game"
version = "0.1.0"
authors = ["Example <example@nice.com>"]
authors = ["Example <example@example.com>"]
edition = "2021"

[dependencies]
Expand Down
16 changes: 15 additions & 1 deletion docs/src/crossbundle/command-build.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Crossbow gradle

Crossbow default build process requires installed Gradle on your PC. You can download it [here](https://gradle.org/). Don't forget to install `GRADLE_HOME` environment variable.
Crossbow default build process requires installed Gradle on your PC.

To create a project go to the example you want to build and use the command below. The command belongs to macroquad engine examples building:

Expand All @@ -18,3 +18,17 @@ gradle installDebug
```

Also you can replace `build` with `run` subcommand to build and run APK on your device (it uses `installDebug` command under the hood). To see how to set android emulator check install recommendations for [linux-android](./install-linux-android.md), [macos-android](./install-macos-android.md), [windows-android](./install-windows-android.md).

If you don't want to use gradle you can specify it in strategy native-apk:

```sh
crossbundle build android -s=native-apk
# or do you need AAB:
crossbundle build android -s=native-aab
```

To find out available commands specify the -h flag.

```sh
crossbundle build android -h
```
27 changes: 26 additions & 1 deletion docs/src/crossbundle/command-run.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Run Command

TODO: Write documentation.
Crossbow default run process requires installed Gradle on your PC.

To create a project go to the example you want to build and use the command below. The command belongs to macroquad engine examples building:

```sh
crossbundle run android

# To specify custom export gradle directory
crossbundle run android --export-path=./gen/
```

By default run directory is `target/android/<project_name>/gradle`. But you can specify your own build directory via `--export-path=<OUT_PATH>` flag.

If you don't want to use gradle you can specify it in strategy native-apk:

```sh
crossbundle run android -s=native-apk
# or do you need AAB:
crossbundle run android -s=native-aab
```

To find out available commands specify the -h flag.

```sh
crossbundle run android -h
```
10 changes: 9 additions & 1 deletion docs/src/install/android-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export PATH=<path_to_sdk>\sdk\emulator:$PATH
export PATH=<path_to_sdk>\sdk\tools\bin:$PATH
```

Crossbow default build process requires installed Gradle on your PC. You can download it [here](https://services.gradle.org/distributions/). Set to environment variable.

```sh
export GRADLE_HOME=<path_to_gradle>
```

Also, we need to make sure we have a java runtime environment (JRE) installed. We need a key tool utility from there. <br/>
To make sure it's present type this command: `ls /usr/lib/jvm/default/bin/ | grep keytool`

Expand All @@ -46,7 +52,9 @@ Examples:

If you haven't already done so, download bundletool from the [`GitHub repository`](https://github.com/google/bundletool/releases).

- Add `BUNDLETOOL_PATH` variable with value `<path_to_bundletool>`.
```sh
export BUNDLETOOL_PATH=<path_to_bundletool>
```

## Set up your Android device

Expand Down
6 changes: 6 additions & 0 deletions docs/src/install/android-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export PATH=<path_to_sdk>\sdk\emulator:$PATH
export PATH=<path_to_sdk>\sdk\tools\bin:$PATH
```

Crossbow default build process requires installed Gradle on your PC. You can download it [here](https://services.gradle.org/distributions/). Set to environment variable.

```sh
export GRADLE_HOME=<path_to_gradle>
```

Also, we need to make sure we have a java runtime environment (JRE) installed. We will need a key tool utility from there. <br/>
To make sure it's present type this command: `ls /usr/lib/jvm/default/bin/ | grep keytool` or add to your `PATH` env var.

Expand Down
28 changes: 28 additions & 0 deletions docs/src/install/android-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,40 @@ Take these steps to add Android-related environment variables:
- Add `ANDROID_SDK_ROOT` variable with value `<path_to_sdk>\sdk`.<br/>(ex. `C:\Users\username\AppData\Local\android\sdk`)
- Add `ANDROID_NDK_ROOT` variable with value `<path_to_sdk>\sdk\ndk\<version>`.<br/>(ex. `C:\Users\username\AppData\Local\Android\Sdk\ndk\23.1.7779620`)

Or you can install via command line

```sh
SETX ANDROID_SDK_ROOT "path_to_sdk\sdk" /M
SETX ANDROID_NDK_ROOT "path_to_sdk\sdk\ndk\version" /M
```

Crossbow default build process requires installed Gradle on your PC. You can download it [here](https://services.gradle.org/distributions/). Set to environment variable.

- Add `GRADLE_HOME` variable with value `<path_to_gradle>`.

```sh
SETX GRADLE_HOME "path_to_gradle" /M
```

If you will build application with emulator you should add this to environment variables:

- Add `<path_to_sdk>\sdk\tools\bin` to `PATH` variable.
- Add `<path_to_sdk>\sdk\emulator` to `PATH` variable.

```sh
SETX "<path_to_sdk>\sdk\tools\bin" ~PATH~
SETX "<path_to_sdk>\sdk\emulator" ~PATH~
```

Also, we need to make sure we have a [java runtime environment](https://www.oracle.com/java/technologies/downloads/) (JRE) or [Java developer kit](https://www.oracle.com/java/technologies/downloads/) (JDK) installed. We need a key tool utility from there. <br/>
To make sure it's present type this command: `keytool -h`

- If command above fails, add `<path_to_jre>\bin` to `PATH` environment variable.<br/>(ex. `C:\Program Files\Android\Android Studio\jre\bin`) <br/>(ex. `C:\Program Files\java\jdk\bin`)

```sh
SETX JAVA_HOME "path_to_jdk" /M
```


You have to close and reopen any existing console windows for these changes to take effect.

Expand All @@ -38,6 +62,10 @@ If you haven't already done so, download bundletool from the [`GitHub repository

- Add `BUNDLETOOL_PATH` variable with value `<path_to_bundletool>`.

```sh
SETX BUNDLETOOL_PATH "path_to_bundletool" /M
```

## Set up your Android device

To prepare to run your `Crossbow` app on an Android device, you need an Android device running Android 4.1 (API level 16) or higher.
Expand Down
4 changes: 1 addition & 3 deletions docs/src/tutorials/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ authors = ["Example <[email protected]>"]
edition = "2021"

[dependencies]
crossbundle = "*"
crossbow = "*"

[package.metadata]
app_name = "My Project"
Expand All @@ -54,8 +54,6 @@ Let's build and run our first `crossbundle` application. Android commands below
```sh
# cd project-name
crossbundle run android
# or (if your project uses macroquad)
crossbundle run android
# or
crossbundle run ios
```
Expand Down

0 comments on commit 36595cf

Please sign in to comment.