Fix for idea-plugin goal that generates too long project filename

Review Request #4231 — Created Sept. 13, 2016 and submitted

wisechengyi
pants
3863
pants-reviews
benjyw, kwlzn, peiyu, stuhood, zundel

Earlier in order to generate meaningful names for intellij, idea-plugin concatenates all target specs. However it will easily exceed the limit of UNIX filename length given a few target specs. This fix limits the name to up to 200 characters.

https://travis-ci.org/pantsbuild/pants/builds/159747876

KW
  1. 
      
  2. might it make more sense to use or incorporate a hash digest here for/in the project name vs truncating the joined/normalized string of specs?

    I worry there's a fairly high risk of path collision with the truncation approach.

    1. thought about this, the consequence seems minor, in that case, it's just going to overwrite the previous project file.

    2. The project is put into a different temp dir that persists after the run, so there would be no colllision.

      e.g.

      $ ./pants idea-plugin --no-open testprojects/tests/java/org/pantsbuild/testproject/workdirs/onedir:onedir testprojects/tests/java/org/pantsbuild/testproject/matcher:matcher testprojects/tests/java/org/pantsbuild/testproject/testjvms:seven 
      /Users/yic/workspace/pants/.idea/IdeaPluginGen_idea_plugin/tmpFWRaKu
      
  3. 
      
PE
  1. 
      
  2. tests/python/pants_test/backend/project_info/tasks/test_idea_plugin_integration.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    nit: this is prone to break on changes to these targets, can use

    with self.pants_results(['list', 'testprojects/tests/java/org/pantsbuild/testproject::']) as results: and extract these targets from results.

  3. 
      
WI
BE
  1. Ship It!
  2. 
      
WI
WI
Review request changed

Status: Closed (submitted)

Change Summary:

424929b3761c273cc07e4af55889b7322aefed63. thanks gents!

Loading...