psake / PowerShellBuild

Common build tasks for psake and Invoke-Build that build and test PowerShell modules
MIT License
134 stars 24 forks source link

builds fail when attempting to compile monolithic .psm1 file via $PSBPreference.Build.CompileModule = $true #33

Closed joeypiccola closed 5 years ago

joeypiccola commented 5 years ago

When setting $PSBPreference.Build.CompileModule = $true in the properties block of a psakeFile.ps1 generated from the Plaster Stucco template v0.1.1 an error is generated.

Expected Behavior

PowerShellBuild should be correctly passed $true via $PSBPreference.Build.CompileModule and proceed to compile a monolithic .psm1 file in the build output directory.

Current Behavior

The following error is generated.

Task: CLEAN
Task: STAGEFILES
Task: GENERATEMARKDOWN
Error: 9/9/2019 11:03:07 PM:
At C:\gits\psmeetup\oldmod\issuemodule\Output\issuemodule\0.1.0\issuemodule.psm1:2 char:14 + ... public  = @(Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -Child ... +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Cannot find path 'C:\gits\psmeetup\oldmod\issuemodule\Output\issuemodule\0.1.0\public\' because it does not exist.

Possible Solution

In testing it appears deleteing the contents of the Plater \ Stucco generated .psm1 file allows the build to complete and a monolithic .psm1 is generated in the build output directory.

Steps to Reproduce (for bugs)

Ensure development modules are current.

Get-Module plaster, stucco -ListAvailable | select name, version
Name    Version
----    -------
Plaster 1.1.3
Stucco  0.1.1
  1. Get stucco template. $template = Get-PlasterTemplate -IncludeInstalledModules | Where-Object TemplatePath -Match 'Stucco'
  2. Invoke plaster with stucco template. Invoke-Plaster -TemplatePath $template.TemplatePath
  3. Run through plaster prompts.
  4. Modify generated psakeFile.ps1 properties block set the value for $PSBPreference.Build.CompileModule from $false to $true.
    properties {
    # Disable "compiling" module into monolithinc PSM1.
    # This modifies the default behavior from the "Build" task
    # in the PowerShellBuild shared psake task module
    $PSBPreference.Build.CompileModule = $true
    }
  5. Run build. ./build.ps1 -Bootstrap

Context

Unable to generate a monolithic .psm1 file due to build erroring out.

Your Environment

pauby commented 5 years ago

The same as #25 ? There is a PR in to fix this.

joeypiccola commented 5 years ago

@pauby Yes, totally a duplicate of #25. Erg, sorry. Closing closing...