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

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

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