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

Commit a32b33d

Browse files
committed
[[ Store ]] Output manifest.xml when packaging LCS extensions
1 parent c81ae01 commit a32b33d

2 files changed

Lines changed: 76 additions & 3 deletions

File tree

Toolset/libraries/revidedeveloperextensionlibrary.livecodescript

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,18 @@ private command __revIDEDeveloperExtensionBuildPackage pFolder, pTargetFolder, @
775775
return "Error: missing file" && tFullPath
776776
end if
777777

778+
local tManifestFile
779+
put pFolder & slash & "manifest.xml" into tManifestFile
780+
781+
if tDetailsA["source_type"] is "lcs" then
782+
revIDEExtensionGenerateManifestForLCSExtension \
783+
tDetailsA["source_file"], pFolder
784+
end if
785+
786+
if there is no file tManifestFile then
787+
return "Error: missing manifest" && tManifestFile
788+
end if
789+
778790
local tTargetFolder
779791
if pTargetFolder is empty then
780792
put pFolder into tTargetFolder
@@ -892,9 +904,14 @@ private command __revIDEDeveloperExtensionBuildPackage pFolder, pTargetFolder, @
892904
local tSupportFiles
893905
put tDetailsA["support_files"] into tSupportFiles
894906

907+
local tModuleFile
908+
if tDetailsA["source_type"] is "lcb" then
909+
put pFolder & slash & "module.lcm" into tModuleFile
910+
end if
911+
895912
if tError is empty then
896913
put __revIDEDeveloperExtensionAddSpecifiedFilesToPackage(\
897-
tFullPath, tSupportFiles, pFolder, tArchive, pFolder & slash & "module.lcm", \
914+
tFullPath, tSupportFiles, pFolder, tArchive, tModuleFile, \
898915
tIcon, tRetinaIcon, tGuide, tDocs, tResources, tCode, \
899916
tSamples, tInterfaceFile, tDefaultScript, tEditors) \
900917
into tError
@@ -918,7 +935,7 @@ private command __revIDEDeveloperExtensionBuildPackage pFolder, pTargetFolder, @
918935
end __revIDEDeveloperExtensionBuildPackage
919936

920937
private function __revIDEDeveloperExtensionAddSpecifiedFilesToPackage \
921-
pSource, pSupportFiles, pFolder, pArchive, pModule, pIcon, \
938+
pSource, pSupportFiles, pFolder, pArchive, pModuleFile, pIcon, \
922939
pRetinaIcon, pGuide, pDocs, pResourcesFolder, pCodeFolder, \
923940
pSamplesFolder, pInterfaceFile, pDefaultScript, pEditors
924941

@@ -943,7 +960,9 @@ private function __revIDEDeveloperExtensionAddSpecifiedFilesToPackage \
943960
end repeat
944961

945962
# Add module into package
946-
revZipAddItemWithFile pArchive, "module.lcm", pModule
963+
if pModuleFile is not empty then
964+
revZipAddItemWithFile pArchive, item -1 of pModuleFile, pModuleFile
965+
end if
947966

948967
if the result begins with "ziperr" then
949968
put "couldn't add module" into tError

Toolset/libraries/revideextensionlibrary.livecodescript

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,8 @@ private command __revIDELCSExtensionLoad pFullPath, pFolder, pVersion, pStatus,
13571357
__extensionPropertySet tCacheIndex, "author", pAdditionalInfoA["author"]
13581358
__extensionPropertySet tCacheIndex, "title", pAdditionalInfoA["display name"]
13591359
__extensionPropertySet tCacheIndex, "svgicon", pAdditionalInfoA["svgicon"]
1360+
__extensionPropertySet tCacheIndex, "version", pAdditionalInfoA["version"]
1361+
13601362
repeat for each key tKey in pAdditionalInfoA["uses"]
13611363
local tSettingString
13621364
put empty into tSettingString
@@ -1890,3 +1892,55 @@ command revIDEExtensionIconFromType pType, pID, @rIconName, @rIconPath
18901892
break
18911893
end switch
18921894
end revIDEExtensionIconFromType
1895+
1896+
private command addXML @xXML, pDepth, pTag, pContent, pAttributesA
1897+
repeat pDepth
1898+
put space after xXML
1899+
end repeat
1900+
put "<" & pTag after xXML
1901+
repeat for each key tKey in pAttributesA
1902+
put " " & tKey & "=" & quote & pAttributesA[tKey] & quote \
1903+
after xXML
1904+
end repeat
1905+
if pContent is empty then
1906+
put " />" after xXML
1907+
else
1908+
put ">" & pContent & "</" & pTag & ">" after xXML
1909+
end if
1910+
put return after xXML
1911+
end addXML
1912+
1913+
command revIDEExtensionGenerateManifestForLCSExtension pSource, pFolder
1914+
local tDataA
1915+
put __fetchScriptLibraryData(pFolder, pSource) into tDataA
1916+
1917+
local tPackageXML, tAttrA
1918+
repeat for each item tTag in "name,title,author,version,type"
1919+
addXML tPackageXML, 1, tTag, tDataA[tTag]
1920+
end repeat
1921+
1922+
addXML tPackageXML, 1, "license", "community"
1923+
1924+
// TODO: This will only work for loaded lcs libraries
1925+
repeat for each line tRequirement in revSBGetExtensionDependenciesForExtension(tDataA["name"])
1926+
put tRequirement into tAttrA["name"]
1927+
addXML tPackageXML, 1, "requires", "", tAttrA
1928+
put empty into tAttrA
1929+
end repeat
1930+
1931+
repeat for each item tMetadata in "svgicon"
1932+
local tValue
1933+
put tDataA[tMetadata] into tValue
1934+
if tValue is empty then
1935+
next repeat
1936+
end if
1937+
put tMetadata into tAttrA["key"]
1938+
addXML tPackageXML, 1, "metadata", tValue, tAttrA
1939+
put empty into tAttrA
1940+
end repeat
1941+
1942+
local tXML
1943+
put "0.0" into tAttrA["version"]
1944+
addXML tXML, 0, "package", return & tPackageXML, tAttrA
1945+
put textEncode(tXML, "utf-8") into url("binfile:" & pFolder & slash & "manifest.xml")
1946+
end revIDEExtensionGenerateManifestForLCSExtension

0 commit comments

Comments
 (0)