openharmony: add servoshell for ohos (#33295)

* openharmony: add servoshell for ohos

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* ohos: handle missing signing config on forks

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2024-09-20 13:50:27 +05:30 committed by GitHub
parent 457d37d94e
commit 157e28c59b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 625 additions and 9 deletions

View file

@ -0,0 +1,34 @@
import { appTasks, OhosAppContext, OhosPluginId } from '@ohos/hvigor-ohos-plugin';
import { getNode } from '@ohos/hvigor'
import * as fs from 'fs';
import * as path from 'path';
const rootNode = getNode(__filename);
rootNode.afterNodeEvaluate(node => {
const appContext = node.getContext(OhosPluginId.OHOS_APP_PLUGIN) as OhosAppContext;
const buildProfileOpt = appContext.getBuildProfileOpt();
const signingConfigsPath = process.env["SERVO_OHOS_SIGNING_CONFIG"];
if (signingConfigsPath) {
if (!fs.existsSync(signingConfigsPath)) {
console.error("File referenced by SERVO_OHOS_SIGNING_CONFIG does not exist!");
return;
}
const basePath = path.dirname(signingConfigsPath);
const signingConfigs = JSON.parse(fs.readFileSync(signingConfigsPath));
for (const config of signingConfigs) {
config.material.certpath = path.resolve(basePath, config.material.certpath);
config.material.profile = path.resolve(basePath, config.material.profile);
config.material.storeFile = path.resolve(basePath, config.material.storeFile);
}
buildProfileOpt['app']['signingConfigs'] = signingConfigs;
} else {
console.log('Signing config not found in enviroment. hvigor will fallback to build-profile.json5.')
}
// Set the obj object back to the context object to enable the build process and results.
appContext.setBuildProfileOpt(buildProfileOpt);
})
export default {
system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}