Skip to content

Commit

Permalink
Make cmd_line_differ be CWD friendly
Browse files Browse the repository at this point in the history
Progress towards #5380 and #5883

RELNOTES: None.
PiperOrigin-RevId: 227675648
  • Loading branch information
hlopko authored and Copybara-Service committed Jan 3, 2019
1 parent e038bb6 commit fbd027c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tools/cmd_line_differ/cmd_line_differ.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
--input_type=textproto
"""

import os
from absl import app
from absl import flags
from google.protobuf import text_format
Expand Down Expand Up @@ -104,11 +105,22 @@ def _aquery_diff(before, after):
print("No difference")


def to_absolute_path(path):
path = os.path.expanduser(path)
if os.path.isabs(path):
return path
else:
if os.environ["BUILD_WORKING_DIRECTORY"]:
return os.path.join(os.environ["BUILD_WORKING_DIRECTORY"], path)
else:
return path


def main(unused_argv):

before_file = flags.FLAGS.before
after_file = flags.FLAGS.after
input_type = flags.FLAGS.input_type
before_file = to_absolute_path(flags.FLAGS.before)
after_file = to_absolute_path(flags.FLAGS.after)
input_type = to_absolute_path(flags.FLAGS.input_type)

before_proto = analysis_pb2.ActionGraphContainer()
after_proto = analysis_pb2.ActionGraphContainer()
Expand Down

0 comments on commit fbd027c

Please sign in to comment.