Gradle plugin for http://kaitai.io/
Usage
Minimum configuration
- Add plugin dependency
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("name.valery1707.kaitai:kaitai-gradle-plugin:0.1.2")
}
}
- Apply plugin
apply plugin: 'name.valery1707.kaitai'
- Add Kaitai compile dependencies
repositories {
jcenter()
}
dependencies {
implementation("io.kaitai:kaitai-struct-runtime:0.8")
}
- Configure plugin (all params are optional)
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. Default: Detected from version |
| version | String | 0.1.0 | Version of KaiTai 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 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. |
Developments
For debug on integration tests you must previously call some gradle tasks: jar assemble pluginUnderTestMetadata
Deploy new version manually:
- Update
versioninside this files:build.gradle.kts: from0.1.3-SNAPSHOTinto0.1.3README.md: from0.1.2into0.1.3CHANGELOG.md: create new block for0.1.3
- Commit with
Prepare release 0.1.3 - Prepare
gradle.propertiesfromgradle-template.properties - Run
./gradlew clean build uploadArchives - Open Staging Repository
- Search for
namevalery1707and select founded - Check content on tab
Content - Press
Closewith commentRelease version 0.1.3 - Wait for operation:
- On failure:
- Check reason on tab
Activity - Press
Dropwith some comment
- Check reason on tab
- Press
Releasewith commentRelease version 0.1.3 - Check exists for Gradle API keys in local configuration
- Run
./gradlew publishPlugins - Update
versioninto0.1.4-SNAPSHOTand commit withPrepare for next development iteration