Skip to content

Commit

Permalink
add jacamo CLI in install optinos
Browse files Browse the repository at this point in the history
  • Loading branch information
jomifred committed May 23, 2023
1 parent c50bc9b commit 733949f
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 67 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ demos/demo-nodered-mqtt/node-red/.config.json.backup
settings.gradle
demos/integration/dummyart-nodered-mqtt/node-red/.config.json.backup
demos/integration/dummyag-nodered-mqtt/node-red/.config.json.backup
doc/devs/creating-packages/based-on-existing-project.html
94 changes: 51 additions & 43 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {
api('org.jacamo:npl:0.5') { transitive = false }

api('org.jacamo:intmas:1.0.0')
api('org.jacamo:sai:0.5.2') { transitive = false }
api('org.jacamo:sai:0.5.3') { transitive = false }
api('org.antlr:antlr4:4.8')

//api('net.sf.ingenias:jade:4.3')
Expand All @@ -81,30 +81,30 @@ dependencies {
}

// copy dep jars and scritps into build directory
task copyJarsToBuild {
inputs.files configurations.runtimeClasspath.files
inputs.dir 'scripts'
outputs.dir 'build/libs'
outputs.dir 'build/scripts'
doLast {
copy {
from configurations.runtimeClasspath
into 'build/libs'
//exclude '**/jason-2.0.jar'
}
copy {
from 'scripts'
into 'build/scripts'
include '**'
filter {
String line -> line.replaceAll("JacamoREL=[0-9]+\\.[0-9]+", "JacamoREL="+project.version)
}
//task copyJarsToBuild {
// inputs.files configurations.runtimeClasspath.files
// inputs.dir 'scripts'
// outputs.dir 'build/libs'
// outputs.dir 'build/scripts'
// doLast {
// copy {
// from configurations.runtimeClasspath
// into 'build/libs'
// //exclude '**/jason-2.0.jar'
// }
// copy {
// from 'scripts'
// into 'build/scripts'
// include '**'
// filter {
// String line -> line.replaceAll("JasonREL", file(configurations.compileClasspath.find { it.name.startsWith("jason-") }).name)
// String line -> line.replaceAll("JacamoREL=[0-9]+\\.[0-9]+", "JacamoREL="+project.version)
// }
}
}
}
//// filter {
//// String line -> line.replaceAll("JasonREL", file(configurations.compileClasspath.find { it.name.startsWith("jason-") }).name)
//// }
// }
// }
//}

compileJavacc {
inputDirectory = file('src/main/javacc')
Expand Down Expand Up @@ -194,13 +194,17 @@ task config (dependsOn: 'jar') {
}*/

doLast {
copy {
from '../jacamo-cli/build/bin/jacamo'
into 'bin'
}
println '------'
println ''
println 'you can set the JaCaMo home directory with the following command:'
println ' export JACAMO_HOME='+project.buildDir.absolutePath
println ''
println 'and also change your PATH with:'
println ' export PATH=$JACAMO_HOME/scripts:$PATH'
println ' export PATH=$JACAMO_HOME/bin:$PATH'
println ''
println '-----'
}
Expand Down Expand Up @@ -312,17 +316,21 @@ task copyRel {
include 'doc/**'
}
copy {
from 'build/scripts'
into 'build/jacamo-'+project.version+'/scripts'
}
copy {
duplicatesStrategy = 'include'
from 'build/libs'
from configurations.runtimeClasspath
into 'build/jacamo-'+project.version+'/libs'
include '**/*.jar'
//exclude '**/jason-2.0.jar'
from '../jacamo-cli/build/bin/jacamo'
into 'build/jacamo-'+project.version+'/bin'
}
// copy {
// from 'build/scripts'
// into 'build/jacamo-'+project.version+'/scripts'
// }
// copy {
// duplicatesStrategy = 'include'
// from 'build/libs'
// from configurations.runtimeClasspath
// into 'build/jacamo-'+project.version+'/libs'
// include '**/*.jar'
// //exclude '**/jason-2.0.jar'
// }
copy {
from docsDir
into 'build/jacamo-'+project.version+'/doc'
Expand All @@ -331,22 +339,22 @@ task copyRel {
from 'examples'
into 'build/jacamo-'+project.version+'/examples'
}
copy {
from 'demos'
into 'build/jacamo-'+project.version+'/demos'
}
copy {
from 'src/main/resources/templates'
into 'build/jacamo-'+project.version+'/src/templates'
}
// copy {
// from 'demos'
// into 'build/jacamo-'+project.version+'/demos'
// }
// copy {
// from 'src/main/resources/templates'
// into 'build/jacamo-'+project.version+'/src/templates'
// }
delete fileTree('build/jacamo-'+project.version+'/doc') { include '**/*.adoc', '**/Makefile', '**/publish.sh' }
}
}

// creates a zip file for a release
task zipRel(type: Zip, dependsOn: copyRel) {
from 'build/jacamo-'+project.version
archiveBaseName = 'jacamo'
archiveBaseName = 'jacamo-bin'
}

task runauction (type: JavaExec, dependsOn: 'classes') {
Expand Down
18 changes: 16 additions & 2 deletions doc/install.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ If you want to run a JaCaMo application that was not created with a `build.gradl
To edit your code, any text editor can be used. VS Code has plugins for syntax highlight.



== JaCaMo Command Line Interface

This option requires that you install JaCaMo CLI in your machine. JaCaMo CLI has features to create and manage JaCaMo projects.
Expand All @@ -93,7 +92,22 @@ Requirements:

- Java >= 17

TBD
Download a JaCaMo release from link:https://github.com/jacamo-lang/jacamo/releases[here] (download the file named `jacamo-bin-.....zip`) and decompress it. The zip file contains documentation, examples, and a sub-directory `bin` with the file *`jacamo`*. It is a unix executable file, if not, change its properties with `chmod +x jacamo`. Finally, link:https://www.computerhope.com/issues/ch000549.htm[adds the directory `bin` in your machine `PATH`] so that the command `jacamo` can be executed in a terminal.

In a terminal, ou can create a new application named `app1` with the command

```
jacamo app create app1
```

and execute it with
```
cd app1
jacamo app1.jcm
```

More parameters for the `jacamo` command can be found https://github.com/jacamo-lang/jacamo-cli[here].


// [cols="<1,<1,<2",options="header"]
// |===
Expand Down
45 changes: 23 additions & 22 deletions readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@ Installation instructions and options for users are described xref:doc/install.a
----
git clone https://github.com/jacamo-lang/jacamo.git
cd jacamo
./gradlew config // <1> <2>
./gradlew build
----
<1> the config task builds the jacamo jar, configure jacamo properties file, and place all jars in `build/libs`.
<2> this task also prints out the commands to set up the `JACAMO_HOME` and `PATH` variables.

Examples can be run using the `jacamo` shell script, for example:

jacamo examples/house-building/house.jcm

Other useful gradle tasks:

-----
gradle jar // <1>
gradle doc // <2>
gradle clean // <3>
gradle release // <4>
-----
<1> generates a new jacamo jar.
<2> generates the javadoc and transforms asciidoc files into html (Docker must be running for the latter).
<3> cleans all generated files.
<4> produces a zip file in `build/distributions` to be distributed to users.

An _eclipse_ project to change the JaCaMo implementation can be created form menu "File/Import/Existing Gradle Project".
// The build task builds the jacamo jar
// , configure jacamo properties file, and place all jars in `build/libs`.
//<2> this task also prints out the commands to set up the `JACAMO_HOME` and `PATH` variables.

// Examples can be run using the `jacamo` shell script, for example:
//
// jacamo examples/house-building/house.jcm
//
// Other useful gradle tasks:
//
// -----
// gradle jar // <1>
// gradle doc // <2>
// gradle clean // <3>
// gradle release // <4>
// -----
// <1> generates a new jacamo jar.
// <2> generates the javadoc and transforms asciidoc files into html (Docker must be running for the latter).
// <3> cleans all generated files.
// <4> produces a zip file in `build/distributions` to be distributed to users.
//
// An _eclipse_ project to change the JaCaMo implementation can be created form menu "File/Import/Existing Gradle Project".

The development of the main tools used by JaCaMo is also hosted on GitHub:

Expand Down

0 comments on commit 733949f

Please sign in to comment.