From cc9bbf19695eec16fbbed6422f5959d0ce2f6569 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Thu, 24 Oct 2024 10:43:17 -0400 Subject: [PATCH] fix: make CSPApplication deprecated & forward compatible --- src/%ZPM/PackageManager.cls | 2 ++ src/%ZPM/PackageManager/Common.inc | 3 +++ .../Developer/Processor/CSPApplication.cls | 12 +++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/%ZPM/PackageManager.cls b/src/%ZPM/PackageManager.cls index fdca6077..f6ed9222 100755 --- a/src/%ZPM/PackageManager.cls +++ b/src/%ZPM/PackageManager.cls @@ -495,6 +495,7 @@ ClassMethod GetVersion(ModuleName, ByRef out, list) /// For use in unit tests that need to test if a command threw any exceptions. ClassMethod ShellInternal(pCommand As %String, Output pException As %Exception.AbstractException) [ Internal ] { + New $$$DeprecationWarned Set pException = $$$NULLOREF Set tOneCommand = 0 Set tCommand = $Get(pCommand) @@ -509,6 +510,7 @@ ClassMethod ShellInternal(pCommand As %String, Output pException As %Exception.A ) Set tInShell = 0 For { + Kill $$$DeprecationWarned Try { // Have intro message just for first entrance to shell diff --git a/src/%ZPM/PackageManager/Common.inc b/src/%ZPM/PackageManager/Common.inc index 4d371800..b068a253 100644 --- a/src/%ZPM/PackageManager/Common.inc +++ b/src/%ZPM/PackageManager/Common.inc @@ -141,3 +141,6 @@ ROUTINE %ZPM.PackageManager.Common [Type=INC] /// OS corresponding slash #define SLASH $Select($$$isWINDOWS: "\", 1: "/") + +#; Variable to mark deprecation warning has been shown in the current process +#define DeprecationWarned %ZPMModuleDeprecatedResource \ No newline at end of file diff --git a/src/%ZPM/PackageManager/Developer/Processor/CSPApplication.cls b/src/%ZPM/PackageManager/Developer/Processor/CSPApplication.cls index fddd6992..781ba448 100644 --- a/src/%ZPM/PackageManager/Developer/Processor/CSPApplication.cls +++ b/src/%ZPM/PackageManager/Developer/Processor/CSPApplication.cls @@ -1,4 +1,4 @@ -Include (%sySecurity, %occErrors) +Include (%sySecurity, %occErrors, %ZPM.PackageManager.Common, %ZPM.Formatting) Class %ZPM.PackageManager.Developer.Processor.CSPApplication Extends (%ZPM.PackageManager.Developer.Processor.Abstract, %XML.Adaptor, %Installer.CSPApplication) [ PropertyClass = %ZPM.PackageManager.Developer.Processor.PropertyParameters ] { @@ -31,10 +31,10 @@ Parameter XMLTYPE = "ZPMCSPApplication"; Property Enabled As %Boolean [ InitialExpression = 1 ]; /// DeepSee Enabled -Property DeepSeeEnabled As %Boolean [ InitialExpression = 0 ]; +Property DeepSeeEnabled As %Installer.Boolean [ InitialExpression = 0 ]; /// iKnow Enabled -Property iKnowEnabled As %Boolean [ InitialExpression = 0 ]; +Property iKnowEnabled As %Installer.Boolean [ InitialExpression = 0 ]; /// Password authentication enabled Property PasswordAuthEnabled As %Boolean [ InitialExpression = 0 ]; @@ -65,6 +65,12 @@ Property Directory As %String(ATTRIBUTEREQUIRED = 0, MAXLEN = 1024) [ Required ] Method %OnNew(pResourceReference As %ZPM.PackageManager.Developer.ResourceReference) As %Status [ Private, ServerOnly = 1 ] { + Set packageName = pResourceReference.Module.Name + If ($Get(packageName) '= "") && '$Data($$$DeprecationWarned(packageName)) { + Set $$$DeprecationWarned(packageName) = 1 + Write !, $$$FormattedLine($$$Red, "WARNING: The resource tag is deprecated and may be removed in a future release of ZPM (IPM).") + Write !, $$$FormattedLine($$$Red, $$$FormatText(" Please contact the package developer of %1 to use instead", packageName)) + } Set tSC = ##super(pResourceReference) Set ..Url = $ZConvert(..Url,"L") Quit tSC