@@ -3,32 +3,9 @@ import { IBuildTaskOption } from "~types/packages/builder/@types";
3
3
import { run } from "node-cmd"
4
4
import { BUILDER_NAME } from "@/extensions/constants" ;
5
5
import { checkOSPlatform , getAdapterConfig , getRCSkipBuild , getRealPath } from "@/extensions/utils" ;
6
- import {
7
- TPlatform ,
8
- unmountGlobalVars ,
9
- mountGlobalVars ,
10
- exec3xAdapter ,
11
- } from 'playable-adapter-core'
6
+ import { exec3xAdapter } from 'playable-adapter-core'
12
7
import { join } from 'path' ;
13
8
14
- const prepareBuildStart = ( platform : TPlatform ) : TPlatform => {
15
- const {
16
- projectRootPath,
17
- projectBuildPath,
18
- buildPlatform,
19
- adapterBuildConfig,
20
- } = getAdapterConfig ( platform )
21
- // 加载项目全局变量
22
- mountGlobalVars ( {
23
- projectRootPath,
24
- projectBuildPath,
25
- platform : buildPlatform ! ,
26
- adapterBuildConfig
27
- } )
28
-
29
- return buildPlatform !
30
- }
31
-
32
9
const runBuilder = ( buildPlatform : TPlatform ) => {
33
10
return new Promise < void > ( ( resolve , reject ) => {
34
11
let cocosBuilderPath = Editor . App . path
@@ -54,16 +31,26 @@ const runBuilder = (buildPlatform: TPlatform) => {
54
31
55
32
export const initBuildStartEvent = async ( options : Partial < IBuildTaskOption > ) => {
56
33
console . log ( `${ BUILDER_NAME } 进行预构建处理` )
57
- prepareBuildStart ( options . platform ! )
58
34
console . log ( `${ BUILDER_NAME } 跳过预构建处理` )
59
35
}
60
36
61
37
export const initBuildFinishedEvent = async ( options : Partial < IBuildTaskOption > ) => {
62
38
console . info ( `${ BUILDER_NAME } 开始适配,导出平台 ${ options . platform } ` )
63
39
const start = new Date ( ) . getTime ( ) ;
64
- await exec3xAdapter ( )
40
+
41
+ const {
42
+ projectRootPath,
43
+ projectBuildPath,
44
+ buildPlatform,
45
+ adapterBuildConfig,
46
+ } = getAdapterConfig ( options . platform ! )
47
+ await exec3xAdapter ( {
48
+ projectRootPath,
49
+ projectBuildPath,
50
+ platform : buildPlatform ! ,
51
+ adapterBuildConfig,
52
+ } )
65
53
const end = new Date ( ) . getTime ( ) ;
66
- unmountGlobalVars ( )
67
54
console . log ( `${ BUILDER_NAME } 适配完成,共耗时${ ( ( end - start ) / 1000 ) . toFixed ( 0 ) } 秒` )
68
55
}
69
56
@@ -75,7 +62,6 @@ export const builder3x = async () => {
75
62
projectRootPath,
76
63
projectBuildPath,
77
64
} = getAdapterConfig ( )
78
- prepareBuildStart ( buildPlatform )
79
65
// 初始化 end
80
66
console . log ( `开始构建项目,导出${ buildPlatform } 包` )
81
67
const isSkipBuild = getRCSkipBuild ( )
0 commit comments