Class: Objc2swiftAssistant::ObjCFileSet
- Inherits:
-
ScannedFileSet
- Object
- FailableProcessingElement
- FileSet
- ScannedFileSet
- Objc2swiftAssistant::ObjCFileSet
- Defined in:
- lib/objc2swift_assistant/file_sets.rb
Instance Attribute Summary collapse
-
#code_recognizers ⇒ Object
Returns the value of attribute code_recognizers.
-
#generated_swift_file_set ⇒ Object
Returns the value of attribute generated_swift_file_set.
-
#header_file_extensions ⇒ Object
Returns the value of attribute header_file_extensions.
-
#implmentation_file_extensions ⇒ Object
Returns the value of attribute implmentation_file_extensions.
Attributes inherited from ScannedFileSet
Attributes inherited from FileSet
#configuration, #directory_nodes_by_path, #root, #root_dir_node
Attributes inherited from FailableProcessingElement
Instance Method Summary collapse
- #generate_swift_file_set(root, dry_run) ⇒ Object
-
#initialize(root, code_recognizers, configuration: nil) ⇒ ObjCFileSet
constructor
A new instance of ObjCFileSet.
-
#make_directory_node(path) ⇒ Object
Factory Methods.
- #omit_file(path) ⇒ Object
- #prepare_conversion ⇒ Object
- #recognize_code_fragments ⇒ Object
Methods inherited from ScannedFileSet
#collect_active_file_nodes, #process_directory, #process_file
Methods inherited from FileSet
#directory_node_for_path, #dump, #scan
Methods inherited from FailableProcessingElement
#add_error, #add_warning, #has_errors, #initiailize
Constructor Details
#initialize(root, code_recognizers, configuration: nil) ⇒ ObjCFileSet
Returns a new instance of ObjCFileSet.
457 458 459 460 461 462 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 457 def initialize( root, code_recognizers, configuration:nil ) super( root, configuration ) @code_recognizers = code_recognizers @header_file_extensions=[ '.h', '.hh' ] @implmentation_file_extensions=[ '.m', '.mm' ] end |
Instance Attribute Details
#code_recognizers ⇒ Object
Returns the value of attribute code_recognizers.
452 453 454 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 452 def code_recognizers @code_recognizers end |
#generated_swift_file_set ⇒ Object
Returns the value of attribute generated_swift_file_set.
455 456 457 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 455 def generated_swift_file_set @generated_swift_file_set end |
#header_file_extensions ⇒ Object
Returns the value of attribute header_file_extensions.
453 454 455 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 453 def header_file_extensions @header_file_extensions end |
#implmentation_file_extensions ⇒ Object
Returns the value of attribute implmentation_file_extensions.
454 455 456 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 454 def implmentation_file_extensions @implmentation_file_extensions end |
Instance Method Details
#generate_swift_file_set(root, dry_run) ⇒ Object
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 489 def generate_swift_file_set(root, dry_run) @generated_swift_file_set = GeneratedSwiftFileSet.new( root, @configuration ) # Map the original source files to the new generated source files @directory_nodes_by_path.each_value do |node | node.create_associated_generated_nodes( @generated_swift_file_set ) end # Create the Swift code generator generator_definitions = SwiftGenerator::SwiftDefinitionSet.new( generated_root:@generated_swift_file_set.root.to_s ) generator_definitions.make_unknown_types = true @active_file_nodes.each do |file_node| file_node.objc_2_swift_converter.generate( generator_definitions, @configuration, dry_run ) end generator_definitions.run_generation_sequence() SwiftGenerator::write_files_for_definition_set( generator_definitions ) end |
#make_directory_node(path) ⇒ Object
Factory Methods
465 466 467 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 465 def make_directory_node( path ) ObjCDirectoryNode.new( path, self ) end |
#omit_file(path) ⇒ Object
509 510 511 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 509 def omit_file( path ) return @configuration.omit_file( path ) end |
#prepare_conversion ⇒ Object
476 477 478 479 480 481 482 483 484 485 486 487 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 476 def prepare_conversion() # TODO: Error handling # puts( "1: #{@configuration.config_value( "Test", "company_name")}" ) # puts( "2: #{@configuration.config_value( "SomePathTest", "company_name")}" ) # puts( "3: #{@configuration.config_value( ".", "company_name")}" ) # puts( "4: #{@configuration.config_value( "Runtime/Channel", "company_name")}" ) @active_file_nodes.each do |file_node| file_node.prepare_conversion( @configuration ) end end |
#recognize_code_fragments ⇒ Object
469 470 471 472 473 474 |
# File 'lib/objc2swift_assistant/file_sets.rb', line 469 def recognize_code_fragments() @active_file_nodes.each do |file_node| file_node.prepare_for_use file_node.recognize_code_fragments( @code_recognizers ) end end |