@@ -20,6 +20,18 @@ var packageSet = new Set()
20
20
const scriptForObjC = './objc/DNObjectiveCConverter.js'
21
21
const scriptForJava = './java/DNJavaConverter.js'
22
22
23
+ const langForExtension = { h : 'objc' , java : 'java' }
24
+ const scriptForExtension = {
25
+ h : path . join ( __dirname , scriptForObjC ) ,
26
+ java : path . join ( __dirname , scriptForJava )
27
+ }
28
+
29
+ const fileSplitConfig = new Map ( )
30
+ fileSplitConfig . set ( scriptForExtension . h , {
31
+ separator : '@end\n' ,
32
+ maxLength : 5000 }
33
+ )
34
+
23
35
function mkdirs ( dirname ) {
24
36
if ( fs . existsSync ( dirname ) ) {
25
37
return true
@@ -167,9 +179,9 @@ function splitCodeFileIfNeed(separator, maxLength, path) {
167
179
async function runWorkItems ( workItems ) {
168
180
const promises = Array . from ( workItems . keys ( ) ) . map ( ( filePath ) => {
169
181
let script = workItems . get ( filePath )
182
+ let config = fileSplitConfig . get ( script )
170
183
console . log ( 'processing: ' + filePath )
171
- // TODO: change separator
172
- let contents = splitCodeFileIfNeed ( "@end\n" , 5000 , filePath )
184
+ let contents = splitCodeFileIfNeed ( config . separator , config . maxLength , filePath )
173
185
let ps = contents . map ( ( content , index ) => {
174
186
let p = filePath
175
187
if ( contents . length > 1 ) {
@@ -223,12 +235,6 @@ async function main(input, options, onMainThread = !isSupportWorkerThreads) {
223
235
224
236
var baseOutputDir = outputDir
225
237
226
- const langForExtension = { 'h' : 'objc' , 'java' : 'java' }
227
- const scriptForExtension = {
228
- 'h' : path . join ( __dirname , scriptForObjC ) ,
229
- 'java' : path . join ( __dirname , scriptForJava )
230
- }
231
-
232
238
var workItems = new Map ( )
233
239
extArray . forEach ( ( ext ) => {
234
240
let files = recFindByExt ( input , ext )
0 commit comments