Skip to content

Commit

Permalink
Merge pull request #22 from VirxEC/no-hack
Browse files Browse the repository at this point in the history
Drop deprecated proc-macro-hack
  • Loading branch information
SOF3 authored Oct 14, 2023
2 parents 4d79700 + a0aed34 commit e718682
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 33 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ members = [".", "codegen-exports", "codegen"]

[package]
name = "include-flate"
version = "0.2.0"
version = "0.3.0"
authors = ["SOFe <sofe2038@gmail.com>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/SOF3/include-flate.git"
homepage = "https://github.com/SOF3/include-flate"
Expand All @@ -14,12 +14,12 @@ categories = ["compression", "rust-patterns", "memory-management"]
keywords = ["compression", "deflate", "macro", "include", "assets"]

[dependencies]
include-flate-codegen-exports = { version = "0.1.4", path = "codegen-exports" }
lazy_static = "1.3"
libflate = "1.0.0"
include-flate-codegen-exports = { version = "0.2.0", path = "codegen-exports" }
lazy_static = "1.3.0"
libflate = "2.0.0"

[badges]
travis-ci = {repository = "SOF3/include-flate"}

[features]
stable = ["include-flate-codegen-exports/stable"]
stable = []
10 changes: 3 additions & 7 deletions codegen-exports/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
[package]
name = "include-flate-codegen-exports"
version = "0.1.4"
version = "0.2.0"
authors = ["SOFe <sofe2038@gmail.com>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/SOF3/include-flate.git"
homepage = "https://github.com/SOF3/include-flate"
description = "Macro codegen for the include-flate crate"

[dependencies]
include-flate-codegen = { version = "0.1.4", path = "../codegen" }
proc-macro-hack = "0.5.9"

[features]
stable = ["include-flate-codegen/stable"]
include-flate-codegen = { version = "0.2.0", path = "../codegen" }
3 changes: 0 additions & 3 deletions codegen-exports/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#[cfg_attr(feature = "stable", proc_macro_hack::proc_macro_hack)]
pub use include_flate_codegen::deflate_file;

#[cfg_attr(feature = "stable", proc_macro_hack::proc_macro_hack)]
pub use include_flate_codegen::deflate_utf8_file;
10 changes: 3 additions & 7 deletions codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "include-flate-codegen"
version = "0.1.4"
version = "0.2.0"
authors = ["SOFe <sofe2038@gmail.com>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/SOF3/include-flate.git"
homepage = "https://github.com/SOF3/include-flate"
Expand All @@ -12,11 +12,7 @@ description = "Macro codegen for the include-flate crate"
proc-macro = true

[dependencies]
libflate = "1.0.0"
proc-macro-hack = { version = "0.5.9", optional = true }
libflate = "2.0.0"
proc-macro2 = "1.0.9"
quote = "1.0.2"
syn = { version = "2.0.2", features = ["full"] }

[features]
stable = ["proc-macro-hack"]
8 changes: 2 additions & 6 deletions codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![cfg_attr(not(feature = "stable"), feature(proc_macro_span))]

extern crate proc_macro;

use std::fs::File;
Expand Down Expand Up @@ -43,8 +41,7 @@ use syn::{Error, LitByteStr, LitStr, Result};
/// # Compile errors
/// - If the argument is not a single literal
/// - If the referenced file does not exist or is not readable
#[cfg_attr(feature = "stable", proc_macro_hack::proc_macro_hack)]
#[cfg_attr(not(feature = "stable"), proc_macro)]
#[proc_macro]
pub fn deflate_file(ts: TokenStream) -> TokenStream {
match inner(ts, false) {
Ok(ts) => ts.into(),
Expand All @@ -57,8 +54,7 @@ pub fn deflate_file(ts: TokenStream) -> TokenStream {
/// # Compile errors
/// - The compile errors in `deflate_file!`
/// - If the file contents are not all valid UTF-8
#[cfg_attr(feature = "stable", proc_macro_hack::proc_macro_hack)]
#[cfg_attr(not(feature = "stable"), proc_macro)]
#[proc_macro]
pub fn deflate_utf8_file(ts: TokenStream) -> TokenStream {
match inner(ts, true) {
Ok(ts) => ts.into(),
Expand Down
2 changes: 1 addition & 1 deletion tests/base64-raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pub static DATA: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/asset

#[test]
fn test() {
verify_str("base64.txt", &DATA);
verify_str("base64.txt", DATA);
}
2 changes: 1 addition & 1 deletion tests/ff-raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pub static DATA: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/as

#[test]
fn test() {
verify("ff.dat", &DATA);
verify("ff.dat", DATA);
}
2 changes: 1 addition & 1 deletion tests/random-raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pub static DATA: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/as

#[test]
fn test() {
verify("random.dat", &DATA);
verify("random.dat", DATA);
}
2 changes: 1 addition & 1 deletion tests/zero-raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ pub static DATA: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/as

#[test]
fn test() {
verify("zero.dat", &DATA);
verify("zero.dat", DATA);
}

0 comments on commit e718682

Please sign in to comment.