()
| 87 | } |
| 88 | |
| 89 | function buildHar() { |
| 90 | ensureWrapperProject(); |
| 91 | |
| 92 | const devecoRoots = getDevEcoRoots(); |
| 93 | const hvigorwPath = resolveBinary('hvigorw', [ |
| 94 | process.env.HVIGORW_PATH, |
| 95 | ...devecoRoots.map((root) => |
| 96 | path.join(root, 'tools', 'hvigor', 'bin', 'hvigorw'), |
| 97 | ), |
| 98 | ]); |
| 99 | const ohpmPath = resolveBinary('ohpm', [ |
| 100 | process.env.OHPM_PATH, |
| 101 | ...devecoRoots.map((root) => |
| 102 | path.join(root, 'tools', 'ohpm', 'bin', 'ohpm'), |
| 103 | ), |
| 104 | ]); |
| 105 | |
| 106 | if (!hvigorwPath) { |
| 107 | fail( |
| 108 | 'Cannot find hvigorw. Set HVIGORW_PATH or install DevEco Studio.', |
| 109 | ); |
| 110 | } |
| 111 | |
| 112 | if (!ohpmPath) { |
| 113 | fail('Cannot find ohpm. Set OHPM_PATH or install DevEco Studio.'); |
| 114 | } |
| 115 | |
| 116 | const env = { |
| 117 | ...process.env, |
| 118 | }; |
| 119 | |
| 120 | if (!env.DEVECO_SDK_HOME) { |
| 121 | const devecoSdkHome = findExistingPath( |
| 122 | devecoRoots.map((root) => path.join(root, 'sdk')), |
| 123 | ); |
| 124 | if (devecoSdkHome) { |
| 125 | env.DEVECO_SDK_HOME = devecoSdkHome; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | if (!env.DEVECO_STUDIO_HOME) { |
| 130 | const devecoStudioHome = findExistingPath(devecoRoots); |
| 131 | if (devecoStudioHome) { |
| 132 | env.DEVECO_STUDIO_HOME = devecoStudioHome; |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | if (!skipInstall) { |
| 137 | if (hasDependencies(harmonyModuleDir)) { |
| 138 | runCommand(ohpmPath, ['install'], { |
| 139 | cwd: harmonyModuleDir, |
| 140 | env, |
| 141 | label: 'Install Harmony dependencies', |
| 142 | }); |
| 143 | } |
| 144 | |
| 145 | if (hasDependencies(wrapperProjectDir)) { |
| 146 | runCommand(ohpmPath, ['install'], { |
no test coverage detected