Discover the WarpFleet Gradle plugin that allows you to interact with WarpFleet and generate macros documentation
We have launched a brand new tool to interact with WarpFleet.
You already know (I hope so) the WarpFleet Cli that relies on NodeJS. We decided to refactor it as a Gradle plugin that only relies on Java.
For now, both tools are working and supported.
WarpFleet is the Warp 10 artifact repository. Read more about it here. |
Prerequisites
You need:
- Java >= 1.8 (18 supported)
- Gradle
That's all.
Setup
Create a directory and init a Gradle project:
$ mkdir my-warpfleet-project
$ cd my-warpfleet-project
$ gradle init
Select type of project to generate:
1: basic
2: application
3: library
4: Gradle plugin
Enter selection (default: basic) [1..4] 1
Select build script DSL:
1: Groovy
2: Kotlin
Enter selection (default: Groovy) [1..2] 1
Project name (default: my-warpfleet-project):
> Task :init
Get more help with your project: Learn more about Gradle by exploring our samples at https://docs.gradle.org/7.2/samples
BUILD SUCCESSFUL in 6s
2 actionable tasks: 2 executed
Now edit the build.gradle
file (which should be empty):
buildscript{
repositories {
mavenCentral()
mavenLocal()
dependencies{
classpath 'io.warp10:warpfleet-gradle-plugin:0.0.3'
}
}
}
apply plugin: 'io.warp10.warpfleet-gradle-plugin'
You should now be able to invoke new Gradle tasks:
$ ./gradlew -q tasks --group WarpFleet
------------------------------------------------------------
Tasks runnable from root project 'my-warpfleet-project'
------------------------------------------------------------
WarpFleet tasks
---------------
wfDoc - Generates documentation files against a Warp 10 instance thanks to the INFOMODE.
wfGetArtifactInfo - Get Artifact info
wfGetArtifacts - Get list of available artifacts
wfGetGroups - Get list of available groups
wfGetVersions - Get list of available artifact's versions
wfInstall - Install Artifact
wfPublish - Publishes a plugin, macro or extension against WarpFleet
wfUnPublish - Unpublishes a plugin, macro or extension against WarpFleet
To see all tasks and more detail, run gradlew tasks --all
To see more detail about a task, run gradlew help --task <task>
Browsing the WarpFleet Repository
The WarpFleet repository is organized like a Maven repository. We expose artifacts as jar files.
These jars contain either:
- extensions (new functions added to the WarpScript language)
- plugins (new features added to the Warp 10 platform)
They are defined by a group (e.g. io.warp10
), an artifact name (e.g. warp10-ext-s3
or warp10-plugin-kafka
), a version number (e.g. 1.2.3
), and an optional classifier.
So, you can define an artifact with a selector like this:
group
:artifact's name
:version
:classifier
Browse available plugins and extensions |
You can use the Gradle plugin to browse our repositories.
wfGetGroups
– Get the list of available groups:
$ ./gradlew -q wfGetGroups
- io.senx
- io.warp10
...
wfGetArtifacts
– Get the list of available artifacts:
$ ./gradlew -q wfGetArtifacts --group=io.warp10
- io.warp10:warp10-ext-arrow:2.0.3-uberjar (Conversions to and from Apache Arrow streaming format)
- io.warp10:warp10-ext-barcode:1.0.2-uberjar (WarpScript™ Barcode Extension)
- io.warp10:warp10-ext-flows:0.1.1-uberjar (FLoWS WarpScript Extension)
- io.warp10:warp10-ext-forecasting:2.0.0 (Forecast extension)
- io.warp10:warp10-ext-geotransform:0.2.3-uberjar (Extension to transform coordinates from one geographic coordinate system to another. Based on Proj4J.)
- io.warp10:warp10-ext-git:1.0.1-uberjar (WarpScript Git Extension)
...
wfGetVersions
– Get the list of available artifact versions:
$ ./gradlew -q wfGetVersions --group=io.warp10 --artifact=warp10-plugin-warpstudio
- Name: io.warp10:warp10-plugin-warpstudio
- Description: WarpStudio, the WarpScript editor
- Latest version: 2.0.6
- Available:
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
Warp 10 Extension/Plugin Installation
You can use this Gradle plugin to add new features and functionality to your Warp 10 platform.
Single Artifact Installation
$ ./gradlew -q wfInstall \
--group=io.warp10 \
--artifact=warp10-plugin-warpstudio \
--vers=2.0.3 \
--dest=/path/to/warp10
The vers
field is not mandatory and can be set to latest
. In either case, WarpFleet will fetch the latest available version.
You can also use this syntax:
$ ./gradlew -q wfInstall \
--packages=io.warp10:warp10-plugin-warpstudio:2.0.3:jar \
--dest=/path/to/warp10
Multiple Artifacts Installation
Install many plugins and extensions at once with a comma-separated list of artifact selectors:
$ ./gradlew -q wfInstall \
--packages=io.warp10:warp10-plugin-warpstudio:latest,io.warp10:warp10-ext-barcode \
--dest=/path/to/warp10
Generate Documentation
Maybe you have developed macros that are deployed on your Warp 10 platform and you would like to generate documentation about them? No problem, this Gradle plugin can actually parse the INFO structure of your macros and generate documentation in various formats:
- default:
json
json
: JSON filesmd
ormarkdown
: Markdown files with an indexhtml
: HTML pages with an index.
For instance for @path/to/macro
and /path/to/root/folder/path/to/macro.mc2
$ ./gradlew -q wfDoc \
--url=https://warp10.server/api/v0/exec \
--source=/path/to/root/folder \ # where your Warpscripts are located
--dest=./doc \ # documentation destination
--macroDir=path \ # root path of your macros
--format=json # json by default (could be html or md)
Artifact publication
You may have authored a Warp 10 plugin or a WarpScript extension and would like to share it with the rest of the Warp 10 community? Follow the steps below:
First Step: Contact SenX
Contact us to save your group name and GPG key.
You can also send an email with your GPG key attached.
Second Step: Publish it
Once your GPG key has been accepted and installed on our servers, you can publish your extension/plugin:
$ ./gradlew -q wfPublish \
--gpgKeyId=BDxxx0A \ # Optional GPG Key Id
--vers=1.2.3 # Optional version overrides version in wf.json
--wfJson=/path/to/wf.json # where wf.json is located
Build.gradle
Yes, you do not have to use the command line to pass all your parameters, you can benefit from your build.gradle
(the one described at the top of this article).
Documentation sample
apply plugin: 'io.warp10.warpfleet-gradle-plugin'
buildscript{
repositories {
mavenCentral()
mavenLocal()
dependencies{
classpath 'io.warp10:warpfleet-gradle-plugin:0.0.3'
}
}
}
warpfleet {
url = "https://warp10.server/api/v0/exec"
source = "/path/to/root/folder"
dest = "./doc"
macroDir = "path"
format = "html"
}
And just run:
$ ./gradlew -q wfDoc
Artifact publication sample
Of course, the same applies to artifact publication. Just edit the build.gradle
file of your extension (or plugin) by adding this:
apply plugin: 'io.warp10.warpfleet-gradle-plugin'
buildscript{
repositories {
mavenCentral()
mavenLocal()
dependencies{
classpath 'io.warp10:warpfleet-gradle-plugin:0.0.3'
}
}
}
..... // rest of your file
warpfleet {
gpgKeyId = "BDxxxxx0A"
vers = "1.2.3"
wfJson = "./wf.json"
}
And just run:
$ ./gradlew build shadowJar wfPublish
Learn more about Extension/Plugin authoring |
Read more
Create a custom tile for Discovery
February 2024: Warp 10 release 3.2.0
Warp 10 and the Ethereum blockchain
Senior Software Engineer