Skip to content

Commit f0169aa

Browse files
committed
修复windows下编译命令行太长的问题
1 parent bc486b0 commit f0169aa

File tree

5 files changed

+6103
-1723
lines changed

5 files changed

+6103
-1723
lines changed

build.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
raise Exception("Blockly build only compatible with Python 2.x.\n"
44
"You are using: " + sys.version)
55

6-
import errno, glob, httplib, json, os, re, subprocess, threading, urllib
6+
import errno, glob, httplib, json, os, re, subprocess, threading, urllib, shutil
77

88
CLOSURE_DIR = os.path.pardir
99
CLOSURE_ROOT = os.path.pardir
@@ -181,12 +181,17 @@ def gen_core(self, vertical):
181181
# Read in all the source files.
182182
filenames = calcdeps.CalculateDependencies(search_paths,
183183
[os.path.join("core", "blockly.js")])
184+
185+
186+
184187
filenames.sort() # Deterministic build.
188+
if not os.path.exists('goog'):
189+
shutil.copytree('node_modules\\google-closure-library\\closure\\goog','goog')
185190
for filename in filenames:
191+
filename = filename.replace("node_modules\\google-closure-library\\closure\\","")
186192
# Append filenames as false arguments the step before compiling will
187193
# either transform them into arguments for local or remote compilation
188194
params.append(("js_file", filename))
189-
190195
self.do_compile(params, target_filename, filenames, "")
191196

192197
def gen_blocks(self, block_type):
@@ -237,7 +242,7 @@ def do_compile_jar(self, params, target_filename):
237242
args = []
238243
for group in [["java -jar google-closure-compiler.jar"], dash_params]:
239244
args.extend(group)
240-
# print args
245+
print " ".join(args)
241246
if sys.platform == "darwin":
242247
proc = subprocess.Popen(" ".join(args), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
243248
else:

local_build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
# Find the Closure Compiler.
3838
if [ -f "$(npm root)/google-closure-compiler/compiler.jar" ]; then
3939
COMPILER="$(npm root)/google-closure-compiler/compiler.jar"
40-
elif [ -f closure-compiler*.jar ]; then
41-
COMPILER="closure-compiler*.jar"
40+
elif [ -f google-closure-compiler.jar ]; then
41+
COMPILER="google-closure-compiler.jar"
4242
# TODO: Check whether multiple files were found.
4343
else
4444
echo "ERROR: Closure Compiler not found."

0 commit comments

Comments
 (0)