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.



340
341
342
343
344
345
# File 'lib/phoenx/use_cases/generate_target.rb', line 340

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



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/phoenx/use_cases/generate_target.rb', line 347

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



385
386
387
# File 'lib/phoenx/use_cases/generate_target.rb', line 385

def target
	return @target
end