
JettyDaemon invokes buck build to ensure GWT JS is up-to-date before running the server. To be completely compatible with the command line build it uses the same PATH environment variable, ignoring the PATH that is inherited from Eclipse. Including the PATH as part of the genrule() command ensures buck will rewrite the properties file anytime the user modifies the PATH, rather than only when there are updates to GWT Java sources. Using a properties file frees us from worrying about double quoting in shell: once in the genrule, again in the script itself. Using a single properties file ensures any GWT UI can be computed or verified by JettyDaemon. This change simplifies bootstrap for a developer as they no longer need to build the UI before launching the server from within Eclipse. JettyDaemon now takes care of it. Change-Id: If096a60d9a3f9d6d1502cc947b966109b4458717
63 lines
1.8 KiB
Python
Executable File
63 lines
1.8 KiB
Python
Executable File
#!/usr/bin/python
|
|
# Copyright (C) 2013 The Android Open Source Project
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from __future__ import print_function
|
|
|
|
from multiprocessing import cpu_count
|
|
from os import environ, makedirs, mkdir, path
|
|
from subprocess import Popen, PIPE
|
|
from sys import argv, stderr
|
|
|
|
cp, opt, end, TMP = [], [], False, environ['TMP']
|
|
module, outzip = argv[1], argv[2]
|
|
|
|
for a in argv[3:]:
|
|
if end:
|
|
if a.endswith('.jar'):
|
|
cp.append(a)
|
|
elif a == '--':
|
|
end = True
|
|
else:
|
|
opt.append(a)
|
|
|
|
if not outzip.endswith('.zip'):
|
|
print("%s must end with .zip" % outzip, file=stderr)
|
|
exit(1)
|
|
|
|
rebuild = outzip[:-4] + '.rebuild'
|
|
for d in ['deploy', 'unit_cache', 'work']:
|
|
mkdir(path.join(TMP, d))
|
|
if not path.exists(path.dirname(outzip)):
|
|
makedirs(path.dirname(outzip))
|
|
|
|
cmd = [
|
|
'java', '-Xmx512m',
|
|
'-Djava.io.tmpdir=' + TMP,
|
|
'-Dgwt.normalizeTimestamps=true',
|
|
'-Dgwt.persistentunitcachedir=' + path.join(TMP, 'unit_cache'),
|
|
'-classpath', ':'.join(cp),
|
|
'com.google.gwt.dev.Compiler',
|
|
'-deploy', path.join(TMP, 'deploy'),
|
|
'-workDir', path.join(TMP, 'work'),
|
|
'-war', outzip,
|
|
'-localWorkers', str(cpu_count()),
|
|
] + opt + [module]
|
|
|
|
gwt = Popen(cmd, stdout = PIPE, stderr = PIPE)
|
|
out, err = gwt.communicate()
|
|
if gwt.returncode != 0:
|
|
print(out + err, file=stderr)
|
|
exit(gwt.returncode)
|