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