duchess-rs / duchess

Silky smooth Java-Rust interop

Home Page:https://duchess-rs.github.io/duchess/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build java files in build.rs

nikomatsakis opened this issue · comments

We should really build the java files used by tests and examples in a build.rs step instead of checking in .class files into the repository.

Mentoring instructions

I'm not sure the 100% best approach but I imagine a build.rs that walks through the java directory, looking at each .java file and comparing its date/time to the corresponding .class file, then invoking javac on it if anything has changed. Or maybe just javac */*.java if anything has changed anywhere. Maybe there are nice Rust utility crates for doing this? We could of course shell out to Make, but I don't want to add that dependency on the system environment. We already depend on javap being on the path, so calling javac seems fine.

We have to modify gitignore to exclude .class files.

Bonus points would be to write the class files into the target directory in some suitable place.

I've always wanted to get familiar with build.rs. Let me take a look at this