@@ -73,15 +73,22 @@ public static String escapeKey(String s) {
73
73
}
74
74
}
75
75
76
- public Label populateFile (File absoluteFile ) {
77
- String databasePath = transformer .fileAsDatabaseString (absoluteFile );
78
- // Ensure the rewritten path is used from now on.
79
- File normalisedFile = new File (databasePath );
80
- Label result = tw .getLabelFor ("@\" " + escapeKey (databasePath ) + ";sourcefile" + "\" " );
81
- KotlinExtractorDbSchemeKt .writeFiles (tw , result , databasePath );
82
- populateParents (normalisedFile , result );
83
- return result ;
84
- }
76
+ public Label populateFile (File absoluteFile ) {
77
+ return getFileLabel (absoluteFile , true );
78
+ }
79
+
80
+ public Label getFileLabel (File absoluteFile , boolean populateTables ) {
81
+ String databasePath = transformer .fileAsDatabaseString (absoluteFile );
82
+ Label result = tw .getLabelFor ("@\" " + escapeKey (databasePath ) + ";sourcefile" + "\" " );
83
+ // Ensure the rewritten path is used from now on.
84
+
85
+ if (populateTables ) {
86
+ KotlinExtractorDbSchemeKt .writeFiles (tw , result , databasePath );
87
+ populateParents (new File (databasePath ), result );
88
+ }
89
+
90
+ return result ;
91
+ }
85
92
86
93
private Label addFolderTuple (String databasePath ) {
87
94
Label result = tw .getLabelFor ("@\" " + escapeKey (databasePath ) + ";folder" + "\" " );
@@ -104,15 +111,22 @@ private void populateParents(File normalisedFile, Label label) {
104
111
KotlinExtractorDbSchemeKt .writeContainerparent (tw , parentLabel , label );
105
112
}
106
113
107
- public Label relativeFileId (File jarFile , String pathWithinJar ) {
114
+ public Label relativeFileId (File jarFile , String pathWithinJar ) {
115
+ return getFileInJarLabel (jarFile , pathWithinJar , true );
116
+ }
117
+
118
+ public Label getFileInJarLabel (File jarFile , String pathWithinJar , boolean populateTables ) {
108
119
if (pathWithinJar .contains ("\\ " ))
109
120
throw new CatastrophicError ("Invalid jar path: '" + pathWithinJar + "' should not contain '\\ '." );
110
121
122
+ String databasePath = transformer .fileAsDatabaseString (jarFile );
123
+ if (!populateTables )
124
+ return tw .getLabelFor ("@\" " + databasePath + "/" + pathWithinJar + ";jarFile\" " );
125
+
111
126
Label jarFileId = this .populateFile (jarFile );
112
- Label jarFileLocation = tw .getLocation (jarFileId ,0 , 0 , 0 , 0 );
113
- KotlinExtractorDbSchemeKt .writeHasLocation (tw , jarFileId , jarFileLocation );
127
+ Label jarFileLocation = tw .getLocation (jarFileId , 0 , 0 , 0 , 0 );
128
+ KotlinExtractorDbSchemeKt .writeHasLocation (tw , jarFileId , jarFileLocation );
114
129
115
- String databasePath = transformer .fileAsDatabaseString (jarFile );
116
130
StringBuilder fullName = new StringBuilder (databasePath );
117
131
String [] split = pathWithinJar .split ("/" );
118
132
Label current = jarFileId ;
0 commit comments