forked from iotaledger/iri
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request iotaledger#35 from th0br0/bazel
Add bazel buildfiles
- Loading branch information
Showing
15 changed files
with
535 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
.meghanada/ | ||
bazel-* | ||
bazel-*/ | ||
target/ | ||
|
||
layers/ | ||
addresses.csv | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
MAIN_BASE_PATH = "src/main/java/coo/%s" | ||
|
||
java_import( | ||
name = "jota", | ||
jars = ["libs/jota-0.9.11-SNAPSHOT.jar"], | ||
runtime_deps = [ | ||
"@com_google_code_gson_gson//jar", | ||
"@com_squareup_okhttp3_okhttp//jar", | ||
"@com_squareup_okio_okio//jar", | ||
"@com_squareup_retrofit2_converter_gson//jar", | ||
"@com_squareup_retrofit2_retrofit//jar", | ||
"@org_bouncycastle_bcprov_jdk15on//jar", | ||
], | ||
) | ||
|
||
java_library( | ||
name = "common", | ||
srcs = [ | ||
(MAIN_BASE_PATH % (x)) | ||
for x in [ | ||
"crypto/Hasher.java", | ||
"crypto/ISS.java", | ||
"crypto/ISSInPlace.java", | ||
"MilestoneSource.java", | ||
"MilestoneDatabase.java", | ||
"KerlPoW.java", | ||
] | ||
], | ||
deps = [ | ||
":jota", | ||
"@com_google_guava_guava//jar", | ||
"@org_bouncycastle_bcprov_jdk15on//jar", | ||
"@org_slf4j_slf4j_api//jar", | ||
], | ||
) | ||
|
||
java_library( | ||
name = "conf", | ||
srcs = [ | ||
(MAIN_BASE_PATH % x) | ||
for x in [ | ||
"conf/BaseConfiguration.java", | ||
"conf/Configuration.java", | ||
"conf/ShadowingConfiguration.java", | ||
"conf/POWModeValidator.java", | ||
] | ||
], | ||
deps = [ | ||
":common", | ||
":jota", | ||
"@com_beust_jcommander//jar", | ||
], | ||
) | ||
|
||
java_binary( | ||
name = "address_generator", | ||
srcs = [MAIN_BASE_PATH % "util/AddressGenerator.java"], | ||
main_class = "coo.util.AddressGenerator", | ||
visibility = ["//visibility:public"], | ||
runtime_deps = ["@org_slf4j_slf4j_simple//jar"], | ||
deps = [ | ||
":common", | ||
":jota", | ||
"@org_slf4j_slf4j_api//jar", | ||
], | ||
) | ||
|
||
java_binary( | ||
name = "merkle_tree_calculator", | ||
srcs = [MAIN_BASE_PATH % "util/MerkleTreeCalculator.java"], | ||
main_class = "coo.util.MerkleTreeCalculator", | ||
visibility = ["//visibility:public"], | ||
runtime_deps = ["@org_slf4j_slf4j_simple//jar"], | ||
deps = [ | ||
":common", | ||
":jota", | ||
"@com_google_guava_guava//jar", | ||
"@org_slf4j_slf4j_api//jar", | ||
], | ||
) | ||
|
||
COORDINATOR_RUNTIME_DEPS = [ | ||
"@org_slf4j_slf4j_simple//jar", | ||
] | ||
|
||
java_binary( | ||
name = "shadowing_coordinator", | ||
srcs = [MAIN_BASE_PATH % "shadow/ShadowingCoordinator.java"], | ||
main_class = "coo.shadow.ShadowingCoordinator", | ||
visibility = ["//visibility:public"], | ||
runtime_deps = COORDINATOR_RUNTIME_DEPS, | ||
deps = [ | ||
":common", | ||
":conf", | ||
":jota", | ||
"@com_beust_jcommander//jar", | ||
"@org_apache_commons_commons_lang3//jar", | ||
"@org_slf4j_slf4j_api//jar", | ||
], | ||
) | ||
|
||
java_binary( | ||
name = "coordinator", | ||
srcs = [MAIN_BASE_PATH % "Coordinator.java"], | ||
main_class = "coo.Coordinator", | ||
visibility = ["//visibility:public"], | ||
runtime_deps = COORDINATOR_RUNTIME_DEPS, | ||
deps = [ | ||
":common", | ||
":conf", | ||
":jota", | ||
"@com_beust_jcommander//jar", | ||
"@org_slf4j_slf4j_api//jar", | ||
], | ||
) | ||
|
||
java_test( | ||
name = "test_milestone", | ||
srcs = glob(["src/test/java/**/*.java"]), | ||
test_class = "MilestoneTest", | ||
deps = [ | ||
":address_generator", | ||
":common", | ||
":jota", | ||
":merkle_tree_calculator", | ||
"@com_google_guava_guava//jar", | ||
"@junit_junit//jar", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "io_bazel_rules_docker", | ||
sha256 = "29d109605e0d6f9c892584f07275b8c9260803bf0c6fcb7de2623b2bedc910bd", | ||
strip_prefix = "rules_docker-0.5.1", | ||
url = "https://github.com/bazelbuild/rules_docker/archive/v0.5.1.tar.gz", | ||
) | ||
|
||
load( | ||
"@io_bazel_rules_docker//container:container.bzl", | ||
"container_pull", | ||
container_repositories = "repositories", | ||
) | ||
|
||
container_repositories() | ||
|
||
container_pull( | ||
name = "java_base", | ||
digest = | ||
"sha256:bb1c9179c2263733f235291998cb849d52fb730743125420cf4f97a362d6a6dd", | ||
registry = "gcr.io", | ||
repository = "distroless/java", | ||
) | ||
|
||
# Java dependencies | ||
|
||
load("//third-party:maven_deps.bzl", "maven_jars") | ||
|
||
maven_jars() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
load("@io_bazel_rules_docker//container:container.bzl", "container_image") | ||
|
||
container_image( | ||
name = "address_generator", | ||
base = "@java_base//image", | ||
cmd = ["address_generator_deploy.jar"], | ||
files = ["//:address_generator_deploy.jar"], | ||
repository = "iota/compass", | ||
) | ||
|
||
container_image( | ||
name = "merkle_tree_calculator", | ||
base = "@java_base//image", | ||
cmd = ["merkle_tree_calculator_deploy.jar"], | ||
files = ["//:merkle_tree_calculator_deploy.jar"], | ||
repository = "iota/compass", | ||
) | ||
|
||
container_image( | ||
name = "coordinator", | ||
base = "@java_base//image", | ||
cmd = ["coordinator_deploy.jar"], | ||
files = ["//:coordinator_deploy.jar"], | ||
repository = "iota/compass", | ||
) | ||
|
||
container_image( | ||
name = "shadowing_coordinator", | ||
base = "@java_base//image", | ||
cmd = ["shadowing_coordinator_deploy.jar"], | ||
files = ["//:shadowing_coordinator_deploy.jar"], | ||
repository = "iota/compass", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
config.json | ||
data/ | ||
.*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
. lib.sh | ||
load_config | ||
|
||
docker run -t --rm -v `pwd`/data:/data iota/compass/docker:address_generator address_generator_deploy.jar $sigMode $seed $security $depth /data/addresses.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
. lib.sh | ||
load_config | ||
|
||
docker run -t --rm -v `pwd`/data:/data iota/compass/docker:merkle_tree_calculator merkle_tree_calculator_deploy.jar $sigMode /data/addresses.csv /data/layers/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
. lib.sh | ||
load_config | ||
|
||
docker run -t --net host --rm -v `pwd`/data:/data iota/compass/docker:coordinator coordinator_deploy.jar \ | ||
-layers /data/layers \ | ||
-sigMode $sigMode \ | ||
-powMode $powMode \ | ||
-mwm $mwm \ | ||
-security $security \ | ||
-seed $seed \ | ||
-tick $tick \ | ||
-host $host \ | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"seed": "MYSEEDHEREPLEASEREPLACEMEIMMEDIATELYWITHSOMETHINGSECURE99999999999999999999999999", | ||
"powMode": "CURLP81", | ||
"sigMode": "CURLP27", | ||
"security": 2, | ||
"depth": 5, | ||
"mwm": 9, | ||
"tick": 60000, | ||
"host": "http://localhost:14265" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
function load_config { | ||
if [ ! -f config.json ]; then | ||
echo "Config file 'config.json' does not exist! Please look at config.example.json and create one!" | ||
exit 1 | ||
fi | ||
|
||
mkdir data &> /dev/null | ||
|
||
host=$(jq -r .host config.json) | ||
sigMode=$(jq -r .sigMode config.json) | ||
powMode=$(jq -r .powMode config.json) | ||
seed=$(jq -r .seed config.json) | ||
security=$(jq .security config.json) | ||
depth=$(jq .depth config.json) | ||
tick=$(jq .tick config.json) | ||
mwm=$(jq .mwm config.json) | ||
|
||
|
||
if [ ! -d data/ ]; then | ||
mkdir data/ | ||
echo "Depending on OS you might have to set SELinux permissions for data/" | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.