extern mod head { path = "${GXL_START_ROOT}/_gal/"; }

mod envs  {
   env _common  : rust_env.init   {
    root      = ".";
    target_name = "";
    prj_key   = "galaxy_flow" ;
    DIST_REPO = "unknow";
    AFT_PREFIX = "g";

  }

  #[usage(desp="use debug ",color="blue")]
  env debug :  _common,rust_env.debug {
    AFT_PREFIX = "d" ;
  }
  #[usage(desp="use debug ",color="blue")]
  env release :  _common,rust_env.release{
    AFT_PREFIX = "g" ;
  }


  #[usage(desp="default mamcos", color="green")]
  env default    : envs._common,debug;
}

mod main  {
      bld_bins = "target/${ENV_BUILD_NAME}" ;
      rls_bins = "target/release" ;
      HOME_BIN = "${HOME}/bin" ;

    #[auto_load(entry)]
    flow __into | conf {
        DIST_REPO = "unkonw";
        if defined(${GXL_OS_SYS}) {
             gx.echo (  "${GXL_OS_SYS} is defined " )
        }
        if ${GXL_OS_SYS} =* "arm64_macos_*" {
            DIST_REPO = "macos";
        } else if ${GXL_OS_SYS} =* "x86_64_ubuntu*" {
            DIST_REPO = "ubuntu22";
        }
        else {
            DIST_REPO = "other";
        }

    }
    #[task(name="config")]
    flow conf  {
    }

  #[task(name="${ENV_PRJ_KEY}@build")]
  flow ver.use | conf | rust_flow.build | @build  {
      gx.echo(  "${MAIN_HOME_BIN}" );
      //os.path (  "${MAIN_HOME_BIN}" );
  }
  #[usage(desp="lint code")]
  flow lint | rust_flow.lint {} ;

  #[task(name="test")]
  flow build  |   @test  {
    gx.cmd ( "cargo test --all ${ENV_BUILD_FLAG}", log : "1" , out:"true"  );
  }



}
