Revert "Revert "use fasl & post-installer""

This reverts commit 93c0f4e527.
main
Matthew Butterick 5 years ago
parent 93c0f4e527
commit 2fddd8d7f4

@ -1,3 +1,4 @@
#lang info
(define scribblings '(("scribblings/hyphenate.scrbl" ())))
(define compile-omit-paths '("tests.rkt"))
(define post-install-collection "post-installer.rkt")

@ -0,0 +1,8 @@
#lang racket/base
(provide (all-defined-out))
(define (post-installer home-dir)
(for ([mod '(hyphenate/us hyphenate/fr)])
(displayln (format "running post-installer in ~a" mod))
(define proc (dynamic-require mod 'post-installer))
(proc home-dir)))

@ -4,6 +4,7 @@
sugar/define
racket/contract
racket/file
racket/fasl
(only-in xml xexpr/c)
(prefix-in core: hyphenate/private/core))
@ -51,8 +52,8 @@
(unless (and (file-exists? cache-path)
(> (file-or-directory-modify-seconds cache-path)
(file-or-directory-modify-seconds module-path)))
(write-to-file (dynamic-require module-path id-sym) cache-path #:exists 'replace))
(file->value cache-path))
(s-exp->fasl (dynamic-require module-path id-sym) (open-output-file cache-path #:exists 'replace)))
(fasl->s-exp (open-input-file cache-path)))
(define-syntax (mb stx)
(syntax-case stx ()
@ -67,12 +68,15 @@
[PATTERNS-ID 'patterns]
[EXCEPTIONS-ID 'exceptions])
#'(#%module-begin
(define PATTERNS-ID (load-from-cache-if-possible PATTERNS-PATH PATTERN-CACHE-PATH 'PATTERNS-ID))
;; a file-cached hash is immutable, so convert it
(define EXCEPTIONS-ID (make-hash (hash->list (load-from-cache-if-possible EXCEPTIONS-PATH EXCEPTIONS-CACHE-PATH 'EXCEPTIONS-ID))))
(define+provide+safe hyphenate
hyphenate/c
(make-hyphenate-function PATTERNS-ID EXCEPTIONS-ID))
(define+provide+safe unhyphenate
unhyphenate/c
(make-unhyphenate-function)))))]))
(define PATTERNS-ID (load-from-cache-if-possible PATTERNS-PATH PATTERN-CACHE-PATH 'PATTERNS-ID))
;; a file-cached hash is immutable, so convert it
(define EXCEPTIONS-ID (make-hash (hash->list (load-from-cache-if-possible EXCEPTIONS-PATH EXCEPTIONS-CACHE-PATH 'EXCEPTIONS-ID))))
(define+provide (post-installer home-dir)
(load-from-cache-if-possible PATTERNS-PATH PATTERN-CACHE-PATH 'PATTERNS-ID)
(load-from-cache-if-possible EXCEPTIONS-PATH EXCEPTIONS-CACHE-PATH 'EXCEPTIONS-ID))
(define+provide+safe hyphenate
hyphenate/c
(make-hyphenate-function PATTERNS-ID EXCEPTIONS-ID))
(define+provide+safe unhyphenate
unhyphenate/c
(make-unhyphenate-function)))))]))
Loading…
Cancel
Save