Class: Phoenx::TestTargetBuilder

Inherits:
TargetBuilder show all
Defined in:
lib/phoenx/use_cases/generate_target.rb

Instance Attribute Summary

Attributes inherited from TargetBuilder

#framework_files, #project, #project_spec, #target_spec

Instance Method Summary collapse

Methods inherited from TargetBuilder

#add_build_phase_scripts, #add_config_files, #add_frameworks_and_libraries, #add_headers, #add_private_headers, #add_project_headers, #add_public_headers, #add_resources, #add_sources, #add_support_files, #add_system_dependencies, #configure_target

Constructor Details

#initialize(main_target, project, target_spec, project_spec, main_target_spec, main_target_frameworks_files) ⇒ TestTargetBuilder

Returns a new instance of TestTargetBuilder.



531
532
533
534
535
536
537
538
# File 'lib/phoenx/use_cases/generate_target.rb', line 531

def initialize(main_target, project, target_spec, project_spec, main_target_spec, main_target_frameworks_files)

	super(project, target_spec, project_spec)
	@main_target = main_target
	@main_target_spec = main_target_spec
	@main_target_frameworks_files = main_target_frameworks_files

end

Instance Method Details

#buildObject



540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/phoenx/use_cases/generate_target.rb', line 540

def build
	
	@target = @project.new(Xcodeproj::Project::PBXNativeTarget)
	@project.targets << @target
	@target.name = @target_spec.name
	@target.product_name = @target_spec.name
	@target.product_type = Xcodeproj::Constants::PRODUCT_TYPE_UTI[:unit_test_bundle]
	@target.build_configuration_list = Xcodeproj::Project::ProjectHelper.configuration_list(@project, @main_target_spec.platform, @main_target_spec.version)

	product_ref = @project.products_group.new_reference(@target_spec.name + '.' + XCTEST_EXTENSION, :built_products)
	product_ref.include_in_index = '0'
	product_ref.set_explicit_file_type
	@target.product_reference = product_ref

	@target.build_phases << @project.new(Xcodeproj::Project::PBXSourcesBuildPhase)
	@target.build_phases << @project.new(Xcodeproj::Project::PBXFrameworksBuildPhase)
	@target.build_phases << @project.new(Xcodeproj::Project::PBXResourcesBuildPhase)

	self.add_sources
	self.add_config_files
	self.add_frameworks_and_libraries
	self.add_system_dependencies
	
	self.add_build_phase_scripts
	self.add_resources
	self.add_support_files
	
	copy_frameworks = @target.new_copy_files_build_phase "Embed Frameworks"
	copy_frameworks.symbol_dst_subfolder_spec = :frameworks

	frameworks_group = @project.main_group.find_subpath(FRAMEWORKS_ROOT, false)

	self.framework_files.each do |file|

		build_file = copy_frameworks.add_file_reference(file)
		build_file.settings = ATTRIBUTES_CODE_SIGN_ON_COPY

	end
	
	@main_target_frameworks_files.each do |file|

		build_file = copy_frameworks.add_file_reference(file)
		build_file.settings = ATTRIBUTES_CODE_SIGN_ON_COPY

	end
	
	# Add target dependency.
	@target.add_dependency(@main_target)
	@target.frameworks_build_phase.add_file_reference(@main_target.product_reference)
	self.configure_target
	
end

#targetObject



593
594
595
596
597
# File 'lib/phoenx/use_cases/generate_target.rb', line 593

def target

	return @target

end