forked from material-components/material-components-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MaterialComponentsSnapshotTests.podspec
79 lines (70 loc) · 2.79 KB
/
MaterialComponentsSnapshotTests.podspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
module SnapshotPodspecHelper
class Component
attr_accessor :name
attr_accessor :source_files
attr_accessor :resources
def initialize(name)
@name = name
@source_files = default_source_files
@resources = default_resources
end
def default_source_files
if @name.present?
source_files = Dir["components/#{@name}/tests/snapshot/*.{h,m,swift}"]
supplemental_files = Dir["components/#{@name}/tests/snapshot/supplemental/*.{h,m,swift}"]
example_files = Dir["components/#{@name}/examples/tests/snapshot/*.{h,m,swift}"]
extension_files = Dir["components/#{@name}/tests/snapshot/*/*.{h,m,swift}"]
return source_files + supplemental_files + example_files + extension_files
end
return []
end
def default_resources
if @name.present?
return [
"components/#{@name}/tests/snapshot/resources/*",
]
end
return []
end
end
def self.snapshot_sources
base_sources = ["components/private/Snapshot/src/*.{h,m,swift}", "components/private/Snapshot/src/*/*.{h,m,swift}"]
return components.reduce(base_sources) do |sources_so_far, component|
sources_so_far + component.source_files
end
end
def self.snapshot_resources
return components.reduce([]) do |resources_so_far, component|
resources_so_far + component.resources
end
end
def self.components
return Dir["components/**/tests/snapshot"].map { |dir|
dir = Component.new(dir.split(File::SEPARATOR)[1])
}
end
end
Pod::Spec.new do |s|
s.name = "MaterialComponentsSnapshotTests"
s.version = "124.2.0"
s.authors = "The Material Components authors."
s.summary = "This spec is an aggregate of all the Material Components snapshot tests."
s.homepage = "https://github.com/material-components/material-components-ios"
s.license = 'Apache 2.0'
s.source = { :git => "https://github.com/material-components/material-components-ios.git", :tag => "v#{s.version}" }
s.platform = :ios, '11.0'
s.requires_arc = true
s.dependency 'MaterialComponents'
s.dependency 'MaterialComponentsExamples'
# Top level sources are required. Without them, unit test targets do not show up in Xcode.
# However, no top level sources can import iOSSnapshotTestCase, otherwise the app will crash on
# launch because XCTest isn't found.
s.source_files = ["components/private/Snapshot/src/SourceDummies/*.{h,m}"]
s.test_spec "SnapshotTests" do |snapshot_tests|
snapshot_tests.ios.deployment_target = '11.0'
snapshot_tests.requires_app_host = true
snapshot_tests.source_files = SnapshotPodspecHelper.snapshot_sources
snapshot_tests.resources = SnapshotPodspecHelper.snapshot_resources
snapshot_tests.dependency 'iOSSnapshotTestCase/Core', '2.2.0'
end
end