Skip to content

Commit

Permalink
tools/setup: avoid running gn gen twice in the same output directory
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Aug 2, 2018
1 parent 446081b commit e5b7d31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion tools/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_gn_args():


# gn gen.
for mode in ["release", "debug"]:
def gn_gen(mode):
os.environ["DENO_BUILD_MODE"] = mode

gn_args = get_gn_args()
Expand All @@ -52,3 +52,11 @@ def get_gn_args():

run([third_party.gn_path, "gen", build_path()],
env=third_party.google_env())


mode = build_mode(default=None)
if mode is not None:
gn_gen(mode)
else:
gn_gen("release")
gn_gen("debug")
4 changes: 2 additions & 2 deletions tools/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ def rm_readonly(func, path, _):
shutil.rmtree(directory, onerror=rm_readonly)


def build_mode():
def build_mode(default="debug"):
if "DENO_BUILD_MODE" in os.environ:
return os.environ["DENO_BUILD_MODE"]
else:
return "debug"
return default


# E.G. "out/debug"
Expand Down

0 comments on commit e5b7d31

Please sign in to comment.