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

Introduce new verb between compile and publish / Allow users to add functionality between verbs #4584

Closed
cdmihai opened this issue Dec 15, 2015 · 5 comments
Milestone

Comments

@cdmihai
Copy link
Contributor

cdmihai commented Dec 15, 2015

There's a set of build functionality which sits somewhere between compile and publish:

  • the logic in the current post compile place-binaries scripts
  • setting the right file permissions per OS per file
  • sign?
  • analyze?
  • fxcop?

I suggest we introduce a new build verb between compile and publish that covers this responsibility (possible names: deploy, post-build, pre-publish).

A quick scan of issues that will benefit from this:

@davidfowl
Copy link
Member

This is what scripts are for. How would this verb work?

@cdmihai
Copy link
Contributor Author

cdmihai commented Dec 17, 2015

I think the problem needs to be split in 2:

  1. functionality that absolutely has to be there and CLI should implement it in c#, within the new deploy verb (or maybe even a PostRestore verb). For example: copying compiler output, setting the right permissions per OS, etc
  2. arbitrary functionality that users want to run after / before the compilation phase. These represent extension points into the CLI and we need to define some kind of model for it. We could:
  • define an interface that users have to implement and then deploy picks it up (like ITask in msbuild). This means that we'd have PreBuild / PostRestore style verbs that scan for user provided ITasks (IDotnetVerbs?) and run them
  • use an analogy of msbuild's BeforeBuild and AfterBuild targets, In CLI's current model where the unit of execution is the script on PATH that starts with "dotnet-", this would translate into users creating dotnet-prebuild and dotnet-postbuild commands that would aggregate the arbitrary functionality.

Whatever the implementation decision, in the current CLI model these arbitrary scripts that can do anything should not be invoked from within the execution of built-in CLI verbs (restore, build, compile, run, publish, etc) but should be aggregated in special phases that have the explicit semantics of running user provided functionality. If they are not separated from built-in verbs and contained, CLI would be prone to hard to debug crashes since the happy path of each built-in CLI verb would risk being perturbed by the scripts they invoke during their own execution. This problem is not entirely removed by moving the arbitrary user scripts between built-in verbs, but at least it makes things a bit more sane and debugable.

@cdmihai
Copy link
Contributor Author

cdmihai commented Dec 23, 2015

I see that issue #4407 discussed problem nr. 2 from my previous post: introducing a generic mechanism which allows users to hook up event listeners (or just script runs) on pre / post dotnet verb execution.

This is different from problem 1. for which we need to create a deploy verb that performs actions which most / all projects need (maybe configurable through project.json or flags).

@ghost
Copy link

ghost commented Dec 23, 2015

Having PreCompile and PostCompile scripts tightly wrapping each actual compiler invocation is problematic for reliable incrementality, so we need to offer something better.

Options are a separate "deploy" verb that runs deployment scripts, or a new concept of a PostBuild script that runs after the entire build is done.

If the goal of the CLI is to tease apart pieces of functionality that are logically different, then I feel that a "deploy" verb would be the cleanest approach. But it's also confusing to have "deploy" and "publish" --- what's the difference? That would speak for PostBuild or PrePublish script. If we expect these scripts to be or become somewhat involved, then maybe PostBuild would be best, and one day we might enhance the "build" verb to perform the tasks that PostBuild scripts tend to do, but in a way that supports incrementality. If we expect the scripts to always remain shallow, than a PrePublish script might be better.

@cdmihai cdmihai changed the title Introduce new verb between compile and publish Introduce new verb between compile and publish / Allow users to add functionality between verbs Jan 4, 2016
@TheRealPiotrP
Copy link
Contributor

The team is actively working on enabling MSBuild and the component affected will be superseded by the new project system, so I am closing this issue.

wli3 referenced this issue in wli3/cli Jul 14, 2017
Adding ClassLibrary (.NET Core) and Creating new VSIX for ClassLibrary (.NET Standard)
@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the Backlog milestone Jan 31, 2020
rainersigwald pushed a commit that referenced this issue Jul 20, 2020
* Update dependencies from https://github.com/microsoft/msbuild build 20200521.1

Microsoft.Build.Localization , Microsoft.Build
 From Version 16.7.0-preview-20270-03 -> To Version 16.7.0-preview-20271-01

* Update dependencies from https://github.com/microsoft/msbuild build 20200521.2

Microsoft.Build.Localization , Microsoft.Build
 From Version 16.7.0-preview-20270-03 -> To Version 16.7.0-preview-20271-02

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants