Skip to content

Add options to control recompilation #8

@JustusAdam

Description

@JustusAdam

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions