-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Simplify it to just run any command from string options * Validate 3 things in 2 runs * Provide verbose output when a command completes so we can test for it * Fix a problem in path handling when the conf dir is in . * Document the ways to obtain riddlc
- Loading branch information
1 parent
4195dea
commit 3e37000
Showing
8 changed files
with
165 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
doc/src/hugo/content/audience/implementors-guide/ways-to-use-riddl.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
title: "Different Ways To Get/Use RIDDL" | ||
description: "RIDDL documentation focused on implementors' usage" | ||
date: 2022-08-06T10:50:32-07:00 | ||
draft: false | ||
weight: 30 | ||
--- | ||
|
||
There are several ways to get riddl software on to your computer, depending | ||
on how you want to work. | ||
|
||
{{< toc >}} | ||
|
||
## Download | ||
This is the simplest way to get `riddlc`. It should run on Windows, Mac | ||
and Linux. Follow these steps: | ||
* Go to [the riddlc downloads page](https://github.com/reactific/riddl/releases) | ||
* Select the release you want to install | ||
* Scroll down to the "Assets" section | ||
* Download the riddlc-{version}.zip file | ||
* Unzip that file on your computer | ||
* Place the riddlc-{version}/bin directory in your path | ||
|
||
## Staged | ||
To use `riddlc` locally and be able to update it with new changes without a | ||
large download, use this approach: | ||
* `git clone https://github.com/reactific/riddl.git` | ||
* `cd riddl` | ||
* Put the `./riddlc/target/universal/stage/bin` directory in your PATH | ||
variable using a full path instead of "." | ||
* Run `sbt stage` to build the program | ||
* To update, run `git pull` from the `riddl` cloned repository directory and | ||
rerun `sbt stage` to rebuild. | ||
|
||
This allows you to both make local changes and pull in changes from others to | ||
keep your local copy of `riddlc` up to date. | ||
|
||
## Integrate With SBT | ||
|
||
TBD. | ||
|
||
## RiddlSbtPlugin | ||
To use the sdt-plugin you must first have installed riddlc by one of the above | ||
methods. This approach allows you to run `riddlc` commands from a sbt based | ||
project. The command you configure will run first when you use the `compile` | ||
command in sbt. Follow these steps: | ||
|
||
* In your `plugins.sbt` file, add: | ||
`addSbtPlugin("com.reactific" % "sbt-riddl" % "{version}"). You can find | ||
the [available version here](https://github.com/reactific/riddl/releases) | ||
* In your `build.sbt` file, use `enablePlugins(SbtRiddlPlugin)` on your project | ||
* Set the following sbt settings: | ||
* `riddlcPath := file("...")` This defaults to "riddlc" which is | ||
appropriate if the right version is in your path; otherwise specify the | ||
full path to the `riddlc` command | ||
* `riddlcOptions := Seq("from", "path/to/config/file", "hugo")` This is | ||
just an example, you can put any command or options you want in that | ||
sequence. Use `riddlc help` to find out what commands you can use. | ||
* To run a translator in this way, put a `riddlc.conf` file next to the top | ||
level `.riddl` file you want to translate. The content of that file can | ||
specify common options and the commands you want to support from | ||
`sbt-riddl`, like the example below, taken from the | ||
[`riddl-examples` project](https://github.com/reactifi/riddl-examples). | ||
These files use | ||
[Human-Oriented-CONfiguration](https://github.com/lightbend/config) | ||
|
||
```hocon | ||
common { | ||
show-times = true | ||
verbose = true | ||
quiet = false | ||
dry-run = false | ||
show-warnings = true | ||
show-missing-warnings = false | ||
show-style-warnings = false | ||
} | ||
hugo { | ||
input-file = "ReactiveBBQ.riddl" | ||
output-dir = "target/hugo/ReactiveBBQ" | ||
project-name = "Reactive BBQ" | ||
site-title = "Reactive BBQ Generated Specification" | ||
site-description = "This site provides a specification for the Reactive BBQ application as generated by riddlc" | ||
site-logo-path = "images/RBBQ.png" | ||
erase-output = true | ||
base-url = "https://bbq.riddl.tech" | ||
source-url = "https://github.com/reactific/riddl" | ||
edit-path = "/-/blob/main/src/riddl/ReactiveBBQ" | ||
} | ||
validate { | ||
input-file = "ReactiveBBQ.riddl" | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
lazy val root = (project in file(".")).enablePlugins(RiddlSbtPlugin) | ||
.settings(version := "0.1", scalaVersion := "2.12.16") | ||
import scala.sys.process.Process | ||
|
||
lazy val root = (project in file(".")).enablePlugins(RiddlSbtPlugin).settings( | ||
version := "0.1", | ||
scalaVersion := "2.12.6", | ||
TaskKey[Unit]("checkInfoOutput") := { | ||
val i = Seq("--verbose", "info") | ||
val p1 = Process("riddlc", i) | ||
val out1 = (p1 !!).trim | ||
println(out1) | ||
if (!out1.contains("name: riddlc")) { | ||
sys.error("output should contain 'name: riddlc'") | ||
} | ||
val plugin_version = sys.props.get("plugin.version").getOrElse("0") | ||
if (!out1.contains(s"version: $plugin_version")) { | ||
sys.error(s"output should contain 'version: $plugin_version") | ||
} | ||
val v = Seq( | ||
"--verbose", | ||
"--suppress-missing-warnings", | ||
"from", | ||
"src/main/riddl/riddlc.conf", | ||
"validate" | ||
) | ||
val p2 = Process("riddlc", v) | ||
val out2 = (p2 !!).trim | ||
println(out2) | ||
if ( | ||
!out2 | ||
.contains("Ran: from src/main/riddl/riddlc.conf validate: success=yes") | ||
) { | ||
sys.error( | ||
"riddlc output did not contain 'Ran: from riddlc.conf validate: success=yes'" | ||
) | ||
} | ||
() | ||
} | ||
) |
4 changes: 4 additions & 0 deletions
4
sbt-riddl/src/sbt-test/sbt-riddl/simple/src/main/riddl/riddlc.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
validate { | ||
input-file = "./simple.riddl" | ||
} | ||
info {} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Put in sbt-test scripted checks in this file | ||
# See: https://www.scala-sbt.org/1.x/docs/Testing-sbt-plugins.html for options | ||
> compile | ||
# $ exists target/scala-2.12/foo.jar | ||
> checkInfoOutput |