|
|
|
|
|
|
base_path = get_base_path() |
|
|
|
print(f"Running in base path {base_path}") |
|
|
|
|
|
|
|
# Only build the standalone player if we're overriding the C# version |
|
|
|
# Otherwise we'll use the one built earlier in the pipeline. |
|
|
|
# We can't rely on the old C# code recognizing the commandline argument to set the output |
|
|
|
# So rename testPlayer (containing the most recent build) to something else temporarily |
|
|
|
full_player_path = os.path.join("Project", "testPlayer.app") |
|
|
|
temp_player_path = os.path.join("Project", "temp_testPlayer.app") |
|
|
|
final_player_path = os.path.join("Project", f"testPlayer_{csharp_version}.app") |
|
|
|
|
|
|
|
os.rename(full_player_path, temp_player_path) |
|
|
|
|
|
|
|
build_returncode = run_standalone_build(base_path) |
|
|
|
build_returncode = run_standalone_build(base_path) |
|
|
|
if build_returncode != 0: |
|
|
|
print("Standalone build FAILED!") |
|
|
|
sys.exit(build_returncode) |
|
|
|
if build_returncode != 0: |
|
|
|
print("Standalone build FAILED!") |
|
|
|
sys.exit(build_returncode) |
|
|
|
|
|
|
|
# Now rename the newly-built executable, and restore the old one |
|
|
|
os.rename(full_player_path, final_player_path) |
|
|
|
os.rename(temp_player_path, full_player_path) |
|
|
|
standalone_player_path = f"testPlayer_{csharp_version}" |
|
|
|
else: |
|
|
|
standalone_player_path = "testPlayer" |
|
|
|
|
|
|
|
venv_path = init_venv(python_version) |
|
|
|
|
|
|
|
|
|
|
buffer_size=10, |
|
|
|
) |
|
|
|
|
|
|
|
# TODO pass scene name and exe destination to build |
|
|
|
# TODO make sure we fail if the exe isn't found - see MLA-559 |
|
|
|
mla_learn_cmd = f"mlagents-learn override.yaml --train --env=Project/testPlayer --run-id={run_id} --no-graphics --env-args -logFile -" # noqa |
|
|
|
mla_learn_cmd = ( |
|
|
|
f"mlagents-learn override.yaml --train --env=Project/{standalone_player_path} " |
|
|
|
f"--run-id={run_id} --no-graphics --env-args -logFile -" |
|
|
|
) # noqa |
|
|
|
res = subprocess.run( |
|
|
|
f"source {venv_path}/bin/activate; {mla_learn_cmd}", shell=True |
|
|
|
) |
|
|
|