-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11f8f81
commit a57dc03
Showing
5 changed files
with
134 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// BEGIN - Legion Labs lints v0.6 | ||
// do not change or add/remove here, but one can add exceptions after this | ||
// section | ||
#![deny(unsafe_code)] | ||
#![warn(future_incompatible, nonstandard_style, rust_2018_idioms)] | ||
// Rustdoc lints | ||
#![warn( | ||
rustdoc::broken_intra_doc_links, | ||
rustdoc::missing_crate_level_docs, | ||
rustdoc::private_intra_doc_links | ||
)] | ||
// Clippy pedantic lints, treat all as warnings by default, add exceptions in allow list | ||
#![warn(clippy::pedantic)] | ||
#![allow( | ||
clippy::cast_possible_truncation, | ||
clippy::cast_sign_loss, | ||
clippy::if_not_else, | ||
clippy::items_after_statements, | ||
clippy::missing_panics_doc, | ||
clippy::module_name_repetitions, | ||
clippy::must_use_candidate, | ||
clippy::similar_names, | ||
clippy::shadow_unrelated, | ||
clippy::unreadable_literal, | ||
clippy::unseparated_literal_suffix | ||
)] | ||
// Clippy nursery lints, still under development | ||
#![warn( | ||
clippy::debug_assert_with_mut_call, | ||
clippy::disallowed_method, | ||
clippy::disallowed_type, | ||
clippy::fallible_impl_from, | ||
clippy::imprecise_flops, | ||
clippy::mutex_integer, | ||
clippy::path_buf_push_overwrite, | ||
clippy::string_lit_as_bytes, | ||
clippy::use_self, | ||
clippy::useless_transmute | ||
)] | ||
// Clippy restriction lints, usually not considered bad, but useful in specific cases | ||
#![warn( | ||
clippy::dbg_macro, | ||
clippy::exit, | ||
clippy::float_cmp_const, | ||
clippy::map_err_ignore, | ||
clippy::mem_forget, | ||
clippy::missing_enforced_import_renames, | ||
clippy::rest_pat_in_fully_bound_structs, | ||
clippy::string_to_string, | ||
clippy::todo, | ||
clippy::unimplemented, | ||
clippy::verbose_file_reads | ||
)] | ||
// END - Legion Labs lints v0.6 | ||
// crate-specific exceptions: | ||
#![allow()] | ||
|
||
use std::env; | ||
|
||
use lgn_data_compiler::compiler_api::{multi_compiler_main, CompilerError}; | ||
|
||
fn main() -> Result<(), CompilerError> { | ||
multi_compiler_main(env::args(), lgn_ubercompiler::create()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use lgn_data_compiler::{compiler_api::CompilationEnv, compiler_cmd, Locale, Platform, Target}; | ||
|
||
static UBERCOMPILER_EXE: &str = env!("CARGO_BIN_EXE_compiler-ubercompiler"); | ||
|
||
#[test] | ||
fn test() { | ||
// list all compiler info. | ||
let info_output = { | ||
let info_cmd = lgn_data_compiler::compiler_cmd::CompilerInfoCmd::default(); | ||
let info_output = info_cmd | ||
.execute(UBERCOMPILER_EXE) | ||
.expect("valid output") | ||
.take(); | ||
|
||
assert!(info_output.len() > 1); | ||
info_output | ||
}; | ||
|
||
let env = CompilationEnv { | ||
target: Target::Game, | ||
platform: Platform::Windows, | ||
locale: Locale::new("en"), | ||
}; | ||
|
||
// get hashes for all compilers | ||
{ | ||
let all_hash_cmd = compiler_cmd::CompilerHashCmd::new(&env, None); | ||
|
||
let all_hash_output = all_hash_cmd | ||
.execute(UBERCOMPILER_EXE) | ||
.expect("valid output"); | ||
|
||
assert!(all_hash_output.compiler_hash_list.len() >= info_output.len()); | ||
} | ||
|
||
// get hash of a single selected transform | ||
{ | ||
let selected_transform = info_output[0].transform; | ||
let single_hash_cmd = compiler_cmd::CompilerHashCmd::new(&env, Some(selected_transform)); | ||
let single_hash_output = single_hash_cmd | ||
.execute(UBERCOMPILER_EXE) | ||
.expect("valid output"); | ||
|
||
assert!(!single_hash_output.compiler_hash_list.is_empty()); | ||
for (transform, _) in single_hash_output.compiler_hash_list { | ||
assert_eq!(transform, selected_transform); | ||
} | ||
} | ||
} |