diff --git a/.github/scripts/publish_crates.sh b/.github/scripts/publish_crates.sh index a2c7cdb5..fe9a2338 100755 --- a/.github/scripts/publish_crates.sh +++ b/.github/scripts/publish_crates.sh @@ -3,18 +3,19 @@ # Legends say that the order of the crates should be kept. crates=( - platform/android - platform/ios - plugins/admob-android - plugins/play-games-services - crossbundle/tools - crossbundle/cli + ./platform/android + ./platform/ios + ./ + ./crossbundle/tools + ./crossbundle/cli + ./plugins/admob-android + ./plugins/play-games-services ) for crate in "${crates[@]}" do echo "Publishing ${crate}" - cargo publish --manifest-path=$crate/Cargo.toml + pushd $crate + cargo publish sleep 40 + popd done -sleep 40 -cargo publish diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9321232f..ed209d2d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,10 +1,12 @@ -name: Docker images +name: Publish Docker images on: push: branches: [main] paths: - '.github/docker/*.Dockerfile' - '.github/workflows/docker.yml' + - '**.rs' + - '**.toml' jobs: build-crossbundle-dockerfile: name: Build Crossbundle Dockerfile diff --git a/Cargo.toml b/Cargo.toml index 3bd7d2ec..f9fc3e59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossbow" -version = "0.1.9" +version = "0.2.0" edition = "2021" authors = ["DodoRare Team "] description = "Cross-Platform build tools and toolkit for games" @@ -8,7 +8,7 @@ repository = "/~https://github.com/dodorare/crossbow" license = "MIT OR Apache-2.0" keywords = ["build", "android", "ios", "tools"] readme = "README.md" -exclude = [".github/**/*"] +exclude = ["assets/", "docs/"] [dependencies] thiserror = "1.0" @@ -21,10 +21,10 @@ apple-bundle = { version = "0.1.4", optional = true } [target.'cfg(target_os = "android")'.dependencies] ndk-glue = "0.7.0" -crossbow-android = { path = "platform/android", version = "0.1.9", optional = true } +crossbow-android = { path = "platform/android", version = "0.2.0", optional = true } [target.'cfg(target_os = "ios")'.dependencies] -crossbow-ios = { path = "platform/ios", version = "0.1.9", optional = true } +crossbow-ios = { path = "platform/ios", version = "0.2.0", optional = true } [patch.crates-io] winit = { git = "/~https://github.com/rust-windowing/winit", rev = "f93f2c158bf527ed56ab2b6f5272214f0c1d9f7d" } diff --git a/README.md b/README.md index d8a920be..31885f76 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [![Crossbow Splash Image](assets/splash.png)](/~https://github.com/dodorare/crossbow) +# [![Crossbow Splash Image](/~https://github.com/dodorare/crossbow/blob/main/assets/crossbow/splash.png?raw=true)](/~https://github.com/dodorare/crossbow) [![CI Info](/~https://github.com/dodorare/crossbow/workflows/CI/badge.svg)](/~https://github.com/dodorare/crossbow/actions) [![Crate Info](https://img.shields.io/crates/v/crossbow.svg)](https://crates.io/crates/crossbow) @@ -16,7 +16,7 @@ The `crossbow` project aims to provide a complete toolkit for cross-platform gam > There are already [cargo-apk](/~https://github.com/rust-windowing/android-ndk-rs/tree/master/cargo-apk), [cargo-mobile](/~https://github.com/BrainiumLLC/cargo-mobile), [cargo-xcode](https://gitlab.com/kornelski/cargo-xcode), etc. - why do I need another packaging tool? -Project `crossbow` is not only a packaging tool for **Android** and **iOS** - it's cross-platform build tools and toolkit for Rust! With `crossbundle` you can create native **.apk/.aab** without any *Java* or setup *Gradle* project with fancy **Crossbow Android plugins** (**iOS** in near future); with `crossbundle-tools` you can customize and create new commands; with `crossbow-android` you can write your own Android plugins in *Java/Kotlin*. +Project `crossbow` is not only a packaging tool for **Android** and **iOS** - it's cross-platform build tools, plugins, and toolkit for Rust! With `crossbundle` you can create native **.apk/.aab** without any *Java* or setup *Gradle* project with fancy **Crossbow Android plugins** (**iOS** in near future); with `crossbundle-tools` you can customize and create new commands; with `crossbow-android` you can write your own Android plugins in *Java/Kotlin*. A lot of functionality was inspired by [Godot](/~https://github.com/godotengine/godot), [Xamarin](https://dotnet.microsoft.com/en-us/apps/xamarin), and [cargo-apk](/~https://github.com/rust-windowing/android-ndk-rs/tree/master/cargo-apk). @@ -24,7 +24,7 @@ A lot of functionality was inspired by [Godot](/~https://github.com/godotengine/go * **Customizable**: Create new commands with available tools. * **Simple**: Easy to install and start hacking but also pretty flexible for strong devs. -* **Capable**: It's possible to build plain **.apk/.aab** or **.app/.ipa**; or with help of *Gradle/XCode*. +* **Flexible**: 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`. * **Plugins**: Godot-like plugins for **Android** (and **iOS** in future) with *Rust* wrapper! @@ -41,15 +41,21 @@ 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 crates: +Crossbow Platform crates: | Name | Description | Status | | ---- | ----------- | ------ | | [crossbow-android](./platform/android) | Crossbow Android Platform implementation. | 🆗 | | [crossbow-ios](./platform/ios) | Crossbow iOS Platform implementation. | 🛠 | -| [crossbow-admob](./crossbow/admob) | Google AdMob Plugin for Android (iOS in future). | 🆗 | -| [crossbow-play-games-sdk](./crossbow/play-games-sdk) | Google Play Games Sdk for Android. | 🆗 | -| [crossbow-play-billing](./crossbow/play-billing) | Google Play Billing for Android. | 🛠 | + +Crossbow Plugins: + +| Name | Description | Status | +| ---- | ----------- | ------ | +| [admob-android](./crossbow/admob-android) | [Google AdMob](https://developers.google.com/admob/android/quick-start) Plugin for Android. | 🆗 | +| [play-games-services](./crossbow/play-games-services) | [Google Play Games Services](https://developers.google.com/games/services/) Plugin for Android. | 🆗 | +| [play-billing](./crossbow/play-billing) | [Google Play Billing](https://developer.android.com/google/play/billing) Plugin for Android. | 🆗 | +| [play-core](./crossbow/play-core) | [Google Play Core](https://developer.android.com/guide/playcore) Plugin for Android. | 📝 | Helper crates: @@ -65,7 +71,7 @@ Helper crates: 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! -W3F Grants Badge +W3F Grants Badge ## License diff --git a/assets/splash.png b/assets/crossbow/splash.png similarity index 100% rename from assets/splash.png rename to assets/crossbow/splash.png diff --git a/assets/w3f_grants_badge.svg b/assets/crossbow/w3f_grants_badge.svg similarity index 100% rename from assets/w3f_grants_badge.svg rename to assets/crossbow/w3f_grants_badge.svg diff --git a/assets/models/helmet/FlightHelmet.bin b/assets/models/helmet/FlightHelmet.bin deleted file mode 100644 index 3a878be1..00000000 Binary files a/assets/models/helmet/FlightHelmet.bin and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet.gltf b/assets/models/helmet/FlightHelmet.gltf deleted file mode 100644 index 37687d8e..00000000 --- a/assets/models/helmet/FlightHelmet.gltf +++ /dev/null @@ -1,705 +0,0 @@ -{ - "asset": { - "version": "2.0", - "generator": "babylon.js glTF exporter for Maya 2018 v20200228.3 (with minor hand modifications)" - }, - "scene": 0, - "scenes": [ - { - "nodes": [ - 0, - 1, - 2, - 3, - 4, - 5 - ] - } - ], - "nodes": [ - { - "mesh": 0, - "name": "Hose_low" - }, - { - "mesh": 1, - "name": "RubberWood_low" - }, - { - "mesh": 2, - "name": "GlassPlastic_low" - }, - { - "mesh": 3, - "name": "MetalParts_low" - }, - { - "mesh": 4, - "name": "LeatherParts_low" - }, - { - "mesh": 5, - "name": "Lenses_low" - } - ], - "meshes": [ - { - "primitives": [ - { - "attributes": { - "POSITION": 1, - "TANGENT": 2, - "NORMAL": 3, - "TEXCOORD_0": 4 - }, - "indices": 0, - "material": 0 - } - ], - "name": "Hose_low" - }, - { - "primitives": [ - { - "attributes": { - "POSITION": 6, - "TANGENT": 7, - "NORMAL": 8, - "TEXCOORD_0": 9 - }, - "indices": 5, - "material": 1 - } - ], - "name": "RubberWood_low" - }, - { - "primitives": [ - { - "attributes": { - "POSITION": 11, - "TANGENT": 12, - "NORMAL": 13, - "TEXCOORD_0": 14 - }, - "indices": 10, - "material": 2 - } - ], - "name": "GlassPlastic_low" - }, - { - "primitives": [ - { - "attributes": { - "POSITION": 16, - "TANGENT": 17, - "NORMAL": 18, - "TEXCOORD_0": 19 - }, - "indices": 15, - "material": 3 - } - ], - "name": "MetalParts_low" - }, - { - "primitives": [ - { - "attributes": { - "POSITION": 21, - "TANGENT": 22, - "NORMAL": 23, - "TEXCOORD_0": 24 - }, - "indices": 20, - "material": 4 - } - ], - "name": "LeatherParts_low" - }, - { - "primitives": [ - { - "attributes": { - "POSITION": 26, - "TANGENT": 27, - "NORMAL": 28, - "TEXCOORD_0": 29 - }, - "indices": 25, - "material": 5 - } - ], - "name": "Lenses_low" - } - ], - "accessors": [ - { - "bufferView": 0, - "componentType": 5123, - "count": 59040, - "type": "SCALAR", - "name": "accessorIndices" - }, - { - "bufferView": 1, - "componentType": 5126, - "count": 10472, - "max": [ - 0.10810829, - 0.356580257, - 0.190409869 - ], - "min": [ - -0.07221258, - 0.104120225, - -0.088394776 - ], - "type": "VEC3", - "name": "accessorPositions" - }, - { - "bufferView": 2, - "componentType": 5126, - "count": 10472, - "type": "VEC4", - "name": "accessorTangents" - }, - { - "bufferView": 1, - "byteOffset": 125664, - "componentType": 5126, - "count": 10472, - "type": "VEC3", - "name": "accessorNormals" - }, - { - "bufferView": 3, - "componentType": 5126, - "count": 10472, - "type": "VEC2", - "name": "accessorUVs" - }, - { - "bufferView": 0, - "byteOffset": 118080, - "componentType": 5123, - "count": 72534, - "type": "SCALAR", - "name": "accessorIndices" - }, - { - "bufferView": 1, - "byteOffset": 251328, - "componentType": 5126, - "count": 13638, - "max": [ - 0.162940636, - 0.7025226, - 0.200029165 - ], - "min": [ - -0.158857465, - -2.14242937E-05, - -0.171545789 - ], - "type": "VEC3", - "name": "accessorPositions" - }, - { - "bufferView": 2, - "byteOffset": 167552, - "componentType": 5126, - "count": 13638, - "type": "VEC4", - "name": "accessorTangents" - }, - { - "bufferView": 1, - "byteOffset": 414984, - "componentType": 5126, - "count": 13638, - "type": "VEC3", - "name": "accessorNormals" - }, - { - "bufferView": 3, - "byteOffset": 83776, - "componentType": 5126, - "count": 13638, - "type": "VEC2", - "name": "accessorUVs" - }, - { - "bufferView": 0, - "byteOffset": 263148, - "componentType": 5123, - "count": 24408, - "type": "SCALAR", - "name": "accessorIndices" - }, - { - "bufferView": 1, - "byteOffset": 578640, - "componentType": 5126, - "count": 4676, - "max": [ - 0.140494063, - 0.61828655, - 0.147373646 - ], - "min": [ - -0.140846014, - 0.440957, - -0.107818365 - ], - "type": "VEC3", - "name": "accessorPositions" - }, - { - "bufferView": 2, - "byteOffset": 385760, - "componentType": 5126, - "count": 4676, - "type": "VEC4", - "name": "accessorTangents" - }, - { - "bufferView": 1, - "byteOffset": 634752, - "componentType": 5126, - "count": 4676, - "type": "VEC3", - "name": "accessorNormals" - }, - { - "bufferView": 3, - "byteOffset": 192880, - "componentType": 5126, - "count": 4676, - "type": "VEC2", - "name": "accessorUVs" - }, - { - "bufferView": 0, - "byteOffset": 311964, - "componentType": 5123, - "count": 60288, - "type": "SCALAR", - "name": "accessorIndices" - }, - { - "bufferView": 1, - "byteOffset": 690864, - "componentType": 5126, - "count": 13636, - "max": [ - 0.132708371, - 0.6024364, - 0.199477077 - ], - "min": [ - -0.203642711, - 0.02116075, - -0.147512689 - ], - "type": "VEC3", - "name": "accessorPositions" - }, - { - "bufferView": 2, - "byteOffset": 460576, - "componentType": 5126, - "count": 13636, - "type": "VEC4", - "name": "accessorTangents" - }, - { - "bufferView": 1, - "byteOffset": 854496, - "componentType": 5126, - "count": 13636, - "type": "VEC3", - "name": "accessorNormals" - }, - { - "bufferView": 3, - "byteOffset": 230288, - "componentType": 5126, - "count": 13636, - "type": "VEC2", - "name": "accessorUVs" - }, - { - "bufferView": 0, - "byteOffset": 432540, - "componentType": 5123, - "count": 65688, - "type": "SCALAR", - "name": "accessorIndices" - }, - { - "bufferView": 1, - "byteOffset": 1018128, - "componentType": 5126, - "count": 12534, - "max": [ - 0.124933377, - 0.716000438, - 0.129168555 - ], - "min": [ - -0.125863016, - 0.2958266, - -0.1541516 - ], - "type": "VEC3", - "name": "accessorPositions" - }, - { - "bufferView": 2, - "byteOffset": 678752, - "componentType": 5126, - "count": 12534, - "type": "VEC4", - "name": "accessorTangents" - }, - { - "bufferView": 1, - "byteOffset": 1168536, - "componentType": 5126, - "count": 12534, - "type": "VEC3", - "name": "accessorNormals" - }, - { - "bufferView": 3, - "byteOffset": 339376, - "componentType": 5126, - "count": 12534, - "type": "VEC2", - "name": "accessorUVs" - }, - { - "bufferView": 0, - "byteOffset": 563916, - "componentType": 5123, - "count": 2208, - "type": "SCALAR", - "name": "accessorIndices" - }, - { - "bufferView": 1, - "byteOffset": 1318944, - "componentType": 5126, - "count": 436, - "max": [ - 0.101920746, - 0.5936986, - 0.152926728 - ], - "min": [ - -0.101920947, - 0.5300429, - 0.090174824 - ], - "type": "VEC3", - "name": "accessorPositions" - }, - { - "bufferView": 2, - "byteOffset": 879296, - "componentType": 5126, - "count": 436, - "type": "VEC4", - "name": "accessorTangents" - }, - { - "bufferView": 1, - "byteOffset": 1324176, - "componentType": 5126, - "count": 436, - "type": "VEC3", - "name": "accessorNormals" - }, - { - "bufferView": 3, - "byteOffset": 439648, - "componentType": 5126, - "count": 436, - "type": "VEC2", - "name": "accessorUVs" - } - ], - "bufferViews": [ - { - "buffer": 0, - "byteLength": 568332, - "name": "bufferViewScalar" - }, - { - "buffer": 0, - "byteOffset": 568332, - "byteLength": 1329408, - "byteStride": 12, - "name": "bufferViewFloatVec3" - }, - { - "buffer": 0, - "byteOffset": 1897740, - "byteLength": 886272, - "byteStride": 16, - "name": "bufferViewFloatVec4" - }, - { - "buffer": 0, - "byteOffset": 2784012, - "byteLength": 443136, - "byteStride": 8, - "name": "bufferViewFloatVec2" - } - ], - "buffers": [ - { - "uri": "FlightHelmet.bin", - "byteLength": 3227148 - } - ], - "materials": [ - { - "pbrMetallicRoughness": { - "baseColorTexture": { - "index": 2 - }, - "metallicRoughnessTexture": { - "index": 1 - } - }, - "normalTexture": { - "index": 0 - }, - "occlusionTexture": { - "index": 1 - }, - "doubleSided": true, - "name": "HoseMat" - }, - { - "pbrMetallicRoughness": { - "baseColorTexture": { - "index": 2 - }, - "metallicRoughnessTexture": { - "index": 1 - } - }, - "normalTexture": { - "index": 0 - }, - "occlusionTexture": { - "index": 1 - }, - "name": "RubberWoodMat" - }, - { - "pbrMetallicRoughness": { - "baseColorTexture": { - "index": 5 - }, - "metallicRoughnessTexture": { - "index": 4 - } - }, - "normalTexture": { - "index": 3 - }, - "occlusionTexture": { - "index": 4 - }, - "name": "GlassPlasticMat" - }, - { - "pbrMetallicRoughness": { - "baseColorTexture": { - "index": 8 - }, - "metallicRoughnessTexture": { - "index": 7 - } - }, - "normalTexture": { - "index": 6 - }, - "occlusionTexture": { - "index": 7 - }, - "name": "MetalPartsMat" - }, - { - "pbrMetallicRoughness": { - "baseColorTexture": { - "index": 11 - }, - "metallicRoughnessTexture": { - "index": 10 - } - }, - "normalTexture": { - "index": 9 - }, - "occlusionTexture": { - "index": 10 - }, - "name": "LeatherPartsMat" - }, - { - "pbrMetallicRoughness": { - "baseColorTexture": { - "index": 14 - }, - "metallicRoughnessTexture": { - "index": 13 - } - }, - "normalTexture": { - "index": 12 - }, - "occlusionTexture": { - "index": 13 - }, - "alphaMode": "BLEND", - "name": "LensesMat" - } - ], - "textures": [ - { - "sampler": 0, - "source": 0, - "name": "FlightHelmet_Materials_RubberWoodMat_Normal.png" - }, - { - "sampler": 0, - "source": 1, - "name": "FlightHelmet_Materials_RubberWoodMat_OcclusionRoughMetal.png" - }, - { - "sampler": 0, - "source": 2, - "name": "FlightHelmet_Materials_RubberWoodMat_BaseColor.png" - }, - { - "sampler": 0, - "source": 3, - "name": "FlightHelmet_Materials_GlassPlasticMat_Normal.png" - }, - { - "sampler": 0, - "source": 4, - "name": "FlightHelmet_Materials_GlassPlasticMat_OcclusionRoughMetal.png" - }, - { - "sampler": 0, - "source": 5, - "name": "FlightHelmet_Materials_GlassPlasticMat_BaseColor.png" - }, - { - "sampler": 0, - "source": 6, - "name": "FlightHelmet_Materials_MetalPartsMat_Normal.png" - }, - { - "sampler": 0, - "source": 7, - "name": "FlightHelmet_Materials_MetalPartsMat_OcclusionRoughMetal.png" - }, - { - "sampler": 0, - "source": 8, - "name": "FlightHelmet_Materials_MetalPartsMat_BaseColor.png" - }, - { - "sampler": 0, - "source": 9, - "name": "FlightHelmet_Materials_LeatherPartsMat_Normal.png" - }, - { - "sampler": 0, - "source": 10, - "name": "FlightHelmet_Materials_LeatherPartsMat_OcclusionRoughMetal.png" - }, - { - "sampler": 0, - "source": 11, - "name": "FlightHelmet_Materials_LeatherPartsMat_BaseColor.png" - }, - { - "sampler": 0, - "source": 12, - "name": "FlightHelmet_Materials_LensesMat_Normal.png" - }, - { - "sampler": 0, - "source": 13, - "name": "FlightHelmet_Materials_LensesMat_OcclusionRoughMetal.png" - }, - { - "sampler": 0, - "source": 14, - "name": "FlightHelmet_Materials_LensesMat_BaseColor.png" - } - ], - "images": [ - { - "uri": "FlightHelmet_Materials_RubberWoodMat_Normal.png" - }, - { - "uri": "FlightHelmet_Materials_RubberWoodMat_OcclusionRoughMetal.png" - }, - { - "uri": "FlightHelmet_Materials_RubberWoodMat_BaseColor.png" - }, - { - "uri": "FlightHelmet_Materials_GlassPlasticMat_Normal.png" - }, - { - "uri": "FlightHelmet_Materials_GlassPlasticMat_OcclusionRoughMetal.png" - }, - { - "uri": "FlightHelmet_Materials_GlassPlasticMat_BaseColor.png" - }, - { - "uri": "FlightHelmet_Materials_MetalPartsMat_Normal.png" - }, - { - "uri": "FlightHelmet_Materials_MetalPartsMat_OcclusionRoughMetal.png" - }, - { - "uri": "FlightHelmet_Materials_MetalPartsMat_BaseColor.png" - }, - { - "uri": "FlightHelmet_Materials_LeatherPartsMat_Normal.png" - }, - { - "uri": "FlightHelmet_Materials_LeatherPartsMat_OcclusionRoughMetal.png" - }, - { - "uri": "FlightHelmet_Materials_LeatherPartsMat_BaseColor.png" - }, - { - "uri": "FlightHelmet_Materials_LensesMat_Normal.png" - }, - { - "uri": "FlightHelmet_Materials_LensesMat_OcclusionRoughMetal.png" - }, - { - "uri": "FlightHelmet_Materials_LensesMat_BaseColor.png" - } - ], - "samplers": [ - { - "magFilter": 9729, - "minFilter": 9987 - } - ] -} diff --git a/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_BaseColor.png b/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_BaseColor.png deleted file mode 100644 index f79eafe4..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_BaseColor.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_Normal.png b/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_Normal.png deleted file mode 100644 index 06e70ef1..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_Normal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_OcclusionRoughMetal.png b/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_OcclusionRoughMetal.png deleted file mode 100644 index 3a03d7bb..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_GlassPlasticMat_OcclusionRoughMetal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_BaseColor.png b/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_BaseColor.png deleted file mode 100644 index dbee2d41..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_BaseColor.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_Normal.png b/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_Normal.png deleted file mode 100644 index 467e2ca9..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_Normal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_OcclusionRoughMetal.png b/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_OcclusionRoughMetal.png deleted file mode 100644 index 24058ff8..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_LeatherPartsMat_OcclusionRoughMetal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_LensesMat_BaseColor.png b/assets/models/helmet/FlightHelmet_Materials_LensesMat_BaseColor.png deleted file mode 100644 index 81b29d8e..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_LensesMat_BaseColor.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_LensesMat_Normal.png b/assets/models/helmet/FlightHelmet_Materials_LensesMat_Normal.png deleted file mode 100644 index ed6502e3..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_LensesMat_Normal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_LensesMat_OcclusionRoughMetal.png b/assets/models/helmet/FlightHelmet_Materials_LensesMat_OcclusionRoughMetal.png deleted file mode 100644 index bc7dd395..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_LensesMat_OcclusionRoughMetal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_BaseColor.png b/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_BaseColor.png deleted file mode 100644 index 33b91592..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_BaseColor.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_Normal.png b/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_Normal.png deleted file mode 100644 index b977bac8..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_Normal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_OcclusionRoughMetal.png b/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_OcclusionRoughMetal.png deleted file mode 100644 index 9cde90c3..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_MetalPartsMat_OcclusionRoughMetal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_BaseColor.png b/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_BaseColor.png deleted file mode 100644 index c60cc956..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_BaseColor.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_Normal.png b/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_Normal.png deleted file mode 100644 index bc5669cf..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_Normal.png and /dev/null differ diff --git a/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_OcclusionRoughMetal.png b/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_OcclusionRoughMetal.png deleted file mode 100644 index f846b055..00000000 Binary files a/assets/models/helmet/FlightHelmet_Materials_RubberWoodMat_OcclusionRoughMetal.png and /dev/null differ diff --git a/crossbundle/cli/Cargo.toml b/crossbundle/cli/Cargo.toml index 5cd7d4a3..51f59257 100644 --- a/crossbundle/cli/Cargo.toml +++ b/crossbundle/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossbundle" -version = "0.1.9" +version = "0.2.0" edition = "2021" authors = ["DodoRare Team "] description = "Build and publish apps for Android/iOS" @@ -18,8 +18,8 @@ name = "crossbundle" path = "src/main.rs" [dependencies] -crossbow = { path = "../../", version = "0.1.9", default-features = false, features = ["update-manifest"] } -crossbundle-tools = { path = "../tools", version = "0.1.9", default-features = false } +crossbow = { path = "../../", version = "0.2.0", default-features = false, features = ["update-manifest"] } +crossbundle-tools = { path = "../tools", version = "0.2.0", default-features = false } android-tools = { version = "0.2.10", optional = true } clap = { version = "3.2", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } diff --git a/crossbundle/cli/README.md b/crossbundle/cli/README.md index a0d11bf3..e23087aa 100644 --- a/crossbundle/cli/README.md +++ b/crossbundle/cli/README.md @@ -1,6 +1,6 @@ # Crossbundle CLI -![splash](/~https://github.com/dodorare/crossbow/blob/main/assets/splash.png?raw=true) +![splash](/~https://github.com/dodorare/crossbow/blob/main/assets/crossbow/splash.png?raw=true) [![Crate Info](https://img.shields.io/crates/v/crossbundle.svg)](https://crates.io/crates/crossbundle) [![Documentation](https://img.shields.io/badge/docs.rs-crossbundle-green)](https://docs.rs/crossbundle/) diff --git a/crossbundle/tools/Cargo.toml b/crossbundle/tools/Cargo.toml index 0f10b9d8..004ae1a3 100644 --- a/crossbundle/tools/Cargo.toml +++ b/crossbundle/tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crossbundle-tools" -version = "0.1.9" +version = "0.2.0" edition = "2021" authors = ["DodoRare Team "] description = "Build and publish apps for Android/iOS" @@ -10,6 +10,7 @@ keywords = ["android", "ios"] readme = "README.md" [dependencies] +crossbow-android = { version = "0.2.0", path = "../../platform/android", default-features = false, features = ["embed"] } # Apple crates apple-bundle = { version = "0.1.4", optional = true } simctl = { version = "0.1.1", package = "creator-simctl", optional = true } @@ -31,7 +32,6 @@ zip-extensions = "0.6.1" itertools = "0.10" cargo = "0.63.1" cargo-util = "0.2.0" -rust-embed = { version = "6.4.0", features = ["include-exclude"] } thiserror = "1.0" anyhow = "1.0" diff --git a/crossbundle/tools/README.md b/crossbundle/tools/README.md index 0418bdc0..d88fdf51 100644 --- a/crossbundle/tools/README.md +++ b/crossbundle/tools/README.md @@ -1,9 +1,9 @@ # Crossbundle Tools -![splash](/~https://github.com/dodorare/crossbow/blob/main/assets/splash.png?raw=true) +![splash](/~https://github.com/dodorare/crossbow/blob/main/assets/crossbow/splash.png?raw=true) [![Crate Info](https://img.shields.io/crates/v/crossbundle-tools.svg)](https://crates.io/crates/crossbundle-tools) -[![Documentation](https://img.shields.io/badge/docs.rs-crossbundle-tools-green)](https://docs.rs/crossbundle-tools/) +[![Documentation](https://img.shields.io/badge/docs.rs-crossbundle_tools-green)](https://docs.rs/crossbundle-tools/) [![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](/~https://github.com/dodorare/crossbow#license) [![GitHub Stars](https://img.shields.io/github/stars/dodorare/crossbow.svg?style=social)](/~https://github.com/dodorare/crossbow/stargazers) diff --git a/crossbundle/tools/src/commands/android/common/attach_logger.rs b/crossbundle/tools/src/commands/android/common/attach_logger.rs index 5e5f787e..6b65a17e 100644 --- a/crossbundle/tools/src/commands/android/common/attach_logger.rs +++ b/crossbundle/tools/src/commands/android/common/attach_logger.rs @@ -12,7 +12,11 @@ fn logcat_cmd(sdk: &AndroidSdk) -> Result { /// Runs`adb logcat RustStdoutStderr:D '*:S'` command pub fn attach_logger_only_rust(sdk: &AndroidSdk) -> Result<()> { let mut adb = logcat_cmd(sdk)?; - adb.arg("RustStdoutStderr:D").arg("SAPP:D").arg("*:S"); + adb.arg("RustStdoutStderr:D") + .arg("SAPP:D") + .arg("Crossbow:D") + .arg("CrossbowPlugin:D") + .arg("*:S"); adb.spawn()?.wait()?; Ok(()) } diff --git a/crossbundle/tools/src/commands/android/common/rust_compile/compile_options.rs b/crossbundle/tools/src/commands/android/common/rust_compile/compile_options.rs index ddc33eff..6f986dab 100644 --- a/crossbundle/tools/src/commands/android/common/rust_compile/compile_options.rs +++ b/crossbundle/tools/src/commands/android/common/rust_compile/compile_options.rs @@ -38,7 +38,7 @@ pub fn compile_options( // Set features options opts.cli_features = - CliFeatures::from_command_line(features, all_features, no_default_features)?; + CliFeatures::from_command_line(features, all_features, !no_default_features)?; // Set the path and file name for the generated shared library opts.target_rustc_args = Some(vec![format!( diff --git a/crossbundle/tools/src/commands/android/gradle/gen_gradle_project.rs b/crossbundle/tools/src/commands/android/gradle/gen_gradle_project.rs index 876c8d02..e5df0b53 100644 --- a/crossbundle/tools/src/commands/android/gradle/gen_gradle_project.rs +++ b/crossbundle/tools/src/commands/android/gradle/gen_gradle_project.rs @@ -1,5 +1,5 @@ use crate::error::*; -use rust_embed::RustEmbed; +use crossbow_android::embed::CrossbowAndroidAppTemplate; use serde::{Deserialize, Serialize}; use std::{ fs::File, @@ -7,15 +7,6 @@ use std::{ path::{Path, PathBuf}, }; -#[derive(RustEmbed)] -#[folder = "../../platform/android/java/app"] -#[include = "src/*"] -#[include = "*.xml"] -#[include = "*.gradle"] -#[exclude = "build/"] -#[exclude = "libs/"] -pub struct CrossbowAppTemplate; - #[derive(Debug, Clone, Deserialize, Serialize, Default)] pub struct AndroidGradlePlugins { /// Android Gradle local plugins. @@ -48,13 +39,13 @@ pub fn gen_gradle_project( ) -> Result { let gradle_project_path = android_build_dir.join("gradle"); - for file_name in CrossbowAppTemplate::iter() { + for file_name in CrossbowAndroidAppTemplate::iter() { let file_path = gradle_project_path.join(file_name.as_ref()); if let Some(path) = file_path.parent() { std::fs::create_dir_all(path)?; } let mut build_gradle = File::create(file_path)?; - let file = CrossbowAppTemplate::get(file_name.as_ref()).unwrap(); + let file = CrossbowAndroidAppTemplate::get(file_name.as_ref()).unwrap(); write!( build_gradle, "{}", @@ -160,15 +151,16 @@ mod tests { #[test] fn test_crossbow_app_template() { - for file in CrossbowAppTemplate::iter() { + for file in CrossbowAndroidAppTemplate::iter() { println!("{}", file.as_ref()); } assert!( - CrossbowAppTemplate::get("src/com/crossbow/game/CrossbowApp.kt").is_some(), + CrossbowAndroidAppTemplate::get("src/com/crossbow/game/CrossbowApp.kt").is_some(), "CrossbowApp.kt should exist" ); assert!( - CrossbowAppTemplate::get("libs/debug/arm64-v8a/libcrossbow_android.so").is_none(), + CrossbowAndroidAppTemplate::get("libs/debug/arm64-v8a/libcrossbow_android.so") + .is_none(), "libcrossbow_android.so shouldn't exist" ); } diff --git a/crossbundle/tools/src/error.rs b/crossbundle/tools/src/error.rs index 6759b01f..c7e9383b 100644 --- a/crossbundle/tools/src/error.rs +++ b/crossbundle/tools/src/error.rs @@ -16,6 +16,10 @@ pub type Result = std::result::Result; pub enum AndroidError { /// Android NDK is not found AndroidNdkNotFound, + /// Failed to read source.properties + FailedToReadSourceProperties, + /// Invalid source.properties: {0} + InvalidSourceProperties(String), /// Gradle Dependency project dir not found: {0} GradleDependencyProjectNotFound(PathBuf), /// Gradle Dependency project doesn't contain build.gradle: {0} diff --git a/crossbundle/tools/src/types/android/android_ndk.rs b/crossbundle/tools/src/types/android/android_ndk.rs index 849a71b2..71d62722 100644 --- a/crossbundle/tools/src/types/android/android_ndk.rs +++ b/crossbundle/tools/src/types/android/android_ndk.rs @@ -39,28 +39,30 @@ impl AndroidNdk { } }; let build_tag = std::fs::read_to_string(ndk_path.join("source.properties")) - .expect("Failed to read source.properties"); + .map_err(|_| AndroidError::FailedToReadSourceProperties)?; let build_tag = build_tag .split('\n') .find_map(|line| { - let (key, value) = line - .split_once('=') - .expect("Failed to parse `key = value` from source.properties"); - if key.trim() == "Pkg.Revision" { - // AOSP writes a constantly-incrementing build version to the patch field. - // This number is incrementing across NDK releases. - let mut parts = value.trim().split('.'); - let _major = parts.next().unwrap(); - let _minor = parts.next().unwrap(); - let patch = parts.next().unwrap(); - // Can have an optional `XXX-beta1` - let patch = patch.split_once('-').map_or(patch, |(patch, _beta)| patch); - Some(patch.parse().expect("Failed to parse patch field")) - } else { - None + if let Some((key, value)) = line.split_once('=') { + if key.trim() == "Pkg.Revision" { + // AOSP writes a constantly-incrementing build version to the patch field. + // This number is incrementing across NDK releases. + let mut parts = value.trim().split('.'); + let _major = parts.next().unwrap(); + let _minor = parts.next().unwrap(); + let patch = parts.next().unwrap(); + // Can have an optional `XXX-beta1` + let patch = patch.split_once('-').map_or(patch, |(patch, _beta)| patch); + return Some(patch.parse().expect("Failed to parse patch field")); + } } + None }) - .expect("No `Pkg.Revision` in source.properties"); + .ok_or_else(|| { + AndroidError::InvalidSourceProperties( + "No `Pkg.Revision` in source.properties".to_owned(), + ) + })?; Ok(Self { ndk_path, build_tag, diff --git a/docs/src/introduction.md b/docs/src/introduction.md index 33a52365..3708b803 100644 --- a/docs/src/introduction.md +++ b/docs/src/introduction.md @@ -1,6 +1,6 @@ # Introduction -![splash](/~https://github.com/dodorare/crossbow/blob/main/assets/splash.png?raw=true) +![splash](/~https://github.com/dodorare/crossbow/blob/main/assets/crossbow/splash.png?raw=true) ## What is Crossbow? diff --git a/examples/bevy-2d/Cargo.toml b/examples/bevy-2d/Cargo.toml index 4ecbd5d4..0fae8c5d 100644 --- a/examples/bevy-2d/Cargo.toml +++ b/examples/bevy-2d/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "bevy-2d" -version = "0.1.9" +version = "0.2.0" authors = ["DodoRare Team "] edition = "2021" [dependencies] -crossbow = { version = "0.1.9", path = "../../" } +crossbow = { version = "0.2.0", path = "../../" } log = "0.4" anyhow = "1.0" bevy = { version = "0.7.0", features = ["mp3"] } diff --git a/examples/bevy-3d/Cargo.toml b/examples/bevy-3d/Cargo.toml deleted file mode 100644 index 47fc564e..00000000 --- a/examples/bevy-3d/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "bevy-3d" -version = "0.1.9" -authors = ["DodoRare Team "] -edition = "2021" - -[dependencies] -crossbow = { version = "0.1.9", path = "../../" } -log = "0.4" -anyhow = "1.0" -bevy = "0.7.0" - -[package.metadata] -app_name = "Bevy 3D" -assets = "../../assets" - -[package.metadata.android] -release_build_targets = ["aarch64-linux-android", "armv7-linux-androideabi", "i686-linux-android", "x86_64-linux-android"] -res = "../../assets/res/android" - -[package.metadata.apple] -release_build_targets = ["aarch64-apple-ios", "x86_64-apple-ios"] -res = "../../assets/res/apple" diff --git a/examples/bevy-3d/src/main.rs b/examples/bevy-3d/src/main.rs deleted file mode 100644 index 4214a169..00000000 --- a/examples/bevy-3d/src/main.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::prelude::*; - -fn main() { - println!("Initialization."); - std::thread::sleep(std::time::Duration::from_secs(2)); - App::new() - .insert_resource(AmbientLight { - color: Color::WHITE, - brightness: 1.0 / 5.0f32, - }) - .add_plugins(DefaultPlugins) - .add_startup_system(setup) - .add_system(animate_light_direction) - .run(); -} - -fn setup(mut commands: Commands, asset_server: Res) { - commands.spawn_scene(asset_server.load("models/helmet/FlightHelmet.gltf#Scene0")); - commands.spawn_bundle(PerspectiveCameraBundle { - transform: Transform::from_xyz(0.7, 0.7, 1.0).looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y), - ..Default::default() - }); - const HALF_SIZE: f32 = 1.0; - commands.spawn_bundle(DirectionalLightBundle { - directional_light: DirectionalLight { - shadow_projection: OrthographicProjection { - left: -HALF_SIZE, - right: HALF_SIZE, - bottom: -HALF_SIZE, - top: HALF_SIZE, - near: -10.0 * HALF_SIZE, - far: 10.0 * HALF_SIZE, - ..Default::default() - }, - shadows_enabled: true, - ..Default::default() - }, - ..Default::default() - }); -} - -fn animate_light_direction( - time: Res