-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Port DNX "scripts" concept #4407
Comments
I had an even crazier idea last night. dotnet command runs dotnet-command Which will run the script pre{command}, dotnet-{command}, post{command}. Might not work well in all scenarios as context is required. But it's worth thinking about. |
Yeah... I think that's getting a little more complicated that we want though. Worth thinking about |
I like it. Code will be simpler and project.json will be easier to parse by humans. Having 4 top-level nodes [compile, pack, restore, publish] is much easier to reason about than 8. |
@Sridhar-MS, I think you were starting to look at this issue as well. |
also added a postcompile script to each project to place the outputs in the right folder fixes #237
@piotrpMSFT There would still be |
Let's take expansion of this behavior offline or to a new thread though. I've submitted a PR to add the infrastructure and |
@anurse yep, I understand the proposal. Though it's more text, I think grouping pre/post scripts around their commands makes the overall experience easier to understand. |
I agree with @piotrpMSFT but I guess it will involve changing the project.json schema. |
So are you talking about a possible restructuring of the schema? Something like {
"scripts": {
"compile": {
"before": [ ... ],
"after": [ ... ]
},
...
}
} If we're going to do that, maybe we change the top-level property name. Thoughts @davidfowl ? |
right. |
Ok, I'll let this issue represent the initial port of the code and the |
agreed. |
also added a postcompile script to each project to place the outputs in the right folder fixes #237
@anurse did you already open that issue for the generalization? |
DNX has a useful
scripts
construct where scripts can be assigned to run during certain lifecycle events in thednu build/pack/restore
pipelines. We should migrate that concept todotnet
. It is extremely useful for things like incremental compilation ofdotnet
itself where compiling an individual project can copy the resulting binary into your previous full build so that you don't have to rebuild the whole stack.It works by adding a scripts section of the following form:
On each event, the scripts in the array are executed in sequence. The scripts can also contain variable replacements in the CMD format (
%variable%
; this syntax is used even on Unix, since we do the replacement before passing to the shell). Available variables depend on the script, but some examples include%project:ProjectDirectory%
which gives the absolute file system path of the project and%compile:TargetFramework%
or%compile:Configuration%
which give the full framework name and configuration (respectively) currently being compiled.Events include:
precompile
: Run after generating the RSP file, and provided the RSP file for potential modificationpostcompile
: Run after the compiler, and provided the path to the output managed binaryprepack
: Run before packing compiled output into a nuget packagepostpack
: Run after packing output into a nuget package and provided the path to the output packageprerestore
: Run beforedotnet restore
/nuget restore
postrestore
: Run afterdotnet restore
/nuget restore
(often used to tie in other package managers like npm and bower)/cc @davidfowl
The text was updated successfully, but these errors were encountered: