Class: Pod::Target::NonLibrary

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-spm/def/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(underlying: nil, spec: nil) ⇒ NonLibrary

Returns a new instance of NonLibrary.



6
7
8
9
# File 'lib/cocoapods-spm/def/target.rb', line 6

def initialize(underlying: nil, spec: nil)
  @underlying = underlying
  @spec = spec
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



4
5
6
# File 'lib/cocoapods-spm/def/target.rb', line 4

def spec
  @spec
end

#underlyingObject (readonly)

Returns the value of attribute underlying.



4
5
6
# File 'lib/cocoapods-spm/def/target.rb', line 4

def underlying
  @underlying
end

Instance Method Details

#nameObject



11
12
13
14
15
16
17
# File 'lib/cocoapods-spm/def/target.rb', line 11

def name
  if underlying.is_a?(Xcodeproj::Project::Object::PBXNativeTarget) && underlying.test_target_type?
    return underlying.name.sub(/-(Unit|UI)-/, "/")
  end

  spec.name
end

#platformObject



19
20
21
# File 'lib/cocoapods-spm/def/target.rb', line 19

def platform
  underlying.platform
end

#xcconfig_path(variant) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/cocoapods-spm/def/target.rb', line 23

def xcconfig_path(variant)
  # For test spec, return the path as <TargetName>.unit-test.<Config>.xcconfig
  # Here, we're trying to get `unit-tests` out of the spec, then calling
  # `underlying.xcconfig_path("unit-tests.debug")` to get the result
  variant_prefix = underlying.spec_label(spec).sub("#{underlying.name}-", "")
  underlying.xcconfig_path("#{variant_prefix}.#{variant}")
end