Revert "Use cp instead of install for ndk_headers"

This reverts commit 1202729cb2.

Reason for revert: Breaks aosp-main/ndk builds

Change-Id: I453792f7f974dc336d5f6775adfc5899b8d34d7b
This commit is contained in:
Spandan Das
2024-04-04 17:11:43 +00:00
committed by Gerrit Code Review
parent 1202729cb2
commit c299c3f913
4 changed files with 22 additions and 16 deletions

View File

@@ -15,6 +15,7 @@
package cc
import (
"fmt"
"path/filepath"
"android/soong/android"
@@ -44,7 +45,7 @@ func init() {
}
// Returns the NDK base include path for use with sdk_version current. Usable with -I.
func getCurrentIncludePath(ctx android.ModuleContext) android.OutputPath {
func getCurrentIncludePath(ctx android.ModuleContext) android.InstallPath {
return getNdkSysrootBase(ctx).Join(ctx, "usr/include")
}
@@ -86,7 +87,7 @@ type headerModule struct {
}
func getHeaderInstallDir(ctx android.ModuleContext, header android.Path, from string,
to string) android.OutputPath {
to string) android.InstallPath {
// Output path is the sysroot base + "usr/include" + to directory + directory component
// of the file without the leading from directory stripped.
//
@@ -128,12 +129,13 @@ func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
for _, header := range m.srcPaths {
installDir := getHeaderInstallDir(ctx, header, String(m.properties.From),
String(m.properties.To))
installedPath := ctx.InstallFile(installDir, header.Base(), header)
installPath := installDir.Join(ctx, header.Base())
ctx.Build(pctx, android.BuildParams{
Rule: android.Cp,
Input: header,
Output: installPath,
})
if installPath != installedPath {
panic(fmt.Sprintf(
"expected header install path (%q) not equal to actual install path %q",
installPath, installedPath))
}
m.installPaths = append(m.installPaths, installPath)
}