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

Commit 8fdce6e

Browse files
committed
[[ ExtensionNotes ]] Ensure extension notes are in release notes
1 parent fd1d16a commit 8fdce6e

1 file changed

Lines changed: 85 additions & 45 deletions

File tree

builder/release_notes_builder.livecodescript

Lines changed: 85 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,15 @@ command releaseNotesBuilderRun pEdition, pVersion, pReleaseType, pOutputDir
5858
put "LiveCode Builder changes" into tComponents[tIndex]["metadata"]["section"]
5959

6060
local tPath, tTypePath
61-
repeat for each line tPath in builderPrivateRepoFolder() & return & builderRepoFolder()
61+
local tReposA, tEdition
62+
put builderPrivateRepoFolder() into tReposA["indy"]
63+
put builderRepoFolder() into tReposA["community"]
64+
65+
repeat for each key tEdition in tReposA
66+
put tReposA[tEdition] into tPath
67+
6268
repeat for each item tType in kExtensionLcbTypes
63-
put tPath & slash & tType into tTypePath
69+
put tPath & slash & "extensions" & slash & tType into tTypePath
6470
if there is not a folder tTypePath then
6571
next repeat
6672
end if
@@ -70,20 +76,13 @@ command releaseNotesBuilderRun pEdition, pVersion, pReleaseType, pOutputDir
7076
put tFolder into tComponents[tIndex]["folder"]
7177
put "extension" into tComponents[tIndex]["metadata"]["category"]
7278

73-
--!TODO move these extensions to components
74-
switch tFolder
75-
case "drawing"
76-
put "indy" into tComponents[tIndex]["metadata"]["edition"]
77-
break
78-
default
79-
put "community" into tComponents[tIndex]["metadata"]["edition"]
80-
end switch
79+
put tEdition into tComponents[tIndex]["metadata"]["edition"]
80+
put ExtensionsGetSectionName(tFolder) into tComponents[tIndex]["metadata"]["section"]
8181
end repeat
82-
put ExtensionsGetLcbSectionName(tFolder) into tComponents[tIndex]["metadata"]["section"]
8382
end repeat
8483

8584
repeat for each item tType in kExtensionScriptTypes
86-
put tPath & slash & tType into tTypePath
85+
put tPath & slash & "extensions" & slash & tType into tTypePath
8786
if there is not a folder tTypePath then
8887
next repeat
8988
end if
@@ -100,13 +99,10 @@ command releaseNotesBuilderRun pEdition, pVersion, pReleaseType, pOutputDir
10099
case "scriptprofiler"
101100
put "business" into tComponents[tIndex]["metadata"]["edition"]
102101
break
103-
case "aws"
104-
put "indy" into tComponents[tIndex]["metadata"]["edition"]
105-
break
106102
default
107-
put "community" into tComponents[tIndex]["metadata"]["edition"]
103+
put tEdition into tComponents[tIndex]["metadata"]["edition"]
108104
end switch
109-
put tFolder && "script library" into tComponents[tIndex]["metadata"]["section"]
105+
put ExtensionsGetSectionName(tFolder) into tComponents[tIndex]["metadata"]["section"]
110106
end repeat
111107
end repeat
112108
end repeat
@@ -166,17 +162,17 @@ private command ComponentsCreatePath pComponent, @xCollated, @xBugInfo
166162

167163
builderLog "report", "Creating release notes for" && the last item of pComponent["folder"]
168164

169-
-- just because something is a LCB module or a script library does not mean
170-
-- we necessarily want to give it a separate section in the release notes
171-
-- for example a widget or library for use purely within the IDE should
172-
-- just merge into the IDE notes.
173165
if pComponent["metadata"]["section"] is empty then
166+
-- just because something is a LCB module or a script library does not mean
167+
-- we necessarily want to give it a separate section in the release notes
168+
-- for example a widget or library for use purely within the IDE should
169+
-- just merge into the IDE notes.
174170
ScanAndCollatePath \
175171
pComponent["folder"], \
176172
xCollated[pComponent["metadata"]["edition"]][pComponent["metadata"]["category"]], \
177173
xBugInfo[pComponent["metadata"]["edition"]][pComponent["metadata"]["category"]]
178174
else
179-
local tCollatedSection
175+
local tCollatedSection, tToMerge
180176
ScanAndCollatePath \
181177
pComponent["folder"], \
182178
tCollatedSection, \
@@ -185,13 +181,14 @@ private command ComponentsCreatePath pComponent, @xCollated, @xBugInfo
185181
-- Note the use of AppendToSection here means multiple components can be merged
186182
-- into the same sub-section of the notes. For example, engine -> Mobile or
187183
-- ide -> Script Editor
184+
put 1 into tToMerge["__count"]
185+
put tCollatedSection into tToMerge[1]
186+
put pComponent["metadata"]["section"] into tToMerge[1]["__name"]
187+
188188
if NotesHaveContent(tCollatedSection) then
189-
NotesEnsureRootSection \
190-
pComponent["metadata"]["section"], \
191-
xCollated[pComponent["metadata"]["edition"]][pComponent["metadata"]["category"]]
192189
NotesMerge \
193-
tCollatedSection, \
194-
xCollated[pComponent["metadata"]["edition"]][pComponent["metadata"]["category"]][1]
190+
tToMerge, \
191+
xCollated[pComponent["metadata"]["edition"]][pComponent["metadata"]["category"]]
195192
end if
196193
end if
197194
end ComponentsCreatePath
@@ -679,16 +676,6 @@ private command NotesExtractSectionInfo pLine, @rLevel, @rName
679676
end if
680677
end NotesExtractSectionInfo
681678

682-
private command NotesEnsureRootSection pSection, @xCollated
683-
if xCollated[1]["__name"] is not pSection then
684-
local tCollated
685-
put 1 into tCollated["__count"]
686-
put xCollated into tCollated[1]
687-
put pSection into tCollated[1]["__name"]
688-
put tCollated into xCollated
689-
end if
690-
end NotesEnsureRootSection
691-
692679
private command NotesMerge pLeftCollated, @xRightCollated
693680
if pLeftCollated is not an array then
694681
exit NotesMerge
@@ -783,7 +770,7 @@ private function NotesGenerateContent pType, pCollated, pLevel
783770
return tContent
784771
end NotesGenerateContent
785772

786-
private function ExtensionsGetLcbSectionName pExtPath
773+
private function ExtensionsGetSectionName pExtPath
787774
local tName, tType, tTypeOffset, tPrettyType
788775

789776
set the itemdelimiter to slash
@@ -793,15 +780,37 @@ private function ExtensionsGetLcbSectionName pExtPath
793780
put itemoffset(tType, kExtensionLcbTypes) into tTypeOffset
794781
put item tTypeOffset of kExtensionLcbStrings into tPrettyType
795782

796-
put ExtensionsGetLcbName(pExtPath) into tName
783+
put ExtensionsGetName(pExtPath) into tName
797784
if word -1 of tName is not tPrettyType then
798785
put space & tPrettyType after tName
799786
end if
800787

801788
return tName
802-
end ExtensionsGetLcbSectionName
803-
804-
private function ExtensionsGetLcbName pExtPath
789+
end ExtensionsGetSectionName
790+
791+
private function ExtensionsGetName pExtPath
792+
if there is a file ExtensionsGetManifestPath(pExtPath) then
793+
return ExtensionsGetLCBName(pExtPath)
794+
else if there is a file ExtensionsGetDocPath(pExtPath) then
795+
-- Script library
796+
return ExtensionsGetLCSName(pExtPath)
797+
end if
798+
return empty
799+
end ExtensionsGetName
800+
801+
private function ExtensionsGetLCSName pExtPath
802+
local tDoc, tTitle
803+
put builderFileGetContents(ExtensionsGetDocPath(pExtPath)) into tDoc
804+
repeat for each line tLine in tDoc
805+
get matchText(tLine, "(?i)^\s*(?:Title\:)\s+([\w.]*)", tTitle)
806+
if tTitle is not empty then
807+
exit repeat
808+
end if
809+
end repeat
810+
return tTitle
811+
end ExtensionsGetLCSName
812+
813+
private function ExtensionsGetLCBName pExtPath
805814
local tManifest, tXmlId
806815
put builderFileGetContents(ExtensionsGetManifestPath(pExtPath)) into tManifest
807816
put revXMLCreateTree(tManifest, true, true, false) into tXmlId
@@ -818,7 +827,7 @@ private function ExtensionsGetLcbName pExtPath
818827
return empty
819828
end if
820829
return tTargetName
821-
end ExtensionsGetLcbName
830+
end ExtensionsGetLCBName
822831

823832
private function ExtensionsGetKind pExtPath
824833
-- Horrible-ish hack for extracting the "real" name of the LiveCode
@@ -827,8 +836,32 @@ private function ExtensionsGetKind pExtPath
827836
set the itemdelimiter to slash
828837
put item -1 of pExtPath into tShortName
829838

839+
if there is no file merge("[[pExtPath]]/[[tShortName]].lcb") then
840+
return ExtensionsGetLCSKind(pExtPath, tShortName)
841+
else
842+
return ExtensionsGetLCBKind(pExtPath, tShortName)
843+
end if
844+
end ExtensionsGetKind
845+
846+
private function ExtensionsGetLCSKind pExtPath, pShortName
847+
local tSource, tLine, tName
848+
if there is no file merge("[[pExtPath]]/[[pShortName]].livecodescript") then
849+
return empty
850+
end if
851+
put builderFileGetUTF8Contents(merge("[[pExtPath]]/[[pShortName]].livecodescript")) into tSource
852+
repeat for each line tLine in tSource
853+
get matchText(tLine, "(?i)^\s*(?:" & quote & "script" & quote & ")\s+([\w.]*)", tName)
854+
if tName is not empty then
855+
exit repeat
856+
end if
857+
end repeat
858+
859+
return tName
860+
end ExtensionsGetLCSKind
861+
862+
private function ExtensionsGetLCBKind pExtPath, pShortName
830863
local tLcbSource, tLine, tModuleName
831-
put builderFileGetUTF8Contents(merge("[[pExtPath]]/[[tShortName]].lcb")) into tLcbSource
864+
put builderFileGetUTF8Contents(merge("[[pExtPath]]/[[pShortName]].lcb")) into tLcbSource
832865
repeat for each line tLine in tLcbSource
833866
get matchText(tLine, "(?i)^\s*(?:module|widget|library)\s+([\w.]*)", tModuleName)
834867
if tModuleName is not empty then
@@ -837,7 +870,7 @@ private function ExtensionsGetKind pExtPath
837870
end repeat
838871

839872
return tModuleName
840-
end ExtensionsGetKind
873+
end ExtensionsGetLCBKind
841874

842875
private function ExtensionsGetManifestPath pExtPath
843876
local tManifestFile
@@ -847,6 +880,13 @@ private function ExtensionsGetManifestPath pExtPath
847880
return tManifestFile
848881
end ExtensionsGetManifestPath
849882

883+
private function ExtensionsGetDocPath pExtPath
884+
local tDocFile
885+
put FileGetPath("built-extensions") into tDocFile
886+
put slash & ExtensionsGetKind(pExtPath) after tDocFile
887+
put slash & "api.lcdoc" after tDocFile
888+
return tDocFile
889+
end ExtensionsGetDocPath
850890

851891
private command ScanAndCollatePath pExtPath, @xCollated, @xBugInfo
852892
local tNotesPath

0 commit comments

Comments
 (0)