Set root dir in lint project.xml
Set the root dir in the project.xml for lint so that the paths in the
lint report are relative to the top of the tree instead of relative
to the project.xml.
Bug: 153485543
Test: run lint
Change-Id: Ie163a4dadd976e708f798855de73e58084931a91
Merged-In: Ie163a4dadd976e708f798855de73e58084931a91
(cherry picked from commit c31efeb25c
)
This commit is contained in:
@@ -155,8 +155,11 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext,
|
|||||||
cmd.FlagForEachArg("--extra_checks_jar ", l.extraLintCheckJars.Strings())
|
cmd.FlagForEachArg("--extra_checks_jar ", l.extraLintCheckJars.Strings())
|
||||||
deps = append(deps, l.extraLintCheckJars...)
|
deps = append(deps, l.extraLintCheckJars...)
|
||||||
|
|
||||||
// The cache tag in project.xml is relative to the project.xml file.
|
cmd.FlagWithArg("--root_dir ", "$PWD")
|
||||||
cmd.FlagWithArg("--cache_dir ", "cache")
|
|
||||||
|
// The cache tag in project.xml is relative to the root dir, or the project.xml file if
|
||||||
|
// the root dir is not set.
|
||||||
|
cmd.FlagWithArg("--cache_dir ", cacheDir.String())
|
||||||
|
|
||||||
cmd.FlagWithInput("@",
|
cmd.FlagWithInput("@",
|
||||||
android.PathForSource(ctx, "build/soong/java/lint_defaults.txt"))
|
android.PathForSource(ctx, "build/soong/java/lint_defaults.txt"))
|
||||||
|
@@ -77,6 +77,8 @@ def parse_args():
|
|||||||
help='mark the module as a test.')
|
help='mark the module as a test.')
|
||||||
parser.add_argument('--cache_dir', dest='cache_dir',
|
parser.add_argument('--cache_dir', dest='cache_dir',
|
||||||
help='directory to use for cached file.')
|
help='directory to use for cached file.')
|
||||||
|
parser.add_argument('--root_dir', dest='root_dir',
|
||||||
|
help='directory to use for root dir.')
|
||||||
group = parser.add_argument_group('check arguments', 'later arguments override earlier ones.')
|
group = parser.add_argument_group('check arguments', 'later arguments override earlier ones.')
|
||||||
group.add_argument('--fatal_check', dest='checks', action=check_action('fatal'), default=[],
|
group.add_argument('--fatal_check', dest='checks', action=check_action('fatal'), default=[],
|
||||||
help='treat a lint issue as a fatal error.')
|
help='treat a lint issue as a fatal error.')
|
||||||
@@ -162,6 +164,8 @@ def write_project_xml(f, args):
|
|||||||
|
|
||||||
f.write("<?xml version='1.0' encoding='utf-8'?>\n")
|
f.write("<?xml version='1.0' encoding='utf-8'?>\n")
|
||||||
f.write("<project>\n")
|
f.write("<project>\n")
|
||||||
|
if args.root_dir:
|
||||||
|
f.write(" <root dir='%s' />\n" % args.root_dir)
|
||||||
f.write(" <module name='%s' android='true' %sdesugar='full' >\n" % (args.name, "library='true' " if args.library else ""))
|
f.write(" <module name='%s' android='true' %sdesugar='full' >\n" % (args.name, "library='true' " if args.library else ""))
|
||||||
if args.manifest:
|
if args.manifest:
|
||||||
f.write(" <manifest file='%s' %s/>\n" % (args.manifest, test_attr))
|
f.write(" <manifest file='%s' %s/>\n" % (args.manifest, test_attr))
|
||||||
|
Reference in New Issue
Block a user