Class: Squash::Java::RenameLog
- Inherits:
-
Object
- Object
- Squash::Java::RenameLog
- Defined in:
- lib/squash/java/rename_log.rb
Overview
Parses a rename log file (generated from yGuard or ProGuard) and generates a Namespace object from it.
Constant Summary collapse
- JAVA_PACKAGE_COMPONENT =
'[a-z][a-z0-9_]*'
- JAVA_PACKAGE_NAME =
"#{JAVA_PACKAGE_COMPONENT}(?:\\.#{JAVA_PACKAGE_COMPONENT})*"
- JAVA_CLASS_NAME =
JAVA_VARIABLE_NAME = JAVA_OBFUSCATED_NAME = JAVA_METHOD_NAME = "[A-Za-z0-9_$]+"
- JAVA_CLASS_PATH =
"(?:#{JAVA_PACKAGE_NAME}\\.)?#{JAVA_CLASS_NAME}"
- JAVA_PRIMITIVE =
'(?:boolean|byte|char|short|int|long|float|double|void)'
- JAVA_TYPE =
"(?:#{JAVA_PRIMITIVE}|#{JAVA_CLASS_PATH})(?:\\[\\])*"
- JAVA_TYPE_LIST =
"#{JAVA_TYPE}(?:,\\s?#{JAVA_TYPE})*"
- JAVA_METHOD_SIGNATURE =
"#{JAVA_TYPE} #{JAVA_METHOD_NAME}\\((?:#{JAVA_TYPE_LIST})?\\)"
Instance Method Summary collapse
-
#initialize(logfile) ⇒ RenameLog
constructor
Creates a new parser for a given rename log file.
-
#parse ⇒ Squash::Java::Namespace
The name mapping in the file.
Constructor Details
#initialize(logfile) ⇒ RenameLog
Creates a new parser for a given rename log file. The file is assumed to be in the yGuard format if it ends in “.xml”, and in the ProGuard format if it ends in “.txt”.
44 45 46 |
# File 'lib/squash/java/rename_log.rb', line 44 def initialize(logfile) @logfile = logfile end |
Instance Method Details
#parse ⇒ Squash::Java::Namespace
Returns The name mapping in the file.
50 51 52 53 |
# File 'lib/squash/java/rename_log.rb', line 50 def parse return parse_yguard if File.extname(@logfile) == '.xml' return parse_proguard if File.extname(@logfile) == '.txt' end |