Create info collection for "info.rkt" files.

This commit is contained in:
Sam Tobin-Hochstadt 2013-07-04 15:17:26 -04:00
parent 0d60486a32
commit 14207682d3
34 changed files with 70 additions and 59 deletions

View File

@ -1,4 +1,4 @@
(module info setup/infotab
(module info info
(define name "DeinProgramm - QuickCheck")
(define compile-omit-files

View File

@ -219,10 +219,10 @@
Module Language: invalid language specification
Interactions disabled}
#t)
(test @t{#lang setup/infotab}
(test @t{#lang info}
#f
;; test the complete buffer, to make sure that there is no error
"\nInteractions disabled: setup/infotab does not support a REPL (no #%top-interaction)"
"\nInteractions disabled: info does not support a REPL (no #%top-interaction)"
#t)
;; test racket/load behavior

View File

@ -35,7 +35,7 @@
(define files
(list (list "info.rkt"
(retain-src
setup/infotab
info
(define drracket-tools (list (list "tool.rkt")))))
(list "tool.rkt"
(retain-src

View File

@ -172,7 +172,7 @@ DrRacket continues to start up, without the tool.
For example, if the @File{info.rkt} file in a collection
contains:
@racketmod[
setup/infotab
info
(define drracket-name "Tool Name")
(define drracket-tools (list (list "tool.rkt")))
]
@ -379,7 +379,7 @@ The lists must have the same length.
As an example, the @italic{Essentials of Programming Languages}
language specification's @File{info.rkt} used to look like this:
@racketmod[
setup/infotab
info
(require string-constants)
(define name "EoPL Support")
(define drscheme-language-modules

View File

@ -22,7 +22,7 @@ installed as sub-collections of the @filepath{games} collection (see
The game-starting console inspects the sub-collections of the
@filepath{games} collection. If a sub-collection has an
@filepath{info.rkt} module (see @racketmodname[setup/infotab]), the
@filepath{info.rkt} module (see @racketmodname[info]), the
following fields of the collection's @filepath{info.rkt} file are used:
@itemize[

View File

@ -337,7 +337,7 @@
(call-with-output-file*
(build-path pkg-dir "info.rkt")
(lambda (o)
(fprintf o "#lang setup/infotab\n")
(fprintf o "#lang info\n")
(write `(define deps ',deps) o)))))

View File

@ -550,8 +550,8 @@ select its name, @nonterm{package}:
Optionally, enter your directory and create a basic @filepath{info.rkt} file:
@commandline{cd @nonterm{package}}
@commandline{echo "#lang setup/infotab" > info.rkt}
@commandline{echo "(define deps (list))" >> info.rkt}
@commandline{echo "#lang info" > info.rkt}
@commandline{echo "(define deps (list \"base\"))" >> info.rkt}
The @filepath{info.rkt} file is not necessary for a
@tech{single-collection package} with no dependencies, but you may
@ -725,12 +725,12 @@ PLT curation.}
Package metadata, including dependencies on other packages, is reported
by an @filepath{info.rkt} module within the package. This module must be
implemented in the @racketmodname[setup/infotab] language.
implemented in the @racketmodname[info] language.
For example, a basic @filepath{info.rkt} file might be
@codeblock{
#lang setup/infotab
#lang info
(define version "1.0")
(define deps (list _package-source-string ...))
}

View File

@ -715,7 +715,7 @@ compiled during installation; it is a good idea to add it.
An example info.rkt file looks like this:
@racketmod[
setup/infotab
info
(define name "My Application")
(define blurb
'("My application runs 60% faster on 20% less peanut "

View File

@ -2,7 +2,7 @@
@(require scribble/manual
(for-label (except-in racket require)
setup/getinfo
(only-in setup/infotab require)))
(only-in info require)))
@(begin
(define-syntax-rule (define-racket-require id)
@ -13,7 +13,7 @@
@title[#:tag "info.rkt"]{@filepath{info.rkt} File Format}
@defmodulelang[setup/infotab]
@defmodulelang*[(info setup/infotab)]
In each collection, a special module file @filepath{info.rkt} provides
general information about a collection for use by various tools. For
@ -26,19 +26,22 @@ declaration has a highly constrained form. It must match the following
grammar of @racket[_info-module]:
@racketgrammar*[
#:literals (info lib setup/infotab quote quasiquote
#:literals (info lib info quote quasiquote
cons car cdr list list* reverse append
string-append path->string build-path
collection-path
system-library-subpath)
[info-module (module info intotab-mod-path
[info-module (module info info-mod-path
decl
...)]
[intotab-mod-path setup/infotab
(lib "setup/infotab.ss")
(lib "setup/infotab.rkt")
(lib "infotab.rkt" "setup")
(lib "infotab.ss" "setup")]
[info-mod-path info
setup/infotab
(lib "info/main.rkt")
(lib "setup/infotab.ss")
(lib "setup/infotab.rkt")
(lib "main.rkt" "info")
(lib "infotab.rkt" "setup")
(lib "infotab.ss" "setup")]
[decl (define id info-expr)]
[info-expr (quote datum)
(quasiquote datum)
@ -60,14 +63,15 @@ three info tags, @racket[name], @racket[gracket-launcher-libraries], and
@racket[gracket-launcher-names].
@racketmod[
setup/infotab
info
(define name "Games")
(define gracket-launcher-libraries '("main.rkt"))
(define gracket-launcher-names '("PLT Games"))
]
As illustrated in this example, an @filepath{info.rkt} file can use
@hash-lang[] notation, but only with the @racketmodname[setup/infotab]
language.
@hash-lang[] notation, but only with the @racketmodname[info] (or
@racketmodname[setup/infotab]) language.
See also @racket[get-info] from @racketmodname[setup/getinfo].

View File

@ -128,7 +128,7 @@ For example, the @filepath{info.rkt} file in the @filepath{sirmail} collection
might contain the following @racket[info] declaration:
@racketmod[
setup/infotab
info
(define name "SirMail")
(define mred-launcher-libraries (list "sirmail.rkt"))
(define mred-launcher-names (list "SirMail"))

View File

@ -12,8 +12,8 @@
setup/main-collects
setup/path-to-relative
setup/xref scribble/xref
;; setup/infotab -- no bindings from this are used
setup/getinfo
;; info -- no bindings from this are used
(only-in info)
setup/pack
setup/unpack
setup/link
@ -1109,7 +1109,7 @@ v
The @racket[get-info/full] function returns @racket[#f] if there is
no @filepath{info.rkt} (or @filepath{info.ss}) file in the directory. If there is a
@filepath{info.rkt} (or @filepath{info.ss}) file that has the wrong shape (i.e., not a module
using @racketmodname[setup/infotab] or @racket[(lib "infotab.rkt" "setup")]),
using @racketmodname[info] or @racketmodname[setup/infotab]),
or if the @filepath{info.rkt} file fails to load, then an exception
is raised. If the @filepath{info.rkt} file loaded, @racket[get-info/full]
returns the @racket[get-info] file. If the @filepath{info.rkt} file does not exist,

View File

@ -17,7 +17,7 @@
(call-with-output-file*
(build-path pkg-x-dir "info.rkt")
(lambda (o)
(displayln "#lang setup/infotab" o)
(displayln "#lang info" o)
(write `(define deps '(("pkg-x-windows" #:platform windows)
("pkg-x-unix" #:platform unix)
("pkg-x-macosx" #:platform macosx)

View File

@ -203,7 +203,7 @@ using 'system' to call out to the tool and then reading its results, etc.
(define files
'(("info.rkt"
#<<--
#lang setup/infotab
#lang info
(define name "the-name")
(define blurb

View File

@ -7,7 +7,7 @@
(define files
'(("info.rkt"
#<<--
#lang setup/infotab
#lang info
(define name "planet-docs-test")
(define scribblings '(("docs.scrbl")))

View File

@ -182,14 +182,14 @@
(with-output-to-file (build-path c1-dir "info.rkt")
(lambda ()
(printf "#lang setup/infotab\n(define compile-omit-paths '(\"b1.rkt\"))\n")))
(printf "#lang info\n(define compile-omit-paths '(\"b1.rkt\"))\n")))
(with-output-to-file (build-path c1-dir "b1.rkt")
(lambda ()
(printf "#lang racket/base\n'b1\n")))
(with-output-to-file (build-path another-c1-dir "info.rkt")
(lambda ()
(printf "#lang setup/infotab\n(define compile-omit-paths '(\"b2.rkt\"))\n")))
(printf "#lang info\n(define compile-omit-paths '(\"b2.rkt\"))\n")))
(with-output-to-file (build-path another-c1-dir "b2.rkt")
(lambda ()
(printf "#lang racket/base\n'b2\n")))

View File

@ -56,7 +56,7 @@ To document a collection or @|PLaneT| package:
here's a suitable complete module:
@racketmod[
setup/infotab
info
(define scribblings '(("manual.scrbl" ())))
]}

View File

@ -1,3 +1 @@
#lang setup/infotab
(define compile-omit-files '("tests"))
#lang info

View File

@ -1,3 +1,3 @@
#lang setup/infotab
#lang info
(define compile-omit-paths '("examples"))

View File

@ -1,3 +1,3 @@
#lang setup/infotab
#lang info
(define compile-omit-files '("tests"))

View File

@ -0,0 +1,4 @@
#lang racket/base
(require setup/infotab)
(provide (all-from-out setup/infotab))
(module reader syntax/module-reader setup/infotab)

View File

@ -1,3 +1,3 @@
#lang setup/infotab
#lang info
(define compile-omit-paths '("tests"))

View File

@ -1,4 +1,4 @@
#lang setup/infotab
#lang info
;; in OSX the starter app is a directory
(define compile-omit-paths '("Starter.app"))

View File

@ -1,4 +1,4 @@
#lang setup/infotab
#lang info
(define raco-commands
'(("pkg" pkg/raco "manage packages" 81)))

View File

@ -147,8 +147,8 @@
#f)])
(parameterize ([current-namespace metadata-ns])
;; with compiled files on:
(dynamic-require 'setup/infotab/lang/reader #f)
(dynamic-require 'setup/infotab 0))
(dynamic-require '(submod info reader) #f)
(dynamic-require 'info 0))
;; without compiled files:
(parameterize ([use-compiled-file-paths '()])
(get-info/full pkg-dir #:namespace metadata-ns))))

View File

@ -197,8 +197,8 @@
;; convert:
(define new-content
(match content
[`(module info setup/infotab (#%module-begin . ,defns))
`(module info setup/infotab
[`(module info info (#%module-begin . ,defns))
`(module info info
(#%module-begin
(define assume-virtual-sources '())
. ,(filter values

View File

@ -1,4 +1,4 @@
#lang setup/infotab
#lang info
(define name "PLaneT")

View File

@ -1,4 +1,4 @@
#lang setup/infotab
#lang info
(define release-notes '(("Racket core" "HISTORY.txt"
-100

View File

@ -1,3 +1,3 @@
#lang setup/infotab
#lang info
(define compile-omit-paths '("examples"))

View File

@ -1,3 +1,3 @@
#lang setup/infotab
#lang info
(define compile-omit-paths '("shared-body.rkt"))

View File

@ -1,4 +1,4 @@
#lang setup/infotab
#lang info
(define compile-omit-paths '("main.rkt"))

View File

@ -27,7 +27,8 @@
;; Another would be to force all info files to use `#lang' which means
;; that we'll be able to query their module-language via the
;; `get-info' protocol.
(require (prefix-in !!!HACK!!! setup/infotab/lang/reader))
(require (prefix-in !!!HACK!!! setup/infotab/lang/reader)
(prefix-in !!!HACK!!!2 (submod info reader)))
;; get-info/full : path -> info/#f
(define (get-info/full dir #:namespace [ns #f])
@ -43,7 +44,9 @@
(parameterize ([current-reader-guard
(lambda (x)
(if (or (eq? x 'setup/infotab/lang/reader)
(equal? x '(submod setup/infotab reader)))
(eq? x 'info/lang/reader)
(equal? x '(submod setup/infotab reader))
(equal? x '(submod info reader)))
x
(err "has illegal #lang or #reader")))])
(with-input-from-file file
@ -59,7 +62,9 @@
'(lib "infotab.ss" "setup")
'(lib "setup/infotab.rkt")
'(lib "setup/infotab.ss")
'setup/infotab)
'(lib "main.rkt" "info")
'setup/infotab
'info)
expr ...)
;; No need to set a reader-guard, since we checked it
;; above (a guard will see other uses of #lang for stuff

View File

@ -1,4 +1,4 @@
#lang setup/infotab
#lang info
(define compile-omit-paths '("main.rkt"))

View File

@ -340,7 +340,7 @@
(call-with-output-file*
info-path
(lambda (o)
(displayln "#lang setup/infotab" o))))
(displayln "#lang info" o))))
(define stx (call-with-input-file*
info-path
(lambda (i)

View File

@ -94,8 +94,8 @@
(define (get-pkg-info pkg-dir)
(parameterize ([current-namespace metadata-ns])
;; with compiled files on:
(dynamic-require 'setup/infotab/lang/reader #f)
(dynamic-require 'setup/infotab 0))
(dynamic-require '(submod info reader) #f)
(dynamic-require 'info 0))
;; without compiled files:
(parameterize ([use-compiled-file-paths '()])
(get-info/full pkg-dir #:namespace metadata-ns)))