Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Fix#240/add build step to construct psm1 #242

Merged
merged 20 commits into from
Apr 3, 2018
Merged

Fix#240/add build step to construct psm1 #242

merged 20 commits into from
Apr 3, 2018

Conversation

Benny1007
Copy link
Contributor

No description provided.

@Benny1007
Copy link
Contributor Author

Benny1007 commented Mar 10, 2018

Code to merge public and private functions into one psm1 file to address https://github.com/PowerShell/PowerShellGet/issues/240 #Closed

tools/build.psm1 Outdated
Set-Content -Path $ModuleFile -Value $ModuleFileContent

Write-Verbose -Message "Updating module manifest file"
Update-ModuleManifest -Path "$ModuleRoot\PowerShellGet.psd1" -FunctionsToExport $PublicFunctions.BaseName
Copy link
Contributor

@bmanikm bmanikm Mar 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$PublicFunctions.BaseName [](start = 84, length = 25)

$PublicFunctions.BaseName [](start = 84, length = 25)

This adds all the provider level public functions at module level. #Closed

@@ -904,11 +904,13 @@ Describe PowerShell.PSGet.PublishScriptTests -Tags 'BVT','InnerLoop' {
#
# Expected Result: should fail
#
It "InstallScriptWithExistingCommand" {
# this test is skipped for now as it is failing due to the /public/Install-Package.ps1 not taking a -Name parameter.
Copy link
Contributor

@bmanikm bmanikm Mar 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is skipped for now as it is failing due to the /public/Install-Package.ps1 not taking a -Name parameter. [](start = 6, length = 114)

this test is skipped for now as it is failing due to the /public/Install-Package.ps1 not taking a -Name parameter. [](start = 6, length = 114)

It is not clear why this test needs to be skipped. Install-Package is a provider level public function and implements the PackageManagement provider level Install-Package functionality. #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..but the script under test was passing a -Name parameter, something Install-Package does not have? I can reintroduce this, but I am getting different test failures with each build that are unrelated to this latest PR I think.
#Closed

Copy link
Contributor

@bmanikm bmanikm Mar 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Install-Package is a PackageManagement cmdlet. For more details, please take a look at https://github.com/PowerShell/PowerShellGet/pull/242#issuecomment-372787390. #Closed

tools/build.psm1 Outdated
function Remove-FunctionFolders {
Remove-Item -Path $ModuleRoot\public -Recurse -Force
Remove-Item -Path $ModuleRoot\private -Recurse -Force
}
Copy link
Contributor

@bmanikm bmanikm Mar 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid the in-place update of the module contents? like having a \bin\PowerShellGet folder then copying this folder to the AllUsers scope during the test runs? #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really in place as it happens before any tests have been kicked off, this is what the tests should be run against (a compiled psm1 file). I don't think it should be a responsibility of the tests to rearrange or package up the artifact into it's final form the Invoke-PowerShellGetTest already seems to be doing too much, and more than just tests. #Closed

Copy link
Contributor

@bmanikm bmanikm Mar 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build.psm1 files can be used on our development machines, in that case all the local changes in the individual files will be lost due to this removal step. #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build.psm1 is just a script module tho?, loading it won't execute the function Remove-FunctionFolders. It will just load it into memory. The function is executed specifically by the Travis, and Appveyor config. #Closed

Copy link
Contributor

@bmanikm bmanikm Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reproduce the CI failures, some times we will have to use the Merge-FunctionsIntoPSMFile and Remove-FunctionFolders functions from the build.psm1 on our dev machines, in that case we will loose the local uncommitted changes, if any, right? #Closed

@bmanikm
Copy link
Contributor

bmanikm commented Mar 12, 2018

Please take a look at the CI test failures.


In reply to: 372024549 [](ancestors = 372024549)

Copy link
Contributor

@bmanikm bmanikm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

@Benny1007
Copy link
Contributor Author

Benny1007 commented Mar 12, 2018 via email

@bmanikm
Copy link
Contributor

bmanikm commented Mar 13, 2018

@Benny1007 Please take a look at the below topics for more details.
How does PackageManagement relate to PowerShellGet? (High Level Answer)
How does PackageManagement actually relate to PowerShellGet? (Technical Details)

The PackageManagement provider functions, implemented in the PowerShellGet module, can't be used directly by the end-users, they can only be used with the PackageManagement cmdlets. That's they are not listed in the FunctionsToExport entry of the PowerShellGet module manifest.

All the public functions under public folder need to be separated into two folders, so that it will be easier to get the list of public cmdlets to be exported at the module level and the list of provider functions to be exported at provider level.

public\cmdlets
public\provider

(I am fine with other suitable names for the above proposed sub folders)

All public functions from both folders need to be listed as the Export-ModuleMember in PSModule.psm1 file.
All public functions under public\cmdlets dir need to be be listed as the FunctionsToExport in PowerShellGet.psd1 file. #Closed

@bmanikm
Copy link
Contributor

bmanikm commented Mar 13, 2018

https://github.com/Benny1007/PowerShellGet/blob/84e1c78b60cbb1be40f0d892fa65be077517cd2d/PowerShellGet/PSModule.psm1#L855

# Create install locations for scripts if they are not already created

Please move the region placeholders prior to the above line in PSModule.psm1 file. This is the reason for Test-RunningAsElevated related errors in the CI test runs.

Test-RunningAsElevated : The term 'Test-RunningAsElevated' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\powershellcore\Modules\powershellget\1.6.2\PSModule.psm1:856 char:110
+ ... :ProgramFilesInstalledScriptInfosPath) -and (Test-RunningAsElevated))
+                                                  ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Test-RunningAsElevated:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Expected

#region private functions imported via build script

#buildScriptPrivateFunctionsGoHere

#endregion

#region public functions imported via build script

#buildScriptPublicFunctionsGoHere

#endregion

# Create install locations for scripts if they are not already created

# ---

Refers to: PowerShellGet/PSModule.psm1:855 in 84e1c78. [](commit_id = 84e1c78, deletion_comment = False) #Closed

@Benny1007
Copy link
Contributor Author

Benny1007 commented Mar 14, 2018

with regard to moving the regions for the function import, I will do this. (this was actually the reason I made it place holder replacement rather than just appending to the file, however I forgot the reason I did that.
#Closed

@Benny1007
Copy link
Contributor Author

Benny1007 commented Mar 14, 2018

I am still not clear about those explanations around Packagemangement vs PowerShellGet. From reading those pages it would seem that PowerShellGet is just a package manager, and PackageManagement is a common interface to work with ANY package manager so why are there Packagemanagement implementation details within the PowerShellGet? Shouldn't Packagemanagement be a separate repo, or is it a separate repo already and these functions are just used by packagemanagement?
#Closed

@bmanikm
Copy link
Contributor

bmanikm commented Mar 14, 2018

While merging the contents of individual files into the PSModule.psm1 file, we need to remove the below region, right?

#region Load of module functions after split from main .psm1 file issue Fix#37

$PublicFunctions = @( Get-ChildItem -Path $PSScriptRoot\public\*.ps1 -ErrorAction SilentlyContinue )
$PrivateFunctions = @( Get-ChildItem -Path $PSScriptRoot\private\*.ps1 -ErrorAction SilentlyContinue )

# Load the separate function files from the private and public folders.
$AllFunctions = $PublicFunctions + $PrivateFunctions
foreach($function in $AllFunctions) {
    try {
        . $function.Fullname
    }
    catch {
        Write-Error -Message "Failed to import function $($function.fullname): $_"
    }
}

#endregion

Proposal:

  • We might have to split the current contents of PSModule.psm1 file into multiple .ps1 files under PowerShellGet\private\init\ folder and dot source them in the PSModule.psm1 file. The current contents of PSModule.psm1 can be moved into begin.ps1, process.ps1 and end.ps1 files (these are just placeholder file names, I am open to other suitable names).
  • Move the private folder contents into private\functions.
  • process.ps1 will be ignored during the single file construction. This file will have the dot source logic as in above region with some additional logic.
  • During the single file construction, PSModule.psm1 file will be overwritten in Merge-FunctionsIntoPSMFile function.

#Closed

@@ -1,7 +1,7 @@
function Get-PSRepository
{
<#
.ExternalHelp ..\PSModule-help.xml
.ExternalHelp PSModule-help.xml
Copy link
Contributor

@bmanikm bmanikm Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.ExternalHelp PSModule-help.xml [](start = 4, length = 31)

Get-PSRepository is a psd1 export function, please move this file to public/psdexports folder.

tools/build.psm1 Outdated
}

$psmExportFunctionNames = $psmExportFunctionNames.TrimEnd(",")
$psmFunctionExportString = "Export-ModuleMember -Function $psmExportFunctionNames"
Copy link
Contributor

@bmanikm bmanikm Mar 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also include the $PublicPSDFunctions.BaseName, otherwise no PublicPSDFunctions names will be exported at the module level. This is the reason for CI test failures too. #Closed

@bmanikm
Copy link
Contributor

bmanikm commented Mar 14, 2018

Why are there Packagemanagement implementation details within the PowerShellGet? Shouldn't Packagemanagement be a separate repo, or is it a separate repo already and these functions are just used by packagemanagement?

PackageManagement has its own repo --> https://github.com/oneget/oneget
PowerShellGet is PackageManagement provider, so all the provider functions need to be implemented in this module, these provider functions can only be used with the PackageManagement cmdlets.

PackageManagment architecture can be found at https://github.com/oneget/oneget#get-started .

High-level execution flow of a PowerShellGet cmdlet

PowerShellGet\Install-Module --> PackageManagement\Install-Package --> PowerShellGet provider Install-Package function
#Closed

tools/build.psm1 Outdated
Set-Content -Path $ModuleFile -Value $ModuleFileContent

# Update the PowerShellGet.psd1 module manifest to export only /public/psmexports functions.
Update-ModuleManifest -Path "$ModuleRoot\PowerShellGet.psd1" -FunctionsToExport $PublicPSGetFunctions.BaseName
Copy link
Contributor

@bmanikm bmanikm Mar 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update-ModuleManifest -Path "$ModuleRoot\PowerShellGet.psd1" -FunctionsToExport $PublicPSGetFunctions.BaseName [](start = 4, length = 110)

Update-ModuleManifest -Path "$ModuleRoot\PowerShellGet.psd1" -FunctionsToExport $PublicPSGetFunctions.BaseName [](start = 4, length = 110)

This cmdlet is not available on PS v4, this impacts the AppVeyor test run on PS v4. #Closed

@bmanikm
Copy link
Contributor

bmanikm commented Mar 15, 2018

@Benny1007 It looks like the providerfunctions folder has the psget function files and vice-versa.
Also please ensure that Get-PSRepository.ps1 file is under public\psgetfunctions folder since it is a PowerShellGet module level cmdlet. #Closed

tools/build.psm1 Outdated
if($PSVersionTable.PSVersion.Major -lt 5) {
# Update the psd1 file by replacing @(#functionsToExportGoHere) in psd1 file.
$ManifestFileContent = Get-Content -Path "$ModuleRoot\PowerShellGet.psd1"
$ManifestFunctionExportString = "FunctionsToExport = @($($PublicPSGetFunctions.BaseName -Join ","))"
Copy link
Contributor

@bmanikm bmanikm Mar 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ManifestFunctionExportString = "FunctionsToExport = @($($PublicPSGetFunctions.BaseName -Join ","))" [](start = 8, length = 100)

Quotes are missing around each function name listed in the string. CI test run for PS 4 is blocked due to this issue.

Please change this line to below.

$ManifestFunctionExportString = "FunctionsToExport = @('$($PublicPSGetFunctions.BaseName -Join "', '")')" #Closed

tools/build.psm1 Outdated
} else {
Write-Warning -Message "Unable to restore pre-merged psm1 file, not found in $ModuleFileBackupFolder"
}
}
Copy link
Contributor

@bmanikm bmanikm Mar 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This additional function can be avoided when the merged files are created under different path like bin\PowerShellGet. Please let me know your thoughts on why you prefer this additional Restore-PreMergedModuleFiles function.

With this function, during the development, we need to run two functions one for merging and other for restoring the changes prior to submitting the PR, right?

I prefer the merged files location to be bin\PowerShellGet (or some other path) instead of in-place merge.

#Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's a bit strange as I have split the repo out without ever having done any development on it. How do you envisage the development workflow?
For example if you were to work on the function Update-ModuleManifest how do you go about loading it, with all it's dependencies (throwerror in private functions) and in module scope? How do you step through debug the function?
How do you see this working with the amalgamated psm1 file, the developer would have to do that merge in order to load the module and do debugging right? So the psm1 merge wouldn't just be performed in the build function.

apologies for the delay, but I am in gmt+8 timezone.
#Closed

Copy link
Contributor

@bmanikm bmanikm Mar 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries @Benny1007, here are my thoughts:

  • Split the current contents of PSModule.psm1 file into two .ps1 files under PowerShellGet\private\init\ folder.

  • Move the current contents of PSModule.psm1 into begin.ps1 and end.ps1 files (these are just placeholder file names, I am open to suitable names).

  • begin.ps1 contents

    • Current contents of PSModule.psm1 above (in this PR) #region private functions imported via build script
  • end.ps1 contents are

    • Alias related code, and
    • Scripts folder creation code
  • Move the current files under PowerShellGet\private\ folder into PowerShellGet\private\functions\.

  • New code in PSModule.psm1

    • dot source logic in below order (NOTE: this will ensure that it is not required to create the merged file during the development)
      • begin.ps1
      • script files under PowerShellGet\private\functions\
      • script files under PowerShellGet\public\psgetfunctions and PowerShellGet\private\providerfunctions
      • end.ps1
    • There won't be any placeholders for creating the single .psm1 during CI runs.
    • Developer will have to add the PowerShellGet clone path at the beginning of the $env:PSModulePath, so that this path gets preference in loading the module and provider. Please note that during the development workflow, it is not required to execute the Merge-FunctionsIntoPSMFile function.
  • Single file construction logic in Merge-FunctionsIntoPSMFile function during CI test runs and release time

    • Creates root\bin\PowerShellGet folder and deletes this folder contents, if there are any files from the previous merge run.
    • Copies the contents of root\PowerShellGet to root\bin\PowerShellGet folder.
    • Constructs the PSModule.psm1 file under root\bin\PowerShellGet
      • The current contents of PSModule.psm1 file will be overwritten.
      • Adds file content in the following order
        • begin.ps1
        • script files under PowerShellGet\private\functions\
        • script files under PowerShellGet\public\psgetfunctions and PowerShellGet\public\providerfunctions
        • Export-ModuleManifest line with all public function names under PowerShellGet\public folder.
        • end.ps1
      • Update-ModuleManifest logic for updating the FunctionsToExport entry.
  • As part of the CI test runs, we need to copy the contents of root\bin\PowerShellGet folder instead of root\PowerShellGet folder.

#Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that works. standby... #Closed


$baseDirectory = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
Microsoft.PowerShell.Utility\Import-LocalizedData LocalizedData -filename PSGet.Resource.psd1 -BaseDirectory $baseDirectory

Copy link
Contributor

@bmanikm bmanikm Mar 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change work fine with the merged singl psm1 file? #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was necessary to load the combined psm1 file with import-module. Without the -BaseDirectory switch the module would not load. #Closed

Copy link
Contributor

@bmanikm bmanikm Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Benny1007 This change is not working for the merged file scenario. I am getting below error as $baseDirctory assignment assumes the current folder structure PowerShellGet/private/modulefile/, right? To resolve this, we might have to move these partOne.ps1 and partTwo.ps1 files to the PowerShellGet folder and delete them during merge time.

C:\>Import-Module PowerShellGet -Verbose -Force

Microsoft.PowerShell.Utility\Import-LocalizedData : Cannot find the Windows PowerShell data file 'PSGet.Resource.psd1' in directory 'C:\Program Files\WindowsPowerShell\Modules\en-US\', or in any parent culture
directories.
At C:\Program Files\WindowsPowerShell\Modules\powershellget\1.6.4\PSModule.psm1:465 char:1
+ Microsoft.PowerShell.Utility\Import-LocalizedData LocalizedData -file ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Program File...t.Resource.psd1:String) [Import-LocalizedData], PSInvalidOperationException
    + FullyQualifiedErrorId : ImportLocalizedData,Microsoft.PowerShell.Commands.ImportLocalizedData
``` #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to the Import-LocalizedData line was because the module file PSModule.psm1 would not import due to issues dotsourcing the partone.ps1. Ultimately this was because the filename parameter of Import-LocalizedData assumes the local directory as it's source. At which point I added the -BaseDirectory parameter, and the $baseDirectory variable at line 464, and then the module loaded fine, so I am surprised that you encounter that issue:-

M:\dev\repos\PowerShellGet\powershellget [fix#240/Add-build-step-to-construct-psm1 ↑2 +0 ~1 -0 ~]> Import-Module .\PSModule.psm1
WARNING: The names of some imported commands from the module 'PSModule' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
M:\dev\repos\PowerShellGet\powershellget [fix#240/Add-build-step-to-construct-psm1 ↑2 +0 ~1 -0 ~]>

Moving the partone and parttwo files seems a bit drastic, if the above isn't working could we not revert line 465 , removing the -BaseDirectory parameter and move the Import-LocalizedData line into the PSModule.psm1 (before the dot sourcing of partone.ps1)? #Closed

Copy link
Contributor

@bmanikm bmanikm Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above solution works for the developer scenario. When and where are you planning to add
Microsoft.PowerShell.Utility\Import-LocalizedData LocalizedData -filename PSGet.Resource.psd1 line for the CI or merged file scenario?
#Closed

New-Item -Path $ArtifactRoot -ItemType Directory | Out-Null

# Copy the module into the dist folder
Copy-Item -Path $ModuleRoot -Destination $ArtifactRoot -Recurse
Copy link
Contributor

@bmanikm bmanikm Mar 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the CI test runs are not validating the module created under dist/PowerShellGet, right? It is required to generate the dist/PowerShellGet folder and then copy it to the expected location in Invoke-PowerShellGetTest. Please take a look at the code starting at line # 310 or # Copy OneGet and PSGet modules to PSHOME #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you saying you want the Invoke-PowerShellGetTest to do more than just run tests on the /private and /public structure but to actually assemble the distributed module and install it, then perform all tests on that /dist module? How would that work for local dev testing?

#Closed

Copy link
Contributor

@bmanikm bmanikm Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Benny1007 CI test runs should validate the generated module under /dist, right? otherwise, we are not sure /dist module is working fine or not. One such example is above mentioned Import-LocalizedData error.

I think, we need to move some portion of the Invoke-PowerShellGetTest function to a new function and handle additional logic for copying the generated PowerShellGet module /dist during CI test runs. During local dev testing, I am fine with executing the tests on /PowerShellGet folder instead of /dist/PowerShellGet folder. #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so something like this appveyor flow:-

install:
Import-Module .\tools\build.psm1
Install-Dependencies
Update-ModuleManifestFunctions

test_script
Publish-ModuleArtifacts
Install-PublishedModule
Invoke-PowerShellGetTest

on_finish
New-ModuleArtifactZip

Now that the install of the module would be outside of the testing (a good thing imo) we would need to update the developer docs on the flow around importing the module locally before running the tests etc?
#Closed

Copy link
Contributor

@bmanikm bmanikm Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appveyor flow looks good to me.
Yes, for running the tests locally, we need to update the documentation in running-tests to prefix the clone path to $env:PSModulePath so that PowerShellGet will be loaded from the clone path.
$env:PSModulePath = "$ClonePath;$env:PSModulePath" #Closed

tools/build.psm1 Outdated
$script:ProjectRoot = Split-Path -Path $PSScriptRoot -Parent
$script:ModuleRoot = Join-Path -Path $ProjectRoot -ChildPath "PowerShellGet"
$script:ModuleFile = Join-Path -Path $ModuleRoot -ChildPath "PSModule.psm1"
$script:ArtifactRoot = if($script:IsWindows) { "$ProjectRoot\dist" } else { "$ProjectRoot/dist" }
Copy link
Contributor

@bmanikm bmanikm Mar 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if($script:IsWindows) { "$ProjectRoot\dist" } else { "$ProjectRoot/dist" } [](start = 23, length = 74)

Please consider using Join-Path cmdlet here so that this if-else logic is not required. Also consider this at other places too. #Closed

Update-ModuleManifestFunctions;
Publish-ModuleArtifacts;
Install-PublishedModule;
Invoke-PowerShellGetTest;"
Copy link
Contributor

@bmanikm bmanikm Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-PowerShellGetTest [](start = 24, length = 18)

-IsFullTestPass is missing here. #Closed





Copy link
Contributor

@bmanikm bmanikm Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider removing these empty lines. #Closed

@bmanikm
Copy link
Contributor

bmanikm commented Mar 27, 2018

Please fix the encoding of this file. #Closed


Refers to: PowerShellGet/PSModule.psm1:58 in 66ddc64. [](commit_id = 66ddc64, deletion_comment = False)

@@ -904,11 +904,12 @@ Describe PowerShell.PSGet.PublishScriptTests -Tags 'BVT','InnerLoop' {
#
# Expected Result: should fail
#

It "InstallScriptWithExistingCommand" {
Copy link
Contributor

@bmanikm bmanikm Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider reverting this change in this file. #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure which change you mean (having trouble tracking the comments you are making in this PR) #Closed

Copy link
Contributor

@bmanikm bmanikm Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whitespace addition in Tests/PSGetPublishScript.Tests.ps1 file can be removed. Otherwise change history of that file includes this PR even though we are not making any changes. #Closed

tools/build.psm1 Outdated
<# if(($script:PowerShellEdition -eq 'Core') -and $script:IsWindows)
{
$AllUsersModulesPath = Join-Path -Path $PowerShellHome -ChildPath 'Modules'
} #>
Copy link
Contributor

@bmanikm bmanikm Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change? #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to extract the module installation from the tests, this logic is moved from the test function. I have a further question though, why does the test function call a get function which actually installs dot net core. That is concerning. A get function should not change state, and especially not install anything. #Closed

Copy link
Contributor

@bmanikm bmanikm Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, please remove the commented code. #Closed

(ls $zipFile)
) | % { Push-AppveyorArtifact $_.FullName }
$zipFile = ".\dist\PowerShellGet.zip"
Push-AppveyorArtifact $zipFile
Copy link
Contributor

@bmanikm bmanikm Mar 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we retain the existing logic to zip the entire project folder including tests, results and dist, etc.,? #Closed

Copy link
Contributor Author

@Benny1007 Benny1007 Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of zipping the source? #Closed

Copy link
Contributor

@bmanikm bmanikm Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including the source code, tests and test results along with dist folder in the artifact helps us in investigating the test failures when CI runs (PRs, Merge and Daily) are failed. Another option is to create two artifacts, one for dist and other for source & test results. #Closed


Move-Item -Path $tempZipfile -Destination $artifactZipFile -Force
}
function Install-PublishedModule {
Copy link
Contributor

@bmanikm bmanikm Mar 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PackageManagement needs to be installed prior to installing the PowerShellGet module. This is the reason for the CI test failures. The newly installed module is unable to load as PowerShellGet requires 1.1.7.0 or higher.

Please move the logic starting at line# 191 to #231 in Invoke-PowerShellGetTest function to Install-PublishedModule function.

Starting from # Install latest PackageManagement from Gallery
#Closed

@bmanikm
Copy link
Contributor

bmanikm commented Mar 30, 2018

@Benny1007 Please let me know if I can submit the required changes to your fork's branch. #Closed

@Benny1007
Copy link
Contributor Author

Benny1007 commented Mar 31, 2018

@bmanikm sure be my guest, bit busy this weekend ! 👍 #Closed

Copy link
Contributor

@bmanikm bmanikm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@bmanikm bmanikm merged commit dbbfc68 into PowerShell:development Apr 3, 2018
@bmanikm
Copy link
Contributor

bmanikm commented Apr 3, 2018

@Benny1007 Thanks a lot for the great contributions to the PowerShellGet repository!

@Benny1007
Copy link
Contributor Author

@bmanikm I still have to modify artifact zip to include the source stuff. Also let me know if you'd like me to squish commits before you merge back.

@bmanikm
Copy link
Contributor

bmanikm commented Apr 3, 2018

@Benny1007 Sorry, I already squashed and merged this PR :(. Could you please submit an another pull request for the artifact zip change?

@Benny1007 Benny1007 deleted the fix#240/Add-build-step-to-construct-psm1 branch March 10, 2019 09:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants