forked from apache/cordova-node-xcode
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconstants.js
135 lines (126 loc) · 4.02 KB
/
constants.js
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
var DEFAULT_SOURCETREE = '"<group>"',
DEFAULT_PRODUCT_SOURCETREE = 'BUILT_PRODUCTS_DIR',
DEFAULT_FILEENCODING = 4,
DEFAULT_GROUP = 'Resources',
DEFAULT_FILETYPE = 'unknown',
HEADER_FILE_TYPE_SUFFIX = ".h",
ENTITLEMENTS_FILE_TYPE_SUFFIX = ".entitlements",
SOURCE_CODE_FILE_TYPE_PREFIX = "sourcecode.";
var FILETYPE_BY_EXTENSION = {
a: 'archive.ar',
app: 'wrapper.application',
appex: 'wrapper.app-extension',
bundle: 'wrapper.plug-in',
c: 'sourcecode.c.c',
cc: 'sourcecode.cpp.cpp',
cpp: 'sourcecode.cpp.cpp',
cxx: 'sourcecode.cpp.cpp',
'c++': 'sourcecode.cpp.cpp',
dylib: 'compiled.mach-o.dylib',
framework: 'wrapper.framework',
h: 'sourcecode.c.h',
hh: 'sourcecode.cpp.h',
hpp: 'sourcecode.cpp.h',
hxx: 'sourcecode.cpp.h',
'h++': 'sourcecode.cpp.h',
m: 'sourcecode.c.objc',
mm: 'sourcecode.cpp.objcpp',
markdown: 'text',
mdimporter: 'wrapper.cfbundle',
octest: 'wrapper.cfbundle',
pch: 'sourcecode.c.h',
plist: 'text.plist.xml',
entitlements: 'text.plist.entitlements',
png: "image.png",
sh: 'text.script.sh',
swift: 'sourcecode.swift',
tbd: 'sourcecode.text-based-dylib-definition',
xcassets: 'folder.assetcatalog',
xcconfig: 'text.xcconfig',
xcdatamodel: 'wrapper.xcdatamodel',
xcodeproj: 'wrapper.pb-project',
xctest: 'wrapper.cfbundle',
xib: 'file.xib',
strings: 'text.plist.strings'
},
GROUP_BY_FILETYPE = {
'archive.ar': 'Frameworks',
'compiled.mach-o.dylib': 'Frameworks',
'sourcecode.text-based-dylib-definition': 'Frameworks',
'wrapper.framework': 'Frameworks',
'embedded.framework': 'Embed Frameworks',
'sourcecode.c.h': 'Resources',
'sourcecode.c.c': 'Sources',
'sourcecode.c.objc': 'Sources',
'sourcecode.swift': 'Sources',
'sourcecode.cpp.cpp': 'Sources',
'sourcecode.cpp.objcpp': 'Sources'
},
PATH_BY_FILETYPE = {
'compiled.mach-o.dylib': 'usr/lib/',
'sourcecode.text-based-dylib-definition': 'usr/lib/',
'wrapper.framework': 'System/Library/Frameworks/'
},
SOURCETREE_BY_FILETYPE = {
'compiled.mach-o.dylib': 'SDKROOT',
'sourcecode.text-based-dylib-definition': 'SDKROOT',
'wrapper.framework': 'SDKROOT'
},
ENCODING_BY_FILETYPE = {
'sourcecode.c.h': 4,
'sourcecode.c.h': 4,
'sourcecode.cpp.h': 4,
'sourcecode.c.c': 4,
'sourcecode.c.objc': 4,
'sourcecode.cpp.cpp': 4,
'sourcecode.cpp.objcpp': 4,
'sourcecode.swift': 4,
'text': 4,
'text.plist.xml': 4,
'text.script.sh': 4,
'text.xcconfig': 4,
'text.plist.strings': 4
};
function isHeaderFileType(fileType) {
return fileType.endsWith(HEADER_FILE_TYPE_SUFFIX);
}
function isSourceFileType(fileType) {
return fileType.startsWith(SOURCE_CODE_FILE_TYPE_PREFIX) && !isHeaderFileType(fileType);
}
function isAssetFileType(fileType) {
return fileType === FILETYPE_BY_EXTENSION.xcassets;
}
function isResource(group) {
return group === "Resources";
}
function isEntitlementFileType(fileType) {
return fileType.endsWith(ENTITLEMENTS_FILE_TYPE_SUFFIX);
}
function isPlistFileType(fileType) {
return fileType === FILETYPE_BY_EXTENSION.plist;
}
function unquoted(text) {
return text == null ? '' : text.replace (/(^")|("$)/g, '')
}
module.exports = {
DEFAULT_SOURCETREE,
DEFAULT_PRODUCT_SOURCETREE,
DEFAULT_FILEENCODING,
DEFAULT_GROUP,
DEFAULT_FILETYPE,
HEADER_FILE_TYPE_SUFFIX,
ENTITLEMENTS_FILE_TYPE_SUFFIX,
SOURCE_CODE_FILE_TYPE_PREFIX,
FILETYPE_BY_EXTENSION,
GROUP_BY_FILETYPE,
PATH_BY_FILETYPE,
SOURCETREE_BY_FILETYPE,
ENCODING_BY_FILETYPE,
isHeaderFileType,
isSourceFileType,
isAssetFileType,
isResource,
isEntitlementFileType,
isPlistFileType,
unquoted
}