{"action":"created","issue":{"url":"https://api.github.com/repos/rchain/rchain/issues/255","repository_url":"https://api.github.com/repos/rchain/rchain","labels_url":"https://api.github.com/repos/rchain/rchain/issues/255/labels{/name}","comments_url":"https://api.github.com/repos/rchain/rchain/issues/255/comments","events_url":"https://api.github.com/repos/rchain/rchain/issues/255/events","html_url":"https://github.com/rchain/rchain/pull/255","id":296075155,"number":255,"title":"OPS-65 CORE-135 CORE-155 Single build.sbt for all projects.","user":{"login":"kirkwood","id":1438807,"avatar_url":"https://avatars2.githubusercontent.com/u/1438807?v=4","gravatar_id":"","url":"https://api.github.com/users/kirkwood","html_url":"https://github.com/kirkwood","followers_url":"https://api.github.com/users/kirkwood/followers","following_url":"https://api.github.com/users/kirkwood/following{/other_user}","gists_url":"https://api.github.com/users/kirkwood/gists{/gist_id}","starred_url":"https://api.github.com/users/kirkwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirkwood/subscriptions","organizations_url":"https://api.github.com/users/kirkwood/orgs","repos_url":"https://api.github.com/users/kirkwood/repos","events_url":"https://api.github.com/users/kirkwood/events{/privacy}","received_events_url":"https://api.github.com/users/kirkwood/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-10T05:20:38Z","updated_at":"2018-02-12T15:49:17Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/rchain/rchain/pulls/255","html_url":"https://github.com/rchain/rchain/pull/255","diff_url":"https://github.com/rchain/rchain/pull/255.diff","patch_url":"https://github.com/rchain/rchain/pull/255.patch"},"body":"A single build.sbt file now resides at top level. This should be pretty easy to bust apart, should we decide to unconsolidate the repository.\r\n\r\nI have tried to keep each scoped build as similar to the original, per-project build process as I could.\r\n\r\n### Notes\r\n1. @henrytill helped a bunch\r\n1. All dependencies are gathered in `project/Dependencies.scala`\r\n1. \"Standard\" plugins are gathered in `project/plugins.sbt`\r\n1. Other plugins (looking at you, BNFC) are in their respective files in `project/`\r\n1. `sbt` version is bumped to 1.1 across the board\r\n1. Main Scala version is standardized now to 2.14.2, though cross-compilation for older versions is kept fragmented as it was previously\r\n1. Compiler flags are gathered and standardized in `project/CompilerSettings.scala`, though they are the less restrictive union for now\r\n1. I'm not emotionally prepared to add automatic scalafmt invocation on every compile for all projects (so no one gets it, yet)\r\n\r\n\r\n### Examples\r\nEach sub-project is selectable within `sbt`; alternatively sub-projects may prefix the task. The projects are:\r\n```shell\r\nsbt:root> projects\r\n[info] In file:...\r\n[info] \t   comm\r\n[info] \t   node\r\n[info] \t   rholang\r\n[info] \t * root\r\n[info] \t   storage\r\n```\r\n#### Rholang\r\n```shell\r\n$ sbt\r\n...\r\n[info] sbt server started at local:...\r\nsbt:root> project rholang\r\n[info] Set current project to rholang (in build file:.../src/crypto/rchain/rchain/)\r\nsbt:rholang> bnfc:clean\r\n[success] Total time: 0 s, completed Feb 9, 2018 8:29:28 PM\r\nsbt:rholang> bnfc:generate\r\n\r\n98 rules accepted\r\n\r\n   (Tested with  JFlex 1.4.3 )\r\n   (Parser created only for category Contr)\r\n   (Tested with  CUP 0.10k )\r\nwriting new file .../rholang/src/main/java/coop/rchain/rholang/syntax/rholang/Absyn/Contr.java\r\n...\r\n148 states before minimization, 124 states in minimized DFA\r\nWriting code to \".../rchain/rholang/src/main/java/coop/rchain/rholang/syntax/rholang/Yylex.java\"\r\n...\r\n86 rules accepted\r\n...\r\n[success] Total time: 1 s, completed Feb 9, 2018 8:29:34 PM\r\nsbt:rholang> assembly\r\n[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list\r\n[info] Including from cache: sbt-dependency-graph-0.9.0.jar\r\n[info] Including from cache: slf4j-api-1.7.25.jar\r\n...\r\n[info] CompilerTests:\r\n[info] - tests/comparison_test.rho\r\n[info] - tests/contract_invocation.rho\r\n...\r\n[info] - should Compile as GString\r\n[info] GroundUri\r\n[info] - should Compile as GUri\r\n[info] BoolMatcherSpec:\r\n[info] BoolTrue\r\n[info] - should Compile as GBool(true)\r\n[info] BoolFalse\r\n[info] - should Compile as GBool(false)\r\n[info] Run completed in 1 second, 33 milliseconds.\r\n[info] Total number of tests run: 25\r\n[info] Suites: completed 5, aborted 0\r\n[info] Tests: succeeded 25, failed 0, canceled 0, ignored 0, pending 0\r\n[info] All tests passed.\r\n[info] Checking every *.class/*.jar file's SHA-1.\r\n[info] Merging files...\r\n[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'\r\n[warn] Merging 'META-INF/maven/ch.qos.logback/logback-classic/pom.properties' with strategy 'discard'\r\n[warn] Merging 'META-INF/maven/ch.qos.logback/logback-classic/pom.xml' with strategy 'discard'\r\n[warn] Merging 'META-INF/maven/ch.qos.logback/logback-core/pom.properties' with strategy 'discard'\r\n[warn] Merging 'META-INF/maven/ch.qos.logback/logback-core/pom.xml' with strategy 'discard'\r\n[warn] Merging 'META-INF/maven/org.slf4j/slf4j-api/pom.properties' with strategy 'discard'\r\n[warn] Merging 'META-INF/maven/org.slf4j/slf4j-api/pom.xml' with strategy 'discard'\r\n[info] Strategy 'deduplicate' was applied to 22 files (Run the task at debug level to see details)\r\n[warn] Strategy 'discard' was applied to 7 files\r\n[info] Packaging rholang/target/scala-2.12/rholang-assembly-0.1.0-SNAPSHOT.jar ...\r\n[info] Done packaging.\r\n[success] Total time: 4 s, completed Feb 9, 2018 8:29:41 PM\r\n```\r\nand the assembly still runs\r\n```shell\r\n$ java -jar rholang/target/scala-2.12/rholang-assembly-0.1.0-SNAPSHOT.jar rholang/examples/hello_world_again.rho \r\ncompiled rholang/examples/hello_world_again.rho to rholang/examples/hello_world_again.rbl\r\n$ cat rholang/examples/hello_world_again.rbl; echo\r\n(let [[helloworld (generateFresh \"helloworld\")]] (block ( (proc [] (run (compile (let [[[[Rholang299c65db145b]] (consume t [helloworld] [['world]] #t)]] ( (proc [[world]] (let [[[Rholang56b844bc1baa] (consume t [world] ['msg] #f)]] ( (proc [[[msg]]] (seq (print msg) (display #\\\\n))) [Rholang56b844bc1baa]))) [Rholang299c65db145b])))))) (let [[world (generateFresh \"world\")] [world2 (generateFresh \"world2\")]] (block (block (block (produce t helloworld world) (produce t world \"Hello World\")) (produce t helloworld world2)) (produce t world2 \"Hello World again\")))))\r\n$ \r\n```\r\n\r\n#### Node\r\nSimilarly, with the comms main pulled out into node, the assembly builds and runs. The `node` project depends on `comm`, so clean that out for kicks.\r\n```\r\nsbt:root> comm / clean\r\n[success] Total time: 0 s, completed Feb 9, 2018 8:36:39 PM\r\n```\r\nAssemble the node jar\r\n```\r\nsbt:root> node / assembly\r\n[info] Updating comm...\r\n[info] Done updating.\r\n[info] Updating node...\r\n[info] Done updating.\r\n[info] Compiling 2 protobuf files to .../comm/target/scala-2.12/src_managed/main,.../comm/target/scala-2.12/src_managed/main\r\n[info] Compiling schema .../comm/src/main/protobuf/coop/rchain/comm/protocol/routing.proto\r\n[info] Compiling schema .../comm/src/main/protobuf/coop/rchain/comm/protocol/p2p.proto\r\nprotoc-jar: protoc version: 340, detected platform: linux/amd64\r\nprotoc-jar: executing: [/tmp/protocjar1627693794844218892/bin/protoc.exe, --plugin=protoc-gen-scala=/tmp/protocbridge4263553812881026912, --java_out=:.../comm/target/scala-2.12/src_managed/main, --scala_out=java_conversions,grpc:.../comm/target/scala-2.12/src_managed/main, -I.../comm/src/main/protobuf, -I.../comm/target/protobuf_external, .../comm/src/main/protobuf/coop/rchain/comm/protocol/routing.proto, .../comm/src/main/protobuf/coop/rchain/comm/protocol/p2p.proto]\r\n[info] Compiling protobuf\r\n[info] Protoc target directory: .../comm/target/scala-2.12/src_managed/main\r\n[info] Protoc target directory: .../comm/target/scala-2.12/src_managed/main\r\n[info] Compiling 26 Scala sources and 88 Java sources to comm/target/scala-2.12/classes ...\r\n...\r\n[info] Packaging node/target/scala-2.12/node-assembly-0.1.jar ...\r\n[info] Done packaging.\r\n[success] Total time: 16 s, completed Feb 9, 2018 8:36:57 PM\r\nsbt:root>\r\n```\r\nand try it out\r\n```\r\n$ java -jar node/target/scala-2.12/node-assembly-0.1.jar --help\r\nRChain Communications Library version 0.1\r\n  -b, --bootstrap  <arg>   Bootstrap rnode address for initial seed.\r\n  -h, --host  <arg>        Hostname or IP of this node.\r\n  -n, --name  <arg>        Node name or key.\r\n  -p, --port  <arg>        Network port to use.\r\n  -s, --standalone         Start a stand-alone node (no bootstrapping).\r\n      --help               Show help message\r\n      --version            Show version of this program\r\n```\r\nObviously, there's some messaging work required. Running for real:\r\n```\r\n$ java -jar node/target/scala-2.12/node-assembly-0.1.jar\r\n20:39:31.664 [main] INFO main - uPnP: Some(/10.0.0.9) -> Some(192.168.0.101)\r\n20:39:31.770 [main] INFO main - Listening for traffic on #{Network rnode://752ace74f7f744bfa4de3bda135bdf86@10.0.0.9:30304}.\r\n20:39:31.771 [main] INFO main - Bootstrapping from rnode://0f365f1016a54747b384b386b8e85352@216.83.154.106:30012.\r\n20:39:31.772 [main] DEBUG p2p - connect(): Connecting to #{PeerNode 0f365f1016a54747b384b386b8e85352}\r\n20:39:31.998 [main] DEBUG p2p - connect(): Received encryption handshake response from #{PeerNode 0f365f1016a54747b384b386b8e85352}.\r\n```\r\n\r\nDockerization survived this, too:\r\n```\r\nsbt:root> node / docker\r\n[info] Including from cache: JLex.jar\r\n[info] Including from cache: scala-logging_2.12-3.7.2.jar\r\n[info] Including from cache: java-cup-11b-runtime.jar\r\n...\r\n[warn] Merging 'META-INF/maven/org.slf4j/slf4j-api/pom.properties' with strategy 'discard'\r\n[warn] Merging 'META-INF/maven/org.slf4j/slf4j-api/pom.xml' with strategy 'discard'\r\n[info] Strategy 'deduplicate' was applied to 22 files (Run the task at debug level to see details)\r\n[warn] Strategy 'discard' was applied to 27 files\r\n[info] Assembly up to date: .../node/target/scala-2.12/node-assembly-0.1.jar\r\n[info] Sending build context to Docker daemon  39.38MB\r\n[info] Step 1/5 : FROM openjdk:8u151-jre-alpine\r\n[info]  ---> a7441b26c41b\r\n[info] Step 2/5 : ADD 0/node-assembly-0.1.jar /node-assembly-0.1.jar\r\n[info]  ---> cc0cec8a5f2b\r\n[info] Step 3/5 : ENV RCHAIN_TARGET_JAR=\"/node-assembly-0.1.jar\"\r\n[info]  ---> Running in 7d61280cabd0\r\n[info] Removing intermediate container 7d61280cabd0\r\n[info]  ---> 4de44f688e38\r\n[info] Step 4/5 : ADD 1/main.sh /bin\r\n[info]  ---> 56efc381cba8\r\n[info] Step 5/5 : ENTRYPOINT [\"\\/bin\\/main.sh\"]\r\n[info]  ---> Running in d13efa8f9df3\r\n[info] Removing intermediate container d13efa8f9df3\r\n[info]  ---> 078e299bec43\r\n[info] Successfully built 078e299bec43\r\n[info] Tagging image 078e299bec43 with name: coop.rchain/coop.rchain-node:latest\r\n[info] Tagging image 078e299bec43 with name: coop.rchain/coop.rchain-node:v0.1.0-SNAPSHOT\r\n[success] Total time: 3 s, completed Feb 9, 2018 8:38:08 PM\r\n```\r\nbut did it really?\r\n```\r\n$ docker inspect coop.rchain/coop.rchain-node:latest | jq '.[].Id'\r\n\"sha256:078e299bec438da81c85217e2de44044cd69529223d75d5060b23230bfc1bb4b\"\r\n```\r\nyes, and it still runs\r\n```\r\n$ docker run -ti coop.rchain/coop.rchain-node:latest\r\n04:45:43.419 [main] INFO main - uPnP: None -> None\r\n04:45:43.553 [main] INFO main - Listening for traffic on #{Network rnode://19c03b786230453898fc2a7bc2cd9210@172.17.0.2:30304}.\r\n04:45:43.553 [main] INFO main - Bootstrapping from rnode://0f365f1016a54747b384b386b8e85352@216.83.154.106:30012.\r\n04:45:43.555 [main] DEBUG p2p - connect(): Connecting to #{PeerNode 0f365f1016a54747b384b386b8e85352}\r\n04:45:43.827 [main] DEBUG p2p - connect(): Received encryption handshake response from #{PeerNode 0f365f1016a54747b384b386b8e85352}.\r\n04:45:43.868 [main] DEBUG p2p - connect(): Received protocol handshake response from #{PeerNode 0f365f1016a54747b384b386b8e85352}.\r\n^C04:45:48.108 [shutdownHook1] INFO main - Goodbye.\r\n$\r\n```\r\n\r\nOPS-65 CORE-135 CORE-155"},"comment":{"url":"https://api.github.com/repos/rchain/rchain/issues/comments/364964070","html_url":"https://github.com/rchain/rchain/pull/255#issuecomment-364964070","issue_url":"https://api.github.com/repos/rchain/rchain/issues/255","id":364964070,"user":{"login":"nashef","id":9731659,"avatar_url":"https://avatars0.githubusercontent.com/u/9731659?v=4","gravatar_id":"","url":"https://api.github.com/users/nashef","html_url":"https://github.com/nashef","followers_url":"https://api.github.com/users/nashef/followers","following_url":"https://api.github.com/users/nashef/following{/other_user}","gists_url":"https://api.github.com/users/nashef/gists{/gist_id}","starred_url":"https://api.github.com/users/nashef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nashef/subscriptions","organizations_url":"https://api.github.com/users/nashef/orgs","repos_url":"https://api.github.com/users/nashef/repos","events_url":"https://api.github.com/users/nashef/events{/privacy}","received_events_url":"https://api.github.com/users/nashef/received_events","type":"User","site_admin":false},"created_at":"2018-02-12T15:49:17Z","updated_at":"2018-02-12T15:49:17Z","author_association":"COLLABORATOR","body":"To make the CI work, you have to update `scripts/build-subproject.sh`. It's a very simple shell script that you can easily modify to make work with this update. I think you will have to include it here to get the Travis checks to pass."}}
{"actor":{"display_login":"nashef"}}