mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Use the recommended layout for proc macros
This commit is contained in:
parent
af0cf7170e
commit
f3e3c243a4
|
@ -6,7 +6,11 @@ license = "MPL-2.0"
|
||||||
description = "Library for playing tracker music. Designed for use with the agb library for the Game Boy Advance."
|
description = "Library for playing tracker music. Designed for use with the agb library for the Game Boy Advance."
|
||||||
repository = "https://github.com/agbrs/agb"
|
repository = "https://github.com/agbrs/agb"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["xm"]
|
||||||
|
xm = ["dep:agb_xm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
agb_xm = { version = "0.15.0", path = "../agb-xm" }
|
agb_xm = { version = "0.15.0", path = "../agb-xm", optional = true }
|
||||||
agb = { version = "0.15.0", path = "../../agb" }
|
agb = { version = "0.15.0", path = "../../agb" }
|
||||||
agb_tracker_interop = { version = "0.15.0", path = "../agb-tracker-interop", default-features = false }
|
agb_tracker_interop = { version = "0.15.0", path = "../agb-tracker-interop", default-features = false }
|
15
tracker/agb-xm-core/Cargo.toml
Normal file
15
tracker/agb-xm-core/Cargo.toml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[package]
|
||||||
|
name = "agb_xm_core"
|
||||||
|
version = "0.15.0"
|
||||||
|
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
||||||
|
edition = "2021"
|
||||||
|
license = "MPL-2.0"
|
||||||
|
description = "Library for converting XM tracker files for use with agb-tracker on the Game Boy Advance. You shouldn't use this package directly"
|
||||||
|
repository = "https://github.com/agbrs/agb"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
proc-macro-error = "1"
|
||||||
|
proc-macro2 = "1"
|
||||||
|
quote = "1"
|
||||||
|
|
||||||
|
agb_tracker_interop = { version = "0.15.0", path = "../agb-tracker-interop" }
|
14
tracker/agb-xm-core/src/lib.rs
Normal file
14
tracker/agb-xm-core/src/lib.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
use proc_macro2::TokenStream;
|
||||||
|
use proc_macro_error::abort;
|
||||||
|
|
||||||
|
use quote::quote;
|
||||||
|
|
||||||
|
pub fn agb_xm_core(args: TokenStream) -> TokenStream {
|
||||||
|
if args.is_empty() {
|
||||||
|
abort!(args, "must pass a filename");
|
||||||
|
}
|
||||||
|
|
||||||
|
quote! {
|
||||||
|
fn hello_world() {}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,10 +4,13 @@ version = "0.15.0"
|
||||||
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
authors = ["Gwilym Kuiper <gw@ilym.me>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
description = "Library for converting XM tracker files for use with agb-tracker on the Game Boy Advance"
|
description = "Library for converting XM tracker files for use with agb-tracker on the Game Boy Advance. You shouldn't use this package directly"
|
||||||
repository = "https://github.com/agbrs/agb"
|
repository = "https://github.com/agbrs/agb"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
agb_xm_core = { version = "0.15.0", path = "../agb-xm-core" }
|
||||||
|
proc-macro-error = "1"
|
||||||
|
proc-macro2 = "1"
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
fn add(left: usize, right: usize) -> usize {
|
use proc_macro::TokenStream;
|
||||||
left + right
|
use proc_macro_error::proc_macro_error;
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[proc_macro_error]
|
||||||
mod tests {
|
#[proc_macro]
|
||||||
use super::*;
|
pub fn import_xm(args: TokenStream) -> TokenStream {
|
||||||
|
agb_xm_core::agb_xm_core(args.into()).into()
|
||||||
#[test]
|
|
||||||
fn it_works() {
|
|
||||||
let result = add(2, 2);
|
|
||||||
assert_eq!(result, 4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue