Skip to content
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

Add options to control recompilation #8

Open
JustusAdam opened this issue Aug 12, 2023 · 0 comments
Open

Add options to control recompilation #8

JustusAdam opened this issue Aug 12, 2023 · 0 comments

Comments

@JustusAdam
Copy link
Contributor

It would be super useful if the plugin could specify a recompilation policy.

Possible useful policies I can think if could be

  • Always recompile
  • Recompile if arguments/configuration changes
  • Recompile if plugin defined state changes
  • Default rustc behavior

Either of these policies may then also apply to dependencies or the workspace.

A definition of a policy could look something like this

enum RecompilationPolicy<Plugin> {
    /// Recompile every time the tool is run
    Always,
    /// Spiritually the same as `WhenStateChanges(Hash::hash)`
    WhenArgsChange,
    /// Recompile when the state changes. Change here is defined as the
    /// arguments and potentially external state (hence the function pointer to
    /// fetch external state) hashes to a new value.
    /// 
    /// Can also be used to only depend on a subset of the arguments.
    WhenStateChanges(for<'a> fn (&'a Plugin::Args) -> u64),
    Rustc
}

Then RustcPluginArgs could have two fields for the recompilation policy for the workspace and the dependencies respectively, both of type RecompilationPolicy.

@JustusAdam JustusAdam changed the title Add option to control recompilation Add options to control recompilation Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant