This repository contains the Protobuf schema file for the Tinkar project and generates code packages for different languages that can be distributed to read and write Tinkar files.
Data Team
- Java
- Maven
- C#
- NuGet
To generate Java and C# based objects from the Tinkar.proto file a Docker image will build a JPMS modular jar artifact file and a .nupkg file.
To build the proto container, which can be used for file generation. This is used for executing protoc commands.
docker build -t tinkar-schema-protoc:latest -f protoc.dockerfile .
Similarly, the csharp/mono build container has been created for consistency in executing the csharp commands.
docker build -t tinkar-schema-csharp:latest -f csharp.dockerfile .
Docker doesn't know how to identify the specific version of the OS because of the virtualization layer on the processor. To encourage it to execute the right one, add the following to any build command:
--platform linux/x86_64
If you want to create the java source files, you should something like the following:
protoc -I <location of current direct> Tinkar.proto --java_out=<target directory>
An example of running this and generating the files for your local environment would look something like this:
docker run -it -v "$(pwd)/src:/home/proto-builder/src" protoc sh -c "mkdir -p /home/proto-builder/src/main/java && protoc -I /home/proto-builder/ Tinkar.proto --java_out=/home/proto-builder/src/main/java"
Once you have created the protoc, we can use the following to create a java jar file that will be installed in your local maven repository.
mvn clean install
The C-Sharp dll is pushed to Maven Central and can be found at
https://www.nuget.org/packages/Tinkar.ProtoBuf-cs/
To use this dependency in maven, include the following dependency (replacing ${tinkar.version}
with the version that
you would prefer to use.
<dependency>
<groupId>dev.ikm.tinkar</groupId>
<artifactId>tinkar-schema</artifactId>
<version>${tinkar.version}</version>
</dependency>
If you want to create the java source files, you should something like the following:
protoc -I <location of current direct> Tinkar.proto --csharp_out=<target directory>
An example of running this and generating the files for your local environment would look something like this:
docker run -it -v "$(pwd)/code:/home/proto-builder/code" protoc sh -c "mkdir -p /home/proto-builder/code/csharp && protoc -I /home/proto-builder/ Tinkar.proto --csharp_out=/home/proto-builder/code/csharp"
To create the C# package, you will restore the installation, then build everything, then package it, using the following commands:
dotnet restore
dotnet build --no-restore
dotnet pack --no-restore --no-build -o /sln/artifacts
The C-Sharp dll is pushed to NuGet and can be found at
https://www.nuget.org/packages/Tinkar.Schema/
To install into Visual Studio, type the following into the Nuget console.
Install-Package Tinkar.Schema
Technical and non-technical issues can be reported to the Issue Tracker.
Contributions can be submitted via pull requests. Please check the contribution guide for more details.