UNION()

PEERDIR(
    gencfg/custom_generators/balancer_gencfg/utils
    balancer/config/cache/get_cache
)

DEFAULT(METAPROJECT l7heavy)
DEFAULT(SUBPROJECT ${PROJECT})

RUN_PROGRAM(
    balancer/config/cache/get_cache
    -n ${PROJECT}
    -o ${ARCADIA_BUILD_ROOT}/balancer/config/build/${PROJECT}
    CWD ${ARCADIA_ROOT}/balancer/config/build/${PROJECT}
    OUT_NOAUTO ${PROJECT}_gencfg_cache.pickle
)

RUN_PROGRAM(
    gencfg/custom_generators/balancer_gencfg/utils
        -b ${METAPROJECT}
        -p ${SUBPROJECT}
        -t api
        -o ${ARCADIA_BUILD_ROOT}/balancer/config/build/${PROJECT}/${PROJECT}.cfg
        --disable-trunk-fallback
        --save-cache ${ARCADIA_BUILD_ROOT}/balancer/config/build/${PROJECT}/${PROJECT}_gencfg_cache.pickle
        --enable-cache
        --use-only-cache
        --do-not-save-cache
    IN ${PROJECT}_gencfg_cache.pickle
    CWD ${ARCADIA_ROOT}/balancer/config/build/${PROJECT}
    OUT ${PROJECT}.cfg
)

END()
