Fix regeneration rule so it is not triggered needlessly.

pull/15/head
Jussi Pakkanen 12 years ago
parent d5f7207e2e
commit 8c6c0d9b82
  1. 8
      generators.py
  2. 10
      run_tests.py

@ -267,7 +267,9 @@ class NinjaGenerator(Generator):
c = (ninja_quote(self.environment.get_builder_command()),
ninja_quote(self.environment.get_source_dir()),
ninja_quote(self.environment.get_build_dir()))
outfile.write(" command = '%s' '%s' '%s' -G ninja\n\n" % c)
outfile.write(" command = '%s' '%s' '%s' -G ninja\n" % c)
outfile.write(' description = Regenerating build files\n')
outfile.write(' generator = 1\n\n')
def generate_static_link_rules(self, outfile):
static_linker = self.build.static_linker
@ -419,12 +421,14 @@ class NinjaGenerator(Generator):
default = 'default all\n\n'
outfile.write(build)
outfile.write(default)
deps = [ ninja_quote(os.path.join(self.build_to_src, df)) \
for df in self.interpreter.get_build_def_files()]
depstr = ' '.join(deps)
buildregen = 'build build.ninja: REGENERATE_BUILD | %s\n\n' % depstr
ignore_missing = 'build %s: phony\n\n' % depstr
outfile.write(buildregen)
ignore_missing = 'build %s: phony\n\n' % depstr
outfile.write(ignore_missing)
class ShellGenerator(Generator):

@ -19,15 +19,15 @@ import os, subprocess, shutil, sys
test_build_dir = 'work area'
install_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], 'install dir')
use_shell = len(sys.argv) == 1
use_shell = len(sys.argv) > 1
builder_command = './builder.py'
if use_shell:
generator_flags = []
generator_flags = ['--generator', 'shell']
compile_commands = ['compile.sh']
test_commands = ['run_tests.sh']
install_commands = ['install.sh']
else:
generator_flags = ['--generator', 'ninja']
generator_flags = []
compile_commands = ['ninja']
test_commands = ['ninja', 'test']
install_commands = ['ninja', 'install']
@ -38,8 +38,8 @@ def run_test(testdir):
os.mkdir(test_build_dir)
os.mkdir(install_dir)
print('Running test: ' + testdir)
p = subprocess.Popen([builder_command, '--prefix', install_dir, testdir, test_build_dir] +\
generator_flags)
gen_command = [builder_command, '--prefix', install_dir, testdir, test_build_dir] + generator_flags
p = subprocess.Popen(gen_command)
p.wait()
if p.returncode != 0:
raise RuntimeError('Generating the build system failed.')

Loading…
Cancel
Save