Merge "Support <include> directives in manifests." am: ed31855802 am: c611ab31bf

am: beba402bd3

Change-Id: Ifc061abae1a0aa385bfceea2c9d1afa207510e37
This commit is contained in:
Martin Stjernholm
2019-08-29 14:40:23 -07:00
committed by android-build-merger

View File

@@ -26,6 +26,7 @@ import itertools
import json import json
import multiprocessing import multiprocessing
import os import os
import os.path
import re import re
import sys import sys
import xml.dom.minidom import xml.dom.minidom
@@ -170,6 +171,15 @@ def build_project_name_dir_dict(manifest_path):
directory path.""" directory path."""
project_dirs = {} project_dirs = {}
parsed_xml = xml.dom.minidom.parse(manifest_path) parsed_xml = xml.dom.minidom.parse(manifest_path)
includes = parsed_xml.getElementsByTagName('include')
for include in includes:
include_path = include.getAttribute('name')
if not os.path.isabs(include_path):
manifest_dir = os.path.dirname(os.path.realpath(manifest_path))
include_path = os.path.join(manifest_dir, include_path)
project_dirs.update(build_project_name_dir_dict(include_path))
projects = parsed_xml.getElementsByTagName('project') projects = parsed_xml.getElementsByTagName('project')
for project in projects: for project in projects:
name = project.getAttribute('name') name = project.getAttribute('name')
@@ -178,6 +188,7 @@ def build_project_name_dir_dict(manifest_path):
project_dirs[name] = path project_dirs[name] = path
else: else:
project_dirs[name] = name project_dirs[name] = name
return project_dirs return project_dirs