make: Fix symlink generation
TODO: fix ninja warning
This commit is contained in:
parent
7237186561
commit
dba9b12ef9
2 changed files with 20 additions and 16 deletions
|
@ -111,7 +111,7 @@ export async function generateBuild(
|
||||||
}
|
}
|
||||||
|
|
||||||
let buildPackages = Array.from(namedModules.keys())
|
let buildPackages = Array.from(namedModules.keys())
|
||||||
buildPackages.push(...symlinks.map(l => l.moduleName))
|
buildPackages.push('device_symlinks')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
blueprint: {
|
blueprint: {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { basename } from 'path'
|
import { basename, dirname } from 'path'
|
||||||
import { BlobEntry } from '../blobs/entry'
|
import { BlobEntry } from '../blobs/entry'
|
||||||
import { PartitionProps } from '../blobs/props'
|
import { PartitionProps } from '../blobs/props'
|
||||||
import { SelinuxPartResolutions } from '../sepolicy/contexts'
|
import { SelinuxPartResolutions } from '../sepolicy/contexts'
|
||||||
|
@ -87,24 +87,28 @@ export function serializeModulesMakefile(mk: ModulesMakefile) {
|
||||||
blocks.push(mk.radioFiles.map(img => `$(call add-radio-file,${img})`).join('\n'))
|
blocks.push(mk.radioFiles.map(img => `$(call add-radio-file,${img})`).join('\n'))
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let link of mk.symlinks) {
|
if (mk.symlinks.length > 0) {
|
||||||
let destPath = partPathToMakePath(link.linkPartition, link.linkSubpath)
|
let mkdirCmds = new Set<string>()
|
||||||
|
let linkCmds = []
|
||||||
|
for (let link of mk.symlinks) {
|
||||||
|
let destPath = `$(PRODUCT_OUT)/${link.linkPartition}/${link.linkSubpath}`
|
||||||
|
mkdirCmds.add(`mkdir -p ${dirname(destPath)};`)
|
||||||
|
linkCmds.push(`ln -sf ${link.targetPath} ${destPath};`)
|
||||||
|
}
|
||||||
|
|
||||||
blocks.push(`include $(CLEAR_VARS)
|
blocks.push(`include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := ${link.moduleName}
|
LOCAL_MODULE := device_symlinks
|
||||||
LOCAL_MODULE_CLASS := FAKE
|
LOCAL_MODULE_CLASS := ETC
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
LOCAL_MODULE_OWNER := ${mk.vendor}
|
LOCAL_MODULE_OWNER := ${mk.vendor}
|
||||||
include $(BUILD_SYSTEM)/base_rules.mk
|
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)
|
||||||
$(LOCAL_BUILT_MODULE): TARGET := ${link.targetPath}
|
LOCAL_MODULE_STEM := .device_symlinks
|
||||||
$(LOCAL_BUILT_MODULE): SYMLINK := ${destPath}
|
LOCAL_SRC_FILES := Android.mk
|
||||||
$(LOCAL_BUILT_MODULE):
|
LOCAL_POST_INSTALL_CMD := \\
|
||||||
\t$(hide) mkdir -p $(dir $@)
|
${Array.from(mkdirCmds).join(CONT_SEPARATOR)} \\
|
||||||
\t$(hide) mkdir -p $(dir $(SYMLINK))
|
${linkCmds.join(CONT_SEPARATOR)} \\
|
||||||
\t$(hide) rm -rf $@
|
rm -f $(TARGET_OUT_VENDOR_ETC)/.device_symlinks
|
||||||
\t$(hide) rm -rf $(SYMLINK)
|
include $(BUILD_PREBUILT)`)
|
||||||
\t$(hide) ln -sf $(TARGET) $(SYMLINK)
|
|
||||||
\t$(hide) touch $@`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blocks.push('endif')
|
blocks.push('endif')
|
||||||
|
|
Loading…
Reference in a new issue