@@ -103,14 +103,23 @@ function is_changed(dependinfo, opt)
103
103
end
104
104
105
105
-- check whether the dependent files are changed
106
+ local timecache = opt .timecache
106
107
local lastmtime = opt .lastmtime or 0
107
108
_g .files_mtime = _g .files_mtime or {}
108
109
local files_mtime = _g .files_mtime
109
110
for _ , file in ipairs (files ) do
110
111
111
112
-- get and cache the file mtime
112
- local mtime = files_mtime [file ] or os .mtime (file )
113
- files_mtime [file ] = mtime
113
+ local mtime
114
+ if timecache then
115
+ mtime = files_mtime [file ]
116
+ if mtime == nil then
117
+ mtime = os .mtime (file )
118
+ files_mtime [file ] = mtime
119
+ end
120
+ else
121
+ mtime = os .mtime (file )
122
+ end
114
123
115
124
-- source and header files have been changed or not exists?
116
125
if mtime == 0 or mtime > lastmtime then
186
195
-- files = {sourcefile, ...}})
187
196
--
188
197
function on_changed (callback , opt )
189
-
190
- -- init option
191
198
opt = opt or {}
192
199
193
200
-- dry run? we only do callback directly and do not change any status
@@ -209,7 +216,10 @@ function on_changed(callback, opt)
209
216
210
217
-- @note we use mtime(dependfile) instead of mtime(objectfile) to ensure the object file is is fully compiled.
211
218
-- @see https://github.com/xmake-io/xmake/issues/748
212
- if not is_changed (dependinfo , {lastmtime = opt .lastmtime or os .mtime (dependfile ), values = opt .values , files = opt .files }) then
219
+ if not is_changed (dependinfo , {
220
+ timecache = opt .timecache ,
221
+ lastmtime = opt .lastmtime or os .mtime (dependfile ),
222
+ values = opt .values , files = opt .files }) then
213
223
return
214
224
end
215
225
0 commit comments