# Check the handling of generator commands, which are not rerun when they change.

# RUN: rm -rf %t.build
# RUN: mkdir -p %t.build
# RUN: cp %s %t.build/build.ninja
# RUN: touch %t.build/config.ninja %t.build/generator-input
# RUN: %{llbuild} ninja build --no-parallel --chdir %t.build &> %t1.out
# RUN: %{FileCheck} --check-prefix CHECK-FIRST --input-file %t1.out %s
#
# FIXME: We ignore whether not the generator is run in this step, we have other
# tests for that, but we should update this to check that it doesn't once things
# have stabilized.
#
# CHECK-FIRST: date

# Running again after changing the generator flags should not rebuild.
#
# RUN: echo "echo_flags = foo" > %t.build/config.ninja
# RUN: %{llbuild} ninja build --no-parallel --chdir %t.build &> %t2.out
# RUN: %{FileCheck} --check-prefix CHECK-SECOND --input-file %t2.out %s
#
# CHECK-SECOND-NOT: echo
# CHECK-SECOND: date

echo_flags = 
include config.ninja

rule GENERATOR
     command = echo ${echo_flags}
     generator = 1
rule DATE
     command = date

build build.ninja: GENERATOR generator-input
build output: DATE

# Check the handling of generator commands, which are not rerun when they change.

# RUN: rm -rf %t.build
# RUN: mkdir -p %t.build
# RUN: cp %s %t.build/build.ninja
# RUN: touch %t.build/config.ninja
# RUN: %{llbuild} ninja build --no-parallel --chdir %t.build &> %t1.out
# RUN: %{FileCheck} --check-prefix CHECK-FIRST --input-file %t1.out %s
#
# CHECK-FIRST-NOT: echo
# CHECK-FIRST: date

# Running again after changing the generator flags should not rebuild.
#
# RUN: echo "echo_flags = foo" > %t.build/config.ninja
# RUN: %{llbuild} ninja build --no-parallel --chdir %t.build &> %t2.out
# RUN: %{FileCheck} --check-prefix CHECK-SECOND --input-file %t2.out %s
#
# CHECK-SECOND-NOT: echo
# CHECK-SECOND: date

echo_flags = 
include config.ninja

rule GENERATOR
     command = echo ${echo_flags}
     generator = 1
rule DATE
     command = date

build build.ninja: GENERATOR
build output: DATE
