Skip to content

Commit 043fdae

Browse files
Simple tests setup
1 parent 88a3b7f commit 043fdae

File tree

82 files changed

+11046
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+11046
-12
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.3.2
1+
6.0.0

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ IntegrationTests/BUILD.bazel
55
IntegrationTests/Podfile
66
IntegrationTests/Podfile.lock
77
xcodeproj/BazelPods.xcodeproj
8+
Tests/Podfile
9+
Tests/Podfile.lock
10+
Tests/Pods

Makefile

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,54 @@
11

2+
.PHONY: xcodeproj
3+
xcodeproj:
4+
bazel run xcodeproj
5+
6+
clean:
7+
bazel clean
8+
9+
expunge:
10+
bazel clean --expunge
11+
rm -rf .bazel-cache
12+
13+
prepare-tests:
14+
swift TestTools/generate_podfile.swift TestTools/TopPods.json TestTools/Podfile_template > Tests/Podfile
15+
cd Tests && pod install
16+
bazel run :Generator -- "Pods/Pods.json" \
17+
--src "$(shell pwd)/Tests" \
18+
--deps-prefix "//Tests/Pods" \
19+
--pods-root "Tests/Pods" -a -c -f \
20+
--user-options \
21+
"Bolts.sdk_frameworks += CoreGraphics, WebKit" \
22+
"SDWebImage.sdk_frameworks += CoreGraphics, CoreImage, QuartzCore, Accelerate" \
23+
"CocoaLumberjack.sdk_frameworks += CoreGraphics" \
24+
"FBSDKCoreKit.sdk_frameworks += StoreKit"
25+
26+
.PHONY: tests
27+
tests:
28+
@if ! [ -n "$(shell find Tests/Recorded -type d)" ]; then \
29+
echo "Recorded tests are empty";\
30+
exit 1;\
31+
fi
32+
@for dir in Tests/Recorded/*/; do \
33+
if ! diff "$$dir/BUILD.bazel" "Tests/Pods/`basename $$dir`/BUILD.bazel" > /dev/null; then \
34+
echo "Error $(basename $$dir) not equal";\
35+
diff --color=always "$$dir/BUILD.bazel" "Tests/Pods/`basename $$dir`/BUILD.bazel"; \
36+
exit 1; \
37+
fi; \
38+
done
39+
@echo "Tests success"
40+
41+
record-tests:
42+
rm -rf Tests/Recorded
43+
-mkdir Tests/Recorded
44+
@for dir in Tests/Pods/*/ ; do \
45+
if [ -f "$$dir/BUILD.bazel" ]; then \
46+
echo $$dir; \
47+
mkdir Tests/Recorded/`basename $$dir` ; \
48+
cp $$dir/BUILD.bazel Tests/Recorded/`basename $$dir`/ ; \
49+
fi; \
50+
done
51+
252
integration-setup:
353
cd IntegrationTests; \
454
swift generate_pods.swift; \
@@ -18,7 +68,6 @@ integration-generate-dynamic:
1868
"CocoaLumberjack.sdk_frameworks += CoreGraphics" \
1969
"FBSDKCoreKit.sdk_frameworks += StoreKit"
2070

21-
2271
integration-build:
2372
bazel build //IntegrationTests:TestApp_iOS --apple_platform_type=ios --ios_minimum_os=13.4 --ios_simulator_device="iPhone 8" --ios_multi_cpus=x86_64
2473
bazel build //IntegrationTests:TestApp_iOS --apple_platform_type=ios --ios_minimum_os=13.4 --ios_simulator_device="iPhone 8" --ios_multi_cpus=sim_arm64
@@ -37,14 +86,4 @@ integration:
3786
$(MAKE) integration-static
3887
$(MAKE) integration-dynamic
3988

40-
clean:
41-
bazel clean
4289

43-
expunge:
44-
bazel clean --expunge
45-
rm -rf .bazel-cache
46-
47-
.PHONY: xcodeproj
48-
49-
xcodeproj:
50-
bazel run xcodeproj
File renamed without changes.
File renamed without changes.

TestTools/TopPods.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"Action": "5.0.0",
3+
"AMScrollingNavbar": "5.7.3",
4+
"Alamofire": "5.6.2",
5+
"Appboy-iOS-SDK": "4.5.0",
6+
"Cartography": "4.0.0",
7+
"Charts": "4.1.0",
8+
"CocoaLumberjack": "3.7.4",
9+
"CryptoSwift": "1.5.1",
10+
"Eureka": "5.3.6",
11+
"FSPagerView": "0.8.3",
12+
"Facebook-iOS-SDK": "4.38.0",
13+
"FirebaseAnalytics": "9.5.0",
14+
"IQKeyboardManager": "6.5.10",
15+
"JTAppleCalendar": "8.0.4",
16+
"KeychainAccess": "4.2.2",
17+
"Kingfisher": "7.3.2",
18+
"LTMorphingLabel": "0.9.3",
19+
"Material": "3.1.8",
20+
"MessageKit": "3.8.0",
21+
"Moya": "15.0.0",
22+
"NVActivityIndicatorView": "5.1.1",
23+
"OHHTTPStubs": "9.1.0",
24+
"ObjectMapper": "4.2.0",
25+
"Onfido": "25.2.0",
26+
"PromiseKit": "6.18.1",
27+
"R.swift": "6.1.0",
28+
"ReSwift": "6.1.0",
29+
"ReachabilitySwift": "5.0.0",
30+
"ReactiveCocoa": "12.0.0",
31+
"RxSwift": "6.5.0",
32+
"SDWebImage": "5.13.2",
33+
"SQLite.swift": "0.13.3",
34+
"SkeletonView": "1.30.2",
35+
"SnapKit": "5.6.0",
36+
"Starscream": "4.0.4",
37+
"SwiftDate": "6.3.1",
38+
"SwiftMessages": "9.0.6",
39+
"SwifterSwift": "5.2.0",
40+
"SwiftyBeaver": "1.9.6",
41+
"SwiftyJSON": "5.0.1",
42+
"ViewAnimator": "3.1.0",
43+
"Yoga": "1.14.0",
44+
"lottie-ios": "3.4.3"
45+
}

TestTools/generate_buildfile.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Foundation
2+
3+
let args = CommandLine.arguments
4+
if args.count != 4 {
5+
print("\(args.first ?? "command") [Pods.json] [template] [dep_prefix]")
6+
exit(0)
7+
}
8+
9+
let podsJsonFile = args[1]
10+
let templateFile = args[2]
11+
let dep_prefix = args[3]
12+
13+
let data = try NSData(contentsOfFile: podsJsonFile) as Data
14+
let object = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as! [String: String]
15+
let keys = object.keys.sorted()
16+
17+
let pods = keys.map({
18+
" pod '\($0)', '\(object[$0]!)'"
19+
}).joined(separator: "\n")
20+
21+
let deps = keys.map({
22+
" \"\(dep_prefix)/Pods/\($0)\""
23+
}).joined(separator: ",\n")
24+
25+
let buildfile = try String(contentsOf: URL(fileURLWithPath: templateFile), encoding: .utf8).replacingOccurrences(of: "[[DEPS]]", with: deps)
26+
27+
print(buildfile)

TestTools/generate_podfile.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Foundation
2+
3+
let args = CommandLine.arguments
4+
if args.count != 3 {
5+
print("\(args.first ?? "command") [Pods.json] [template]")
6+
exit(0)
7+
}
8+
9+
let podsJsonFile = args[1]
10+
let templateFile = args[2]
11+
12+
let data = try NSData(contentsOfFile: podsJsonFile) as Data
13+
let object = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as! [String: String]
14+
let keys = object.keys.sorted()
15+
16+
let pods = keys.map({
17+
" pod '\($0)', '\(object[$0]!)'"
18+
}).joined(separator: "\n")
19+
20+
let podfile = try String(contentsOf: URL(fileURLWithPath: templateFile), encoding: .utf8).replacingOccurrences(of: "[[PODS]]", with: pods)
21+
print(podfile)
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
load('@build_bazel_rules_ios//rules:framework.bzl', 'apple_framework')
2+
# Add a config setting release for compilation mode
3+
# Assume that people are using `opt` for release mode
4+
# see the bazel user manual for more information
5+
# https://docs.bazel.build/versions/master/be/general.html#config_setting
6+
config_setting(
7+
name = "release",
8+
values = {
9+
"compilation_mode": "opt"
10+
}
11+
)
12+
config_setting(
13+
name = "osxCase",
14+
values = {
15+
"apple_platform_type": "macos"
16+
}
17+
)
18+
config_setting(
19+
name = "tvosCase",
20+
values = {
21+
"apple_platform_type": "tvos"
22+
}
23+
)
24+
config_setting(
25+
name = "watchosCase",
26+
values = {
27+
"apple_platform_type": "watchos"
28+
}
29+
)
30+
config_setting(
31+
name = "ios_armv7",
32+
values = {
33+
"cpu": "ios_armv7"
34+
}
35+
)
36+
config_setting(
37+
name = "ios_arm64",
38+
values = {
39+
"cpu": "ios_arm64"
40+
}
41+
)
42+
config_setting(
43+
name = "ios_arm64e",
44+
values = {
45+
"cpu": "ios_arm64e"
46+
}
47+
)
48+
config_setting(
49+
name = "ios_sim_arm64",
50+
values = {
51+
"cpu": "ios_sim_arm64"
52+
}
53+
)
54+
config_setting(
55+
name = "ios_i386",
56+
values = {
57+
"cpu": "ios_i386"
58+
}
59+
)
60+
config_setting(
61+
name = "ios_x86_64",
62+
values = {
63+
"cpu": "ios_x86_64"
64+
}
65+
)
66+
genrule(
67+
name = "AMScrollingNavbar_InfoPlist",
68+
srcs = [],
69+
outs = [
70+
"AMScrollingNavbar_InfoPlist.plist"
71+
],
72+
cmd = """cat <<EOF > $@
73+
<?xml version="1.0" encoding="UTF-8"?>
74+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
75+
<plist version="1.0">
76+
<dict>
77+
<key>CFBundleIdentifier</key>
78+
<string>org.cocoapods.AMScrollingNavbar</string>
79+
<key>CFBundleInfoDictionaryVersion</key>
80+
<string>6.0</string>
81+
<key>CFBundleName</key>
82+
<string>AMScrollingNavbar</string>
83+
<key>CFBundlePackageType</key>
84+
<string>FMWK</string>
85+
<key>CFBundleShortVersionString</key>
86+
<string>5.7.3</string>
87+
<key>CFBundleSignature</key>
88+
<string>????</string>
89+
<key>CFBundleSupportedPlatforms</key>
90+
<array>
91+
<string>iPhoneSimulator</string>
92+
<string>iPhoneOS</string>
93+
</array>
94+
<key>CFBundleVersion</key>
95+
<string>1</string>
96+
<key>MinimumOSVersion</key>
97+
<string>8.0</string>
98+
<key>UIDeviceFamily</key>
99+
<array>
100+
<integer>1</integer>
101+
<integer>2</integer>
102+
</array>
103+
</dict>
104+
</plist>
105+
106+
EOF"""
107+
)
108+
apple_framework(
109+
name = "AMScrollingNavbar",
110+
module_name = "AMScrollingNavbar",
111+
bundle_id = "org.cocoapods.AMScrollingNavbar",
112+
swift_version = "5",
113+
link_dynamic = True,
114+
infoplists = [
115+
":AMScrollingNavbar_InfoPlist"
116+
],
117+
platforms = {
118+
"ios": "8.0"
119+
},
120+
srcs = glob(
121+
[
122+
"Source/*.swift"
123+
]
124+
),
125+
objc_defines = [
126+
"COCOAPODS=1"
127+
] + select(
128+
{
129+
"//conditions:default": [
130+
"POD_CONFIGURATION_DEBUG=1",
131+
"DEBUG=1"
132+
],
133+
":release": [
134+
"POD_CONFIGURATION_RELEASE=1"
135+
]
136+
}
137+
),
138+
swift_defines = [
139+
"COCOAPODS"
140+
] + select(
141+
{
142+
"//conditions:default": [
143+
"DEBUG"
144+
]
145+
}
146+
),
147+
visibility = [
148+
"//visibility:public"
149+
]
150+
)

0 commit comments

Comments
 (0)