Comments (8)
Done. Sorry that it took so long to get me convinced.
from invoke-build.
Hi,
Thank you for the response and I'm sorry for delay.
The reason I ask for adding the module definition lays exactly in the difference between the purpose of usage. It is more convenient to use nuget.org in development environment (like visual studio). All the dependence of the solution's projects can be expressed in package.conifg for both, code, and development used for improving build process. The second one type of relation is the place where Invoke-Build fit very well.
Unfortunately treating it as the script provide less readable and structure of the build process. From the other hand using it as pure module, from powershell gallery, require additional effort to configure environment. This include both the developer machine and build server.
So what we get use the nuget.org as the structure in development environment:
- consistent way of managing all project dependencies, by package.config just like npm in node
- simple way of restoring the development environment. We can use automatic restore packages during build, using UI of the IDE as well as nuget.exe restore in solution folder. Most of automated build tools like TeamCity, Jenkis can also trigger restoring before starting other tasks.
- powershell can be used as the fill the gap, of the msbuild, in the area of describing the full process or CI
I looked at the projects that use the PowerShell and Invoke-Build for this approach. All of share the same problem with lack of standard way of dealing with PowerShell extensions. One are scripts and other are modules. So the code is mix of fallowing lines:
- Import-Module (Find-Item '../packages/pester.*/pester.psm1')
- & (Find-Item '../packages/Invoke-Build.*/Invoke-Build.ps1') -....
Both are hacks rather the real solution. What I found usefull si the #Requires statement. To be more detailed -Module option. This allow to write scripts in this form: #Requires -Modules pester,invoke-build,...
To make it work with packages.config and automatic nuget restoring, based on OneBuild, very simple bootstrap script that do the fallowing:
- restore nuget packages
- extend Install-Module so first it search packages folder for modules and only if not found use the standard Install-Module rutine.
- execute script that has the
#Requires
statement.
Of course and enrich manual the nuget packages that do not have the module definition with the psd1/psm1 files. As the result I found that I got fallowing results:
- the final scripts can be started using bootstrap script, and from powershell command line if the modules ware installed globally.
- using bootstrap script started on CI server create consistent workspace for the time of running CI process.
I think that there is the place for both packages, gallery and nuget.org, because they serves the same module to different audiences. The difference is only in the package file organization. It hard to tell that it will be unified one day, but this is yest another story :).
I like the way Invoke-Build allow to organize process. I do not fully understand the script approach in nuget.org package, but agree that if peoples will see the psd1 they could first threat is as the module first.
I hope you will find my explanation useful to think about it.
Thanks
from invoke-build.
Hi Bart,
Thank you for the suggestion. Could you please provide some more reasoning?
Here is what we have. There are two packages:
- A module at PowerShell Gallery, the modern place specifically designed for PowerShell modules.
- Scripts at nuget.org, the place for all kind of stuff, also used for PowerShell because there was not much choice.
Thus, we have a module package that you are asking for. If you need a module
then use (1). If some people prefer scripts then they use (2).
So there is a choice and I think this is a good thing. Note that Invoke-Build
is a script in the first place, not a module, and I would like to emphasize
this important fact and encourage using it as a script.
from invoke-build.
Please feel free to reopen with more input.
from invoke-build.
@BartDubois, thank you for the detailed answer and useful explanation. I promise to think of this. It is so simple to add two files to the package, indeed. I just feel some "smell" and have doubts.
from invoke-build.
@nightroman thanks.
from invoke-build.
Hi @BartDubois,
I am reopening this. The next version of the "script" package will include module files, just as you suggested. I do not see any real drawbacks, after all.
from invoke-build.
No problem. Thank you.
from invoke-build.
Related Issues (20)
- Amend output on task errors.
- Reusing or sharing tasks HOT 5
- ib.cmd ? ignores a specified file
- vscode outline view: no symbols found in document HOT 2
- Different module and package versions HOT 2
- Parallel execution based on dependency tree HOT 2
- invoke-build discovery fails in powershell container HOT 3
- Please consider adding -Computername and -Session parameter to Task HOT 8
- GitHub action output is not colored
- Color and formatting text in Azure DevOps Pipelines HOT 8
- Use-BuildEnv should make parameters mandatory
- Invoke-BuildExec spitting out service principal secret as current directory HOT 6
- Exec doesn't work well with forward slash arguments HOT 7
- Use `[System.Management.Automation.Cmdlet]::CommonParameters` to get the names of all common parameters HOT 3
- Task condition does not work HOT 8
- Build-Parallel writes only to Output stream HOT 7
- property 'File' cannot be found on this object HOT 17
- Do not wrap internal errors in Resolve-MSBuild
- Fix cryptic errors on unknown parameters
- Invoke-BuildExec should pass the original stderr error to the thrown terminating error HOT 38
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from invoke-build.