提交 e3a941e3 编写于 作者: fxy060608's avatar fxy060608

wip(uts): compiler

上级 f813c688
......@@ -181,6 +181,7 @@ exports[`code genProxyCode 3`] = `
"body": [
{
"computed": false,
"isOverride": false,
"key": {
"optional": false,
"span": {
......@@ -221,6 +222,7 @@ exports[`code genProxyCode 3`] = `
},
{
"computed": false,
"isOverride": false,
"key": {
"optional": false,
"span": {
......
import path, { join, relative } from 'path'
import path, { basename, join, relative } from 'path'
import fs from 'fs-extra'
import { APP_PLATFORM } from './manifest/utils'
import { normalizePath } from './shared'
......@@ -54,9 +54,9 @@ export async function compileEncrypt(pluginDir: string, isX = false) {
meta: { commonjs: { isCommonJS: true } },
}
}
const cacheDir = process.env.HX_DEPENDENCIES_DIR!
if (!isX) {
// 读取缓存目录的 js code
const cacheDir = process.env.HX_DEPENDENCIES_DIR!
const indexJsPath = resolveJsCodeCacheFilename(
utsPlatform,
cacheDir,
......@@ -69,6 +69,13 @@ export async function compileEncrypt(pluginDir: string, isX = false) {
`uts插件[${path.basename(pluginDir)}]不存在,请重新打包自定义基座`
)
}
} else {
const jarPath = resolveJarCacheFilename(cacheDir, pluginRelativeDir)
if (!fs.existsSync(jarPath)) {
console.error(
`uts插件[${path.basename(pluginDir)}]不存在,请重新打包自定义基座`
)
}
}
return {
dir: outputPluginDir,
......@@ -86,3 +93,10 @@ export function resolveJsCodeCacheFilename(
) {
return join(cacheDir, platform, 'uts', pluginRelativeDir, 'index.js')
}
export function resolveJarCacheFilename(
cacheDir: string,
pluginRelativeDir: string
) {
return join(cacheDir, pluginRelativeDir, basename(pluginRelativeDir) + '.jar')
}
......@@ -594,6 +594,16 @@ export function checkAndroidVersionTips(
}
}
export function getUniModulesEncryptCacheJars(cacheDir: string) {
if (cacheDir) {
return sync('uni_modules/*/*.jar', {
cwd: cacheDir,
absolute: true,
})
}
return []
}
export function getUniModulesCacheJars(cacheDir: string) {
if (cacheDir) {
return sync('app-android/uts/uni_modules/*/index.jar', {
......
......@@ -15,6 +15,7 @@ import {
getUniModulesJars,
resolveKotlincArgs,
createStderrListener,
getUniModulesEncryptCacheJars,
} from '../kotlin'
import { parseUTSSyntaxError } from '../stacktrace'
import {
......@@ -290,6 +291,7 @@ async function runKotlinDev(
getKotlincHome(),
[kotlinClassOutDir].concat(
getDefaultJar(2)
.concat(getUniModulesEncryptCacheJars(cacheDir))
.concat(getUniModulesCacheJars(cacheDir))
.concat(getUniModulesJars(outputDir))
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册