gcc-to-clang-analyzer 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/g++ +10 -7
- data/lib/gcc_to_clang_analyzer/rewrite_plist_file.rb +9 -1
- data/lib/gcc_to_clang_analyzer/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ea614ca2df802ab09462b14c9c49717e4226827f
         | 
| 4 | 
            +
              data.tar.gz: e81b354ba5cae077c704fd82cf4ebab2017799b7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 783a5fed71820a8f0a8c47c0c97d0dd7cc6c2162b7841111578ca615754ed56c9f4cdf8ca484b9d164cf4229eda29a458d8ea31bba997aa7e33a2572f6a43aaa
         | 
| 7 | 
            +
              data.tar.gz: 5591cc996ec00cabf42623405ae293519f79cc5c4f2d6fd22917a06d9dff416dd80ebd4fb235331bcfcbf70b7e463f2748d07f5173c73ed63c9b04dffcdfab84
         | 
    
        data/bin/g++
    CHANGED
    
    | @@ -1,20 +1,22 @@ | |
| 1 1 | 
             
            #!/usr/bin/env ruby
         | 
| 2 2 |  | 
| 3 | 
            +
            require 'logger'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            LOG = Logger.new(STDOUT)
         | 
| 6 | 
            +
            LOG.level = Logger::DEBUG
         | 
| 7 | 
            +
            LOG.debug("original #{ARGV.join(' ')}")
         | 
| 8 | 
            +
             | 
| 3 9 | 
             
            require 'gcc_to_clang_analyzer/prepare_compiler_commandline'
         | 
| 4 10 | 
             
            require 'gcc_to_clang_analyzer/rewrite_plist_file'
         | 
| 5 | 
            -
            require 'logger'
         | 
| 6 | 
            -
            logger = Logger.new(STDOUT)
         | 
| 7 | 
            -
            logger.level = Logger::WARN
         | 
| 8 | 
            -
            logger.debug("original #{ARGV.join(' ')}")
         | 
| 9 11 |  | 
| 10 12 | 
             
            command_line, output = PrepareCompilerCommandline.transform(ARGV)
         | 
| 11 13 |  | 
| 12 14 | 
             
            cl = command_line.join(' ')
         | 
| 13 | 
            -
             | 
| 15 | 
            +
            LOG.info("executing '#{cl}'")
         | 
| 14 16 |  | 
| 15 17 | 
             
            res = system(cl)
         | 
| 16 18 | 
             
            unless res
         | 
| 17 | 
            -
               | 
| 19 | 
            +
              LOG.warn("problems while executing #{cl}")
         | 
| 18 20 | 
             
              exit res
         | 
| 19 21 | 
             
            end
         | 
| 20 22 |  | 
| @@ -23,7 +25,8 @@ if output.length > 0 | |
| 23 25 | 
             
              prefix = File.absolute_path('.').gsub(workspace_path+'/', '')
         | 
| 24 26 | 
             
              tmp_output = output + ".tmp"
         | 
| 25 27 | 
             
              File.open(tmp_output, 'w') do |io|
         | 
| 26 | 
            -
                 | 
| 28 | 
            +
                output_data = File.read(output)
         | 
| 29 | 
            +
                io << RewritePlistFile.with_prefix(prefix, output_data, LOG)
         | 
| 27 30 | 
             
              end
         | 
| 28 31 | 
             
              File.delete(output)
         | 
| 29 32 | 
             
              File.rename(tmp_output, output)
         | 
| @@ -25,12 +25,20 @@ class RewritePlistFile | |
| 25 25 | 
             
            #    end
         | 
| 26 26 | 
             
            #    return original
         | 
| 27 27 | 
             
              #  end
         | 
| 28 | 
            -
               | 
| 28 | 
            +
              class NullLogger
         | 
| 29 | 
            +
                def debug(s)
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
              def self.with_prefix(prefix, original, log=NullLogger.new)
         | 
| 29 33 | 
             
                doc = Nokogiri::XML(original)
         | 
| 34 | 
            +
                log.debug("ORIGINAL") if log 
         | 
| 35 | 
            +
                log.debug(doc.to_xml) if log
         | 
| 30 36 | 
             
                array_element = doc.xpath("//key[text()='files']/following-sibling::array/string")
         | 
| 31 37 | 
             
                array_element.each do |e|
         | 
| 32 38 | 
             
                  e.content = File.join(prefix, e.content)
         | 
| 33 39 | 
             
                end
         | 
| 40 | 
            +
                log.debug("TRANSFORMED") if log
         | 
| 41 | 
            +
                log.debug(doc.to_xml) if log
         | 
| 34 42 | 
             
                return doc.to_xml()
         | 
| 35 43 | 
             
              end
         | 
| 36 44 | 
             
            end
         |