-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pretty-close-to-build-rs #188
Conversation
@rcoh I'm finally getting around to reading this -- is it possible you forgot to add |
Moves javap into build.rs. Error handling works pretty well. There is one missing piece to also capture `#[java...]` derives since those must also be reflected in build.rs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me -- I was removing eprintln!
statements but I realized maybe you're not quite ready for this to land.
duchess-build-rs/src/derive_java.rs
Outdated
reflector: &mut duchess_reflect::reflect::JavapReflector, | ||
) -> anyhow::Result<bool> { | ||
let mut watch_file = false; | ||
eprintln!("Looking for derive(java) in {:?}", rs_file.path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eprintln!("Looking for derive(java) in {:?}", rs_file.path); |
duchess-build-rs/src/derive_java.rs
Outdated
let mut watch_file = false; | ||
eprintln!("Looking for derive(java) in {:?}", rs_file.path); | ||
for capture in re::java_derive().captures_iter(&rs_file.contents) { | ||
eprintln!("Debug: found derive(java) in {:?}", rs_file.path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eprintln!("Debug: found derive(java) in {:?}", rs_file.path); |
pub fn process_file(rs_file: &File, reflector: &mut JavapReflector) -> anyhow::Result<bool> { | ||
let mut watch_file = false; | ||
for capture in re::java_package().captures_iter(&rs_file.contents) { | ||
eprintln!("Debug: found java macro in {:?}", rs_file.path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eprintln!("Debug: found java macro in {:?}", rs_file.path); |
Yeah I have a revision locally that changes them to optional warnings so
you can see them in cargo. Will push that this morning
…On Thu, Dec 26, 2024, 10:29 AM Niko Matsakis ***@***.***> wrote:
***@***.**** approved this pull request.
This makes sense to me -- I was removing eprintln! statements but I
realized maybe you're not quite ready for this to land.
------------------------------
In duchess-build-rs/src/derive_java.rs
<#188 (comment)>:
> +use duchess_reflect::{
+ argument::MethodSelector,
+ parse::{Parse, Parser},
+ reflect::Reflect,
+};
+use proc_macro2::Span;
+use syn::{parse::ParseStream, Attribute};
+
+use crate::re;
+
+pub(crate) fn process_file(
+ rs_file: &crate::files::File,
+ reflector: &mut duchess_reflect::reflect::JavapReflector,
+) -> anyhow::Result<bool> {
+ let mut watch_file = false;
+ eprintln!("Looking for derive(java) in {:?}", rs_file.path);
⬇️ Suggested change
- eprintln!("Looking for derive(java) in {:?}", rs_file.path);
------------------------------
In duchess-build-rs/src/derive_java.rs
<#188 (comment)>:
> + parse::{Parse, Parser},
+ reflect::Reflect,
+};
+use proc_macro2::Span;
+use syn::{parse::ParseStream, Attribute};
+
+use crate::re;
+
+pub(crate) fn process_file(
+ rs_file: &crate::files::File,
+ reflector: &mut duchess_reflect::reflect::JavapReflector,
+) -> anyhow::Result<bool> {
+ let mut watch_file = false;
+ eprintln!("Looking for derive(java) in {:?}", rs_file.path);
+ for capture in re::java_derive().captures_iter(&rs_file.contents) {
+ eprintln!("Debug: found derive(java) in {:?}", rs_file.path);
⬇️ Suggested change
- eprintln!("Debug: found derive(java) in {:?}", rs_file.path);
------------------------------
In duchess-build-rs/src/java_package_macro.rs
<#188 (comment)>:
>
-pub fn process_macro(compiler: &JavaCompiler, file: &File, offset: usize) -> anyhow::Result<()> {
- let the_impl: JavaPackageMacro = syn::parse_str(file.rust_slice_from(offset))
- .with_context(|| format!("{} failed to parse java_package macro", file.slug(offset),))?;
+pub fn process_file(rs_file: &File, reflector: &mut JavapReflector) -> anyhow::Result<bool> {
+ let mut watch_file = false;
+ for capture in re::java_package().captures_iter(&rs_file.contents) {
+ eprintln!("Debug: found java macro in {:?}", rs_file.path);
⬇️ Suggested change
- eprintln!("Debug: found java macro in {:?}", rs_file.path);
—
Reply to this email directly, view it on GitHub
<#188 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADYKZ56VOE7XITGLKLI6ST2HQOGRAVCNFSM6AAAAABROLJVKWVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKMRTGI4DQNJWGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Moves javap into build.rs. Error handling works pretty well. There is one missing piece to also capture
#[java...]
derivessince those must also be reflected in build.rs.