mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
draft cli for project exporter
This commit is contained in:
Generated
+1
@@ -51,6 +51,7 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/fyrox-shader/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/fyrox-graphics-gl/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/editor-automated-tests/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/fyrox-build-tools-cli/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/examples/wasm/target" />
|
||||
</content>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# 1.0.0
|
||||
|
||||
First stable release.
|
||||
|
||||
# 1.0.0-rc.2
|
||||
|
||||
Second release-candidate version.
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ members = [
|
||||
"fyrox-autotile",
|
||||
"fyrox-material",
|
||||
"fyrox-graphics-gl"
|
||||
]
|
||||
, "fyrox-build-tools-cli"]
|
||||
resolver = "2"
|
||||
|
||||
[profile.editor-standalone]
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "fyrox-build-tools-cli"
|
||||
version = "1.0.0"
|
||||
edition = "2024"
|
||||
authors = ["Dmitry Stepanov <[email protected]>"]
|
||||
license = "MIT"
|
||||
description = "Command line interface for build tools of Fyrox engine"
|
||||
keywords = ["fyrox", "game", "project"]
|
||||
categories = ["game-development"]
|
||||
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"]
|
||||
homepage = "https://fyrox.rs"
|
||||
repository = "https://github.com/FyroxEngine/Fyrox"
|
||||
readme = "README.md"
|
||||
rust-version = "1.87"
|
||||
|
||||
[dependencies]
|
||||
fyrox-resource = { path = "../fyrox-resource", version = "1.0.0" }
|
||||
fyrox-build-tools = { path = "../fyrox-build-tools", version = "1.0.0" }
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
@@ -0,0 +1,3 @@
|
||||
# fyrox-build-tools-cli
|
||||
|
||||
Command line interface for build tools of Fyrox engine.
|
||||
@@ -0,0 +1,67 @@
|
||||
// Copyright (c) 2019-present Dmitry Stepanov and Fyrox Engine contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
//! Fyrox Project Template Generator command line interface.
|
||||
|
||||
use clap::Parser;
|
||||
use fyrox_build_tools::export::{ExportOptions, TargetPlatform};
|
||||
use fyrox_resource::{core::task::TaskPool, io::FsResourceIo, manager::ResourceManager};
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(author, version, about, long_about = None)]
|
||||
struct Args {
|
||||
pub target_platform: String,
|
||||
pub destination_folder: PathBuf,
|
||||
pub include_used_assets: bool,
|
||||
pub assets_folders: Vec<PathBuf>,
|
||||
pub ignored_extensions: Vec<String>,
|
||||
pub build_targets: Vec<String>,
|
||||
pub run_after_build: bool,
|
||||
pub open_destination_folder: bool,
|
||||
pub convert_assets: bool,
|
||||
pub enable_optimization: bool,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args: Args = Args::parse();
|
||||
|
||||
let options = ExportOptions {
|
||||
target_platform: match args.target_platform.as_ref() {
|
||||
"android" => TargetPlatform::Android,
|
||||
"pc" => TargetPlatform::PC,
|
||||
"wasm" => TargetPlatform::WebAssembly,
|
||||
_ => panic!("unknown target platform!"),
|
||||
},
|
||||
destination_folder: args.destination_folder,
|
||||
include_used_assets: args.include_used_assets,
|
||||
assets_folders: args.assets_folders,
|
||||
ignored_extensions: args.ignored_extensions,
|
||||
build_targets: args.build_targets,
|
||||
selected_build_target: 0,
|
||||
run_after_build: args.run_after_build,
|
||||
open_destination_folder: args.open_destination_folder,
|
||||
convert_assets: args.convert_assets,
|
||||
enable_optimization: args.enable_optimization,
|
||||
};
|
||||
|
||||
let resource_manager = ResourceManager::new(Arc::new(FsResourceIo), Arc::new(TaskPool::new()));
|
||||
fyrox_build_tools::export::export(options, Default::default(), resource_manager).unwrap();
|
||||
}
|
||||
@@ -22,7 +22,6 @@ use cargo_metadata::camino::Utf8Path;
|
||||
use fyrox_core::{
|
||||
err,
|
||||
log::{Log, MessageKind},
|
||||
platform::TargetPlatform,
|
||||
reflect::prelude::*,
|
||||
};
|
||||
use fyrox_resource::manager::ResourceManager;
|
||||
@@ -36,6 +35,8 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
pub use fyrox_core::platform::TargetPlatform;
|
||||
|
||||
pub mod android;
|
||||
pub mod asset;
|
||||
pub mod pc;
|
||||
|
||||
Reference in New Issue
Block a user