mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Fixing bugs in the scripts that copy headers into dist. Now allow trailing #comments, and handle whitespace after file names.
This commit is contained in:
parent
11d1544188
commit
e71ef66b54
@ -36,35 +36,43 @@ if {verbose}
|
||||
echo "Scripts directory is ¶"{ScriptsDir}¶""
|
||||
end if
|
||||
|
||||
#delete -i temp2
|
||||
# for each line in the source file, remove it if it starts with #, otherwise quote it
|
||||
|
||||
#Strip all comment lines, and quote each line
|
||||
#streamedit "{sourceList}" -e '/#Å/ Delete; /¥/ Replace /(Å)¨1/ "¶""¨1"¶""' > temp2
|
||||
|
||||
#set debugEcho ""
|
||||
#set debugEcho "echo"
|
||||
|
||||
for curLine in `streamedit "{sourceList}" -e '/#Å/ Delete; /¥/ Replace /(Å)¨1/ "¶""¨1"¶""'`
|
||||
for curLine in `streamedit "{sourceList}" -e '/¥#Å/ Delete; /¥/ Replace /(Å)¨1/ "¶""¨1"¶""'`
|
||||
|
||||
if `evaluate "{curLine}" =~ /([Â ¶t]+)¨1[ ¶t]+[:]*(Å)¨2/`
|
||||
echo "{curLine}"
|
||||
|
||||
if {verbose}
|
||||
echo "Cur line is {curLine}"
|
||||
end if
|
||||
|
||||
set exportFile "{¨1}"
|
||||
set theTarget "{¨2}"
|
||||
# ignore empty lines
|
||||
if `evaluate "{{curLine}}" != ""`
|
||||
|
||||
if {verbose}
|
||||
echo "Export file name is {exportFile}"
|
||||
echo "Target directory is {theTarget}"
|
||||
echo "{curLine}"
|
||||
|
||||
# strip out trailing comments
|
||||
if `evaluate "{curLine}" =~ /(Å)¨1[ ¶t]+(#Å)¨2/`
|
||||
set sourceLine "{¨1}"
|
||||
# echo "Discarding comment {¨2}"
|
||||
else
|
||||
set sourceLine "{curLine}"
|
||||
end if
|
||||
|
||||
"{ScriptsDir}CopyList.script" "{exportFile}" "{theTarget}"
|
||||
if `evaluate "{sourceLine}" =~ /([Â ¶t]+)¨1[ ¶t]+[:]*(Å)¨2/`
|
||||
|
||||
if {verbose}
|
||||
echo "Cur line is {sourceLine}"
|
||||
end if
|
||||
|
||||
set exportFile "{¨1}"
|
||||
set theTarget "{¨2}"
|
||||
|
||||
if {verbose}
|
||||
echo "Export file name is {exportFile}"
|
||||
echo "Target directory is {theTarget}"
|
||||
end if
|
||||
|
||||
"{ScriptsDir}CopyList.script" "{exportFile}" "{theTarget}"
|
||||
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
|
||||
end for
|
||||
|
||||
|
||||
#delete -i temp2
|
||||
|
@ -62,17 +62,35 @@ if {verbose}
|
||||
echo "Target directory is ¶"{targetDir}¶""
|
||||
end if
|
||||
|
||||
#delete -i temp1
|
||||
# Strip all comment lines, pipe the stripped lines into the "for" loop.
|
||||
# We quote each whole line here so that we deal with a line at a time in the
|
||||
# for loop. Don't ya just love MPW quoting rulesÉ
|
||||
|
||||
#Strip all comment lines
|
||||
#streamedit "{sourceList}" -e '/#Å/ Delete' > temp1
|
||||
|
||||
#Strip all comment lines, pipe the stripped lines into this "for" loop:
|
||||
for f in `streamedit "{sourceList}" -e '/#Å/ Delete'`
|
||||
if `Newer "{sourceDir}{f}" "{targetDir}:{f}"` #|| !`Exists "{targetDir}:{f}"`
|
||||
if {verbose} ; echo "{sourceDir}{f} is newer than {targetDir}:{f}" ; end if
|
||||
{debugEcho} duplicate -y "{sourceDir}{f}" "{targetDir}"
|
||||
for f in `streamedit "{sourceList}" -e '/¥#Å/ Delete; /¥/ Replace /(Å)¨1/ "¶""¨1"¶""'`
|
||||
|
||||
if `evaluate "{{f}}" != ""`
|
||||
|
||||
# strip out trailing comments (in fact, anything following whitespace)
|
||||
if `evaluate "{f}" =~ /([Â ¶t]+)¨1[ ¶t]+([#]*Å)¨2/`
|
||||
set sourceFile "{¨1}"
|
||||
# echo "Discarding comment {¨2}"
|
||||
else
|
||||
set sourceFile "{f}"
|
||||
end if
|
||||
|
||||
# sourceFile can be a relative path, so need to get the file name for date comparisons
|
||||
if `evaluate "{sourceFile}" =~ /Å:([Â:]+)¨1/`
|
||||
set filename "{¨1}"
|
||||
else
|
||||
set filename {sourceFile}
|
||||
end if
|
||||
|
||||
# now copy the file if newer
|
||||
if `Newer "{sourceDir}{sourceFile}" "{targetDir}:{filename}"` #|| !`Exists "{targetDir}:{filename}"`
|
||||
if {verbose} ; echo "{sourceDir}{sourceFile} is newer than {targetDir}:{filename}" ; end if
|
||||
{debugEcho} duplicate -y "{sourceDir}{sourceFile}" "{targetDir}"
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end for
|
||||
|
||||
#delete -i temp1
|
||||
|
Loading…
Reference in New Issue
Block a user