openharmony: add servoshell for ohos#33295
Conversation
1097ac8 to
a029151
Compare
| 'will choose a default target architecture.', | ||
| ), | ||
| CommandArgument( | ||
| '--ohos', default=None, action='store_true', |
There was a problem hiding this comment.
What benefit does adding a new argument give us? In principle the target triple already tells us that we are targetting ohos.
There was a problem hiding this comment.
It is just an alias to build the default architecture for the platform. The only value is the UX for the user, which is debatable, but we have it for android, so I've added for OH as well.
There was a problem hiding this comment.
Considering that the long term plan is to remove mach, I'm not convinced having users get used to convenience options that "cargo build" does not have is desirable.
There was a problem hiding this comment.
Fair, but I don't see mach being replaced very soon, so I don't see the harm in having a consistent UX while we still depend upon it.
There was a problem hiding this comment.
mach will not be removed, but our plan is to make mach build/check/cargo-* commands more thin (ideally just cargo commands aliases with some options aliases).
.github/workflows/ohos.yml
Outdated
| - name: Build (arch ${{ matrix.arch }} profile ${{ inputs.profile }}) | ||
| env: | ||
| OHOS_SDK_NATIVE: ${{ steps.setup_sdk.outputs.ohos_sdk_native }} | ||
| OHOS_BASE_SDK_HOME: ${{ steps.setup_sdk.outputs.ohos_sdk_native }} |
There was a problem hiding this comment.
Is there something that expects this variable name instead of OHOS_SDK_NATIVE?
There was a problem hiding this comment.
hvigor needs this to find the other components like toolchain and ets that it needs for building the shell. The value should actually come from the ohos_base_sdk_home output of the setup_sdk step. I'll fix this typo.
There was a problem hiding this comment.
Interesting. Is this perhaps only needed for hvigor 4.x? I don't think I'm setting this variable when building on the commandline locally.
There was a problem hiding this comment.
Just tried locally with hvigor 5.x:
Info: The OpenHarmony SDK 4.1.7.5 is targeting API-level 11
> hvigor ERROR: Unable to find 'sdk.dir' in 'local.properties' or 'OHOS_BASE_SDK_HOME' in the system environment path.
at /home/mukilan/servo-ohos/target/openharmony/aarch64-unknown-linux-ohos/release/local.properties
> hvigor ERROR: BUILD FAILED in 1 s 797 ms
Do perhaps have sdk.dir in local.properties or DEVECO_SDK_HOME set?
|
Regarding signing - I updated the servodemo with a small patch (jschwe/ServoDemo#5) which lets hvigor read the signing configuration from a seperate file. I also added an example file to the repo. |
jschwe
left a comment
There was a problem hiding this comment.
Left some comments, but I think this PR is basically fine as is.
Just as a note, I also have a branch on my ServoDemo repo jschwe/ServoDemo#6, which allows building servo directly via the IDE (and without requiring mach, pure cargo build).
I think both approaches can co-exist, just wanted to mention that the OH build can in principle work fully without mach already (and with only very little CMake code).
| 'will choose a default target architecture.', | ||
| ), | ||
| CommandArgument( | ||
| '--ohos', default=None, action='store_true', |
There was a problem hiding this comment.
Considering that the long term plan is to remove mach, I'm not convinced having users get used to convenience options that "cargo build" does not have is desirable.
| # hvigor doesn't support an option to place output files in a specific directory | ||
| # so copy the source files into the target/openharmony directory first. | ||
| ohos_app_dir = path.join(self.get_top_dir(), "support", "openharmony") | ||
| ohos_target_dir = path.join( |
There was a problem hiding this comment.
The source files of OH app, shouldn't be different for release / debug mode, so I don't think adding build_type.directory_name() is strictly necessary.
There was a problem hiding this comment.
The idea is to allow the HAP (which will be generated inside the source folder hierarchy) for debug/release/production profiles to co-exist like we do for other targets.
There was a problem hiding this comment.
Hmm, does the output folder in hvigor not differ between release / debug profiles? (To be fair I've only ever built with the default profile, which I think is debug)
There was a problem hiding this comment.
I'm not sure either. The output currently ends up inside <top-level for app source>/entry/build/default/outputs/default . Is one of the default in this path referring to the debug/release type? There is a buildMode declaration, but I don't follow how that translates to "default". Also, shouldn't the invocation of the hvigor differ for debug/release? It is currently the same for both.
There was a problem hiding this comment.
Just tried invoking hvigor with -p buildMode=release and while the build successfully completes successfully, it does give this warning
> hvigor Finished :servoshell:default@CompileResource... after 53 ms
> hvigor WARN: Dependency libservoshell.so not found.
but the HAP does contain the libservoshell.so. The path is still the same as without buildMode=release i.e entry/build/default/outputs/default so the path doesn't seem to be affected by the debug/release. Perhaps we'll need to map the debug/release to different targets?
There was a problem hiding this comment.
@jschwe the "dependency not found" error seems to originate from 'obfustcation-config-resolver.js' in the ohos-plugin module. I don't know why it says the .so is not found, but still the HAP has the library and it runs as expected.
I've added code in a797e9a to pass bulidMode to hvigor. I've not removed the profile subfolder under target/openharmony/<triple> since the output path doesn't seem to change.
caf7dbc to
a797e9a
Compare
1996717 to
3ce19ee
Compare
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors