Skip to content

Commit f581005

Browse files
authored
Merge pull request #1559 from mario-vera/pr/fix-build-no-swift
2 parents 40cb3e0 + 3561f56 commit f581005

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

CoreFoundation/Locale.subproj/CFCalendar.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
#include <CoreFoundation/CFCalendar.h>
13+
#include <CoreFoundation/CFLocaleInternal.h>
1314
#include <CoreFoundation/CFRuntime.h>
1415
#include "CFInternal.h"
1516
#include "CFPriv.h"

CoreFoundation/Locale.subproj/CFLocale.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// Note the header file is in the OpenSource set (stripped to almost nothing), but not the .c file
1212

13+
#include <CoreFoundation/CFInternal.h>
1314
#include <CoreFoundation/CFLocale.h>
1415
#include <CoreFoundation/CFLocale_Private.h>
1516
#include <CoreFoundation/CFString.h>

CoreFoundation/Parsing.subproj/CFXMLInterface.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
#include <CoreFoundation/CFRuntime.h>
15+
#include <CoreFoundation/CFInternal.h>
1516
#include <libxml/globals.h>
1617
#include <libxml/xmlerror.h>
1718
#include <libxml/parser.h>
@@ -22,7 +23,7 @@
2223
#include <libxml/xpath.h>
2324
#include <libxml/xpathInternals.h>
2425
#include <libxml/dict.h>
25-
#include "CFInternal.h"
26+
#include "CFXMLInterface.h"
2627

2728
/*
2829
libxml2 does not have nullability annotations and does not import well into swift when given potentially differing versions of the library that might be installed on the host operating system. This is a simple C wrapper to simplify some of that interface layer to libxml2.
@@ -110,6 +111,7 @@ typedef struct {
110111
xmlNotationPtr notation;
111112
} _cfxmlNotation;
112113

114+
#if DEPLOYMENT_RUNTIME_SWIFT
113115
static xmlExternalEntityLoader __originalLoader = NULL;
114116

115117
static xmlParserInputPtr _xmlExternalEntityLoader(const char *urlStr, const char * ID, xmlParserCtxtPtr context) {
@@ -119,30 +121,36 @@ static xmlParserInputPtr _xmlExternalEntityLoader(const char *urlStr, const char
119121
}
120122
return __originalLoader(urlStr, ID, context);
121123
}
124+
#endif // DEPLOYMENT_RUNTIME_SWIFT
122125

123126
void _CFSetupXMLInterface(void) {
127+
#if DEPLOYMENT_RUNTIME_SWIFT
124128
static dispatch_once_t xmlInitGuard;
125129
dispatch_once(&xmlInitGuard, ^{
126130
xmlInitParser();
127131
// set up the external entity loader
128132
__originalLoader = xmlGetExternalEntityLoader();
129133
xmlSetExternalEntityLoader(_xmlExternalEntityLoader);
130134
});
135+
#endif // DEPLOYMENT_RUNTIME_SWIFT
131136
}
132137

133138
_CFXMLInterfaceParserInput _CFXMLInterfaceNoNetExternalEntityLoader(const char *URL, const char *ID, _CFXMLInterfaceParserContext ctxt) {
134139
return xmlNoNetExternalEntityLoader(URL, ID, ctxt);
135140
}
136141

142+
#if DEPLOYMENT_RUNTIME_SWIFT
137143
static void _errorCallback(void *ctx, const char *msg, ...) {
138144
xmlParserCtxtPtr context = __CFSwiftBridge.NSXMLParser.getContext((_CFXMLInterface)ctx);
139145
xmlErrorPtr error = xmlCtxtGetLastError(context);
140146
// TODO: reporting
141147
// _reportError(error, (_CFXMLInterface)ctx);
142148
}
149+
#endif // DEPLOYMENT_RUNTIME_SWIFT
143150

144151
_CFXMLInterfaceSAXHandler _CFXMLInterfaceCreateSAXHandler() {
145152
_CFXMLInterfaceSAXHandler saxHandler = (_CFXMLInterfaceSAXHandler)calloc(1, sizeof(struct _xmlSAXHandler));
153+
#if DEPLOYMENT_RUNTIME_SWIFT
146154
saxHandler->internalSubset = (internalSubsetSAXFunc)__CFSwiftBridge.NSXMLParser.internalSubset;
147155
saxHandler->isStandalone = (isStandaloneSAXFunc)__CFSwiftBridge.NSXMLParser.isStandalone;
148156

@@ -168,6 +176,7 @@ _CFXMLInterfaceSAXHandler _CFXMLInterfaceCreateSAXHandler() {
168176
saxHandler->externalSubset = (externalSubsetSAXFunc)__CFSwiftBridge.NSXMLParser.externalSubset;
169177

170178
saxHandler->initialized = XML_SAX2_MAGIC; // make sure start/endElementNS are used
179+
#endif //if DEPLOYMENT_RUNTIME_SWIFT
171180
return saxHandler;
172181
}
173182

CoreFoundation/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
'String.subproj/CFRegularExpression.c',
294294
'String.subproj/CFAttributedString.c',
295295
'String.subproj/CFRunArray.c',
296-
'Base.subproj/CFKnownLocations.h',
296+
'Base.subproj/CFKnownLocations.c',
297297
]
298298

299299
sources = CompileSources(sources_list)

lib/script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def generate_products(self):
226226
script = flags + commands
227227

228228
for product in self.products:
229-
script += product.generate()
229+
script += "".join([product_build_command for product_build_command in product.generate() if not isinstance(product_build_command, list)])
230230

231231
script += """
232232

0 commit comments

Comments
 (0)