Skip to content

Add linux-ohos (HarmonyOS) build infrastructure - #132953

Open
springmin wants to merge 1 commit into
dotnet:mainfrom
springmin:pr/ohos-infra
Open

Add linux-ohos (HarmonyOS) build infrastructure#132953
springmin wants to merge 1 commit into
dotnet:mainfrom
springmin:pr/ohos-infra

Conversation

@springmin

Copy link
Copy Markdown

Summary

First PR of the OpenHarmony (HarmonyOS) port series (tracking issue: #132866). This PR adds the build infrastructure for the linux-ohos target so the runtime can be cross-built with the HarmonyOS NDK. It is a no-op on all existing platforms: every change is guarded by TargetOpenHarmony (only set when the build targets linux-ohos), and CI for the standard platform matrix is expected to stay green.

Changes

File Change
eng/build.sh Accept -os linux-ohos; skip rootfs (NDK-based toolchain)
eng/RuntimeIdentifier.props PortableOS=linux-ohos mapping; TargetOpenHarmony property; exclude from TargetsLinuxGlibc
eng/Subsets.props DefaultSubsets for OHOS; UseNativeAotForComponents exclusion (crossgen2 stays IL, mirrors linux-bionic); _BuildAnyCrossArch
eng/liveBuilds.targets CoreCLR artifacts path for linux-ohos
eng/native/build-commons.sh OHOS NDK toolchain branch (OHOS_NDK_HOME, ohos.toolchain.cmake, OHOS_ARCH); rootfs bypass
eng/native/configureplatform.cmake Map CMAKE_SYSTEM_NAME=OHOS to linux/musl; CLR_CMAKE_HOST_OPENHARMONY / CLR_CMAKE_TARGET_OPENHARMONY
eng/native/configurecompiler.cmake OHOS compile flags (-Qunused-arguments, native TLS); TARGET_OPENHARMONY define (mirrors TARGET_ANDROID)
eng/native/configuretools.cmake Find NDK tools via compiler directory (guarded to OHOS)
eng/native/gen-buildsys.sh Rootfs bypass for OHOS cross-build
src/coreclr/clr.featuredefines.props Disable FeatureXplatEventSource on OHOS (no LTTng in sysroot)
src/coreclr/runtime.proj, src/native/corehost/corehost.proj, src/native/libs/build-native.proj/.sh _BuildNativeTargetOS=linux-ohos (mirrors linux-bionic)
src/native/libs/System.Native/CMakeLists.txt Include OHOS in the "no ecm_support" platform set

Impact on existing platforms

None. TargetOpenHarmony is only defined when PortableOS == linux-ohos (i.e., when -os linux-ohos is passed). Every guarded condition either adds a new branch or excludes OHOS from an existing condition in a way that is logically equivalent for all other platforms.

Validation

  • Full clr.native+libs+host+packs -os linux-ohos -arch arm64 --cross cross-build succeeds: 0 Warning(s) 0 Error(s).
  • Standard platform CI matrix must pass (no-op guarantee).
  • Note: HarmonyOS CI legs are not part of this PR; the follow-up PRs add sysroot compile fixes, NativeAOT support, and RID/packs (see Add OpenHarmony (HarmonyOS) support to the .NET runtime #132866 for the full series).

Note

This PR was authored with AI assistance (Copilot/agent tooling) under the repository owner's direction.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Aug 30, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Infrastructure-libraries community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant