-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some cleanup of the HarmonyOS servo build #56
base: main
Are you sure you want to change the base?
Conversation
The building for servo is currently done in two steps and needs a Linux workstation and MacOS/Windows computer for bundling. | ||
1. Build the shared library (libservo.so). | ||
2. Create the App Bundle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not quite correct. For OpenHarmony I think everything can be done completely on Linux. For HarmonyOS generating the signature file is easiest with DevEco (windows / mac), but I do think there is an official guide on how to create a signature file manually.
Once you have the signature file (and configured your Linux workstation correctly), mach build --ohos
will both build libservoshell.so and additionally bundle it into a signed hap file, which you can then install via ./mach install --ohos [--release --flavor=...]
@@ -196,24 +36,30 @@ Otherwise, the environment variables will not be loaded. | |||
The following command can then be used to compile the servoshell application for a 64-bit ARM device or emulator: | |||
|
|||
```commandline | |||
./mach build --ohos --release [--flavor=harmonyos] | |||
./mach build --ohos --release --flavor=harmonyos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flavor is optional (and defaults to openharmony), so i would keep the brackets
|
||
## Installing and running on-device | ||
Now you should have a shared library in /path/to/servo/target/aarch64-unknown-linux-ohos/release/libservoshell.so. | ||
You can ignore the error about hvigor tool as we will not produce the app bundle on this machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I guess the previous instructions were unclear - but after setting everything up, you can build, package and install all from your Linux workstation. We definitely shouldn't recommend using 2 PCs for building.
export PATH="${PATH}:/path/to/command-line-tools/bin/" | ||
export NODE_HOME=/path/to/command-line-tools/tool/node | ||
|
||
# Alternatively, if you do NOT have the command-line tools installed: | ||
export HVIGOR_PATH=/path/to/parent/directory/containing/node_modules # Not required if `hvigorw` is in $PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the envrc changes. The exact variables needed depend on your configuration, and e.g. removing DEVECO_SDK_HOME will break packaging for HarmonyOS.
API_VERSION=$(cat ${COMPONENT}/oh-uni-package.json | jq -r '.apiVersion') | ||
mkdir -p ${API_VERSION} | ||
mv ${COMPONENT} "${API_VERSION}/" | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hvigor is very finicky with the folder layout. This is necessary when downloading the OH SDK (as opposed to the harmonyos commandline tools, which are fine by default)
|
||
Currently, the commandline tools package is not publicly available and requires a chinese Huawei account to download. | ||
|
||
#### Manual installation of hvigor without the commandline tools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to build on Linux without using the harmonyos commandline tools (e.g. in our CI), then this complicated section is sadly necessary. Perhaps we could move this part / some OH specific parts into a seperate file, so that we have two files? Do you think that would help make the guide easier to follow?
``` | ||
[OpenJDK formula]: https://formulae.brew.sh/formula/openjdk#default | ||
|
||
### Configuring hdc on Linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this section is also definitely necessary if you want to use hdc on Linux. We could move it into a separate file though.
2. Then navigate to the developer options and enable USB debugging. | ||
3. When you connect your device for the first time, confirm the pop-up asking you if you want to trust the computer you are connecting to. | ||
|
||
## Signing configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also necessary for Linux, and recommend for windows / mac too, since using ./mach install is just very convenient.
Rewrote most of the HarmonyOS bits to make a more streamlined install for now.
Without the a windows/mac computer I don't think you can get the signing config so we can just require it.
Added the old guide to the old section on the chance that somebody might still find it useful.