Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 0c8af29

Browse files
committed
[Bug 18875] Include notes for script libraries in release notes
1 parent 0c73a6e commit 0c8af29

File tree

1 file changed

+71
-37
lines changed

1 file changed

+71
-37
lines changed

builder/release_notes_builder.livecodescript

Lines changed: 71 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,10 @@ end V2NotesExtractSectionInfo
768768
-- section in <xCollated> with <pName>. If there is already a section
769769
-- named <pName> in <xCollated>, generate an error.
770770
private command V2NotesAppendSection pName, pCollatedSection, @xCollated
771+
if pCollatedSection is not an array then
772+
exit V2NotesAppendSection
773+
end if
774+
771775
local tId
772776
repeat with tId = 1 to xCollated["__count"]
773777
if xCollated[tId]["__name"] is pName then
@@ -782,20 +786,22 @@ private command V2NotesAppendSection pName, pCollatedSection, @xCollated
782786
put pName into xCollated[tId]["__name"]
783787
end V2NotesAppendSection
784788

785-
private function V2NotesHaveContent pCollated, pBugInfo
786-
if (word 1 to -1 of pCollated["__markdown"]) is not empty then
787-
return true
788-
end if
789-
790-
-- Recurse into child nodes
791-
local tId
792-
repeat with tId = 1 to pCollated["__count"]
793-
if V2NotesHaveContent(pCollated[tId]) then
789+
private function V2NotesHaveContent pCollated, pBugInfo
790+
if pCollated is an array then
791+
if (word 1 to -1 of pCollated["__markdown"]) is not empty then
794792
return true
795793
end if
796-
end repeat
797794

798-
if the number of elements in pBugInfo > 0 then
795+
-- Recurse into child nodes
796+
local tId
797+
repeat with tId = 1 to pCollated["__count"]
798+
if V2NotesHaveContent(pCollated[tId]) then
799+
return true
800+
end if
801+
end repeat
802+
end if
803+
804+
if pBugInfo is an array and the number of elements in pBugInfo > 0 then
799805
return true
800806
end if
801807

@@ -847,21 +853,29 @@ end V2NotesGenerateContent
847853
-- Extension release notes
848854
----------------------------------------------------------------
849855

850-
constant kExtensionTypes = "widgets,libraries,modules"
851-
constant kExtensionStrings = "widget,library,module"
856+
constant kExtensionLcbTypes = "widgets,libraries,modules"
857+
constant kExtensionLcbStrings = "widget,library,module"
858+
constant kExtensionScriptTypes = "script-libraries"
852859

853860
private command ExtensionsCreate
854861
BuilderLog "report", "Creating extension release notes"
855862

856863
local tType, tTypePath, tFolder
857864
local tCollated, tBugInfo
858-
repeat for each item tType in kExtensionTypes
865+
repeat for each item tType in kExtensionLcbTypes
859866
put FileGetPath("extensions") & slash & tType into tTypePath
860867

861868
repeat for each line tFolder in FileGetSubFolders(tTypePath)
862-
ExtensionsCreatePath tFolder, tCollated, tBugInfo
869+
ExtensionsCreateLcbPath tFolder, tCollated, tBugInfo
870+
end repeat
871+
end repeat
872+
873+
repeat for each item tType in kExtensionScriptTypes
874+
put FileGetPath("extensions") & slash & tType into tTypePath
875+
876+
repeat for each line tFolder in FileGetSubFolders(tTypePath)
877+
ExtensionsCreateScriptPath tFolder, tCollated, tBugInfo
863878
end repeat
864-
865879
end repeat
866880

867881
if V2NotesHaveContent(tCollated, tBugInfo) then
@@ -873,59 +887,52 @@ private command ExtensionsCreate
873887
end if
874888
end ExtensionsCreate
875889

876-
private command ExtensionsCreatePath pExtPath, @xCollated, @xBugInfo
890+
private command ExtensionsCreateLcbPath pExtPath, @xCollated, @xBugInfo
877891
set the itemdelimiter to slash
878892

879893
-- Skip the extension if it doesn't appear to have been compiled
880894
if there is not a file ExtensionsGetManifestPath(pExtPath) then
881895
builderLog "report", "Skipping uncompiled extension" && item -1 of pExtPath
882-
exit ExtensionsCreatePath
896+
exit ExtensionsCreateLcbPath
883897
end if
884898

885899
builderLog "report", "Creating release notes for" && item -1 of pExtPath
886900

887901
-- Scan and collate all information for this particular extension
888-
local tNotesPath
889-
put pExtPath & "/notes" into tNotesPath
890-
if there is not a folder tNotesPath then
891-
exit ExtensionsCreatePath
892-
end if
893-
894-
local tScan, tExtCollated
895-
put V2NotesScan(tNotesPath) into tScan
896-
V2NotesCollate pExtPath, tScan, tExtCollated, xBugInfo
902+
local tExtCollated
903+
ExtensionsScanAndCollatePath pExtPath, tExtCollated, xBugInfo
897904

898905
-- Add the collated info in the top-level collation structure
899906
try
900907
local tName
901-
put ExtensionsGetSectionName(pExtPath) into tName
908+
put ExtensionsGetLcbSectionName(pExtPath) into tName
902909
catch tError
903910
builderLog "warning", tError
904-
exit ExtensionsCreatePath
911+
exit ExtensionsCreateLcbPath
905912
end try
906913

907914
V2NotesAppendSection tName, tExtCollated, xCollated
908-
end ExtensionsCreatePath
915+
end ExtensionsCreateLcbPath
909916

910-
private function ExtensionsGetSectionName pExtPath
917+
private function ExtensionsGetLcbSectionName pExtPath
911918
local tName, tType, tTypeOffset, tPrettyType
912919

913920
set the itemdelimiter to slash
914921
put item -2 of pExtPath into tType
915922
set the itemdelimiter to comma
916923

917-
put itemoffset(tType, kExtensionTypes) into tTypeOffset
918-
put item tTypeOffset of kExtensionStrings into tPrettyType
924+
put itemoffset(tType, kExtensionLcbTypes) into tTypeOffset
925+
put item tTypeOffset of kExtensionLcbStrings into tPrettyType
919926

920-
put ExtensionsGetName(pExtPath) into tName
927+
put ExtensionsGetLcbName(pExtPath) into tName
921928
if word -1 of tName is not tPrettyType then
922929
put space & tPrettyType after tName
923930
end if
924931

925932
return tName
926-
end ExtensionsGetSectionName
933+
end ExtensionsGetLcbSectionName
927934

928-
private function ExtensionsGetName pExtPath
935+
private function ExtensionsGetLcbName pExtPath
929936
local tManifest, tXmlId
930937
put FileGetContents(ExtensionsGetManifestPath(pExtPath)) into tManifest
931938
put revXMLCreateTree(tManifest, true, true, false) into tXmlId
@@ -940,7 +947,7 @@ private function ExtensionsGetName pExtPath
940947
return empty
941948
end if
942949
return tTargetName
943-
end ExtensionsGetName
950+
end ExtensionsGetLcbName
944951

945952
private function ExtensionsGetKind pExtPath
946953
-- Horrible-ish hack for extracting the "real" name of the LiveCode
@@ -969,6 +976,33 @@ private function ExtensionsGetManifestPath pExtPath
969976
return tManifestFile
970977
end ExtensionsGetManifestPath
971978

979+
private command ExtensionsCreateScriptPath pExtPath, @xCollated, @xBugInfo
980+
set the itemDelimiter to slash
981+
982+
local tShortName
983+
put item -1 of pExtPath into tShortName
984+
985+
builderLog "report", merge("Creating release notes for [[tShortName]]")
986+
987+
local tExtCollated
988+
ExtensionsScanAndCollatePath pExtPath, tExtCollated, xBugInfo
989+
990+
-- FIXME use human-friendly names for script-only library extensions
991+
V2NotesAppendSection tShortName && "script library", tExtCollated, xCollated
992+
end ExtensionsCreateScriptPath
993+
994+
private command ExtensionsScanAndCollatePath pExtPath, @xCollated, @xBugInfo
995+
local tNotesPath
996+
put merge("[[pExtPath]]/notes") into tNotesPath
997+
if there is not a folder tNotesPath then
998+
exit ExtensionsScanAndCollatePath
999+
end if
1000+
1001+
local tScan
1002+
put V2NotesScan(tNotesPath) into tScan
1003+
V2NotesCollate pExtPath, tScan, xCollated, xBugInfo
1004+
end ExtensionsScanAndCollatePath
1005+
9721006
----------------------------------------------------------------
9731007
-- Dictionary change generation
9741008
----------------------------------------------------------------

0 commit comments

Comments
 (0)