https://github.com/valery1707/kaitai-gradle-plugin
Gradle plugin for Kaitai: declarative language to generate binary data parsers
https://github.com/valery1707/kaitai-gradle-plugin
gradle-plugin java kaitai kaitai-struct
Last synced: 5 months ago
JSON representation
Gradle plugin for Kaitai: declarative language to generate binary data parsers
- Host: GitHub
- URL: https://github.com/valery1707/kaitai-gradle-plugin
- Owner: valery1707
- License: mit
- Created: 2018-12-29T14:44:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-27T11:50:48.000Z (over 2 years ago)
- Last Synced: 2023-07-05T04:15:12.567Z (almost 2 years ago)
- Topics: gradle-plugin, java, kaitai, kaitai-struct
- Language: Java
- Homepage: https://kaitai.io/
- Size: 288 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://maven-badges.herokuapp.com/maven-central/name.valery1707.kaitai/kaitai-gradle-plugin)
[](https://plugins.gradle.org/plugin/name.valery1707.kaitai)
[](https://opensource.org/licenses/MIT)[](https://travis-ci.org/valery1707/kaitai-gradle-plugin)
[](https://circleci.com/gh/valery1707/kaitai-gradle-plugin/tree/master)Gradle plugin for http://kaitai.io/
# Usage
## Minimum configuration
* Add plugin dependency
```groovy
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("name.valery1707.kaitai:kaitai-gradle-plugin:0.1.2")
}
}
```
* Apply plugin
```groovy
apply plugin: 'name.valery1707.kaitai'
```
* Add Kaitai compile dependencies
```groovy
repositories {
jcenter()
}
dependencies {
implementation("io.kaitai:kaitai-struct-runtime:0.8")
}
```
* Configure plugin (all params are optional)
```groovy
kaitai {
packageName = 'preferred.package.name'
}
```## Plugin parameters
| Name | Type | Since | Description |
|-----------------|--------------|-------|-------------------------------------------------------------------------------------------------------------------------|
| skip | boolean | 0.1.0 | Skip plugin execution (don't read/validate any files, don't generate any java types).
**Default**: `false` |
| url | java.net.URL | 0.1.0 | Direct link onto [KaiTai universal zip archive](http://kaitai.io/#download).
**Default**: Detected from version |
| version | String | 0.1.0 | Version of [KaiTai](http://kaitai.io/#download) library.
**Default**: `0.8` |
| cacheDir | java.io.File | 0.1.0 | Cache directory for download KaiTai library.
**Default**: `build/tmp/kaitai-cache` |
| sourceDirectory | java.io.File | 0.1.0 | Source directory with [Kaitai Struct language](http://formats.kaitai.io/) files.
**Default**: src/main/resources/kaitai |
| includes | String[] | 0.1.0 | Include wildcard pattern list.
**Default**: ["*.ksy"] |
| excludes | String[] | 0.1.0 | Exclude wildcard pattern list.
**Default**: [] |
| output | java.io.File | 0.1.0 | Target directory for generated Java source files.
**Default**: `build/generated/kaitai` |
| packageName | String | 0.1.0 | Target package for generated Java source files.
**Default**: Trying to get project's group or `kaitai` otherwise |
| executionTimeout| Long | 0.1.1 | Timeout for execution operations.
**Default**: `5000` |
| fromFileClass | String | 0.1.1 | Classname with custom KaitaiStream implementations for static builder `fromFile(...)`|
| opaqueTypes | Boolean | 0.1.1 | Allow use opaque (external) types in ksy. See more in [documentation](http://doc.kaitai.io/user_guide.html#opaque-types).|# Developments
For debug on integration tests you must previously call some gradle tasks: `jar assemble pluginUnderTestMetadata`Deploy new version manually:
1. Update `version` inside this files:
* `build.gradle.kts`: from `0.1.3-SNAPSHOT` into `0.1.3`
* `README.md`: from `0.1.2` into `0.1.3`
* `CHANGELOG.md`: create new block for `0.1.3`
1. Commit with `Prepare release 0.1.3`
1. Prepare `gradle.properties` from `gradle-template.properties`
1. Run `./gradlew clean build uploadArchives`
1. Open [Staging Repository](https://oss.sonatype.org/#stagingRepositories)
1. Search for `namevalery1707` and select founded
1. Check content on tab `Content`
1. Press `Close` with comment `Release version 0.1.3`
1. Wait for operation:
1. On failure:
* Check reason on tab `Activity`
* Press `Drop` with some comment
1. Press `Release` with comment `Release version 0.1.3`
1. Check exists for [Gradle API keys](https://plugins.gradle.org/u/valery1707) in local configuration
1. Run `./gradlew publishPlugins`
1. Update `version` into `0.1.4-SNAPSHOT` and commit with `Prepare for next development iteration`