syndicate-rkt/syndicate/private/install.rkt

31 lines
1.2 KiB
Racket

#lang racket/base
;;; SPDX-License-Identifier: LGPL-3.0-or-later
;;; SPDX-FileCopyrightText: Copyright © 2021-2022 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
(provide pre-installer)
(require racket/runtime-path)
(require preserves-schema/bin/preserves-schema-rkt)
(require (only-in racket/file delete-directory/files))
(require (only-in "../schema-compiler.rkt"
schema-compiler-plugin
schema-compiler-plugin-mode))
(define (pre-installer _collects-path syndicate-path)
(define output-directory (build-path syndicate-path "schemas"))
(delete-directory/files output-directory #:must-exist? #f)
(parameterize ((schema-compiler-plugin-mode 'meta))
(batch-compile #:inputs (list (build-path syndicate-path "../protocols/schemas/**.prs"))
#:additional-modules (hash '(EntityRef) 'syndicate/entity-ref)
#:output-directory output-directory
#:plugins (list schema-compiler-plugin))))
(define-runtime-path syndicate-path "..")
(define (regenerate!)
(void (pre-installer 'not-bothering-to-figure-this-out-since-we-do-not-need-it
syndicate-path)))
(module+ main
(regenerate!))