extract: Prioritize explicit named dependencies in conflict resolution

This commit is contained in:
Danny Lin 2021-11-07 06:10:58 -08:00
parent 99c984f6e2
commit 2e20befcd4

View file

@ -9,6 +9,10 @@ import { parseFileList } from '../blobs/file_list'
import { copyBlobs } from '../blobs/copy'
import { blobToFileCopy, serializeProductMakefile } from '../build/make'
function nameDepKey(entry: BlobEntry) {
return `${entry.isNamedDependency ? 0 : 1}${entry.srcPath}`
}
async function generateBuild(
entries: Array<BlobEntry>,
vendor: string,
@ -16,6 +20,10 @@ async function generateBuild(
outDir: string,
proprietaryDir: string,
) {
// Re-sort entries to give priority to explicit named dependencies in name
// conflict resolution
entries = Array.from(entries).sort((a, b) => nameDepKey(a).localeCompare(nameDepKey(b)))
// Fast lookup for other arch libs
let entrySrcPaths = new Set(entries.map(e => e.srcPath))