@@ -111,6 +111,7 @@ fun updatePackageFiles(
111
111
name: ?String,
112
112
pkg: InputPackageFiles,
113
113
get_file_contents: String ~> String,
114
+ make_input_source_path: (String, String) ~> String,
114
115
): void {
115
116
(modified_files, removed_files) = packageDir.unsafeMaybeGet(
116
117
context,
@@ -122,14 +123,14 @@ fun updatePackageFiles(
122
123
for ((pkg_base_dir, src_path) in modified_files) {
123
124
fileDir.writeArray(
124
125
context,
125
- InputSource(name, Path.join (pkg_base_dir, src_path)),
126
+ InputSource(name, make_input_source_path (pkg_base_dir, src_path)),
126
127
Array[SKStore.StringFile(get_file_contents(src_path))],
127
128
)
128
129
};
129
130
for ((pkg_base_dir, src_path) in removed_files) {
130
131
fileDir.writeArray(
131
132
context,
132
- InputSource(name, Path.join (pkg_base_dir, src_path)),
133
+ InputSource(name, make_input_source_path (pkg_base_dir, src_path)),
133
134
Array[SKStore.StringFile("")],
134
135
)
135
136
};
@@ -141,6 +142,7 @@ fun writeFiles(
141
142
file_names: Array<String>,
142
143
dependencies: Map<String, (String, Sklib.Metadata)>,
143
144
lib_name_opt: ?String,
145
+ make_input_source_path: (String, String) ~> String,
144
146
): void {
145
147
// TODO: If `lib_name_opt` is `Some(_)`, ensure there is a
146
148
// `Skargo.toml` in the cwd.
@@ -153,9 +155,15 @@ fun writeFiles(
153
155
.map(fn -> (fn, FileSystem.getLastModificationTime(fn)))
154
156
.collect(Array),
155
157
);
156
- updatePackageFiles(context, lib_name_opt, pkg, src ~> {
157
- FileSystem.readTextFile(src)
158
- })
158
+ updatePackageFiles(
159
+ context,
160
+ lib_name_opt,
161
+ pkg,
162
+ src ~> {
163
+ FileSystem.readTextFile(src)
164
+ },
165
+ make_input_source_path,
166
+ )
159
167
};
160
168
161
169
// For each (transitive) dependency, invalidate files that were
@@ -172,14 +180,26 @@ fun writeFiles(
172
180
dep_meta.pkg_dir,
173
181
dep_meta.sources.map(s -> (s.i0, s.i1)).collect(Array),
174
182
);
175
- updatePackageFiles(context, Some(dep_name), pkg, src ~> {
176
- dep_meta.sources.find(f -> f.i0 == src).fromSome().i2
177
- })
183
+ updatePackageFiles(
184
+ context,
185
+ Some(dep_name),
186
+ pkg,
187
+ src ~> {
188
+ dep_meta.sources.find(f -> f.i0 == src).fromSome().i2
189
+ },
190
+ make_input_source_path,
191
+ )
178
192
};
179
193
180
194
if (lib_name_opt is Some _) {
181
195
// Invalidate non-package source files when building a package.
182
- updatePackageFiles(context, None(), InputPackageFiles("", Array[]), _ ~> "")
196
+ updatePackageFiles(
197
+ context,
198
+ None(),
199
+ InputPackageFiles("", Array[]),
200
+ _ ~> "",
201
+ make_input_source_path,
202
+ )
183
203
}
184
204
}
185
205
0 commit comments