167 lines
4.9 KiB
Plaintext
167 lines
4.9 KiB
Plaintext
Option Explicit
|
|
Dim oFS, oManifest, args, oFestures, iFeatureCount, sSolutionId
|
|
|
|
dim arFeatures(20)
|
|
iFeatureCount = 0
|
|
sSolutionId = "3EB8F7B8-7C95-45f0-AF92-646F96B0F7E9"
|
|
|
|
set args = WScript.Arguments
|
|
|
|
' Create the File System Object
|
|
Set oFS = CreateObject("Scripting.FileSystemObject")
|
|
|
|
Set oManifest = oFS.CreateTextFile(args(0) + "manifest.xml", true)
|
|
oManifest.WriteLine "<Solution xmlns='http://schemas.microsoft.com/sharepoint/' SolutionId='" + sSolutionId +"'>"
|
|
|
|
dim oFile, oGacFolder, oBinFolder
|
|
set oGacFolder = oFS.GetFolder(args(0) + "DLLS\GAC")
|
|
set oBinFolder = oFS.GetFolder(args(0) + "DLLS")
|
|
|
|
dim sSafeControls, oSafeXml
|
|
|
|
if (oGacFolder.Files.Count > 0 or oBinFolder.Files.Count > 0) then
|
|
oManifest.WriteLine " <Assemblies>"
|
|
|
|
for each oFile in oGacFolder.Files
|
|
oManifest.WriteLine " <Assembly DeploymentTarget='GlobalAssemblyCache' Location='GAC\" + oFile.Name + "'>"
|
|
if (oFS.FileExists(args(0) + "DLLS\SafeControls\" + oFile.Name + ".xml")) then
|
|
set oSafeXml = oFS.OpenTextFile(args(0) + "DLLS\SafeControls\" + oFile.Name + ".xml")
|
|
|
|
sSafeControls = oSafeXml.ReadAll
|
|
oManifest.Write Mid(sSafeControls, 4)
|
|
|
|
oManifest.WriteBlankLines 1
|
|
oSafeXml.Close
|
|
end if
|
|
oManifest.WriteLine " </Assembly>"
|
|
next
|
|
|
|
for each oFile in oBinFolder.Files
|
|
oManifest.WriteLine " <Assembly DeploymentTarget='WebApplication' Location='" + oFile.Name + "'>"
|
|
if (oFS.FileExists(args(0) + "DLLS\SafeControls\" + oFile.Name + ".xml")) then
|
|
set oSafeXml = oFS.OpenTextFile(args(0) + "DLLS\SafeControls\" + oFile.Name + ".xml")
|
|
|
|
sSafeControls = oSafeXml.ReadAll
|
|
oManifest.Write Mid(sSafeControls, 4)
|
|
|
|
oManifest.WriteBlankLines 1
|
|
oSafeXml.Close
|
|
end if
|
|
oManifest.WriteLine " </Assembly>"
|
|
next
|
|
|
|
oManifest.WriteLine " </Assemblies>"
|
|
end if
|
|
oManifest.WriteLine " <TemplateFiles>"
|
|
|
|
' Add the files in the manifest
|
|
|
|
EnumTemplateFolder args(0) + "TEMPLATE", "TEMPLATE"
|
|
|
|
oManifest.WriteLine " </TemplateFiles>"
|
|
|
|
oManifest.WriteLine " <FeatureManifests>"
|
|
|
|
' Add the features
|
|
dim sFeature
|
|
|
|
for each sFeature in arFeatures
|
|
if (sFeature <> "") then oManifest.WriteLine sFeature
|
|
next
|
|
|
|
oManifest.WriteLine " </FeatureManifests>"
|
|
|
|
oManifest.WriteLine " <RootFiles>"
|
|
|
|
' Add the files in the manifest
|
|
|
|
EnumRootFolder args(0) + "ROOT", "ROOT"
|
|
|
|
oManifest.WriteLine " </RootFiles>"
|
|
|
|
if (oFS.FileExists(args(0) + "cas.xml")) then
|
|
dim sCasXML, oCasFile
|
|
set oCasFile = oFS.OpenTextFile(args(0) + "cas.xml")
|
|
|
|
sCasXml = oCasFile.ReadAll
|
|
oManifest.Write Mid(sCasXml, 4)
|
|
|
|
oManifest.WriteBlankLines 1
|
|
oCasFile.Close
|
|
end if
|
|
|
|
|
|
oManifest.WriteLine "</Solution>"
|
|
|
|
oManifest.Close
|
|
|
|
sub EnumTemplateFolder(sFolder, sRelativePath)
|
|
|
|
dim oFolder, oFolders, oSub, oFile
|
|
set oFolder = oFS.GetFolder(sFolder)
|
|
|
|
for each oFile in oFolder.Files
|
|
|
|
dim sTestFolder, iPos
|
|
|
|
iPos = InStrRev(sFolder, "TEMPLATE\FEATURES")
|
|
if (iPos > 0) then
|
|
sTestFolder = Mid(sFolder, iPos + 18)
|
|
else
|
|
sTestFolder = sFolder
|
|
end if
|
|
|
|
if (InStr(1, sTestFolder, "\") > 0) then
|
|
if (InStr(1, sFolder, "FEATURES") = 0) then
|
|
oManifest.WriteLine " <TemplateFile Location='" + sRelativePath + "\" + oFile.Name + "' />"
|
|
else
|
|
oManifest.WriteLine " <TemplateFile Location='FEATURES\" + sRelativePath + "\" + oFile.Name + "' />"
|
|
end if
|
|
end if
|
|
|
|
if (lcase(oFile.Name) = "feature.xml") then
|
|
arFeatures(iFeatureCount) = " <FeatureManifest Location='" + sRelativePath + "\" + oFile.Name + "' />"
|
|
iFeatureCount = iFeatureCount + 1
|
|
end if
|
|
|
|
next
|
|
|
|
if (sRelativePath = "TEMPLATE") then sRelativePath = ""
|
|
if (sRelativePath = "FEATURES") then sRelativePath = ""
|
|
|
|
if (sRelativePath <> "") then sRelativePath = sRelativePath + "\"
|
|
|
|
for each oSub in oFolder.SubFolders
|
|
if (Instr(oSub.Path, "_tfs")=0) then
|
|
EnumTemplateFolder oSub.Path, sRelativePath + oSub.Name
|
|
end if
|
|
next
|
|
|
|
end sub
|
|
|
|
sub EnumRootFolder(sFolder, sRelativePath)
|
|
|
|
dim oFolder, oFolders, oSub, oFile
|
|
set oFolder = oFS.GetFolder(sFolder)
|
|
|
|
for each oFile in oFolder.Files
|
|
|
|
dim sTestFolder, iPos
|
|
|
|
|
|
oManifest.WriteLine " <RootFile Location='" + sRelativePath + "\" + oFile.Name + "' />"
|
|
|
|
next
|
|
|
|
if (sRelativePath = "ROOT") then sRelativePath = ""
|
|
|
|
if (sRelativePath <> "") then sRelativePath = sRelativePath + "\"
|
|
|
|
for each oSub in oFolder.SubFolders
|
|
if (Instr(oSub.Path, "_tfs")=0) then
|
|
EnumRootFolder oSub.Path, sRelativePath + oSub.Name
|
|
end if
|
|
next
|
|
|
|
end sub
|