Skip to content

Commit

Permalink
v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vontikov committed Jul 23, 2018
1 parent 5653711 commit 4bd325c
Show file tree
Hide file tree
Showing 21 changed files with 810 additions and 268 deletions.
103 changes: 103 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
[Simple Binary Encoding](https://github.com/real-logic/simple-binary-encoding) plugin for [Gradle Build Tool](https://gradle.org/)
------------------------------------------
Runs [SBE Tool](https://github.com/real-logic/simple-binary-encoding/wiki/Sbe-Tool-Guide)
in a Gradle project.

Introduces a set of Gradle tasks which can be used to generate
[Simple Binary Encoding](https://github.com/real-logic/simple-binary-encoding)
codecs for Java and C++.

Compiled Java codecs are packed into a jar file.

C++ codecs are delivered in a tarball, as a header-only
[CMake](https://cmake.org/)-ready library.

Usage
-----

#### Minimum configuration

```Groovy
//
// build.gradle
//
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.vontikov:sbe-generator-plugin:0.0.1"
}
}
apply plugin: "vontikov.sbe-generator-plugin"
```

#### Full configuration

```Groovy
//
// build.gradle
//
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.vontikov:sbe-generator-plugin:0.0.1"
}
}
apply plugin: "vontikov.sbe-generator-plugin"
sbeGenerator {
src {
dir = 'src/main/resources/xml'
includes = []
excludes = []
}
javaCodecsDir = 'build/generated/src/main/java'
javaClassesDir = 'build/generated/classes'
cppCodecsDir = 'build/generated/src/main/cpp1'
cppCmakeDir = 'build/generated/cmake-project'
archivesDir = 'build/archives'
}
```

#### SBE version
```
#
# gradle.properties
#
sbe_version=1.8.5
```

#### SBE Generator tasks

| Task | Description |
| --------------------- | ------------------------------------------ |
| sbeValidate | Validates message declaration schemas |
| sbeGenerateJavaCodecs | Generates Java SBE codecs |
| sbeCompileJavaCodecs | Compiles Java SBE codecs |
| sbeJavaArchive | Creates Java jar with SBE codecs |
| sbeGenerateCppCodecs | Generates C++ SBE codecs |
| sbeCppArchive | Packs generated C++ codecs |
| sbeCppCmakeScripts | Prepares C++ CMake scripts for SBE library |

License (See LICENSE file for full license)
------------------------------------------

Copyright 2018 Vladimir Ontikov

Licensed under the MIT License

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
v0.0.1
------
Initial release
94 changes: 73 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,41 +1,93 @@
buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'com.gradle.publish:plugin-publish-plugin:0.9.10'
}
}


plugins {
id 'groovy'
id 'java-gradle-plugin'
id 'eclipse'
id 'groovy'
id 'java-gradle-plugin'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'ivy-publish'
}

apply plugin: 'com.gradle.plugin-publish'

repositories {
jcenter()
mavenCentral()
mavenLocal()
jcenter()
mavenCentral()
}
group = artifact_group
version = "${artifact_version}"

group = artifact_group
version = artifact_version

sourceCompatibility = 1.8
targetCompatibility = 1.8

task createClasspathManifest {
def outputDir = file("$buildDir/$name")
gradlePlugin {
plugins {
sbeGenerator {
id = 'vontikov.sbe-generator-plugin'
implementationClass = 'vontikov.SbeGeneratorPlugin'
}
}
}

inputs.files sourceSets.main.runtimeClasspath
outputs.dir outputDir
pluginBundle {
website = 'https://github.com/vontikov/sbe-gradle-plugin/'
vcsUrl = 'https://github.com/vontikov/sbe-gradle-plugin/'
description = 'Simple Binary Encoding plugin'
tags = ['SBE', 'Simple Binary Encoding']

doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").text =
sourceSets.main.runtimeClasspath.join('\n')
plugins {
sbeGenerator {
id = 'vontikov.sbe-generator-plugin'
displayName = 'Simple Binary Encoding plugin'
}
}
}

publishing {
repositories {
mavenLocal()
}
}

task createClasspathManifest {
def outputDir = file("$buildDir/$name")

inputs.files sourceSets.main.runtimeClasspath
outputs.dir outputDir

doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").text =
sourceSets.main.runtimeClasspath.join('\n')
}
}

dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.12'
compile 'org.codehaus.groovy:groovy-all:2.4.12'
compile gradleApi()
compile localGroovy()

testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-all:1.3'

testRuntime files(createClasspathManifest)
testRuntime files(createClasspathManifest)
}

defaultTasks 'clean', 'build'
clean.doFirst {
delete "${rootDir}/src/test/resources/projects/generator/build/"
}

defaultTasks 'clean', 'build'
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
artifact_name=sbe-generator-plugin
artifact_group=vontikov
artifact_version=0.0.1
artifact_version=0.0.1
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'sbe-generator-plugin'
rootProject.name = artifact_name
52 changes: 45 additions & 7 deletions src/main/groovy/vontikov/Const.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,51 @@ package vontikov

final class Const {

static final SBE_ARTIFACT = 'uk.co.real-logic:sbe-all:'
static final DEFAULT_SBE_VERSION = '1.7.6'
static final DEFAULT_XSD_URL = 'http://fixprotocol.io/2016/sbe/sbe.xsd'
static final DEFAULT_SRC_DIR = 'src/main/resources/xml'
static final DEFAULT_JAVA_GEN_DIR = 'build/generated/src/main/java'
static final DEFAULT_CPP_GEN_DIR = 'build/generated/src/main/cpp'
static final DEFAULT_SBE_VERSION = '1.8.5'

static final PLUGIN_ID = 'sbe.generator'
static final PLUGIN_GROUP = 'SBE Generator'
static final EXTENSION_NAME = 'sbeGenerator'
static final CONFIGURATION_NAME = 'sbeGenerator'

static final VALIDATE_TASK = 'sbeValidate'
static final VALIDATE_TASK_DESCRIPTION = 'Validates message declaration schemas'

static final GENERATE_JAVA_TASK = 'sbeGenerateJavaCodecs'
static final GENERATE_JAVA_TASK_DESCRIPTION = 'Generates Java SBE codecs'

static final COMPILE_JAVA_TASK = 'sbeCompileJavaCodecs'
static final COMPILE_JAVA_DESCRIPTION = 'Compiles Java SBE codecs'

static final PACK_JAVA_TASK = 'sbeJavaArchive'
static final PACK_JAVA_TASK_DESCRIPTION = 'Creates Java jar with SBE codecs'

static final GENERATE_CPP_TASK = 'sbeGenerateCppCodecs'
static final GENERATE_CPP_TASK_DESCRIPTION = 'Generates C++ SBE codecs'

static final CMAKE_CPP_TASK = 'sbeCppCmakeScripts'
static final CMAKE_CPP_TASK_DESCRIPTION = 'Prepares C++ CMake scripts for SBE library'

static final PACK_CPP_TASK = 'sbeCppArchive'
static final PACK_CPP_TASK_DESCRIPTION = 'Creates tarball containing C++ SBE codecs'

static final TMP_DIR = 'build/tmp'

static final DEFAULT_SRC_DIR = 'src/main/resources/xml'

static final DEFAULT_JAVA_CODECS_DIR = 'build/generated/src/main/java'
static final DEFAULT_JAVA_CLASSES_DIR = 'build/generated/classes'

static final DEFAULT_CPP_CODECS_DIR = 'build/generated/src/main/cpp'
static final DEFAULT_CPP_CMAKE_PROJECT_DIR = 'build/generated/cmake-project'

static final DEFAULT_ARCHIVES_DIR = 'build/archives'

static final DEFAULT_JAVA_SOURCE_COMPATIBILITY = '1.8'
static final DEFAULT_JAVA_TARGET_COMPATIBILITY = '1.8'

static final PROJECT_PROPERTY_SBE_VERSION = 'sbe_version'

private Const() {
}
}
}
Loading

0 comments on commit 4bd325c

Please sign in to comment.