Use the same end of line for main.js generation as it was before.
This commit is contained in:
parent
91e0e78bdf
commit
2f446b7161
@ -13,6 +13,13 @@ def WriteContentToFile (filePath, content):
|
|||||||
fileObject.write (content)
|
fileObject.write (content)
|
||||||
fileObject.close ()
|
fileObject.close ()
|
||||||
|
|
||||||
|
def GetEOLCharFromFile (filePath):
|
||||||
|
content = GetFileContent (filePath)
|
||||||
|
if content.count ('\r\n') > 0:
|
||||||
|
return '\r\n'
|
||||||
|
else:
|
||||||
|
return '\n'
|
||||||
|
|
||||||
def RunCommand (executable, arguments):
|
def RunCommand (executable, arguments):
|
||||||
command = executable + ' "' + '" "'.join (arguments) + '"'
|
command = executable + ' "' + '" "'.join (arguments) + '"'
|
||||||
return os.system (command)
|
return os.system (command)
|
||||||
|
|||||||
@ -10,10 +10,6 @@ def Main (argv):
|
|||||||
rootDir = os.path.dirname (toolsDir)
|
rootDir = os.path.dirname (toolsDir)
|
||||||
os.chdir (rootDir)
|
os.chdir (rootDir)
|
||||||
|
|
||||||
config = None
|
|
||||||
with open (os.path.join (toolsDir, 'config.json')) as configJson:
|
|
||||||
config = json.load (configJson)
|
|
||||||
|
|
||||||
engineFiles = []
|
engineFiles = []
|
||||||
sourceFolder = os.path.join (rootDir, 'source', 'engine')
|
sourceFolder = os.path.join (rootDir, 'source', 'engine')
|
||||||
for dirName in os.listdir (sourceFolder):
|
for dirName in os.listdir (sourceFolder):
|
||||||
@ -26,6 +22,9 @@ def Main (argv):
|
|||||||
'fileName': fileName
|
'fileName': fileName
|
||||||
})
|
})
|
||||||
|
|
||||||
|
mainFilePath = os.path.join (sourceFolder, 'main.js')
|
||||||
|
eolChar = Tools.GetEOLCharFromFile (mainFilePath)
|
||||||
|
|
||||||
exportedSymbols = []
|
exportedSymbols = []
|
||||||
mainFileContent = ''
|
mainFileContent = ''
|
||||||
for engineFile in engineFiles:
|
for engineFile in engineFiles:
|
||||||
@ -38,20 +37,20 @@ def Main (argv):
|
|||||||
if len (matches) == 0:
|
if len (matches) == 0:
|
||||||
continue
|
continue
|
||||||
relativePath = './' + engineFile['dirName'] + '/' + engineFile['fileName']
|
relativePath = './' + engineFile['dirName'] + '/' + engineFile['fileName']
|
||||||
mainFileContent += 'import { ' + ', '.join (matches) + ' } from \'' + relativePath + '\';\n'
|
mainFileContent += 'import { ' + ', '.join (matches) + ' } from \'' + relativePath + '\';' + eolChar
|
||||||
for match in matches:
|
for match in matches:
|
||||||
exportedSymbols.append (match)
|
exportedSymbols.append (match)
|
||||||
|
|
||||||
mainFileContent += '\nexport {\n'
|
mainFileContent += eolChar + 'export {' + eolChar
|
||||||
for i in range (0, len (exportedSymbols)):
|
for i in range (0, len (exportedSymbols)):
|
||||||
exportedSymbol = exportedSymbols[i]
|
exportedSymbol = exportedSymbols[i]
|
||||||
mainFileContent += ' ' + exportedSymbol
|
mainFileContent += ' ' + exportedSymbol
|
||||||
if i < len (exportedSymbols) - 1:
|
if i < len (exportedSymbols) - 1:
|
||||||
mainFileContent += ','
|
mainFileContent += ','
|
||||||
mainFileContent += '\n'
|
mainFileContent += eolChar
|
||||||
mainFileContent += '};\n'
|
mainFileContent += '};' + eolChar
|
||||||
|
|
||||||
Tools.WriteContentToFile (os.path.join (sourceFolder, 'main.js'), mainFileContent)
|
Tools.WriteContentToFile (mainFilePath, mainFileContent)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
sys.exit (Main (sys.argv))
|
sys.exit (Main (sys.argv))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user