瀏覽代碼

Merge pull request #4975 from gero3/AddExtraInfoBuild

Add extra info build
Mr.doob 11 年之前
父節點
當前提交
66dfaba302
共有 2 個文件被更改,包括 14 次插入2 次删除
  1. 7 0
      utils/build/build.js
  2. 7 2
      utils/build/build.py

+ 7 - 0
utils/build/build.js

@@ -34,6 +34,9 @@ function main() {
 
 	var buffer = [];
 	var sources = [];
+		
+	buffer.push('// You shouldn\'t edit this build file. \n');
+	buffer.push('// The following source code is build from the src folder. \n');
 	
 	if ( args.amd ){
 		buffer.push('function ( root, factory ) {\n\n\tif ( typeof define === \'function\' && define.amd ) {\n\n\t\tdefine( [ \'exports\' ], factory );\n\n\t} else if ( typeof exports === \'object\' ) {\n\n\t\tfactory( exports );\n\n\t} else {\n\n\t\tfactory( root );\n\n\t}\n\n}( this, function ( exports ) {\n\n');
@@ -47,8 +50,12 @@ function main() {
 		for ( var j = 0; j < files.length; j ++ ){
 
 			var file = '../../' + files[ j ];
+			
 			sources.push( file );
+			buffer.push('// File:' + files[ j ]);
+			buffer.push('\n\n');
 			buffer.push( fs.readFileSync( file, 'utf8' ) );
+			buffer.push('\n');
 
 		}
 

+ 7 - 2
utils/build/build.py

@@ -5,7 +5,7 @@ import sys
 if sys.version_info < (2, 7):
 	print("This script requires at least Python 2.7.")
 	print("Please, update to a newer version: http://www.python.org/download/releases/")
-	exit()
+#	exit()
 
 import argparse
 import json
@@ -44,7 +44,10 @@ def main(argv=None):
 	fd, path = tempfile.mkstemp()
 	tmp = open(path, 'w')
 	sources = []
-
+	
+	tmp.write('// You shouldn\'t edit this build file. \n')
+	tmp.write('// The following source code is build from the src folder. \n')
+	
 	if args.amd:
 		tmp.write('( function ( root, factory ) {\n\n\tif ( typeof define === \'function\' && define.amd ) {\n\n\t\tdefine( [ \'exports\' ], factory );\n\n\t} else if ( typeof exports === \'object\' ) {\n\n\t\tfactory( exports );\n\n\t} else {\n\n\t\tfactory( root );\n\n\t}\n\n}( this, function ( exports ) {\n\n')
 
@@ -52,6 +55,8 @@ def main(argv=None):
 		with open('includes/' + include + '.json','r') as f:
 			files = json.load(f)
 		for filename in files:
+			tmp.write('// File:' + filename)
+			tmp.write('\n\n')
 			filename = '../../' + filename;
 			sources.append(filename)
 			with open(filename, 'r') as f: