Make sure <?xml starts at the beginning of the file when creating an empty xml report

Review Request #1856 — Created March 4, 2015 and submitted

zundel
pants
zundel/dedent-empty-xml
1196
0b00e32...
pants-reviews
jsirois, stuhood
  • Make sure <?xml starts at the beginning of the file when creating an empty xml report.
  • Create the empty report under a different name to avoid confusing it with real ivy output.
  • This change also raises an exception when the ivy report .xml file is not found. I'm not sure why it wouldn't be there, and the
    creation of ivy_jar_products now depends on it.

CI is green at https://travis-ci.org/pantsbuild/pants/builds/53264069

I don't think this code ever gets exercised, I forced it in a pdb session by setting a break point then moving the report aside.

 ls -l /Users/zundel/.ivy2/pants/internal-f8ecb12181375ea82eee7fdf81233ebfaed4d60f-default*
-rw-r--r--  1 zundel  zundel    409 Mar  5 17:17 /Users/zundel/.ivy2/pants/internal-f8ecb12181375ea82eee7fdf81233ebfaed4d60f-default-empty.xml
-rw-r--r--  1 zundel  zundel  24974 Mar  5 17:14 /Users/zundel/.ivy2/pants/internal-f8ecb12181375ea82eee7fdf81233ebfaed4d60f-default.xml.old

while running ./pants idea examples/src/java:: --resove-ivy-open

Before this change, if you do try to parse the file created by this function you get:

               FAILURE

Exception message: XML or text declaration not at start of entity: line 2, column 8
ST
  1. Ship It!
    1. I could just ship it, but I think this failure mode is now to important to just ignore or paper over with an empty ivy file. My repo is hitting the 'no xml file' scenario and I need to understand why its happening. It means ivy_jar_products won't get populated properly.

    2. +1 - I'll hang back from reviewing.
    3. @Stu, @John, please take another look. I discovered the reason behind my ivy.xml files missing (a bug in code I changed not committed to the OSS repo), and I've changed the behavior to raise an exception when the expected report file is missing.

  2. 
      
ZU
ZU
JS
  1. 
      
  2. This doc needs an update.
  3. Consider a higher-level break:

          out = os.path.join(self._outdir,
                             '{org}-{name}-{conf}.html'.format(org=org, name=name, conf=conf))
    
  4. 
      
ZU
ZU
Review request changed

Status: Closed (submitted)

Change Summary:

Thanks for the reviews. Commit 6099e65

Loading...