Skip to content

Commit

Permalink
Merge pull request #110 from Windos/v0.7.2
Browse files Browse the repository at this point in the history
v0.7.2
  • Loading branch information
Windos committed Aug 6, 2020
2 parents f4cbd05 + 8061751 commit 61c7a94
Show file tree
Hide file tree
Showing 16 changed files with 166 additions and 2,915 deletions.
13 changes: 10 additions & 3 deletions Azure-Pipelines/BurntToast-Template.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
$WinMajorVersion = (Get-CimInstance -ClassName Win32_OperatingSystem -Property Version).Version.Split('.')[0]

if ($WinMajorVersion -ge 10) {
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\*.dll -Recurse -ErrorAction SilentlyContinue )
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Toolkit.Uwp.Notifications\*.dll -Recurse -ErrorAction SilentlyContinue )

if ($IsWindows) {
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.CsWinRT\*.dll -Recurse -ErrorAction SilentlyContinue )
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.SDK.NET\*.dll -Recurse -ErrorAction SilentlyContinue )
}

# Add one class from each expected DLL here:
$LibraryMap = @{
Expand All @@ -28,11 +33,13 @@ if ($WinMajorVersion -ge 10) {

Export-ModuleMember -Alias 'Toast'
Export-ModuleMember -Function $PublicFunctions

# Register default AppId
New-BTAppId

$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
if (-not $IsWindows) {
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
}
} else {
throw 'This version of BurntToast will only work on Windows 10. If you would like to use BurntToast on Windows 8, please use version 0.4'
}
10 changes: 8 additions & 2 deletions Azure-Pipelines/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ if ($Bootstrap.IsPresent) {
# For testing Pester
if (-not (Get-Module -Name Pester -ListAvailable) -or (Get-Module -Name Pester -ListAvailable)[0].Version -eq [Version]'3.4.0') {
Write-Warning "Module 'Pester' is missing. Installing 'Pester' ..."
Install-Module -Name Pester -Scope CurrentUser -Force
Install-Module -Name Pester -Scope CurrentUser -Force -RequiredVersion 4.10.1 -SkipPublisherCheck
}

if ((Get-Module -Name Pester -ListAvailable)[0].Version -ne [Version]'4.10.1') {
Install-Module -Name Pester -Scope CurrentUser -Force -RequiredVersion 4.10.1
}

Import-Module -Name Pester -RequiredVersion 4.10.1

if (-not (Get-Module -Name PSCodeCovIo -ListAvailable)) {
Write-Warning "Module 'PSCodeCovIo' is missing. Installing 'PSCodeCovIo' ..."
Install-Module -Name PSCodeCovIo -Scope CurrentUser -Force
Expand Down Expand Up @@ -82,7 +88,7 @@ if($Test.IsPresent) {
$RelevantFiles = (Get-ChildItem ./BurntToast -Recurse -Include "*.psm1","*.ps1").FullName

if ($env:TF_BUILD) {
$res = Invoke-Pester "./Tests" -OutputFormat NUnitXml -OutputFile TestResults.xml -CodeCoverage $RelevantFiles -PassThru
$res = Invoke-Pester "./Tests" -OutputFormat NUnitXml -OutputFile TestResults.xml -CodeCoverage $RelevantFiles -CodeCoverageOutputFileFormat 'JaCoCo' -CodeCoverageOutputFile "$Env:AgentTemp\CoverageResults.xml" -PassThru
if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." }
} else {
$res = Invoke-Pester "./Tests" -CodeCoverage $RelevantFiles -PassThru
Expand Down
163 changes: 116 additions & 47 deletions Azure-Pipelines/build.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,123 @@
jobs:
- job: CookToast
stages:
- stage: ThawBread
displayName: 'Thaw Frozen Bread'
jobs:
- job: Srv2019_64bit
displayName: 'Server 2019 - 64 bit'
pool: 'AzPS7.1-Preview'
steps:
- task: PowerShell@2
displayName: 'Run tests (individual .ps1 files) - Windows PowerShell - x64'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
env:
AgentTemp: $(Agent.TempDirectory)
- task: PowerShell@2
displayName: 'Run tests (individual .ps1 files) - PowerShell 7.1 Preview 5 - x64'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
pwsh: true
env:
AgentTemp: $(Agent.TempDirectory)
- job: Win10_32bit
displayName: 'Windows 10 - 32 bit'
pool: 'LabPS7x86'
steps:
- task: PowerShell@2
displayName: 'Run tests (individual .ps1 files) - Windows PowerShell - x86'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
env:
AgentTemp: $(Agent.TempDirectory)
- task: PowerShell@2
displayName: 'Run tests (individual .ps1 files) - PowerShell 7.1 Preview 5 - x86'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
pwsh: true
env:
AgentTemp: $(Agent.TempDirectory)
- stage: CookToast
displayName: 'Cook Toast'
pool:
vmImage: 'windows-2019'
steps:
- task: PowerShell@2
displayName: 'Run tests (individual .ps1 files)'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
dependsOn: 'ThawBread'
jobs:
- job: PreBuild
displayName: 'Pre-Build Tests'
pool:
vmImage: 'windows-2019'
steps:
- task: PowerShell@2
displayName: 'Run tests (individual .ps1 files) - Windows PowerShell'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
env:
AgentTemp: $(Agent.TempDirectory)
- job: 'BuildRetest'
displayName: 'Build & Re-test'
dependsOn: 'PreBuild'
pool:
vmImage: 'windows-2019'
steps:
- task: PowerShell@2
displayName: 'Run tests (individual .ps1 files) - PowerShell Core'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
pwsh: true
env:
AgentTemp: $(Agent.TempDirectory)

- task: PowerShell@2
displayName: 'Compile module'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Compile
- task: PowerShell@2
displayName: 'Compile module'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Compile

- task: PowerShell@2
displayName: 'Run tests (compiled .psm1)'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Test
- task: PowerShell@2
displayName: 'Run tests (compiled .psm1)'
inputs:
targetType: Inline
script: ./Azure-Pipelines/build.ps1 -Test
env:
AgentTemp: $(Agent.TempDirectory)

- task: PublishTestResults@2
displayName: 'Publish test results'
inputs:
testRunner: NUnit
testResultsFiles: '**/TestResults.xml'
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: 'Publish test results'
inputs:
testRunner: NUnit
testResultsFiles: '**/TestResults.xml'
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage results'
inputs:
summaryFileLocation: $(Agent.TempDirectory)/CoverageResults.xml
pathToSources: $(Agent.TempDirectory)
condition: succeededOrFailed()

- task: Bash@3
displayName: 'Upload coverage to Codecov'
inputs:
targetType: 'filePath' # Optional. Options: filePath, inline
filePath: ./codecov.sh
arguments: -f coverage.json -t $(CODECOV_TOKEN)
#script: '# Write your commands here# Use the environment variables input below to pass secret variables to this script' # Required when targetType == Inline
#workingDirectory: # Optional
#failOnStderr: false # Optional
- task: Bash@3
displayName: 'Upload coverage to Codecov'
inputs:
targetType: 'filePath' # Optional. Options: filePath, inline
filePath: ./codecov.sh
arguments: -f coverage.json -t $(CODECOV_TOKEN)
#script: '# Write your commands here# Use the environment variables input below to pass secret variables to this script' # Required when targetType == Inline
#workingDirectory: # Optional
#failOnStderr: false # Optional

- task: PublishPipelineArtifact@0
displayName: 'Publish compiled module artifact'
inputs:
artifactName: 'BurntToast'
targetPath: ./BurntToast
condition: succeededOrFailed()
- task: PublishPipelineArtifact@0
displayName: 'Publish compiled module artifact'
inputs:
artifactName: 'BurntToast'
targetPath: ./BurntToast
condition: succeededOrFailed()

- task: PublishPipelineArtifact@0
displayName: 'Publish Pipelines scripts as artifact'
inputs:
artifactName: 'PipelinesScripts'
targetPath: ./Azure-Pipelines
condition: succeededOrFailed()
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipelines scripts as artifact'
inputs:
artifactName: 'PipelinesScripts'
targetPath: ./Azure-Pipelines
condition: succeededOrFailed()
18 changes: 5 additions & 13 deletions BurntToast/BurntToast.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'BurntToast.psm1'
ModuleVersion = '0.7.1'
ModuleVersion = '0.7.2'
# Can only use CompatiblePSEditions if PowerShellVersion is set to 5.1, not sure about limiting this to that version yet.
# CompatiblePSEditions = @('Desktop')
GUID = '751a2aeb-a68f-422e-a2ea-376bdd81612a'
Expand Down Expand Up @@ -40,19 +40,11 @@
LicenseUri = 'https://github.com/Windos/BurntToast/blob/master/LICENSE'
ProjectUri = 'https://github.com/Windos/BurntToast'
IconUri = 'https://raw.githubusercontent.com/Windos/BurntToast/master/Media/BurntToast-Logo.png'
ReleaseNotes = '# 0.7.1
ReleaseNotes = '# 0.7.2
* Update: Microsoft Community Toolkit to 6.0.0
* New: Support relative paths on images
* New: "ScheduledToast" switch added to `Get-BTHistory` which returns scheduled or snoozed toast notifications
* Enhancement: Libraries only loaded on module import if libraries not already loaded
* Enhancement: Validate that image paths exist
* Fix: Reverted to XML clean up to remove curly braces if databindings are not being used (Issue #72)
## Known Issues
* Regardless of what snooze option is chosen, a snoozed toast will re-appear after 9 minutes
* Cause is unknown and isn''t unique to v0.7.1, will be investigated while working on v0.7.2
* Fix: Curly Braces when "Reminder" pops up ([#72](https://github.com/Windos/BurntToast/issues/72))
* Fix: Caching remote gifs are saved based on their remote filename and not overwritten ([#105](https://github.com/Windos/BurntToast/issues/105)) - Thanks [@KelvinTegelaar](https://github.com/KelvinTegelaar)
* Fix: BurntToast and .NET 5 ([#101](https://github.com/Windos/BurntToast/issues/101))
'
}
}
Expand Down
11 changes: 9 additions & 2 deletions BurntToast/BurntToast.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ $WinMajorVersion = (Get-CimInstance -ClassName Win32_OperatingSystem -Property V
if ($WinMajorVersion -ge 10) {
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue )
$Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue )
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\*.dll -Recurse -ErrorAction SilentlyContinue )
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Toolkit.Uwp.Notifications\*.dll -Recurse -ErrorAction SilentlyContinue )

if ($IsWindows) {
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.CsWinRT\*.dll -Recurse -ErrorAction SilentlyContinue )
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.SDK.NET\*.dll -Recurse -ErrorAction SilentlyContinue )
}

# Add one class from each expected DLL here:
$LibraryMap = @{
Expand Down Expand Up @@ -41,7 +46,9 @@ if ($WinMajorVersion -ge 10) {
# Register default AppId
New-BTAppId

$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
if (-not $IsWindows) {
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
}
} else {
throw 'This version of BurntToast will only work on Windows 10. If you would like to use BurntToast on Windows 8, please use version 0.4'
}
2 changes: 1 addition & 1 deletion BurntToast/Private/Optimize-BTImageSource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function Optimize-BTImageSource {
)

if ([bool]([System.Uri]$Source).IsUnc -or $Source -like 'http?://*') {
$RemoteFileName = $Source.Split('/\')[-1] -replace '[\[\]*?]',''
$RemoteFileName = $Source -replace '/|:', '-'

$NewFilePath = '{0}\{1}' -f $Env:TEMP, $RemoteFileName

Expand Down
4 changes: 3 additions & 1 deletion BurntToast/Public/Submit-BTNotification.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
Write-Warning -Message "The AppId $AppId is not present in the registry, please run New-BTAppId to avoid inconsistent Toast behaviour."
}

$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
if (-not $IsWindows) {
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
}

$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new()

Expand Down

0 comments on commit 61c7a94

Please sign in to comment.