File tree Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -211,22 +211,28 @@ def compileTask(libname: String, srcDirTask: SettingKey[File]) = Def.settings(
211
211
Process (command, cwd) ! log
212
212
}
213
213
214
- val opaths = cpaths.map { cpath =>
215
- val opath = abs(cwd / s " ${cpath.getName}.o " )
216
- val command = Seq (clangPath) ++ compileOptions ++ Seq (" -c" ,
217
- abs(cpath),
218
- " -o" ,
219
- opath)
220
-
221
- if (run(command) != 0 ) {
222
- sys.error(s " Failed to compile $cpath" )
223
- }
224
- opath
214
+ val opaths = cpaths.map {
215
+ cpath =>
216
+ val opath = cwd / s " ${cpath.getName}.o "
217
+ val command = Seq (clangPath) ++ compileOptions ++ Seq (" -c" ,
218
+ abs(cpath),
219
+ " -o" ,
220
+ abs(opath))
221
+ val doCompile =
222
+ ! opath.exists() || cpath.lastModified() >= opath.lastModified()
223
+
224
+ if (doCompile && run(command) != 0 ) {
225
+ sys.error(s " Failed to compile $cpath" )
226
+ }
227
+ opath
225
228
}
226
229
227
230
val archivePath = cwd / s " lib $libname.a "
228
- val archive = Seq (" ar" , " cr" , abs(archivePath)) ++ opaths
229
- if (run(archive) != 0 ) {
231
+ val archive = Seq (" ar" , " cr" , abs(archivePath)) ++ opaths.map(abs)
232
+ val doArchive =
233
+ opaths.map(_.lastModified).max >= archivePath.lastModified()
234
+
235
+ if (doArchive && run(archive) != 0 ) {
230
236
sys.error(s " Failed to create archive $archivePath" )
231
237
}
232
238
You can’t perform that action at this time.
0 commit comments