You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: courses/RascalAmendmentProposals/RAP1/RAP1.md
+35-31Lines changed: 35 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,10 @@ sidebar_position: 1
10
10
| Status | Draft |
11
11
| Type | Rascal Infrastructure |
12
12
13
+
## Note
14
+
15
+
The current RAP has been written before the general move to building on top of Apache Maven. However, it is clear that the below design is step-by-step being filled in with the "BOM" implemented with a pom.xml config file, etc. The document has to be revised with these developments in mind, without throwing away requirements which have yet to be fulfilled.
16
+
13
17
## Abstract
14
18
15
19
Rascal needs a mechanism to work with third-party Rascal packages (which may be standalone Rascal programs or Rascal libraries). This document describes the required structure of such packages, the required meta-data, and the standard way in which they are made available in a given Rascal installation.
@@ -26,17 +30,17 @@ A *Rascal Source Project* is a directory folder structure with the source code o
26
30
27
31
The life cycle of a Rascal Package consists of the following phases:
28
32
29
-
*\[**Build**\]: Convert a *Rascal Source Project* to a deployable *Rascal Package*
30
-
*\[**Local Installation**\]: Installing a local \[**Build**\] of a *Rascal Package* into the local *Rascal Installation*
31
-
*\[**Deployment**\]: The *Rascal Package* is uploaded to a (public) *Rascal Package Server*.
32
-
*\[**Discovery**\]: The name and the keywords defined in the *Rascal Package* make it findable.
33
-
*\[**Installation**\]: Once found, the *Rascal Package* can be installed in a *Rascal Installation*
34
-
*\[**Local Installation\]:** Installs a *Rascal Source Project* directly as a *Rascal Package* in the local *Rascal Installation,* i.e. without first deploying it. This is for simulating and testing release, and for being able to work on collections of dependent packages without having to release them officially all the time.
35
-
*\[**Configuration\]:** Once installed a Rascal Package optionally needs to be configured with knowledge about the system it is installed in. An example configuration for a “gitar” package (git analysis in Rascal) would be the absolute location of the git binary tool. Configuration is a way to deal with non-Rascal, non-Java dependencies, but it can also be used to set preferences or tweak run-time parameters of a Rascal package.
36
-
*\[**Use**\]: From then on, the *Rascal Package* can be used as if it is an integral part of Rascal.
37
-
*\[**Update**\]: update to a newer version (is a nice-to-have combination of steps from \[**Discovery**\], \[**Installation**\] and \[**Use**\] for a new version of an already installed package)
38
-
*\[**Uninstall**\]: remove Rascal Package from the current Rascal installation
39
-
*\[**Deprecate**\]: mark the Rascal Package as “obsolete” on the *Package Server*
33
+
*[**Build**]: Convert a *Rascal Source Project* to a deployable *Rascal Package*
34
+
*[**Local Installation**]: Installing a local [**Build**] of a *Rascal Package* into the local *Rascal Installation*
35
+
*[**Deployment**]: The *Rascal Package* is uploaded to a (public) *Rascal Package Server*.
36
+
*[**Discovery**]: The name and the keywords defined in the *Rascal Package* make it findable.
37
+
*[**Installation**]: Once found, the *Rascal Package* can be installed in a *Rascal Installation*
38
+
*[**Local Installation]:** Installs a *Rascal Source Project* directly as a *Rascal Package* in the local *Rascal Installation,* i.e. without first deploying it. This is for simulating and testing release, and for being able to work on collections of dependent packages without having to release them officially all the time.
39
+
*[**Configuration]:** Once installed a Rascal Package optionally needs to be configured with knowledge about the system it is installed in. An example configuration for a “gitar” package (git analysis in Rascal) would be the absolute location of the git binary tool. Configuration is a way to deal with non-Rascal, non-Java dependencies, but it can also be used to set preferences or tweak run-time parameters of a Rascal package.
40
+
*[**Use**]: From then on, the *Rascal Package* can be used as if it is an integral part of Rascal.
41
+
*[**Update**]: update to a newer version (is a nice-to-have combination of steps from [**Discovery**], [**Installation**] and [**Use**] for a new version of an already installed package)
42
+
*[**Uninstall**]: remove Rascal Package from the current Rascal installation
43
+
*[**Deprecate**]: mark the Rascal Package as “obsolete” on the *Package Server*
40
44
41
45
### Rascal Source Project Layout
42
46
@@ -91,13 +95,13 @@ The RASCAL.MF contains the following attributes that are relevant for program de
91
95
* Keywords: A list of keywords that can be used to discover this program.
92
96
* Sources: points to which nested folder contain root source folders, “src” by default
93
97
* Include-Source: boolean to indicate whether source code is to be included in the Package
94
-
* Configuration: TBD, place to declare \[**Configuration**\] values, e.g. loc pathToGit=|file:///usr/bin/git|, str heap-size \= “1G”
98
+
* Configuration: TBD, place to declare [**Configuration**] values, e.g. loc pathToGit=|file:///usr/bin/git|, str heap-size \= “1G”
95
99
96
100
### Building and Deploying of a Package File
97
101
98
102
Each library will be deployed as a single jar and adding a library to a given Rascal installation starts with this jar.
99
103
100
-
*\[**Build**\] A shell command to wrap the current working project into a deployable jar file.
104
+
*[**Build**] A shell command to wrap the current working project into a deployable jar file.
101
105
1. Compiles all Rascal files in the project
102
106
2. Compiles all documentation in the project
103
107
3.**TBD**: what about Java class files?
@@ -107,16 +111,16 @@ Each library will be deployed as a single jar and adding a library to a given Ra
107
111
7. When the jar is finished a checksum is computed and stored next to the jar
108
112
109
113
110
-
*\[**Deployment**\] The packaged jar will be uploaded to a Rascal Package Server, e.g. r2d2.rascal-mpl.org/\<name\>-\<version\>.jar. This is simply a http file server. It could also be our Nexus (which is indeed a file server), but we should not force people to use nexus as their file servers. Http should be the only requirement. Next to the jar should be a checksum file with the same name, i.e. \<name\>-\<version\>.sha1, and a synopsis (description) file, i.e. \<name\>-\<version\>.descr which could be the first sentence of the README.md or something like that (see \[**Discovery**\])
111
-
*\[**Discovery**\] The Rascal shell provides a means to query the currently available libraries on a given server, i.e. by default r2d2.usethesource.io. It should also be possible to query the list of currently installed Rascal packages. E.g. “pkg find \[string\]” will find all packages matching the optional string name on the server or list them all, and “pkg list \[string\]” does the same for the local packages. The discover and list comments also present the single line synopsis next to the name and all available version numbers for the package. Discover will also label already installed packages by a (\*) or something to make sure the user can see what already is there and what is available for download.
112
-
*\[**Installation**\] The Rascal shell offers an “install” command to download a library and install it in a local machine repository, i.e. \/.r2d2/myLibrary-1.0.0.jar. There is also a staging directory to make sure installation is an atomic operation, i.e. \~/.r2d2/staging. “pkg install \<name\>\[version\]” will go through the following steps:
114
+
*[**Deployment**] The packaged jar will be uploaded to a Rascal Package Server, e.g. r2d2.rascal-mpl.org/\<name\>-\<version\>.jar. This is simply a http file server. It could also be our Nexus (which is indeed a file server), but we should not force people to use nexus as their file servers. Http should be the only requirement. Next to the jar should be a checksum file with the same name, i.e. \<name\>-\<version\>.sha1, and a synopsis (description) file, i.e. \<name\>-\<version\>.descr which could be the first sentence of the README.md or something like that (see [**Discovery**])
115
+
*[**Discovery**] The Rascal shell provides a means to query the currently available libraries on a given server, i.e. by default r2d2.usethesource.io. It should also be possible to query the list of currently installed Rascal packages. E.g. “pkg find [string]” will find all packages matching the optional string name on the server or list them all, and “pkg list [string]” does the same for the local packages. The discover and list comments also present the single line synopsis next to the name and all available version numbers for the package. Discover will also label already installed packages by a (\*) or something to make sure the user can see what already is there and what is available for download.
116
+
*[**Installation**] The Rascal shell offers an “install” command to download a library and install it in a local machine repository, i.e. \/.r2d2/myLibrary-1.0.0.jar. There is also a staging directory to make sure installation is an atomic operation, i.e. \~/.r2d2/staging. “pkg install \<name\>[version]” will go through the following steps:
113
117
1. Clear the staging directory (for possible left-overs from a failed previous install)
114
118
2. Push this package name and server on the installation stack file in the staging directory file “TODO”.
115
119
3. Download a package from the **server**, put it in the staging directory.
116
120
4. Download the checksum file.
117
121
5. Compute the checksum independently.
118
122
6. Check the checksum, and bail out if it is broken.
119
-
7. Check for \<name\>-\<version\>.deprecated file on the server. If deprecated show the contents on the file and warn the user. Ask if this can be ignored, if \[yes\] continue, if \[no\] bail out (default is “no”)
123
+
7. Check for \<name\>-\<version\>.deprecated file on the server. If deprecated show the contents on the file and warn the user. Ask if this can be ignored, if [yes] continue, if [no] bail out (default is “no”)
120
124
8. Download the LICENSE file from the library and put it in the staging directory
121
125
9. Extract the Dependencies from the RASCAL.MF file of the project
122
126
10. For each of the Dependencies:
@@ -125,33 +129,33 @@ Each library will be deployed as a single jar and adding a library to a given Ra
125
129
* If not, go to step ‘a’ for the current package and finish the process recursively
126
130
11. When the current package and all of its dependencies are downloaded as above:
127
131
* Collect the LICENSE files and ask the user to agree with them
128
-
* If \[no\] on one of the licenses, bail out.
132
+
* If [no] on one of the licenses, bail out.
129
133
* Check for LICENSE compatibility?
130
-
* If \[yes\] move all packages from staging directory to local repository directory.
134
+
* If [yes] move all packages from staging directory to local repository directory.
131
135
* Unpack all jars in directories \<name\>-\<version\>; this will make nested jars more easily available on the java run-time classpath and loading modules is a lot faster from a file system than out of a jar.
132
136
12. If one of the dependencies bailed out due to checksum failure or failure to agree with the license, or failure to ignore deprecation, then report the reason for the abortion and clear all files in the staging directory.
133
-
*\[**Local Installation**\] a variant of the above, where a *Rascal Source Project* is packaged and deployed directly in the local *Rascal Installation*.
137
+
*[**Local Installation**] a variant of the above, where a *Rascal Source Project* is packaged and deployed directly in the local *Rascal Installation*.
134
138
1. In this way larger projects can be split into reusable packages without having to publicly release ongoing work
135
139
2. In this way we simulate the use of a deployed package as faithfully as possible on the developers machine
136
-
*\[**Configuration**\] triggered after \[**Installation**\] but also re-configuration is possible after installation.
140
+
*[**Configuration**] triggered after [**Installation**] but also re-configuration is possible after installation.
137
141
1. The shell provides a way to trigger a number of configuration questions (e.g. as defined in RASCAL.MF (TDB), e.g. “pkg config \<name\>”
138
142
2. The result of configuration is stored in a file \~/.r2d2/\<name\>-\<version\>.config
139
143
3. A Rascal standard library module provides access to the values in the config file
140
-
*\[**Dependency**\] by editing RASCAL.MF (or via a shell command to add it to the RASCAL.MF? “pkg add \<name\>\<version\>”?), the name of a library is added to a project at Used-Libraries. This dependency declaration contains a version number optionally. If this is not the case, then the latest version (semantic versioning) is always added to the search path.
144
+
*[**Dependency**] by editing RASCAL.MF (or via a shell command to add it to the RASCAL.MF? “pkg add \<name\>\<version\>”?), the name of a library is added to a project at Used-Libraries. This dependency declaration contains a version number optionally. If this is not the case, then the latest version (semantic versioning) is always added to the search path.
141
145
1. This effectively adds the contents of jars to the libraryPath of the project in the order of occurrence in Used-Libraries.
142
-
2. The process of adding to the libraryPath should check existence of the library and bail out with an error message if it is not there anymore (see \[**Uninstall**\]), or propose to “pkg install” it again automatically?
143
-
*\[**Use**\] the programmer imports modules from the libraries on the library path as if they were part of the current project.
146
+
2. The process of adding to the libraryPath should check existence of the library and bail out with an error message if it is not there anymore (see [**Uninstall**]), or propose to “pkg install” it again automatically?
147
+
*[**Use**] the programmer imports modules from the libraries on the library path as if they were part of the current project.
144
148
1. When the shell starts or when a dependency is added, the documentation of each library is also added to the help index.
145
-
2. When the shell starts or when a dependency is added (see \[**Dependency**\]), the libraryPath of the shell is extended to make the library indeed importable. If the dependency does not exist in the local Rascal installation, then an error message should be reported
146
-
*\[**Uninstall**\] a “pkg uninstall \<name\>\[version\]\[“rec”\]” removes a package and its dependencies unless used by another package from the local repository.
147
-
1. This can generate dangling references in source projects (see \[**Dependency**\])
149
+
2. When the shell starts or when a dependency is added (see [**Dependency**]), the libraryPath of the shell is extended to make the library indeed importable. If the dependency does not exist in the local Rascal installation, then an error message should be reported
150
+
*[**Uninstall**] a “pkg uninstall \<name\>[version][“rec”]” removes a package and its dependencies unless used by another package from the local repository.
151
+
1. This can generate dangling references in source projects (see [**Dependency**])
148
152
2. This should fail if any of the installed packages in the local repository still depends on the package, unless they are on the list of currently being removed as well.
149
-
3. The process should mimic the inverse of the \[**Install**\] process and be made atomic as a whole, i.e not take place at all if any of the packages can not be uninstalled.
150
-
4. The process should also remove local \[**Configuration**\] files (if successful)
151
-
*\[**Deprecate**\] Label an already deployed (versioned) package as “obsolete” or “deprecated”, with a reason (security issue, bug, license issue, not maintained anymore, superseded by another project, etc)
153
+
3. The process should mimic the inverse of the [**Install**] process and be made atomic as a whole, i.e not take place at all if any of the packages can not be uninstalled.
154
+
4. The process should also remove local [**Configuration**] files (if successful)
155
+
*[**Deprecate**] Label an already deployed (versioned) package as “obsolete” or “deprecated”, with a reason (security issue, bug, license issue, not maintained anymore, superseded by another project, etc)
152
156
1. The file will not be removed from the server but...
153
157
2. An additional file will be uploaded \<name\>-\<version\>.deprecated, which contains the reason for the deprecation.
154
-
3. The \[**Install**\] comment will check for the deprecated file and show its contents, then ask if the user wants to force the installation or bail out.
158
+
3. The [**Install**] comment will check for the deprecated file and show its contents, then ask if the user wants to force the installation or bail out.
0 commit comments