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

AzureDevOpsDsc: Common module should be built with ModuleBuilder #13

Open
johlju opened this issue Jan 24, 2021 · 0 comments
Open

AzureDevOpsDsc: Common module should be built with ModuleBuilder #13

johlju opened this issue Jan 24, 2021 · 0 comments
Labels
Backlog - Mid Term Backlog - Mid Term enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@johlju
Copy link
Member

johlju commented Jan 24, 2021

In the source/Modules/AzureDevopsDsc.Common should be built using the pattern public/private folders.

We ought to be able to build the PSM1 by merging the Public/Private/Classes/etc. folders the same way as the top module.
We should configure the NestedModules section in the build.yml

NestedModule:
  DscResource.Common:
    CopyOnly: true
    Path: ./output/RequiredModules/DscResource.Common
    AddToManifest: false
    Exclude: PSGetModuleInfo.xml
  AzDevOpsProject.Common:
    CopyOnly: false
    Path: ./source/Modules/AzureDevOpsDsc.Common
    AddToManifest: false

And remove the entry Modules from here:

CopyPaths:
- Classes
- en-US
- Examples
- Modules

That will replace the dot-source code in the file below, and will speed up the usage of the distributed resources.

$functionSubDirectoryPaths = @(
# Api
"$PSScriptRoot\Api\Functions\Private",
# Connection
"$PSScriptRoot\Connection\Functions\Private",
# Resources
"$PSScriptRoot\Resources\Functions\Public",
"$PSScriptRoot\Resources\Functions\Private",
# Server
# Services
"$PSScriptRoot\Services\Functions\Public"
)
$functions = Get-ChildItem -Path $functionSubDirectoryPaths -Recurse -Include "*.ps1"
# Loop through all PSModule functions and import/dot-source them (and export them if 'Public')
foreach ($function in $functions)
{
Write-Verbose "Dot-sourcing '$($function.FullName)'..."
. (
[ScriptBlock]::Create(
[Io.File]::ReadAllText($($function.FullName))
)
)
if ($function.FullName -ilike "$PSScriptRoot\*\Functions\Public\*")
{
Write-Verbose "Exporting '$($function.BaseName)'..."
Export-ModuleMember -Function $($function.BaseName)
}
}

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Jan 24, 2021
@kilasuit kilasuit added the Backlog - Mid Term Backlog - Mid Term label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backlog - Mid Term Backlog - Mid Term enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants