Class: Mysigner::Build::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/mysigner/build/executor.rb

Defined Under Namespace

Classes: BuildError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_info, parser) ⇒ Executor

Returns a new instance of Executor.



11
12
13
14
15
# File 'lib/mysigner/build/executor.rb', line 11

def initialize(project_info, parser)
  @project_info = project_info
  @parser = parser
  @build_errors = []
end

Instance Attribute Details

#build_errorsObject (readonly)

Returns the value of attribute build_errors.



9
10
11
# File 'lib/mysigner/build/executor.rb', line 9

def build_errors
  @build_errors
end

Instance Method Details

#build!(target_name = nil, configuration = 'Release', scheme: nil, signing_style: nil, team_id: nil, bundle_id: nil, skip_extensions: false) ⇒ Object

Build archive Returns: path to .xcarchive Options:

- signing_style: 'Automatic', 'Manual', or nil (default: use project setting)
- team_id: Development team ID to override project setting
- bundle_id: Bundle ID to override project setting
- skip_extensions: If true, disable code signing for extension targets

Raises:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/mysigner/build/executor.rb', line 24

def build!(target_name = nil, configuration = 'Release', scheme: nil, signing_style: nil, team_id: nil,
           bundle_id: nil, skip_extensions: false)
  target = target_name || @parser.main_target.name
  scheme_name = scheme || target
  @signing_style = signing_style
  @team_id = team_id
  @bundle_id = bundle_id
  @skip_extensions = skip_extensions

  # Use Xcode's default DerivedData location to keep project clean
  # This matches Xcode's behavior and avoids polluting the project directory
  output_dir = File.join(@project_info[:directory], 'build')
  FileUtils.mkdir_p(output_dir)

  # Generate archive path with timestamp
  timestamp = Time.now.strftime('%Y%m%d-%H%M%S')
  archive_name = "#{target}-#{timestamp}.xcarchive"
  archive_path = File.join(output_dir, archive_name)

  # Build command
  cmd = build_command(scheme_name, configuration, archive_path)

  # Execute build
  success = execute_with_output(cmd)

  raise BuildError, 'Build failed. Check output above for errors.' unless success

  # Verify archive was created
  raise BuildError, "Build reported success but archive not found at: #{archive_path}" unless File.exist?(archive_path)

  archive_path
end