Skip to content

Commit 8551e5d

Browse files
committed
feat(harmony): inject cpp module
1 parent c130b9a commit 8551e5d

File tree

1 file changed

+16
-0
lines changed
  • packages/taro-platform-harmony-cpp/src

1 file changed

+16
-0
lines changed

packages/taro-platform-harmony-cpp/src/index.ts

+16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable no-console */
2+
import { execSync } from 'node:child_process'
23
import path from 'node:path'
34

45
import { chalk, fs, NPM_DIR } from '@tarojs/helper'
@@ -122,6 +123,21 @@ export default (ctx: IPluginContext, options: IOptions = {}) => {
122123
'./src/main/cpp/types/taro-native-node/obfuscation-rules.txt',
123124
)
124125
})
126+
127+
const C_API_TXT = chalk.yellow('C-API')
128+
try {
129+
const cppOutPath = path.join(projectPath, hapName, 'src/main', 'cpp')
130+
if (!fs.existsSync(cppOutPath)) {
131+
console.log(`开始拉取 ${C_API_TXT} 模块...`)
132+
execSync(`git clone [email protected]:NervJS/taro-harmony-capi-library.git ${cppOutPath}`, {
133+
cwd: path.resolve(__dirname, '..', '..', '..'),
134+
stdio: 'inherit',
135+
env: process.env,
136+
})
137+
}
138+
} catch (error) {
139+
console.log(`${C_API_TXT} 获取失败...`) // eslint-disable-line no-console
140+
}
125141
}
126142
fs.writeJSONSync(buildProfilePath, profile, { spaces: 2 })
127143
} catch (error) {

0 commit comments

Comments
 (0)