Skip to content

Commit

Permalink
Update documentation and docker (#123)
Browse files Browse the repository at this point in the history
* Add mdBook

* Add documentation

* Add CI to build and publish book

* Alter CI
  • Loading branch information
enfipy authored Jul 27, 2022
1 parent 362d33d commit d5d7c07
Show file tree
Hide file tree
Showing 37 changed files with 358 additions and 183 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and Deploy Documentation
on:
push:
branches: [main]
paths:
- 'docs/**.md'
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install and Build
run: |
cargo install mdbook
cd docs/
mdbook build -d book
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/book
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -497,3 +497,6 @@ gradle-app.setting
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# Rust mdBook
docs/book/
28 changes: 5 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@ A lot of functionality was inspired by [Godot](https://github.com/godotengine/go
* **Capable**: It's possible to build plain **.apk/.aab** or **.app/.ipa**; or with help of *Gradle/XCode*.
* **Rust**: Don't leave your *Rust* code - **everything** can be configured from `Cargo.toml`.

## 🛠 Installation

To install crossbundle, run:

```sh
cargo install --git=https://github.com/dodorare/crossbow crossbundle
```
## 📚 Documentation

See [installation documentation](./docs/README.md) for more details on how to setup environment on your platform.
Now we would recommend you to read [crossbow's documentation](https://crossbow.dodorare.com/). Over there you will find how to set up development environment, install needed crates and how to use the tools.

## 🗂️ Project structure

Expand All @@ -46,7 +40,7 @@ Crossbundle crates:
| [crossbundle](./crossbundle/cli) | Command-line tool for building and running applications. ||
| [crossbundle-tools](./crossbundle/tools) | Toolkit used in `crossbundle` to build/pack/sign bundles. ||

Crossbow Plugins:
Crossbow crates:

| Name | Description | Status |
| ---- | ----------- | ------ |
Expand All @@ -66,21 +60,9 @@ Helper crates:

✅ = Works and tested — 🆗 = Works but may contain bugs — 🛠 = Under development — 📝 = Planned

## 📚 Documentation

To learn how to run an example project on your own, build, test, and start using `crossbow` - read our full documentation [here](./docs/README.md).

If you want to start development right away - see our Hello World example [here](./docs/main-hello-world.md).

If you want learn more about `crossbundle` we recommend that you read it's README [here](./crossbundle/cli/).

## 📅 Roadmap

Check out our [ROADMAP](./ROADMAP.md) for a better understanding of what we are doing right now and what planned.

## ✌️ Special Thanks
## Special Thanks

Also, this project initially funded by [Web3 Foundation Grants Program](https://github.com/w3f/Grants-Program/blob/master/applications/crossbow.md). Big cheers to them!
Also, this project initially funded by [Web3 Foundation Grants Program](https://github.com/w3f/Grants-Program/blob/master/applications/crossbow.md). Big shout-out to them!

<img src=".github/assets/w3f_grants_badge.svg" alt="W3F Grants Badge" width="400px" />

Expand Down
1 change: 0 additions & 1 deletion docs/CNAME

This file was deleted.

19 changes: 0 additions & 19 deletions docs/README.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/_config.yml

This file was deleted.

8 changes: 8 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[book]
title = "crossbow"
description = "Official Crossbow documentation"
authors = ["DodoRare Team <[email protected]>"]
language = "en"

[rust]
edition = "2021"
23 changes: 0 additions & 23 deletions docs/crossbow-permissions.md

This file was deleted.

43 changes: 0 additions & 43 deletions docs/other-docker.md

This file was deleted.

41 changes: 41 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Summary

[Introduction](introduction.md)

# Getting Started

- [Installation](install/README.md)
- [Android on Windows](install/android-windows.md)
- [Android on Linux](install/android-linux.md)
- [Android on macOS](install/android-macos.md)
- [Android with Docker](install/docker.md)
- [iOS on macOS](install/ios-macos.md)

# Components

- [Crossbundle](crossbundle/README.md)
- [Install Command](crossbundle/command-install.md)
- [Build Command](crossbundle/command-build.md)
- [Run Command](crossbundle/command-run.md)

- [Crossbow](crossbow/README.md)
- [Configuration](crossbow/configuration.md)
- [Permissions](crossbow/permissions.md)
- [Android Plugins](crossbow/android-plugins.md)

# Tutorials

- [Examples](tutorials/README.md)
- [Hello World](tutorials/hello-world.md)
- [Fastlane](tutorials/fastlane.md)
- [Subxt with Bevy](tutorials/subxt-with-bevy.md)

# Other

- [Contributing](contributing/README.md)
- [Contribute Code](contributing/contribute-code.md)
- [Contribute Docs](contributing/contribute-docs.md)
- [Testing Guide](contributing/testing-guide.md)
- [Contributors](contributing/contributors.md)
- [Roadmap](roadmap.md)
- [Special Thanks](special-thanks.md)
8 changes: 8 additions & 0 deletions docs/src/contributing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Contributing

If you want to help us build an awesome Cross-Platform future for Rust Games, please reach out! We need all the help we can get:

- If you are a software developer and you want to help out, check out the [Contributing Code](contribute-code.md) section.
- If you are good at writing or teaching, consider [Contributing to our Docs](contribute-docs.md).

Also, read [testing guide](testing-guide.md) to run tests in `crossbow`.
15 changes: 15 additions & 0 deletions docs/src/contributing/contribute-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# How to Contribute Code

Would you like to contribute code to Crossbow? Here's how!

1. Fork the [dodorare/crossbow](https://github.com/dodorare/crossbow) repository on GitHub, you'll need to create a GitHub account if you don't have one already.*
2. Make your changes in a local clone of your fork.
3. For a higher chance of CI passing the first time, consider run these commands from the root of your local clone:
1. `cargo fmt --all -- --check` (remove --check to let the command fix found problems)
2. `cargo clippy --all-targets --all-features -- -D warnings -A clippy::unnecessary-unwrap -A clippy::too-many-arguments`
3. `cargo test --all-targets --workspace`
4. Push your changes to your fork and open a Pull Request.
5. Respond to any CI failures or review feedback.
<!-- 6. Remember to follow Crossbow's Code of Conduct, and thanks for contributing! -->

> The same steps apply for any other repository in the organization that you would like to contribute to.
17 changes: 17 additions & 0 deletions docs/src/contributing/contribute-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# How to Contribute Docs

## Crossbow Documentation

If you want to contribute to this documentation, please see the [Contributing](contributing/docs.md) section.

1. Fork the [dodorare/crossbow](https://github.com/dodorare/crossbow) repository on GitHub, you'll need to create a GitHub account if you don't have one already.*
2. Install [mdBook](https://rust-lang.github.io/mdBook/guide/installation.html).
3. In the "docs/" directory, run `mdbook serve --open` and make your changes in a local clone of your fork.
4. Push your changes to your fork and open a [Pull Request](https://github.com/dodorare/crossbow/compare).
5. Respond to any CI failures or review feedback.

<!-- Remember to follow Crossbow's Code of Conduct, and thanks for contributing! -->

That's all, big thanks for contributing!

> The same steps apply for any other repository in the organization that you would like to contribute to.
9 changes: 9 additions & 0 deletions docs/src/contributing/contributors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contributors

Here is a list of the contributors who have helped improving `Crossbow`. Big shout-out to them!

- David ([enfipy](https://github.com/enfipy)) - Project Lead
- Daniil ([Heezay](https://github.com/Heezay))
- Oleksii ([olvyko](https://github.com/olvyko))
- Adil ([Adoka3710](https://github.com/Adoka3710))
- Rodrigo ([rodrigocam](https://github.com/rodrigocam))
11 changes: 11 additions & 0 deletions docs/src/contributing/testing-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Testing guide

## How to run tests in crossbow

In `crossbow`, we have unit tests, integration tests, and examples. To run tests, you will need to set up an **Android** and **Apple** environment (you can find more information in [installation category](../install/README.md)).

If you want to run tests for our `crossbundle` crate, you can make it by the following steps: download this repository, proceed to the `crossbundle/tools` directory, and run `cargo test`. It will run all tests for the `crossbundle-tools` crate that is primarily used by `crossbundle`.

## In case of issues

Feel free to open [Github Issues](https://github.com/dodorare/crossbow/issues/new/choose) - we will be happy to fix or review them.
3 changes: 3 additions & 0 deletions docs/src/crossbow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Overview

In this category, you will learn how to use the `crossbow` crate.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Crossbow plugins
# Crossbow Android Plugins

To write new Crossbow Android plugin - we recommend to clone this repository and use `crossbow-admob` as template for your plugin.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 📂 Project configuration
# Project configuration

## ⚙️ Сonfiguration through metadata
## Сonfiguration through metadata

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

Expand All @@ -17,7 +17,7 @@ edition = "2021"
crossbow = "0.1.0"

[package.metadata.android]
app_name = "Creator 3D"
app_name = "Game"
target_sdk_version = 30
icon = "ic_launcher"

Expand All @@ -26,15 +26,15 @@ assets = "assets"
res = "res/android"

[package.metadata.apple]
app_name = "Creator 3D"
app_name = "Game"
icon = "ic_launcher"

build_targets = ["aarch64-apple-ios", "x86_64-apple-ios"]
assets = "assets"
res = "res/apple"
```

### ⚙️ Сonfiguration through separate files
### Сonfiguration through separate files

But sometimes you need to configure something more complex. For such cases, a more suitable way is to use separate `AndroidManifest.xml` or/and `Info.plist` files.

Expand Down
46 changes: 46 additions & 0 deletions docs/src/crossbow/permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Crossbow permissions

To request permissions with Crossbow you will need to add `crossbow` dependency to your Cargo.toml file. Then invoke request_permission function. This function checks the permission status in the application and will request permission if it's not granted yet:

```rust
use crossbow::Permission;
let res = Permission::Camera.request_async().await?;
match res {
Permission::Unknown => println!("Permission is in an unknown state"),
Permission::Denied => println!("Denied by user"),
Permission::Disabled => println!("Feature is disabled on device."),
Permission::Granted => println!("Granted by user."),
Permission::Restricted => println!("Restricted (only iOS)."),
}
```

Also, remember to set permissions in through `Cargo.toml` or `Info.plist`/`AndroidManifest.xml` files. List of required permissions for Cross-Platform Permission you can find in `Permission` enum.

See usage [example](https://github.com/dodorare/crossbow/blob/main/examples/macroquad-permissions/src/main.rs).

Also, it's possible to request more permissions with this API:

```
#[cfg(target_os = "android")]
crossbow::android::permission::*;
let res = request_permission(&AndroidPermission::ReadCalendar).await?;
// or this for iOS:
#[cfg(target_os = "ios")]
crossbow::ios::permission::*;
let res = request_permission(&IosPermission::CaptureDevice(MediaType::Audio)).await;
```

## Maybe useful

Useful commands to debug permission status in Android application using [adb](https://developer.android.com/studio/command-line/adb):

```sh
adb shell pm reset-permissions
adb shell pm list permission-groups
adb shell pm list permissions

adb shell pm grant <app package> <permission name>
adb shell pm revoke <app package> <permission name>
```
3 changes: 3 additions & 0 deletions docs/src/crossbundle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Overview

In this category, you will learn how to use the `crossbundle` tool.
Loading

0 comments on commit d5d7c07

Please sign in to comment.