diff options
| author | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:26:21 -0500 |
|---|---|---|
| committer | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:26:21 -0500 |
| commit | 278dd9b39c5a3de6320e17d3dd1d10bf447bcc49 (patch) | |
| tree | 333c700c958401ad1ef3446d93eee54dac639cfa /tools/dependency_mapper/src/com/android/dependencymapper/JavaSourceAnalyzer.java | |
| parent | 9b9f43f3305e3304678676813d1fd5945a5f40bf (diff) | |
| parent | 00fcf469ba572bbce3f7c81fb346cccdbfa04219 (diff) | |
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build: (415 commits)
Exclude perf-setup-sh from userdebug builds
Reapply "Drop legacy vboot support."
Revert "build: Enable super image build rules depending on single super block device"
Version bump to BP3A.250905.014 [core/build_id.mk]
Version bump to BP3A.250905.013 [core/build_id.mk]
Version bump to BP3A.250905.012 [core/build_id.mk]
Version bump to BP3A.250905.011 [core/build_id.mk]
Version bump to BP3A.250905.007.W1 [core/build_id.mk]
Version bump to BP3A.250905.005.X5 [core/build_id.mk]
Add apexd.mainline_patch_level_2 to PRODUCT_PACKAGES
Version bump to BP3A.250905.009 [core/build_id.mk]
Version bump to BP3A.250905.008 [core/build_id.mk]
Version bump to BP3A.250905.005.X4 [core/build_id.mk]
Version bump to BP3A.250905.005.Y1 [core/build_id.mk]
Version bump to BP3A.250905.007 [core/build_id.mk]
Version bump to BP3A.250905.005.X3 [core/build_id.mk]
Version bump to BP3A.250905.005.X2 [core/build_id.mk]
Version bump to BP3A.250905.005.X1 [core/build_id.mk]
Version bump to BP3A.250905.006 [core/build_id.mk]
Version bump to BP3A.250905.005 [core/build_id.mk]
...
Change-Id: I84161b0f013eb40002a433053b9383240274e9ea
Diffstat (limited to 'tools/dependency_mapper/src/com/android/dependencymapper/JavaSourceAnalyzer.java')
| -rw-r--r-- | tools/dependency_mapper/src/com/android/dependencymapper/JavaSourceAnalyzer.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tools/dependency_mapper/src/com/android/dependencymapper/JavaSourceAnalyzer.java b/tools/dependency_mapper/src/com/android/dependencymapper/JavaSourceAnalyzer.java index 3a4efadd77..4bb69a0790 100644 --- a/tools/dependency_mapper/src/com/android/dependencymapper/JavaSourceAnalyzer.java +++ b/tools/dependency_mapper/src/com/android/dependencymapper/JavaSourceAnalyzer.java @@ -19,7 +19,6 @@ import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -33,19 +32,29 @@ public class JavaSourceAnalyzer { // Regex that matches against "package abc.xyz.lmn;" declarations in a java file. private static final String PACKAGE_REGEX = "^package\\s+([a-zA-Z_][a-zA-Z0-9_.]*);"; + // Match either a single-quoted string, OR a sequence of non-whitespace characters. + private static final String FILE_PATH_REGEX = "'([^']*)'|(\\S+)"; public static List<JavaSourceData> analyze(Path srcRspFile) { List<JavaSourceData> javaSourceDataList = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(srcRspFile.toFile()))) { String line; while ((line = reader.readLine()) != null) { - // Split the line by spaces, tabs, multiple java files can be on a single line. - String[] files = line.trim().split("\\s+"); + List<String> files = new ArrayList<>(); + Pattern pattern = Pattern.compile(FILE_PATH_REGEX); + Matcher matcher = pattern.matcher(line); + while (matcher.find()) { + if (matcher.group(1) != null) { + // Group 1: Single-quoted string (without the quotes) + files.add(matcher.group(1)); + } else { + // Group 2: Non-whitespace sequence + files.add(matcher.group(2)); + } + } for (String file : files) { - Path p = Paths.get("", file); - System.out.println(p.toAbsolutePath().toString()); - javaSourceDataList - .add(new JavaSourceData(file, constructPackagePrependedFileName(file))); + javaSourceDataList.add(new JavaSourceData(file, + constructPackagePrependedFileName(file))); } } } catch (IOException e) { |
