forked from facebookarchive/AsyncDisplayKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUCK
executable file
·192 lines (174 loc) · 5.69 KB
/
BUCK
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#####################################
# Defines
#####################################
COMMON_PREPROCESSOR_FLAGS = [
'-fobjc-arc',
'-DDEBUG=1',
]
COMMON_LANG_PREPROCESSOR_FLAGS = {
'C': ['-std=gnu99'],
'CXX': ['-std=c++11', '-stdlib=libc++'],
'OBJCXX': ['-std=c++11', '-stdlib=libc++'],
}
COMMON_LINKER_FLAGS = ['-ObjC++']
ASYNCDISPLAYKIT_EXPORTED_HEADERS = glob([
'Source/*.h',
'Source/Details/**/*.h',
'Source/Layout/*.h',
'Source/Base/*.h',
'Source/Debug/AsyncDisplayKit+Debug.h',
# Most TextKit components are not public because the C++ content
# in the headers will cause build errors when using
# `use_frameworks!` on 0.39.0 & Swift 2.1.
# See https://github.com/facebook/AsyncDisplayKit/issues/1153
'Source/TextKit/ASTextNodeTypes.h',
'Source/TextKit/ASTextKitComponents.h'
])
ASYNCDISPLAYKIT_PRIVATE_HEADERS = glob([
'Source/**/*.h'
],
excludes = ASYNCDISPLAYKIT_EXPORTED_HEADERS,
)
def asyncdisplaykit_library(
name,
additional_preprocessor_flags = [],
deps = [],
additional_frameworks = []):
apple_library(
name = name,
prefix_header = 'Source/AsyncDisplayKit-Prefix.pch',
header_path_prefix = 'AsyncDisplayKit',
exported_headers = ASYNCDISPLAYKIT_EXPORTED_HEADERS,
headers = ASYNCDISPLAYKIT_PRIVATE_HEADERS,
srcs = glob([
'Source/**/*.m',
'Source/**/*.mm',
'Source/Base/*.m'
]),
preprocessor_flags = COMMON_PREPROCESSOR_FLAGS + additional_preprocessor_flags,
lang_preprocessor_flags = COMMON_LANG_PREPROCESSOR_FLAGS,
linker_flags = COMMON_LINKER_FLAGS + [
'-weak_framework',
'Photos',
'-weak_framework',
'MapKit',
],
deps = deps,
frameworks = [
'$SDKROOT/System/Library/Frameworks/Foundation.framework',
'$SDKROOT/System/Library/Frameworks/UIKit.framework',
'$SDKROOT/System/Library/Frameworks/QuartzCore.framework',
'$SDKROOT/System/Library/Frameworks/CoreMedia.framework',
'$SDKROOT/System/Library/Frameworks/CoreText.framework',
'$SDKROOT/System/Library/Frameworks/CoreGraphics.framework',
'$SDKROOT/System/Library/Frameworks/CoreLocation.framework',
'$SDKROOT/System/Library/Frameworks/AVFoundation.framework',
# TODO somehow AssetsLibrary can't be weak_framework
'$SDKROOT/System/Library/Frameworks/AssetsLibrary.framework',
] + additional_frameworks,
visibility = ['PUBLIC'],
)
#####################################
# AsyncDisplayKit targets
#####################################
asyncdisplaykit_library(
name = 'AsyncDisplayKit-Core',
)
# (Default) AsyncDisplayKit and AsyncDisplayKit-PINRemoteImage targets are basically the same library with different names
for name in ['AsyncDisplayKit', 'AsyncDisplayKit-PINRemoteImage']:
asyncdisplaykit_library(
name = name,
deps = [
'//Pods/PINRemoteImage:PINRemoteImage-PINCache',
],
additional_frameworks = [
'$SDKROOT/System/Library/Frameworks/MobileCoreServices.framework',
]
)
#####################################
# Test Host
# TODO: Split to smaller BUCK files and parse in parallel
#####################################
apple_resource(
name = 'TestHostResources',
files = ['Tests/TestHost/Default-568h@2x.png'],
dirs = [],
)
apple_bundle(
name = 'TestHost',
binary = ':TestHostBinary',
extension = 'app',
info_plist = 'Tests/TestHost/Info.plist',
info_plist_substitutions = {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.facebook.AsyncDisplayKitTestHost',
},
tests = [':Tests'],
)
apple_binary(
name = 'TestHostBinary',
headers = glob(['Tests/TestHost/*.h']),
srcs = glob(['Tests/TestHost/*.m']),
lang_preprocessor_flags = COMMON_LANG_PREPROCESSOR_FLAGS,
linker_flags = COMMON_LINKER_FLAGS,
deps = [
':TestHostResources',
':AsyncDisplayKit-Core',
],
frameworks = [
'$SDKROOT/System/Library/Frameworks/Photos.framework',
'$SDKROOT/System/Library/Frameworks/MapKit.framework',
],
)
apple_package(
name = 'TestHostPackage',
bundle = ':TestHost',
)
#####################################
# Tests
#####################################
apple_resource(
name = 'TestsResources',
files = ['Tests/en.lproj/InfoPlist.strings'],
dirs = ['Tests/TestResources'],
)
apple_test(
name = 'Tests',
test_host_app = ':TestHost',
info_plist = 'Tests/AsyncDisplayKitTests-Info.plist',
info_plist_substitutions = {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.facebook.AsyncDisplayKitTests',
},
prefix_header = 'Tests/AsyncDisplayKitTests-Prefix.pch',
header_path_prefix = 'AsyncDisplayKit',
# Expose all ASDK headers to tests
headers = ASYNCDISPLAYKIT_EXPORTED_HEADERS + ASYNCDISPLAYKIT_PRIVATE_HEADERS + glob(['Tests/*.h']),
srcs = glob([
'Tests/*.m',
'Tests/*.mm'
],
# ASTextNodePerformanceTests are excluded (#2173)
excludes = ['Tests/ASTextNodePerformanceTests.m*']
),
snapshot_reference_images_path='Tests/ReferenceImages',
preprocessor_flags = COMMON_PREPROCESSOR_FLAGS + [
'-Wno-implicit-function-declaration',
'-Wno-deprecated-declarations',
],
lang_preprocessor_flags = COMMON_LANG_PREPROCESSOR_FLAGS,
linker_flags = COMMON_LINKER_FLAGS,
deps = [
':TestsResources',
'//Pods/OCMock:OCMock',
'//Pods/FBSnapshotTestCase:FBSnapshotTestCase',
'//Pods/JGMethodSwizzler:JGMethodSwizzler',
],
frameworks = [
'$SDKROOT/System/Library/Frameworks/Foundation.framework',
'$SDKROOT/System/Library/Frameworks/UIKit.framework',
'$SDKROOT/System/Library/Frameworks/CoreMedia.framework',
'$SDKROOT/System/Library/Frameworks/CoreText.framework',
'$SDKROOT/System/Library/Frameworks/CoreGraphics.framework',
'$SDKROOT/System/Library/Frameworks/AVFoundation.framework',
'$PLATFORM_DIR/Developer/Library/Frameworks/XCTest.framework',
],
)