forked from FLEXTool/FLEX
-
Notifications
You must be signed in to change notification settings - Fork 2
/
generate-spm-headers.sh
executable file
·65 lines (57 loc) · 2.23 KB
/
generate-spm-headers.sh
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
#!/bin/bash
# Link a specific header
makeheader() {
/bin/rm -f "Classes/Headers/$(basename $1)"
ln -s "../../$1" "Classes/Headers/$(basename $1)"
}
# Link all headers under the given path and in subfolders
generate_headers_recursive() {
for path in `find "Classes/$1" -not -path "*Headers*" -name "*.h"`; do
makeheader "$path"
done
}
# Link all headers directly under the given path, only
generate_headers() {
for path in `ls "Classes/$1" | grep '\.h'`; do
if [[ $1 ]]; then
makeheader "Classes/$1/$path"
else
makeheader "Classes/$path"
fi
done
}
# The code below MUST match what is public_header_files in the podspec.
# When this file was last updated, this was the content of public_header_files:
#
# "Classes/*.h", "Classes/Manager/*.h", "Classes/Toolbar/*.h",
# "Classes/GlobalStateExplorers/Globals/FLEXGlobalsEntry.h",
# "Classes/Core/**/*.h", "Classes/Utility/Runtime/Objc/**/*.h",
# "Classes/ObjectExplorers/**/*.h", "Classes/Editing/**/*.h",
# "Classes/Utility/FLEXMacros.h", "Classes/Utility/Categories/*.h",
# "Classes/Utility/FLEXAlert.h", "Classes/Utility/FLEXResources.h"
rm -rf Classes/Headers
mkdir -p Classes/Headers
# Include all headers in these folders
generate_headers "" # Top-level headers
generate_headers "Manager"
generate_headers "Toolbar"
generate_headers "Utility/Categories"
generate_headers "Core"
generate_headers "Core/Controllers"
generate_headers "Core/Views"
generate_headers "Core/Views/Cells"
generate_headers "ObjectExplorers"
generate_headers "ObjectExplorers/Sections"
generate_headers_recursive "Utility/Runtime/Objc"
# Include only headers in these specific folders,
# such as those with subfolders that should not be linked
makeheader "Classes/Utility/FLEXMacros.h"
makeheader "Classes/Utility/FLEXAlert.h"
makeheader "Classes/Utility/FLEXResources.h"
makeheader "Classes/ObjectExplorers/Sections/Shortcuts/FLEXShortcut.h"
makeheader "Classes/ObjectExplorers/Sections/Shortcuts/FLEXShortcutsSection.h"
makeheader "Classes/GlobalStateExplorers/Globals/FLEXGlobalsEntry.h"
# Print all folders in Classes for use in Package.swift
for folder in `find "Classes" -type d`; do
echo ".headerSearchPath(\"${folder#Classes/}\"),"
done