# SPDX-License-Identifier: MIT
#
# Copyright The SCons Foundation

import random

SetOption('experimental', 'ninja')
DefaultEnvironment(tools=[])
env = Environment(tools=[])
env.Tool('ninja')
SetOption('skip_ninja_regen', True)  # must wait until tool creates the option

# make the dependency list vary in order. Ninja tool should sort them to be deterministic.
for i in range(1, 10):
    node = env.Command(f'out{i}.txt', 'foo.c', 'echo test > $TARGET')
    deps = list(range(1, i))
    random.shuffle(deps)
    for j in deps:
        if j == i:
            continue
        env.Depends(node, f'out{j}.txt')
