Skip to content

Commit 5119b38

Browse files
committed
fix: 并行批处理时,js 脚本路径问题
1 parent 284e73e commit 5119b38

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

bin/codegen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { program } from 'commander'
33
import { main } from '../lib/main.js'
44

5-
program.version('2.0.0')
5+
program.version('2.0.1')
66

77
program
88
.arguments('<input>', 'Iutput directory')

lib/main.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import yaml from 'js-yaml'
55
import { Worker } from 'worker_threads'
66
import DNObjectiveCConverter from './objc/DNObjectiveCConverter.js'
77
import DNJavaConverter from './java/DNJavaConverter.js'
8+
import { fileURLToPath } from 'url';
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
811

912
const dnPartExtension = 'dnpart'
1013
var outputDir
@@ -13,13 +16,13 @@ var packageSet = new Set()
1316
var enumeratorTypeNames = []
1417
var isMainThread = false
1518

16-
const scriptForObjC = './lib/objc/DNObjectiveCConverter.js'
17-
const scriptForJava = './lib/java/DNJavaConverter.js'
19+
const scriptForObjC = './objc/DNObjectiveCConverter.js'
20+
const scriptForJava = './java/DNJavaConverter.js'
1821

1922
const langForExtension = { h: 'objc', java: 'java' }
2023
const scriptForExtension = {
21-
h: path.join(path.resolve(), scriptForObjC),
22-
java: path.join(path.resolve(), scriptForJava)
24+
h: path.resolve(__dirname, scriptForObjC),
25+
java: path.resolve(__dirname, scriptForJava)
2326
}
2427

2528
const fileSplitConfig = new Map()

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dartnative/codegen",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"type": "module",
55
"description": "Code generator for dart_native.",
66
"main": "index.js",
@@ -15,7 +15,7 @@
1515
"test": "test"
1616
},
1717
"scripts": {
18-
"pretest": "git clone -b develop https://github.com/dart-native/dart_native.git",
18+
"pretest": "git clone -b feature/flutter2 https://github.com/dart-native/dart_native.git",
1919
"test": "codegen dart_native/dart_native/example/ios/Runner/RuntimeStub.h -o test/dart/ --project-name my_package -t plugin",
2020
"posttest": "node test/test.js dart_native/dart_native/example/lib/ios/runtimestub.dart test/dart/my_package/lib/objc/runtimestub.dart"
2121
},

0 commit comments

Comments
 (0)