Skip to content

Commit

Permalink
check for out-of-date build-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Feb 5, 2020
1 parent 10dfcb9 commit 0c55845
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/reference/core-builtin.md
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ Displays the arguments *args*.
a, b := string
```

Returns true if file *a* is newer than *b*. Both files must exist.
Returns true if file *a* is newer than *b* by modification-time. Both files must exist.

### create-directory*
``` scheme
Expand Down
5 changes: 4 additions & 1 deletion src/std/build-script.ss
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
prefix: @prefix
@build-spec)))
([]
(unless (file-exists? "build-deps")
(unless (and (file-exists? "build-deps")
(file-newer? "build-deps" +this-source-file+)
(andmap (lambda (f) (file-newer? "build-deps" f))
(buildspec-depfiles @build-spec)))
(displayln "... make deps")
(main "deps"))
(displayln "... compile")
Expand Down
12 changes: 11 additions & 1 deletion src/std/make.ss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"sort"
"sugar")
(export make make-depgraph make-depgraph/spec
buildspec-depfiles
shell-config
env-cppflags
env-ldflags
Expand Down Expand Up @@ -173,6 +174,7 @@
(sort-deps bset)
(lp (append bset new) new)))))

;; make-depgraph : (listof file) -> depgraph
(def (make-depgraph files)
(def (symbol<? a b)
(string<? (symbol->string a) (symbol->string b)))
Expand Down Expand Up @@ -204,7 +206,13 @@
[file (expander-context-id mod) (sort (hash-keys ht) symbol<?) ...])))))
(map depgraph files))

;; make-depgraph/spec : buildspec -> depgraph
(def (make-depgraph/spec spec)
(make-depgraph (buildspec-depfiles spec)))

;; buildspec-depfiles : buildspec -> (listof file)
;; Produces the list of files with deps relevant for making a depgraph
(def (buildspec-depfiles spec)
(def (file-e mod ext)
(if (string-empty? (path-extension mod))
(string-append mod ext)
Expand All @@ -225,9 +233,11 @@
([ssi: mod . opts]
(lp rest (cons (file-e mod ".ssi") files)))
(else
; otherwise it's static-include: or copy:, no deps,
; not relevant for making a depgraph
(lp rest files))))
(else
(make-depgraph (reverse files))))))
(reverse files)))))

(def (shell-config cmd . args)
(let* ((proc (open-input-process [path: cmd arguments: args]))
Expand Down

0 comments on commit 0c55845

Please sign in to comment.