Init proto (#1)

This commit is contained in:
malkoas 2021-01-14 12:38:50 +03:00 committed by GitHub
parent ad48c18b6e
commit 3320cc6a65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 384 additions and 0 deletions

78
.gitignore vendored Normal file
View File

@ -0,0 +1,78 @@
# Created by .ignore support plugin (hsz.mobi)
.eunit
deps
*.o
*.beam
*.plt
erl_crash.dump
ebin/*.beam
rel/example_project
.concrete/DEV_MODE
.rebar
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle:
.idea/gradle.xml
.idea/libraries
# Mongo Explorer plugin:
.idea/mongoSettings.xml
*.iws
*.ipr
*.iml
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
env.list

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git

34
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,34 @@
#!groovy
// -*- mode: groovy -*-
build('dominant-cache-proto', 'docker-host') {
checkoutRepo()
loadBuildUtils()
def pipeDefault
def gitUtils
runStage('load pipeline') {
env.JENKINS_LIB = "build_utils/jenkins_lib"
pipeDefault = load("${env.JENKINS_LIB}/pipeDefault.groovy")
gitUtils = load("${env.JENKINS_LIB}/gitUtils.groovy")
}
pipeDefault() {
runStage('compile') {
sh "make wc_compile"
}
// Java
runStage('Execute build container') {
withCredentials([[$class: 'FileBinding', credentialsId: 'java-maven-settings.xml', variable: 'SETTINGS_XML']]) {
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('epic/')) {
sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} wc_java.deploy'
} else {
sh 'make SETTINGS_XML=${SETTINGS_XML} wc_java.compile'
}
}
}
}
}

80
Makefile Normal file
View File

@ -0,0 +1,80 @@
THRIFT = $(or $(shell which thrift), $(error "`thrift' executable missing"))
REBAR = $(shell which rebar3 2>/dev/null || which ./rebar3)
SUBMODULES = build_utils
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
UTILS_PATH := build_utils
TEMPLATES_PATH := .
# Name of the service
SERVICE_NAME := dominant-cache-proto
# Build image tag to be used
BUILD_IMAGE_TAG := 917afcdd0c0a07bf4155d597bbba72e962e1a34a
CALL_ANYWHERE := \
all submodules compile clean distclean \
java.compile java.deploy
CALL_W_CONTAINER := $(CALL_ANYWHERE)
all: compile
-include $(UTILS_PATH)/make_lib/utils_container.mk
.PHONY: $(CALL_W_CONTAINER)
# CALL_ANYWHERE
$(SUBTARGETS): %/.git: %
git submodule update --init $<
touch $@
submodules: $(SUBTARGETS)
compile:
$(REBAR) compile
clean:
$(REBAR) clean
distclean:
$(REBAR) clean -a
rm -rfv _build
# Java
ifdef SETTINGS_XML
DOCKER_RUN_OPTS = -v $(SETTINGS_XML):$(SETTINGS_XML)
DOCKER_RUN_OPTS += -e SETTINGS_XML=$(SETTINGS_XML)
endif
ifdef LOCAL_BUILD
DOCKER_RUN_OPTS += -v $$HOME/.m2:/home/$(UNAME)/.m2:rw
endif
COMMIT_HASH := $(shell git --no-pager log -1 --pretty=format:"%h")
NUMBER_COMMITS := $(shell git rev-list --count HEAD)
JAVA_PKG_VERSION := 1.$(NUMBER_COMMITS)-$(COMMIT_HASH)
ifdef BRANCH_NAME
ifeq "$(findstring epic,$(BRANCH_NAME))" "epic"
JAVA_PKG_VERSION := $(JAVA_PKG_VERSION)-epic
endif
endif
MVN = mvn -s $(SETTINGS_XML) -Dpath_to_thrift="$(THRIFT)" -Dcommit.number="$(NUMBER_COMMITS)"
java.compile: java.settings
$(MVN) compile
java.deploy: java.settings
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \
$(MVN) deploy
java.install: java.settings
$(MVN) clean && \
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \
$(MVN) install
java.settings:
$(if $(SETTINGS_XML),, echo "SETTINGS_XML not defined"; exit 1)

1
build_utils Submodule

@ -0,0 +1 @@
Subproject commit e1318727d4d0c3e48f5122bf3197158b6695f50e

5
package-lock.json generated Normal file
View File

@ -0,0 +1,5 @@
{
"name": "dominant-cache-proto",
"version": "1.0.0",
"lockfileVersion": 1
}

12
package.json Normal file
View File

@ -0,0 +1,12 @@
{
"name": "dominant-cache-proto",
"version": "1.0.0",
"description": "Dominant cache thrift protocol",
"repository": {
"type": "git",
"url": "git+https://github.com/rbkmoney/dominant-cache-proto.git"
},
"author": "rbk.money",
"license": "UNLICENSED",
"homepage": "https://github.com/rbkmoney/dominant-cache-proto#readme"
}

90
pom.xml Normal file
View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.rbkmoney</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>dominant-cache-proto</artifactId>
<version>SNAPSHOT</version>
<packaging>jar</packaging>
<name>Dominant cache</name>
<description>Generates jar artifact containing compiled thrift classes based on generated thrift IDL files</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!--rbkmoney-->
<dependency>
<groupId>com.rbkmoney.woody</groupId>
<artifactId>woody-thrift</artifactId>
<version>LATEST</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.rbkmoney</groupId>
<artifactId>damsel</artifactId>
<version>1.473-093c982</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- THRIFT -->
<plugin>
<groupId>org.apache.thrift</groupId>
<artifactId>thrift-maven-plugin</artifactId>
<version>0.9.3-1</version>
<configuration>
<generator>java:fullcamel</generator>
<thriftSourceRoot>${project.basedir}/proto</thriftSourceRoot>
<thriftExecutable></thriftExecutable>
</configuration>
<executions>
<execution>
<id>thrift-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.rbkmoney.damsel</pattern>
<shadedPattern>com.rbkmoney.damsel.v${commit.number}</shadedPattern>
</relocation>
</relocations>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>v${commit.number}</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,81 @@
namespace java com.rbkmoney.damsel.dominant.cache
namespace erlang dominant_cache
include "base.thrift"
include "domain.thrift"
include "msgpack.thrift"
typedef string CategoryRef
typedef string CategoryName
typedef string CategoryDescription
enum CategoryType {
test
live
}
typedef string DocumentTypeRef
typedef string DocumentTypeName
typedef string DocumentTypeDescription
typedef string CashRegisterProviderRef
typedef string CashRegisterProviderName
typedef string CashRegisterProviderDescription
typedef string CashRegisterProviderParameterId
typedef string CashRegisterProviderParameterDescription
typedef bool CashRegisterProviderIsRequired
typedef string CashRegisterProviderProxyRef
typedef map<string, string> CashRegisterProviderProxyOptions
enum CashRegisterProviderParameterType {
string_type
integer_type
url_type
password_type
}
struct CashRegisterProviderParameter {
1: required CashRegisterProviderParameterId id
2: optional CashRegisterProviderParameterDescription description
3: optional CashRegisterProviderParameterType type
4: required CashRegisterProviderIsRequired is_required
}
struct CashRegisterProviderProxy {
1: required CashRegisterProviderProxyRef ref
2: optional CashRegisterProviderProxyOptions options
}
struct Category {
1: required CategoryRef ref
2: required CategoryName name
3: optional CategoryDescription description
4: required CategoryType type
}
struct DocumentType {
1: required DocumentTypeRef ref
2: required DocumentTypeName name
3: optional DocumentTypeDescription description
}
struct CashRegisterProvider {
1: required CashRegisterProviderRef ref
2: required CashRegisterProviderName name
3: optional CashRegisterProviderDescription description
4: required CashRegisterProviderParameter parameter
5: required CashRegisterProviderProxy proxy
}
service DominantCache {
list<Category> GetCategories ()
list<DocumentType> GetDocumentTypes ()
list<CashRegisterProvider> GetCashRegisterProviders ()
}