daml/bazel_tools
Samir Talwar d3106682dd
Add a REPL for each Scala target, for debugging. (#9643)
* Add a REPL for each Scala target, for debugging.

For each Scala library target, this adds a `*_repl` target that can be
built and run to provide a Scala REPL with access to the library and all
its dependencies.

To use:

```
$ bazel build //ledger/ledger-on-memory:ledger-on-memory_repl
INFO: Invocation ID: f1c4ec07-68e7-4bc2-a182-40f6ea035110
INFO: Analyzed target //ledger/ledger-on-memory:ledger-on-memory_repl (32 packages loaded, 714 targets configured).
INFO: Found 1 target...
Target //ledger/ledger-on-memory:ledger-on-memory_repl up-to-date:
  bazel-bin/ledger/ledger-on-memory/ledger-on-memory_repl.jar
  bazel-bin/ledger/ledger-on-memory/ledger-on-memory_repl
INFO: Build completed successfully, 7 total actions

$ ./bazel-bin/ledger/ledger-on-memory/ledger-on-memory_repl
Welcome to Scala 2.12.13 (OpenJDK 64-Bit Server VM, Java 1.8.0_272).
Type in expressions for evaluation. Or try :help.

scala> import scala.concurrent.ExecutionContext.Implicits.global
scala> import com.google.protobuf.ByteString
scala> import com.daml.ledger.on.memory._
scala> import com.daml.ledger.participant.state.kvutils.OffsetBuilder
scala> import com.daml.ledger.participant.state.kvutils.Raw
scala> import com.daml.ledger.participant.state.kvutils.api.LedgerRecord

scala> val state = InMemoryState.empty
state: com.daml.ledger.on.memory.InMemoryState = com.daml.ledger.on.memory.InMemoryState@ff21443

scala> state.write { (log, state) => Future { log += LedgerRecord(OffsetBuilder.fromLong(1), Raw.LogEntryId(ByteString.copyFromUtf8("A")), Raw.Envelope(ByteString.EMPTY)) } }
```

The REPL target has the tag "manual", so will only be built on demand.

CHANGELOG_BEGIN
CHANGELOG_END

* Turns out you can run a REPL with `bazel run`.
2021-05-11 14:11:58 +00:00
..
client_server Draw the rest of the Scala 2.13 owl (#8852) 2021-02-15 19:20:24 +00:00
dev_env_tool update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
java_testing update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
packaging fix: set LOCAL_ARCHIVE when unset (#8627) 2021-01-26 15:52:24 +01:00
runfiles Upgrade scalafmt and enable trailing commas (#8437) 2021-01-09 11:37:37 +01:00
sh update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
absl-mingw.patch Upgrade gRPC C library (#8693) 2021-02-01 16:11:06 +01:00
build_environment.bzl update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
BUILD.bazel Upgrade Scala 2.12 to v2.12.13. (#9280) 2021-03-30 11:02:18 +00:00
create_workspace.bzl update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
fat_cc_library.bzl Upgrade to Bazel 4.0 (#8798) 2021-02-11 10:08:47 +01:00
ghc_dwarf.bzl update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
grpc-bazel-apple.patch Pin rules_apple (#6845) 2020-07-24 09:47:05 +02:00
grpc-bazel-mingw.patch Upgrade gRPC C library (#8693) 2021-02-01 16:11:06 +01:00
grpc-haskell-core-cpp-options.patch Replace Hazel by stack_snapshot (#2743) 2019-11-22 14:24:08 +00:00
grpc-haskell-core-upgrade.patch Upgrade gRPC C library (#8693) 2021-02-01 16:11:06 +01:00
haskell_proto3_suite_deriving_defaults.patch Disable deriving-defaults per file (#8684) 2021-01-29 11:01:55 +00:00
haskell-c2hs.patch Building c2hs (#355) 2019-04-10 15:12:08 +02:00
haskell-cc-wrapper-windows.patch Switch to GHC 8.10.3 (#8394) 2021-01-25 11:53:53 +00:00
haskell-ghcide-binary-q.patch Enable assertions in Haskell builds (#6853) 2020-07-24 14:29:25 +00:00
haskell-ghcide-expose-compat.patch Bump ghcide (#5103) 2020-03-20 16:43:59 +00:00
haskell-hie-bios.patch Bump ghc-ghcide (#2936) 2019-09-18 10:29:02 +02:00
haskell-js-dgtable.patch Embed shake data-files via TH (#4584) 2020-02-18 17:53:27 +01:00
haskell-js-flot.patch Embed shake data-files via TH (#4584) 2020-02-18 17:53:27 +01:00
haskell-js-jquery.patch Embed shake data-files via TH (#4584) 2020-02-18 17:53:27 +01:00
haskell-lsp-test-no-reexport.patch Upgrade ghcide and haskell-lsp (#3499) 2019-11-18 10:56:19 +00:00
haskell-opt.patch upgrade rules_haskell (#6284) 2020-06-10 17:21:31 +02:00
haskell-shake.patch Embed shake data-files via TH (#4584) 2020-02-18 17:53:27 +01:00
haskell-strict-source-names.patch Update rules_haskell (#8987) 2021-03-03 10:40:26 +01:00
haskell-windows-extra-libraries.patch Switch to GHC 8.10.3 (#8394) 2021-01-25 11:53:53 +00:00
haskell-windows-remove-fake-libs.patch Switch to GHC 8.10.3 (#8394) 2021-01-25 11:53:53 +00:00
haskell-zip.patch Patch zip library to not use temp files (#5621) 2020-04-20 08:35:11 +00:00
haskell.bzl Switch to GHC 8.10.3 (#8394) 2021-01-25 11:53:53 +00:00
hlint.bzl update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
java.bzl update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
javadoc_library.bzl update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
nixpkgs-disable-http2.patch upgrade rules_nixpkgs (#8078) 2020-11-30 14:36:46 +00:00
oracle.bzl Switch to an environment variable for enabling Oracle tests. (#9511) 2021-04-27 11:50:39 +00:00
os_info.bzl update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
pkg.bzl update copyright notices for 2021 (#8257) 2021-01-01 19:49:51 +01:00
pom_file.bzl More Scala 2.13 cleanup (#8855) 2021-02-16 09:39:16 +00:00
pom_template.xml rename master to main (#8245) 2020-12-27 14:19:07 +01:00
proto.bzl Fix protobuf structure for empty import prefix (#8986) 2021-03-02 17:26:34 +01:00
protobuf-win32.patch Upgrade grpc and protobuf libraries (#8558) 2021-01-26 14:17:18 +00:00
remote_apis_no_services.patch Clean broken entries from the Bazel cache (#8668) 2021-01-28 17:57:09 +00:00
rules_nodejs_bash.patch open-sourcing daml 2019-04-04 09:33:38 +01:00
rules_nodejs_node_dependency.patch Enforce a dependency on node_nix (#6035) 2020-05-19 16:58:00 +00:00
rules_nodejs_npm_cli_path.patch Bazelify daml json types (#4110) 2020-01-20 15:02:33 +00:00
rules_scala_suite_tags.patch Pass along tags in da_scala_test_suite (#9521) 2021-04-28 09:14:27 +02:00
rules-nixpkgs-llvm-cov.patch Upgrade to Bazel 4.0 (#8798) 2021-02-11 10:08:47 +01:00
scala_version.bzl Upgrade to Scala 2.13.5 (#9528) 2021-04-29 13:05:57 +00:00
scala-escape-jvmflags.patch Upgrade rules_scala (#6883) 2020-07-28 08:53:12 +00:00
scala.bzl Add a REPL for each Scala target, for debugging. (#9643) 2021-05-11 14:11:58 +00:00