Skip to content

Commit 859d2ee

Browse files
author
Andrew Ford
committed
Merge branch 'master' into c++11-fixes
2 parents 993aa62 + c523039 commit 859d2ee

38 files changed

+3899
-349
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ csharp/sbe-generated/since-deprecated
111111
csharp/sbe-generated/mktdata/*.cs
112112
csharp/sbe-generated/uk_co_real_logic_sbe_benchmarks_fix
113113

114+
# rust
115+
rust/car_example/.vscode
116+
rust/car_example/car_example_data.sbe
117+
rust/car_example/Cargo.lock
118+
rust/car_example/src/car_example_generated_codec.rs
119+
rust/car_example/target
120+
114121
# Mac
115122
.DS_Store
116123
/sbe-tool/src/main/golang/uk_co_real_logic_sbe_ir_generated/

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,6 @@ The Java and C++ SBE implementations are designed with work very efficiently wit
1818
high-throughput communications. The Java SBE implementation has a dependency on
1919
[Agrona](https://github.com/real-logic/agrona) for its buffer implementations.
2020

21-
License (See LICENSE file for full license)
22-
-------------------------------------------
23-
Copyright 2014 - 2017 Real Logic Limited
24-
Copyright 2017 MarketFactory Inc
25-
26-
Licensed under the Apache License, Version 2.0 (the "License");
27-
you may not use this file except in compliance with the License.
28-
You may obtain a copy of the License at
29-
30-
http://www.apache.org/licenses/LICENSE-2.0
31-
32-
Unless required by applicable law or agreed to in writing, software
33-
distributed under the License is distributed on an "AS IS" BASIS,
34-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35-
See the License for the specific language governing permissions and
36-
limitations under the License.
37-
3821

3922
Binaries
4023
--------
@@ -51,7 +34,6 @@ Example for Maven:
5134
</dependency>
5235
```
5336

54-
5537
Directory Layout
5638
----------------
5739
Main source code
@@ -156,3 +138,21 @@ example. This solution also builds some tests which can be run via the provided
156138
Users of csharp generated code should see the [user documentation (coming)](https://github.com/real-logic/simple-binary-encoding/wiki/Csharp-User-Guide).
157139

158140
Developers wishing to enhance the csharp generator should see the [developer documentation (coming)](https://github.com/real-logic/simple-binary-encoding/blob/master/csharp/README.md)
141+
142+
143+
License (See LICENSE file for full license)
144+
-------------------------------------------
145+
Copyright 2014 - 2017 Real Logic Limited
146+
Copyright 2017 MarketFactory Inc
147+
148+
Licensed under the Apache License, Version 2.0 (the "License");
149+
you may not use this file except in compliance with the License.
150+
You may obtain a copy of the License at
151+
152+
http://www.apache.org/licenses/LICENSE-2.0
153+
154+
Unless required by applicable law or agreed to in writing, software
155+
distributed under the License is distributed on an "AS IS" BASIS,
156+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
157+
See the License for the specific language governing permissions and
158+
limitations under the License.

build.gradle

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,18 @@ subprojects {
118118
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
119119

120120
dependencies {
121-
checkstyle 'com.puppycrawl.tools:checkstyle:8.1'
121+
checkstyle 'com.puppycrawl.tools:checkstyle:8.2'
122122
checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.24.1'
123123

124124
testCompile 'org.hamcrest:hamcrest-all:1.3'
125125
testCompile 'junit:junit:4.12'
126-
testCompile 'org.mockito:mockito-core:2.8.47'
126+
testCompile 'org.mockito:mockito-core:2.10.0'
127127
testCompile 'com.google.code.gson:gson:2.8.0'
128128
}
129129

130130
checkstyle {
131131
configFile = new File(rootDir, 'config/checkstyle/checkstyle.xml')
132-
toolVersion = '8.1'
132+
toolVersion = '8.2'
133133
}
134134

135135
compileJava {
@@ -468,6 +468,64 @@ project(':sbe-benchmarks') {
468468
}
469469
}
470470

471+
/*
472+
* Rust codec targets used for testing and demonstration
473+
*/
474+
task(generateRustCarExample, type: JavaExec) {
475+
main = 'uk.co.real_logic.sbe.SbeTool'
476+
classpath = project(':sbe-all').sourceSets.main.runtimeClasspath
477+
systemProperties(
478+
'sbe.output.dir': 'rust/car_example/src',
479+
'sbe.target.language': 'uk.co.real_logic.sbe.generation.rust.Rust',
480+
'sbe.target.namespace': 'car_example_generated_codec')
481+
args = ['sbe-tool/src/test/resources/example-schema.xml']
482+
}
483+
task(generateCarExampleDataFile, type: JavaExec) {
484+
main = 'uk.co.real_logic.sbe.examples.ExampleUsingGeneratedStub'
485+
classpath = project(':sbe-samples').sourceSets.main.runtimeClasspath
486+
systemProperties(
487+
'sbe.encoding.filename': 'rust/car_example/car_example_data.sbe')
488+
args = []
489+
standardOutput = new ByteArrayOutputStream()
490+
}
491+
492+
task(runRustCarExample, type: Exec) {
493+
workingDir = './rust/car_example'
494+
executable = 'cargo'
495+
args = ['run']
496+
standardOutput = new ByteArrayOutputStream()
497+
errorOutput = new ByteArrayOutputStream()
498+
dependsOn 'generateRustCarExample', 'generateCarExampleDataFile'
499+
}
500+
501+
def cargo_exists() {
502+
try {
503+
def result = project.exec {
504+
executable 'cargo'
505+
args '-v'
506+
standardOutput = new ByteArrayOutputStream()
507+
errorOutput = new ByteArrayOutputStream()
508+
}
509+
return result.exitValue == 0
510+
}
511+
catch (Exception ignore)
512+
{
513+
return false
514+
}
515+
}
516+
517+
if (cargo_exists()) {
518+
test.dependsOn('runRustCarExample')
519+
} else {
520+
println 'Skipping Rust integration test due to absent cargo command'
521+
}
522+
523+
task generateRustCodecs {
524+
description = 'Generate rust test codecs'
525+
dependsOn 'generateRustCarExample',
526+
'generateCarExampleDataFile'
527+
}
528+
471529
/*
472530
* Golang codec targets used for testing, benchmarking etc. We have
473531
* multiple targets as:

rust/car_example/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "sbe_rust_car_example"
3+
version = "0.1.0"
4+
authors = []
5+
6+
[dependencies]
7+
[dev-dependencies]

rust/car_example/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Rust Car Example project
2+
3+
Depends on SBE-tool generated bindings, which can be created by running, from the simple-binary-encoding project root,
4+
`./gradlew generateRustCodecs`.
5+
6+
Assumes the presence of Rust and Cargo.

0 commit comments

Comments
 (0)