From e63bba48f9ca36cc340ce1d821050bcc2b00552e Mon Sep 17 00:00:00 2001 From: Chrissy LeMaire Date: Sun, 29 Jan 2023 01:42:21 +0100 Subject: [PATCH] update library --- .github/workflows/sqlpackage.yml | 3 +- build/build-core.ps1 | 24 +++--- build/build-full.ps1 | 6 +- dbatools.core.library.psd1 | 90 -------------------- dbatools.library.psd1 | 16 +--- dbatools.library.psm1 | 6 +- project/dbatools.Tests/dbatools.Tests.csproj | 6 +- project/dbatools/dbatools.csproj | 5 +- 8 files changed, 32 insertions(+), 124 deletions(-) delete mode 100644 dbatools.core.library.psd1 diff --git a/.github/workflows/sqlpackage.yml b/.github/workflows/sqlpackage.yml index 22b1012..73513dd 100644 --- a/.github/workflows/sqlpackage.yml +++ b/.github/workflows/sqlpackage.yml @@ -16,8 +16,7 @@ jobs: - name: Install and cache PowerShell modules uses: potatoqualitee/psmodulecache@v5.1 with: - modules-to-cache: dbatools.core.library:2022.11.8 - modules-to-cache-prerelease: dbatools.library:2022.11.8-preview + modules-to-cache: dbatools.library:2023.1.29 - name: Execute sqlpackage shell: pwsh diff --git a/build/build-core.ps1 b/build/build-core.ps1 index 61d26da..dd25261 100644 --- a/build/build-core.ps1 +++ b/build/build-core.ps1 @@ -2,13 +2,15 @@ $PSDefaultParameterValues["*:Force"] = $true $PSDefaultParameterValues["*:Confirm"] = $false if (Test-Path ./lib) { - write-warning removing + write-warning "removing ./lib" rm -rf lib rm -rf temp rm -rf third-party rm -rf third-party-licenses } -Push-Location "./project" + +$root = Split-Path -Path $PSScriptRoot +Push-Location "$root/project" dotnet publish --configuration release --framework net6.0 | Out-String -OutVariable build dotnet test --framework net6.0 --verbosity normal | Out-String -OutVariable test Pop-Location @@ -136,14 +138,14 @@ Remove-Item -Path $xmlpdb -Recurse -ErrorAction Ignore Import-Module ./dbatools.core.library.psd1 <# - if ((Get-ChildItem -Path C:\gallery\dbatools.core.library -ErrorAction Ignore)) { - $null = Remove-Item C:\gallery\dbatools.core.library -Recurse - $null = mkdir C:\gallery\dbatools.core.library - $null = robocopy c:\github\dbatools.library C:\gallery\dbatools.core.library /S /XF actions-build.ps1 .markdownlint.json *.psproj* *.git* *.yml *.md dac.ps1 *build*.ps1 /XD .git .github Tests .vscode project temp runtime runtimes replication var opt | Out-String | Out-Null - Remove-Item c:\gallery\dbatools.core.library\dac.ps1 -ErrorAction Ignore - Remove-Item c:\gallery\dbatools.core.library\dbatools.library.psd1 -ErrorAction Ignore - Copy-Item C:\github\dbatools.library\dbatools.core.library.psd1 C:\github\dbatools.core.library - - Get-ChildItem -Recurse -Path C:\gallery\dbatools.core.library\*.ps*, C:\gallery\dbatools.core.library\dbatools.dll | Set-AuthenticodeSignature -Certificate (Get-ChildItem -Path Cert:\CurrentUser\My\fd0dde81152c4d4868afd88d727e78a9b6881cf4) -TimestampServer http://timestamp.digicert.com -HashAlgorithm SHA256 + if ((Get-ChildItem -Path C:\gallery\dbatools.library\core -ErrorAction Ignore)) { + $null = Remove-Item C:\gallery\dbatools.library\core -Recurse + $null = mkdir C:\gallery\dbatools.library\core + $null = robocopy c:\github\dbatools.library C:\gallery\dbatools.library\core /S /XF actions-build.ps1 .markdownlint.json *.psproj* *.git* *.yml *.md dac.ps1 *build*.ps1 /XD .git .github Tests .vscode project temp runtime runtimes replication var opt | Out-String | Out-Null + Remove-Item c:\gallery\dbatools.library\core\dac.ps1 -ErrorAction Ignore + Remove-Item c:\gallery\dbatools.library\core\dbatools.library.psd1 -ErrorAction Ignore + #Copy-Item C:\github\dbatools.library\dbatools.core.library.psd1 C:\github\dbatools.core.library + + Get-ChildItem -Recurse -Path C:\gallery\dbatools.library\*.ps*, C:\gallery\dbatools.library\*\dbatools.dll | Set-AuthenticodeSignature -Certificate (Get-ChildItem -Path Cert:\CurrentUser\My\fd0dde81152c4d4868afd88d727e78a9b6881cf4) -TimestampServer http://timestamp.digicert.com -HashAlgorithm SHA256 } #> diff --git a/build/build-full.ps1 b/build/build-full.ps1 index d407265..0dacfd5 100644 --- a/build/build-full.ps1 +++ b/build/build-full.ps1 @@ -2,14 +2,16 @@ $PSDefaultParameterValues["*:Force"] = $true $PSDefaultParameterValues["*:Confirm"] = $false if (Test-Path "C:\github\dbatools.library\lib") { - write-warning removing + write-warning "removing C:\github\dbatools.library\lib" Remove-Item -Path lib -Recurse -ErrorAction Ignore Remove-Item -Path temp -Recurse -ErrorAction Ignore Remove-Item -Path third-party -Recurse -ErrorAction Ignore Remove-Item -Path third-party-licenses -Recurse -ErrorAction Ignore } -Push-Location ".\project" +$root = Split-Path -Path $PSScriptRoot +Push-Location "$root\project" + dotnet publish --configuration release --framework net462 | Out-String -OutVariable build dotnet test --framework net462 --verbosity normal | Out-String -OutVariable test Pop-Location diff --git a/dbatools.core.library.psd1 b/dbatools.core.library.psd1 deleted file mode 100644 index c13f46c..0000000 --- a/dbatools.core.library.psd1 +++ /dev/null @@ -1,90 +0,0 @@ -# -# Module manifest for module 'dbatools.library' -# -# Generated by: Chrissy LeMaire -# -# Generated on: 10/23/2022 -# -@{ - # Version number of this module. - ModuleVersion = '2022.11.8' - - # ID used to uniquely identify this module - GUID = '76356510-6ad4-47be-b562-8e69e561a77f' - - # Author of this module - Author = 'the dbatools team' - - # Company or vendor of this module - CompanyName = 'dbatools.io' - - # Copyright statement for this module - Copyright = 'Copyright (c) 2022 by dbatools, licensed under MIT' - - # Description of the functionality provided by this module - Description = "The .NET Core library that powers dbatools, the community module for SQL Server Pros" - - # Minimum version of the Windows PowerShell engine required by this module - PowerShellVersion = '7.0' - - # Minimum version of the .NET Framework required by this module - DotNetFrameworkVersion = '6.0' - - # Supported PSEditions - CompatiblePSEditions = @('Core') - - # Modules that must be imported into the global environment prior to importing this module - RequiredModules = @() - - # Assemblies that must be loaded prior to importing this module - RequiredAssemblies = @( - './lib/Microsoft.SqlServer.Server.dll', - './lib/Microsoft.SqlServer.Dac.dll', - './lib/Microsoft.SqlServer.Smo.dll', - './lib/Microsoft.SqlServer.SmoExtended.dll', - './lib/Microsoft.SqlServer.SqlWmiManagement.dll', - './lib/Microsoft.SqlServer.Management.RegisteredServers.dll', - './lib/Microsoft.SqlServer.Management.Collector.dll', - './lib/Microsoft.SqlServer.Management.XEvent.dll', - './lib/Microsoft.SqlServer.Management.XEventDbScoped.dll', - './lib/Microsoft.SqlServer.XEvent.XELite.dll', - './third-party/LumenWorks/LumenWorks.Framework.IO.dll' - ) - - # Script module or binary module file associated with this manifest. - RootModule = 'dbatools.library.psm1' - - FunctionsToExport = @('Get-DbatoolsLibraryPath') - - PrivateData = @{ - # PSData is module packaging and gallery metadata embedded in PrivateData - # It's for rebuilding PowerShellGet (and PoshCode) NuGet-style packages - # We had to do this because it's the only place we're allowed to extend the manifest - # https://connect.microsoft.com/PowerShell/feedback/details/421837 - PSData = @{ - # The primary categorization of this module (from the TechNet Gallery tech tree). - Category = "Databases" - - # Keyword tags to help users find this module via navigations and search. - Tags = @('sqlserver', 'migrations', 'sql', 'dba', 'databases', 'mac', 'linux', 'core', 'smo') - - # The web address of an icon which can be used in galleries to represent this module - IconUri = "https://dbatools.io/logo.png" - - # The web address of this module's project or support homepage. - ProjectUri = "https://dbatools.io" - - # The web address of this module's license. Points to a page that's embeddable and linkable. - LicenseUri = "https://opensource.org/licenses/MIT" - - # Release notes for this particular version of the module - ReleaseNotes = "" - - # If true, the LicenseUrl points to an end-user license (not just a source license) which requires the user agreement before use. - # RequireLicenseAcceptance = "" - - # Indicates this is a pre-release/testing version of the module. - IsPrerelease = 'False' - } - } -} \ No newline at end of file diff --git a/dbatools.library.psd1 b/dbatools.library.psd1 index b0c2f5b..b0fe7a4 100644 --- a/dbatools.library.psd1 +++ b/dbatools.library.psd1 @@ -7,7 +7,7 @@ # @{ # Version number of this module. - ModuleVersion = '2022.11.8' + ModuleVersion = '2023.1.29' # ID used to uniquely identify this module GUID = '00b61a37-6c36-40d8-8865-ac0180288c84' @@ -19,20 +19,11 @@ CompanyName = 'dbatools.io' # Copyright statement for this module - Copyright = 'Copyright (c) 2022 by dbatools, licensed under MIT' + Copyright = 'Copyright (c) 2023 by dbatools, licensed under MIT' # Description of the functionality provided by this module Description = "The library that powers dbatools, the community module for SQL Server Pros" - # Minimum version of the Windows PowerShell engine required by this module - PowerShellVersion = '5.1' - - # Minimum version of the .NET Framework required by this module - DotNetFrameworkVersion = '4.6.2' - - # Supported PSEditions - CompatiblePSEditions = @('Desktop') - # Modules that must be imported into the global environment prior to importing this module RequiredModules = @() @@ -76,8 +67,7 @@ # RequireLicenseAcceptance = "" # Indicates this is a pre-release/testing version of the module. - IsPrerelease = 'true' - Prerelease = 'preview' + IsPrerelease = 'false' } } } \ No newline at end of file diff --git a/dbatools.library.psm1 b/dbatools.library.psm1 index eacbb74..24d23ab 100644 --- a/dbatools.library.psm1 +++ b/dbatools.library.psm1 @@ -1,5 +1,9 @@ function Get-DbatoolsLibraryPath { [CmdletBinding()] param() - $PSScriptRoot + if ($PSVersionTable.PSEdition -eq "Core") { + Join-Path -Path $PSScriptRoot -ChildPath core + } else { + Join-Path -Path $PSScriptRoot -ChildPath desktop + } } \ No newline at end of file diff --git a/project/dbatools.Tests/dbatools.Tests.csproj b/project/dbatools.Tests/dbatools.Tests.csproj index 5519e71..f145dc5 100644 --- a/project/dbatools.Tests/dbatools.Tests.csproj +++ b/project/dbatools.Tests/dbatools.Tests.csproj @@ -34,9 +34,9 @@ - - - + + + diff --git a/project/dbatools/dbatools.csproj b/project/dbatools/dbatools.csproj index 40e586d..94d2b37 100644 --- a/project/dbatools/dbatools.csproj +++ b/project/dbatools/dbatools.csproj @@ -42,10 +42,11 @@ MinimumRecommendedRules.ruleset + - - + +