Skip to content

WIP: Add Mirage_job to wrap Bos actions#930

Closed
emillon wants to merge 1 commit intomirage:masterfrom
emillon:mirage-job
Closed

WIP: Add Mirage_job to wrap Bos actions#930
emillon wants to merge 1 commit intomirage:masterfrom
emillon:mirage-job

Conversation

@emillon
Copy link
Copy Markdown
Contributor

@emillon emillon commented Oct 6, 2018

This adds a module that wraps some Bos actions to add a "dry run" mode. The goal is to expose some of these actions and test them at a high level. (this is not intended to implement a --dry-run flag)

The implementation is based on the free monad pattern used in OpamProcess.Job and explained in [this article]. A list of files is passed to the "dry run" evaluator, which is used to keep track of a static approximation of the file system. This is used for example to determine which value is returned by exists.

The (>>=) from Rresult.R is replaced by a new one in Mirage_job, which means that the conversion is pretty straightforward (that code was monadic already).

As for other similar PRs I have opened, I have some questions as to how to make this not impact the API too much:

  • where should the jobs be defined? At the moment I just exposed configure behind a (**/**), but this does not feel too great.
  • would it make sense to move this to a separate library? Maybe after all similar code has been converted?

Let me know what you think. Thanks!

@emillon
Copy link
Copy Markdown
Contributor Author

emillon commented Oct 6, 2018

(cc @samoht)

@Drup
Copy link
Copy Markdown
Member

Drup commented Oct 7, 2018

This is nice. I would actually put this directly in Functoria instead of Mirage. Maybe just ask for a job in the configure/build/clean actions ? You can then remove some of the ceremony and extend the API to cover all the required bits. It also has the advantage of having more structure for those actions.

For Mirage.configure, I'm not sure we really have a choice. Maybe add some documentation that this function is exposed for testing purposes.

@emillon
Copy link
Copy Markdown
Contributor Author

emillon commented Oct 7, 2018

I'll try that. Most of the jobs are defined in functoria objects, so it might make sense to have a build_job and build that by default calls run self#build_job. If we go that way this means that we'll have to expose the actual configurable rather than the impl (in a separate module like Mirage_crunch etc maybe), but that seems better to me.

@Drup
Copy link
Copy Markdown
Member

Drup commented Oct 7, 2018

I was rather thinking of simply changing the type of build (and others) directly, instead of having two methods. It breaks compat, but it's probably worth it.

samoht added a commit to samoht/mirage that referenced this pull request Mar 6, 2020
samoht added a commit to samoht/mirage that referenced this pull request Mar 9, 2020
samoht added a commit to samoht/mirage that referenced this pull request Mar 10, 2020
samoht added a commit to samoht/mirage that referenced this pull request Mar 10, 2020
samoht added a commit to samoht/mirage that referenced this pull request Mar 10, 2020
samoht added a commit to samoht/mirage that referenced this pull request Mar 12, 2020
samoht added a commit to samoht/mirage that referenced this pull request Mar 12, 2020
Initial draft implementation from @emillon (mirage#930)
samoht added a commit to samoht/mirage that referenced this pull request Mar 12, 2020
Initial draft implementation from @emillon (mirage#930)
samoht added a commit to samoht/mirage that referenced this pull request Mar 12, 2020
Initial draft implementation from @emillon (mirage#930)
@samoht
Copy link
Copy Markdown
Member

samoht commented Mar 14, 2020

Superseeded by #1077

@samoht samoht closed this Mar 14, 2020
samoht added a commit to samoht/mirage that referenced this pull request Mar 14, 2020
Initial draft implementation from @emillon (mirage#930)
samoht added a commit to samoht/mirage that referenced this pull request Mar 14, 2020
Initial draft implementation from @emillon (mirage#930)
samoht added a commit to samoht/mirage that referenced this pull request Mar 14, 2020
Initial draft implementation from @emillon (mirage#930)
samoht added a commit to samoht/mirage that referenced this pull request Mar 14, 2020
Initial draft implementation from @emillon (mirage#930)
samoht added a commit to samoht/mirage that referenced this pull request Mar 15, 2020
Initial draft implementation from @emillon (mirage#930)
samoht added a commit to samoht/mirage that referenced this pull request Mar 15, 2020
Initial draft implementation from @emillon (mirage#930)
@emillon
Copy link
Copy Markdown
Contributor Author

emillon commented Mar 16, 2020

Thanks for taking care of this @samoht !

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

Successfully merging this pull request may close these issues.

3 participants