AIDEGen: Remove the srcjar handling from srcs section
Since the *.srcjar are removed from srcs section in
module_bp_java_deps.json by aosp/1125549, so AIDEGen doesn't need to
handle it on source locator.
Bug: 141528361
Test: 1. Patch aosp/1131512
2. Patch aosp/1133035
3. Patch aosp/1128936
4. Patch aosp/1130098
5. Patch this CL
6. m aidegen
7. aidegen-dev framework
8. Check on there is only 3 errors in both
ActivityManagerService.java and PackageManagerService.java.
Change-Id: I68a1b470f8e2337d493eec6c93312c2f244e521e
diff --git a/aidegen/lib/project_info_unittest.py b/aidegen/lib/project_info_unittest.py
index b1a0aa9..b6c08d4 100644
--- a/aidegen/lib/project_info_unittest.py
+++ b/aidegen/lib/project_info_unittest.py
@@ -135,9 +135,6 @@
generated_jar = ('out/soong/.intermediates/packages/apps/test/test/'
'android_common/generated.jar')
locate_module_info = dict(unittest_constants.MODULE_INFO)
- locate_module_info['srcs'].extend(
- [('out/soong/.intermediates/packages/apps/test/test/android_common/'
- 'gen/test.srcjar')])
locate_module_info['installed'] = [generated_jar]
mock_module_info.is_module.return_value = True
mock_module_info.get_paths.return_value = [
@@ -162,17 +159,6 @@
project_info_obj.locate_source()
self.assertEqual(project_info_obj.source_path['jar_path'], result_jar)
- # Test on jar exists.
- jar_abspath = os.path.join(test_root_path, generated_jar)
- result_jar = set([generated_jar])
- try:
- open(jar_abspath, 'w').close()
- project_info_obj.locate_source()
- self.assertEqual(project_info_obj.source_path['jar_path'],
- result_jar)
- finally:
- shutil.rmtree(test_root_path)
-
# Test collects source and test folders.
result_source = set(['packages/apps/test/src/main/java'])
result_test = set(['packages/apps/test/tests'])
@@ -181,13 +167,6 @@
self.assertEqual(project_info_obj.source_path['test_folder_path'],
result_test)
- # Test loading jar from dependencies parameter.
- default_jar = os.path.join(unittest_constants.MODULE_PATH, 'test.jar')
- locate_module_info['dependencies'] = [default_jar]
- result_jar = set([generated_jar, default_jar])
- project_info_obj.locate_source()
- self.assertEqual(project_info_obj.source_path['jar_path'], result_jar)
-
def test_separate_build_target(self):
"""Test separate_build_target."""
test_list = ['1', '22', '333', '4444', '55555', '1', '7777777']
diff --git a/aidegen/lib/source_locator.py b/aidegen/lib/source_locator.py
index 7d9844b..a5a6119 100644
--- a/aidegen/lib/source_locator.py
+++ b/aidegen/lib/source_locator.py
@@ -265,16 +265,14 @@
for src_item in self.module_data[constant.KEY_SRCS]:
src_dir = None
src_item = os.path.relpath(src_item)
- if src_item.endswith(_SRCJAR_EXT):
- self._append_jar_from_installed(self.specific_soong_path)
- elif common_util.is_target(src_item, _TARGET_FILES):
+ if common_util.is_target(src_item, _TARGET_FILES):
# Only scan one java file in each source directories.
src_item_dir = os.path.dirname(src_item)
if src_item_dir not in scanned_dirs:
scanned_dirs.add(src_item_dir)
src_dir = self._get_source_folder(src_item)
else:
- # To record what files except java and srcjar in the srcs.
+ # To record what files except java and kt in the srcs.
logging.debug('%s is not in parsing scope.', src_item)
if src_dir:
self._add_to_source_or_test_dirs(src_dir)
diff --git a/aidegen/lib/source_locator_unittest.py b/aidegen/lib/source_locator_unittest.py
index adbecec..c97c1e2 100644
--- a/aidegen/lib/source_locator_unittest.py
+++ b/aidegen/lib/source_locator_unittest.py
@@ -301,25 +301,6 @@
module_data.locate_sources_path()
self.assertEqual(module_data.jar_files, result_jar_list)
- # Test find jar by srcjar.
- module_info = dict(unittest_constants.MODULE_INFO)
- module_info['srcs'].extend(
- [('out/soong/.intermediates/packages/apps/test/test/android_common/'
- 'gen/test.srcjar')])
- module_info['installed'] = [
- ('out/soong/.intermediates/packages/apps/test/test/android_common/'
- 'test.jar')
- ]
- result_jar_list = set([
- jar_file,
- ('out/soong/.intermediates/packages/apps/test/test/'
- 'android_common/test.jar')
- ])
- module_data = source_locator.ModuleData(unittest_constants.TEST_MODULE,
- module_info, 0)
- module_data.locate_sources_path()
- self.assertEqual(module_data.jar_files, result_jar_list)
-
@mock.patch('aidegen.lib.common_util.get_android_root_dir')
def test_collect_jar_by_depth_value(self, mock_android_root_dir):
"""Test parameter --depth handling."""
diff --git a/aidegen/unittest_constants.py b/aidegen/unittest_constants.py
index e24d865..557d301 100644
--- a/aidegen/unittest_constants.py
+++ b/aidegen/unittest_constants.py
@@ -50,7 +50,6 @@
'srcs': [
'packages/apps/test/src/main/java/com/android/java.java',
'packages/apps/test/tests/com/android/test.java',
- 'packages/apps/test/tests/test.srcjar'
],
'dependencies': [],
'installed': []