diff --git a/syndicate-examples/.gitignore b/syndicate-examples/.gitignore new file mode 100644 index 0000000..c75f615 --- /dev/null +++ b/syndicate-examples/.gitignore @@ -0,0 +1 @@ +schemas/ diff --git a/syndicate-examples/chat.rkt b/syndicate-examples/chat.rkt index 3058975..7ce1e88 100644 --- a/syndicate-examples/chat.rkt +++ b/syndicate-examples/chat.rkt @@ -7,7 +7,7 @@ (require syndicate/distributed/tcp) (require syndicate/driver-support) (require syndicate/gensym) - (require syndicate/schemas/simpleChatProtocol) + (require "schemas/simpleChatProtocol.rkt") (require syndicate/sturdy) (require (only-in file/sha1 hex-string->bytes)) diff --git a/syndicate-examples/info.rkt b/syndicate-examples/info.rkt index 46ce2bd..49aef01 100644 --- a/syndicate-examples/info.rkt +++ b/syndicate-examples/info.rkt @@ -26,3 +26,5 @@ )) ;; (define build-deps '("rackunit-lib")) + +(define pre-install-collection "private/install.rkt") diff --git a/syndicate-examples/private/install.rkt b/syndicate-examples/private/install.rkt new file mode 100644 index 0000000..25da276 --- /dev/null +++ b/syndicate-examples/private/install.rkt @@ -0,0 +1,26 @@ +#lang racket/base +;;; SPDX-License-Identifier: LGPL-3.0-or-later +;;; SPDX-FileCopyrightText: Copyright © 2021-2023 Tony Garnock-Jones + +(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 syndicate/schema-compiler schema-compiler-plugin)) + +(define (pre-installer _collects-path our-path) + (define output-directory (build-path our-path "schemas")) + (delete-directory/files output-directory #:must-exist? #f) + (batch-compile #:inputs (list (build-path our-path "private/schemas/**.prs")) + #:output-directory output-directory + #:plugins (list schema-compiler-plugin))) + +(define-runtime-path our-path "..") +(define (regenerate!) + (void (pre-installer 'not-bothering-to-figure-this-out-since-we-do-not-need-it + our-path))) + +(module+ main + (regenerate!)) diff --git a/syndicate-examples/private/schemas/simpleChatProtocol.prs b/syndicate-examples/private/schemas/simpleChatProtocol.prs new file mode 100644 index 0000000..997901d --- /dev/null +++ b/syndicate-examples/private/schemas/simpleChatProtocol.prs @@ -0,0 +1,4 @@ +version 1 . + +Present = . +Says = .