Skip to content

Commit

Permalink
Fix faulty docker build in filtersets (#20)
Browse files Browse the repository at this point in the history
* Revert "Revert "Add filterset (#19)""

This reverts commit 81f1a13.

* fix Dockerfile
  • Loading branch information
arvyy authored Jul 10, 2022
1 parent 81f1a13 commit 31e9d4c
Show file tree
Hide file tree
Showing 35 changed files with 1,584 additions and 1,019 deletions.
93 changes: 41 additions & 52 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:toc: left

Scheme index is a tool for indexing and searching through procedures and syntax from R7RS-small, R7RS-large, select SRFI libraries.
The index may be used through a site (https://index.scheme.org), through REST API, or through stdio API.
The index may be used through a site (https://index.scheme.org) or through REST API.

== Userguide for site visitors

Expand Down Expand Up @@ -80,6 +80,8 @@ Build processes requires executables on path:

* `asciidoctor` - Asciidoctor documentation compiler

* `sass` - SCSS compiler

You can build scheme index by running `ant` from the root of the source directory.

After the build successfully completes, you should find everything scheme index needs in `dist` directory.
Expand Down Expand Up @@ -162,10 +164,6 @@ The following is exhaustive list of valid properties
| Solr core to use
| "scmindex"

| enable-web
| Whether enable web ui and REST api
| #t

| port
| Which port to use. Relevant only if enable-web is `#t`
| 8080
Expand All @@ -178,13 +176,17 @@ The following is exhaustive list of valid properties
| Whether application should serve static resources from ./static folder. Use `#f` if you have some other web server (eg nginx in front) serving the content.
| #t

| enable-repl
| Whether to enable stdio repl api
| #f

| spec-index
| Index of definitions to load (see Types definitions section)
| "./types/index.scm"

| filterset-index
| Index of filtersets to load (see Filterset definitions section)
| "filters/index.scm"

| sqlite-data
| File to use for sqlite data
| "sqlitedb"
|===

=== Types definitions
Expand Down Expand Up @@ -275,6 +277,15 @@ Second argument is parameter type definition, as described under functions. This

|===

=== Filterset definitions

Filterset is a coarse filter, and defines which libraries to include (and optionally how to rename them). Filterset definitions are structured into files one for each filterset option, and a single root index file which defines names and paths to those files.

The index file is specified in configuration under `filterset-index` property, with a default value "./filters/index.scm".

Index should be a list of pairs - where `car` is a string corresponding to filterset name, and `cdr` is the file to load its definitions from.

Filterset definition file should be a list of pairs. `car` is a symbolic library name (matching what is defined in index for types definitions). `cdr` is either a symbolic library name (in which case, all the usages of library in `car` are renamed to what is in `cdr`), or a `#t` value (indicating to include library in `car` as is, without a rename).

=== Logging

Expand All @@ -293,9 +304,24 @@ All of the following endpoints accept `wt` query parameter.
If the parameter's value is `sexpr`, the results are returned as if with `write`, using scheme-json convention
as defined in srfi 180. Otherwise, results are returned as json.

=== `/rest/filterset`

List of filtersets as strings. For all endpoints below, `{filterset name}` must correspond to one of the values returned here.

JSON schema
[source,json]
----
{
"type": "array",
"items": {
"type": "string"
}
}
----

'''

=== `/rest/libs`
=== `/rest/filterset/{filterset name}/libs`

Libraries found in index as strings.

Expand All @@ -312,7 +338,7 @@ JSON schema

'''

=== `/rest/tags`
=== `/rest/filterset/{filterset name}/tags`

Tags found in index as strings.

Expand All @@ -329,7 +355,7 @@ JSON schema

'''

=== `/rest/returns`
=== `/rest/filterset/{filterset name}/returns`

Types, which were used as a return type, found in index as strings.

Expand All @@ -346,7 +372,7 @@ JSON schema

'''

=== `/rest/params`
=== `/rest/filterset/{filterset name}/params`

Types, which were used as a parameter type, found in index as strings.

Expand All @@ -363,7 +389,7 @@ JSON schema

'''

=== `/rest/parameterized`
=== `/rest/filterset/{filterset name}/parameterized`

Dynamic parameters (ie., ones created with `make-parameter`) that affect procedures in the index.

Expand All @@ -380,7 +406,7 @@ JSON schema

'''

=== `/rest/search`
=== `/rest/filterset/{filterset name}/search`

Returns found identifiers and faceting meta data.

Expand Down Expand Up @@ -502,40 +528,3 @@ JSON schema
}
}
----

== STDIO API

When enabled (see <<Configuration>>), program starts a repl, reading request from standard input, and returning response in standard output. The exchange is very similar to REST api, just through different medium. Therefore this section only describes how to call it, for the response format see REST description.

Each call should be a list, where a `car` denotes the endpoint. Possible endpoint values: `tags`, `params`, `returns`, `libs`, `parameterized`, `search`. First 5 endpoints do not take any parameters, therefore the call consists of a list of single element. `search` endpoint takes parameters by reading from alist in `cdr` position of the request list. Possible parameters : `start`, `rows`, `query`, `libs`, `param-types`, `return-types`, `tags`, `filter-param-loose?`, `parameterized`.

The response scheme object denoting json (in accordance with srfi 180), returned as if with `write`. In case of an error, a list will be returned in a form of `(error <cause>)`.

Some examples

[source, scheme]
----
; request
(libs)
; response
#("(scheme base)")
----

[source, scheme]
----
; request
(search (rows . 1) (tags pure))
; response
((items . #(...)) (total . 2000) (libs . #(...)))
----

[source, scheme]
----
; request
(foo)
; response
(error "#<ERROR unknown request endpoint>")
----
11 changes: 10 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@
</exec>
</target>

<target name="dist" depends="compile-jar, compile-doc">
<target name="compile-css" depends="prepare_unix, prepare_windows">
<exec dir="." executable="${exec}">
<arg line="${args} 'sass src/main/scss/main.scss static/css/scmindex.css'"/>
</exec>
</target>

<target name="dist" depends="compile-jar, compile-doc, compile-css">
<delete dir="dist" failonerror="false"/>
<mkdir dir="dist"/>
<copy todir="dist/solrhome">
Expand All @@ -54,6 +60,9 @@
<copy todir="dist/types">
<fileset dir="types"/>
</copy>
<copy todir="dist/filters">
<fileset dir="filters"/>
</copy>
<copy todir="dist/templates">
<fileset dir="templates"/>
</copy>
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM maven:3.8-openjdk-11
RUN apt-get update && apt-get -y install ant asciidoctor
RUN apt-get update && apt-get -y install ant asciidoctor npm
RUN npm install -g sass
WORKDIR /app
COPY kawa-web-collection kawa-web-collection
WORKDIR /app/kawa-web-collection
Expand Down
71 changes: 71 additions & 0 deletions filters/chibi.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
(
;; r7rs small
((scheme base) . #t)
((scheme case-lambda) . #t)
((scheme complex) . #t)
((scheme char) . #t)
((scheme cxr) . #t)
((scheme eval) . #t)
((scheme file) . #t)
((scheme inexact) . #t)
((scheme lazy) . #t)
((scheme load) . #t)
((scheme process-context) . #t)
((scheme read) . #t)
((scheme repl) . #t)
((scheme time) . #t)
((scheme write) . #t)

; r7rs large red
((scheme box) . #t)
((scheme comparator) . #t)
((scheme charset) . #t)
((scheme ephemeron) . #t)
((scheme generator) . #t)
((scheme hash-table) . #t)
((scheme ideque) . #t)
((scheme ilist) . #t)
((scheme list) . #t)
((scheme list-queue) . #t)
((scheme lseq) . #t)
((scheme rlist) . #t)
((scheme set) . #t)
((scheme stream) . #t)
((scheme sort) . #t)
((scheme text) . #t)
((scheme vector) . #t)

; r7rs large tangerine
((scheme bitwise) . #t)
((scheme bytevector) . #t)
((scheme division) . #t)
((scheme fixnum) . #t)
((scheme flonum) . #t)
((scheme mapping) . #t)
((scheme mapping hash) . #t)
((scheme regex) . #t)
((scheme show) . #t)
((scheme vector base) . #t)
((scheme vector u8) . #t)
((scheme vector s8) . #t)
((scheme vector u16) . #t)
((scheme vector s16) . #t)
((scheme vector u32) . #t)
((scheme vector s32) . #t)
((scheme vector u64) . #t)
((scheme vector s64) . #t)
((scheme vector f32) . #t)
((scheme vector f64) . #t)
((scheme vector c64) . #t)
((scheme vector c128) . #t)

;; misc srfi, added in order of popularity according to https://misc.lassi.io/2019/srfi-implementation-counts.scm
;; omitting anything added to r7rs small / large
((srfi 8) . #t)
((srfi 2) . #t)
((srfi 27) . #t)
((srfi 26) . #t)
((srfi 38) . #t)
((srfi 18) . #t)

)
7 changes: 7 additions & 0 deletions filters/index.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(
("R7RS small" . "filters/r7rs-small.scm")
("R7RS large" . "filters/r7rs-large.scm")
("R7RS large + SRFIs" . "filters/portable.scm")
("Chibi" . "filters/chibi.scm")
("Kawa" . "filters/kawa.scm")
)
41 changes: 41 additions & 0 deletions filters/kawa.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(

;; r7rs small
((scheme base) . #t)
((scheme case-lambda) . #t)
((scheme complex) . #t)
((scheme char) . #t)
((scheme cxr) . #t)
((scheme eval) . #t)
((scheme file) . #t)
((scheme inexact) . #t)
((scheme lazy) . #t)
((scheme load) . #t)
((scheme process-context) . #t)
((scheme read) . #t)
((scheme repl) . #t)
((scheme time) . #t)
((scheme write) . #t)

; r7rs large red
((scheme charset) . (srfi 14))
((scheme list) . (srfi 1))
((scheme rlist) . (srfi 101))
((scheme stream) . (srfi 41))

;; misc srfi, added in order of popularity according to https://misc.lassi.io/2019/srfi-implementation-counts.scm
;; omitting anything added to r7rs small / large
((srfi 8) . #t)
((srfi 2) . #t)
((srfi 13) . #t)
((srfi 26) . #t)
((srfi 60) . #t)
((srfi 28) . #t)
((srfi 38) . #t)
((srfi 17) . #t)
((srfi 37) . #t)
((srfi 45) . #t)
((srfi 25) . #t)
((srfi 64) . #t)

)
Loading

0 comments on commit 31e9d4c

Please sign in to comment.