Simple inspect tool using CodeInspector from the test library.
Change-Id: Ie977bda0018a9f304608a55d13047a2aaa90626b
diff --git a/tools/toolhelper.py b/tools/toolhelper.py
index 1e6ebfd..56cd5a7 100644
--- a/tools/toolhelper.py
+++ b/tools/toolhelper.py
@@ -2,6 +2,7 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
+import glob
import gradle
import os
import subprocess
@@ -31,6 +32,29 @@
utils.PrintCmd(cmd)
return subprocess.call(cmd)
+def run_in_tests(tool, args, build=None, debug=True, extra_args=None):
+ if build is None:
+ build, args = extract_build_from_args(args)
+ if build:
+ gradle.RunGradle([
+ 'copyMavenDeps',
+ 'compileTestJava',
+ ])
+ cmd = []
+ cmd.append('java')
+ if extra_args:
+ cmd.extend(extra_args)
+ if debug:
+ cmd.append('-ea')
+ cmd.extend(['-cp', ':'.join([
+ utils.BUILD_MAIN_DIR,
+ utils.BUILD_TEST_DIR,
+ ] + glob.glob('%s/*.jar' % utils.BUILD_DEPS_DIR))])
+ cmd.extend([tool])
+ cmd.extend(args)
+ utils.PrintCmd(cmd)
+ return subprocess.call(cmd)
+
def extract_build_from_args(input_args):
build = True
args = []