Commit Graph

602 Commits

Author SHA1 Message Date
Robin Krom
678a8eef71
Replace yarn with npm (#7222)
* replace yarn with npm in docs

CHANGELOG_BEGIN
CHANGELOG_END

* updating assistant and compatibility tests

* moved gitignore entry to toplevel
2020-09-08 12:07:04 +02:00
Samir Talwar
30564a7c90
ledger-api-client: Add test cases for LedgerClient. (#7195)
* ledger-api-client: Add integration tests for the simple stuff.

* sandbox-common: Make `SandboxFixtureWithAuth` a mixin.

This makes it useful with `SandboxNextFixture` as well as
`SandboxFixture`.

Also, add types to non-private fields and methods, and make more fields
protected rather than public.

* ledger-api-client: Add tests to make sure the token is passed through.

CHANGELOG_BEGIN
CHANGELOG_END

* sandbox-common: Tokens are for auth, not auth.
2020-08-20 15:00:32 +00:00
curiousleo-da
8f0970c098
Shebang: use #!/usr/bin/env bash (#7149)
Fixes //language-support/ts/codegen/tests:build-and-lint-test on NixOS.

changelog_begin
changelog_end

Co-authored-by: Leonhard Markert <curiousleo@users.noreply.github.com>
2020-08-17 12:19:18 +02:00
Moritz Kiefer
bb00af0b0b
Unflake build-and-lint ts codegen tests (#7111)
The issue in #6940 has been fixed so in theory this should no longer
fail or at least fail with a different error that we haven’t seen yet
:)

changelog_begin
changelog_end
2020-08-13 12:06:14 +02:00
Leonid Rozenberg
6267950cc1
Add a useFetch. (#7091)
* Add a useFetch.

CHANGELOG_BEGIN
Add a useFetch hook to the @daml/react bindings for when the user knows
a contractId.
CHANGELOG_END

* Update language-support/ts/daml-react/defaultLedgerContext.ts

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-08-12 12:38:07 +02:00
Robin Krom
532676c688
language: daml-ledger: deal with null offsets (#7084)
We allow the `offset` field of a websocket message send in response to a
`streamQuery` request to be `null`. Previously this would cause an
exception to be thrown.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-11 13:54:51 +00:00
Samir Talwar
27f76c4386
Use Future.unit instead of Future.successful(()). (#7080)
And in one instance, `Resource.unit`.

I just think it's easier to read. Too many parentheses make Samir a dull
boy.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-11 09:18:50 +00:00
Samir Talwar
5ac7dfbe78
language-support/ts/codegen: Mark the tests as flaky. (#7082)
Unfortunately, we still have an error that's cropping up fairly
persistently. While we know what the problem is, until this is fixed,
I'd like to mark the tests as `flaky` to make sure that other builds
aren't held up.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-11 09:15:03 +00:00
Gary Verhaegen
23a46e55ec
let users stop listening to event streams (#7072)
I have to imagine this is a typo: there currently is no way to
unsubscribe from a stream without closing it, as the `off` method we
expose actually redirects to an `on` method internally, which means that
instead of the method no longer being called, it now gets called twice
(or rather, one more time) on each event.

That seems a bit rude.

CHANGELOG_BEGIN

- [JavaScript Client Libraries] Bugfix: calling the `off` method of
  event streams returned by `streamQuery` and `streamFetchByKey` now
  correctly removes the given listener, rather than adding it again.

CHANGELOG_END
2020-08-10 16:36:49 +02:00
Stephen Compall
96624a7677
use -Ywarn-unused for all Scala code (#6907)
* add -Ywarn-unused to all scalac options

* remove some unused arguments

* remove some unused definitions

* remove some unused variable names

* suppress some unused variable names

* changeExtension doesn't use baseName

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* work around no plugins in scenario interpreter perf tests

* remove many more unused things

* remove more unused things, restore some used things

* remove more unused things, restore a couple signature mistakes

* missed import

* unused argument

* remove more unused loggingContexts

* some unused code in triggers

* some unused code in sandbox and kvutils

* some unused code in repl-service and daml-script

* some unused code in bindings-rxjava tests

* some unused code in triggers runner

* more comments on silent usages

- suggested by @cocreature; thanks

* fix missing reference in TestCommands

* more unused in triggers

* more unused in sandbox

* more unused in daml-script

* more unused in ledger-client tests

* more unused in triggers

* more unused in kvutils

* more unused in daml-script

* more unused in sandbox

* remove unused in ledger-api-test-tool

* suppress final special case for codegen unused warnings

.../com/daml/sample/mymain/ContractIdNT.scala:24: warning: parameter value ev 0 in method ContractIdNT Value is never used
      implicit def `ContractIdNT Value`[a_a1dk](implicit `ev 0`: ` lfdomainapi`.Value[a_a1dk]): ` lfdomainapi`.Value[_root_.com.daml.sample.MyMain.ContractIdNT[a_a1dk]] = {
                                                         ^
.../com/daml/sample/mymain/ContractIdNT.scala:41: warning: parameter value eva_a1dk in method ContractIdNT LfEncodable is never used
      implicit def `ContractIdNT LfEncodable`[a_a1dk](implicit eva_a1dk: ` lfdomainapi`.encoding.LfEncodable[a_a1dk]): ` lfdomainapi`.encoding.LfEncodable[_root_.com.daml.sample.MyMain.ContractIdNT[a_a1dk]] = {
                                                               ^

* one more unused in daml-script

* special scaladoc rules may need silencer, too

* unused in compatibility/sandbox-migration

* more commas, a different way to `find`

- suggested by @remyhaemmerle-da; thanks
2020-08-07 13:16:09 -04:00
Stephen Compall
4c0dff1dc4
avoid generating unused warnings in Scala codegen (#7031)
* help Scala codegen output by passing actor along

* don't generate unused ` view` variables

* macroexpansion replaces _ with a variable name; avoid this

* be explicit about scope of generated PackageIDs object, to avoid warning

* remove silent annotations, which aren't used yet

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-05 20:45:58 +00:00
Andreas Herrmann
cf24597e70
Factor out reproducibility flags for tar and gzip (#6884)
* Factor out tar/gzip reproducibility flags

* use mktgz in package-app

* Bazel managed tar/gzip

* Remove quiet = True

As stated in the comment this is no longer required with Bazel >= 3.0.

* Build package-app as a sh_binary

This way Bazel will manage the runtime dependencies tar, gzip, mktgz,
and patchelf.

package-app.sh changes directory so it needs to make sure that all paths
are absolute and that the runfiles tree/manifest location is forwarded
to programs called by package-app.sh.

* Avoid file path too long errors

* Fix readlink -f on MacOS

* Document abspath

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-05 14:27:14 +00:00
Stephen Compall
2d5e714b5e
remove unused definitions, params, args from codegen and bindings Scala code (#6981)
CHANGELOG_BEGIN
CHANGELOG_END
2020-08-04 14:56:33 +00:00
Samir Talwar
ab8a77d38d
language-support/scala: Remove unused docs. (#6954)
We seem to have some old, out-of-date documentation lying around. Let's
remove it.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-04 09:30:52 +00:00
Andreas Herrmann
8e706a9bde
Remove vendored pkg_tar (#6934)
* Use Bazel builtin pkg_tar rule

* Use @rules_pkg//:pkg.bzl%pkg_tar

The pkg_tar rule builtin to Bazel has been deprecated.
See https://docs.bazel.build/versions/master/be/pkg.html

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-30 15:53:16 +00:00
Stephen Compall
fd07a26510
check for scaladoc comments that are not actually used (#6802)
* add -Xlint:doc-detached

- reverts 1feae964e3 from #6798

* attach several scaladocs where they'll actually be included

* no changelog

* attach several more scaladocs where they'll actually be included

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-28 20:32:30 +00:00
Moritz Kiefer
a0e7e8f5dd
Fix flakiness in build-and-lint tests (again) (#6905)
This fixes 3 issues:

1. Switch the order in which we assign to `$proc` and
   `waitOn`. Without this the cleanup will not do anthing if `beforeAll`
   fails since the variable has not been assigned. This results in jest
   hanging forever until we hit the Bazel timeout.

2. Increase the timeout on `beforeAll` since we occasionally hit this
   on CI.

3. Allocate 2 CPUs to reflect the number of resources required by this test.

changelog_begin
changelog_end
2020-07-28 21:15:14 +02:00
Samir Talwar
914c4513d3
ts/codegen: Mark the tests as flaky. (#6903)
They seem to break a lot.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-28 18:45:04 +02:00
Martin Huschenbett
3991c8a357
daml2js: Add decoder test for recursive records (#6899)
This is a follow-up on #6898.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-28 14:10:41 +00:00
Martin Huschenbett
960d7ba628
daml2js: Use jtv.lazy as the only loop break (#6898)
We currently use two different mechanisms for breaking loops in the
`Serializable` companion objects generated for each type:

1. Explicit thunks of the form `() => Decoder<A>`, e.g., in the
   definition of the `Serializable` interface itself.
2. the `lazyMemo` combinator, e.g. in enum types, `Optional`s and lists.

This is inconsistent and leads to the introduction of more loop
breakers than actually needed.

This PR changes the situation to use the `lazyMemo` combinator as the
only loop breaker. To this end, we change the definition of the
`Serializable` interface and related similar interfaces to use `Decoder`
directly rather than the thunked up version. This is a *breaking change*
of the affected interfaces. However, the libraries `@daml/ledger` and
`@daml/react` are updated accordingly and hence nothing breaks when
using `daml2js` in combination with these libraries. Furthermore, the
exact definition of the decoder types is considered an implementation
detail since we don't want to tie ourselves long-term to the use of the
`json-type-validation` library, which is mostly unmaintained.

Using `lazy` as the only loop breaker effectively pushes all loop
breakers to the top-level and allows for removing those nested more
deeply in types.

This change should not negatively impact the performance of the
decoding process since it only replaces thunks by memoized thunks and
removes a few calls to `lazyMemo` completely. In fact, we should gain
performance since the decoders in the companion objects are now
memoized.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-28 15:35:35 +02:00
Martin Huschenbett
11c4fe0727
daml2js: Memoize lazily constructed decoders (#6892)
Currently, if you have a record type `T` with a field of type, say,
`Optional S` and you're decoding a list of type `[T]`, then the decoder
for `S` has to be reconstructed for each element of the list. This is
because the `lazy` combinator from the `json-type-validation` does not
memoize the decoder it receives as a thunk.

This PR adds a new combinator `lazyMemo` which behaves like `lazy` but
also memoizes the decoder on its first invocation. All use sites of the
old `lazy` combinator are then replaced with `lazyMemo`.

We could consider upstreaming `lazyMemo` but I'm not sure how much
effort this is given that `json-type-validation` seems to be in
maintenance mode rather than active development.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-28 11:44:29 +00:00
Moritz Kiefer
f588eac0c4
Fix version of @bazel/typescript (#6889)
Not quite sure why this didn’t fail on the PR but now it complains
that the version of @bazel/typescript and rules_nodejs are
incompatible.

changelog_begin
changelog_end
2020-07-28 06:40:32 +00:00
Martin Huschenbett
09c2cb89e8
daml2js: Push the lazy combinator further outward (#6878)
Currently, the decoders for the container types `List` and `TextMap` use
`jtv.lazy` _within_ their container decoders `jtv.array` and `jtv.dict`.
Since `jtv.lazy` does not memoize its result, this has the disadvantage
that the thunk producing the decoder for the element type is invoked
for each element of the container rather than once for the whole
container. This is a potential performance bottleneck.

This PR moves the use of `jtv.lazy` one level further out in oder to
avoid the potential performance issues without adding any further
downsides.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-27 16:59:00 +02:00
Moritz Kiefer
2c10c4444b
Extend daml new to accept template as an option (#6877)
* Extend `daml new` to accept template as an option

The two positional arguments keep confusing users so this PR changes
things to allow the template to be passed via `--template`. Using a
positional argument still works so this is not breaking.

I’ve updated all docs to use the less confusing syntax.

changelog_begin

- [DAML Assistant] You can now use ``daml new project-name
  --template=template-name`` instead of ``daml new project-name
  template-name``. The old CLI syntax continues to be supported.

changelog_end

* Update docs/source/getting-started/index.rst

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-07-27 16:30:48 +02:00
Martin Huschenbett
b7d0e02b5f
daml2js: Add more tests for recursive types (#6871)
I think testing that constructing the decoders doesn't loop deserves
its own very targeted test on top of the more intergration style test
we already have.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-27 10:57:11 +00:00
Samir Talwar
98de16606d
daml-on-sql: An elegant Main class, for a more civilized age. (#6829)
* daml-on-sql: Pull out a new `Main` object that wraps sandbox-classic.

CHANGELOG_BEGIN
CHANGELOG_END

* daml-on-sql: Fail if a JDBC URL is not provided or not for PostgreSQL.

* sandbox-classic: Rename the conformance test H2 database.

* daml-on-sql + sandbox-classic: Report configuration errors cleanly.

This means letting `ProgramResource` catch the errors, log, and exit.

* daml-on-sql: Change the name logged on startup.

* daml-on-sql: Change the default participant ID.

* sandbox-common: Give the ledger name its own tagged string type.

* sandbox-classic: Generate random ledger IDs using the ledger name.

* daml-on-sql: Remove the banner, replacing it with a blank line.

* daml-on-sql: Enable strong seeding by default.

And weak seeding in the conformance tests.

* sandbox-classic: Move the ledger name to a separate parameter.

It's not really configurable.

* sandbox-classic: Move LedgerName from sandbox-common.

* daml-on-sql: Remove "-participant" from the participant ID.

* daml-on-sql: Use `Name` where possible.

* daml-on-sql: Make the ledger ID mandatory.

* Revert "sandbox-classic: Move LedgerName from sandbox-common."

This reverts commit 0dad1584a7.

* daml-on-sql: Print "DAML-on-SQL" in the CLI help, not "Sandbox".

* daml-on-sql + sandbox + sandbox-classic: Split out custom CLI parsing. (#6846)

* participant-state: Simplify naming the seeding modes.
2020-07-24 18:54:19 +00:00
Moritz Kiefer
21a16eef8a
Fix decoding of recursive types in daml-types (#6834)
The examples and the comment are hopefully obvious enough. Builtin
types can also produce terminating recursion so we need to make them
lazy.

changelog_begin

- [@daml/daml-types library] Fix an issue where some recursive types
  resulted in a stackoverflow.

changelog_end
2020-07-22 20:03:25 +02:00
Moritz Kiefer
f23293a5e8
Fix flakiness in TS build-and-lint tests (#6822)
This PR bumps the akka request timeout in the JSON API which we hit
occasionally in the tests which leads to a 503 error
and the tests timing out.

In addition to bumping the timeout, I’ve also changed the logback file
of the JSON API so we don’t get tons and tons of netty debugging
output and updated the token format since the JSON API warns about the
outdated one.

changelog_begin
changelog_end
2020-07-22 18:01:09 +02:00
Samir Talwar
adcbfb45a1
sandbox-classic: Move the configuration from sandbox-common. (#6810)
* sandbox-common: Move the ledgerIdMode up in the configuration.

* sandbox-classic: Move the configuration from sandbox-common.

CHANGELOG_BEGIN
CHANGELOG_END

* Fix miscellaneous warnings caught by IntelliJ IDEA.
2020-07-21 14:43:53 +00:00
Stephen Compall
4355406259
add more scalac 2.12 warnings (#6798)
* set many extra scalac -Xlint options for all Scala projects

CHANGELOG_BEGIN
CHANGELOG_END

* move NoCopy to its own file

package.scala:18: warning: it is not recommended to define classes/objects inside of package objects.
If possible, define trait NoCopy in package data instead.
  trait NoCopy {
        ^

* move more traits, classes, and objects to proper packages

- note that `package` is itself a scoping construct, so if your reason
  is the apparent aesthetic of placing a bunch of things in one `package
  object`, that is easily remedied by deleting the `object` keyword

* fix some type-parameter-shadow warnings

- I'm generally in favor of sensible name-shadowing, following the
  "deliberately hide variables that should not be accessed here" school
  of thought.  But I think type name shadowing isn't quite as valuable
  and more likely to confuse than general variable shadowing, so have
  experimentally linted it out.

  Example warning:

EventsTableFlatEventsRangeQueries.scala:11: warning: type parameter
 Offset defined in trait EventsTableFlatEventsRangeQueries shadows class
 Offset defined in package v1. You may want to rename your type
 parameter, or possibly remove it.
private[events] sealed trait EventsTableFlatEventsRangeQueries[Offset] {
                                                               ^

* fix more package-object-classes warnings

* fix an inaccessible warning

ContractsService.scala:197: warning: method searchDb in class ContractsService references private class ContractsFetch.
Classes which cannot access ContractsFetch may be unable to override searchDb.
  def searchDb(dao: dbbackend.ContractDao, fetch: ContractsFetch)(
      ^

* enable -Xlint:infer-any

- continuing the saga of #6116, #6132

* enable -explaintypes for more detailed type errors

* missed header for NoCopy; probably should have left it in the package file

* misspelling in comment

* revert -Xlint:doc-detached

- there are a lot of these fixes, and they are noisy, so shifting to a
  separate PR
- thanks to @leo-da for pointing out
2020-07-21 08:18:01 -04:00
Robert Autenrieth
7ce9748066
Split sandbox code into separate packages (#6695)
* Move public code into daml-integration-api

CHANGELOG_BEGIN
[DAML Integration Kit]: Removed sandbox specific code from the API intended to be used by ledger integrations. Use the maven coordinates ``com.daml:participant-integration-api:VERSION`` instead of ``com.daml:ledger-api-server`` or ``com.daml:sandbox``.
CHANGELOG_END
2020-07-17 17:06:06 +02:00
dependabot[bot]
2904a5d236
Bump lodash from 4.17.15 to 4.17.19 in /language-support/ts/packages (#6779)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

changelog_begin
changelog_end

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-17 13:54:13 +00:00
Moritz Kiefer
96216557ab
Undo lodash hack (#6771)
lodash released a non-broken version now and while dependabot isn’t
smart enough to realize this one has a vulnerability it still seems
like a good idea to bump it.

changelog_begin
changelog_end
2020-07-17 12:01:23 +00:00
Moritz Kiefer
4ac0a47c81
Fix typing of nested decoders in daml2js (#6729)
I accidentally broke this when I added the types (very sorry about
that). Unfortunately while the tests should actually have caught this,
they didn’t because they are also broken. The `&&` results in bash
assuming the exit code is handled and `set -e` doesn’t kick in so
despite an error things proceeded just fine.

The change turns
```
  Add2: (<a_a1Ag>(a_a1Ag: damlTypes.Serializable<a_a1Ag>) => damlTypes.Serializable<Expr2.Add2>);
```
into
```
  Add2: (<a_a1Ag>(a_a1Ag: damlTypes.Serializable<a_a1Ag>) => damlTypes.Serializable<Expr2.Add2<a_a1Ag>>);
```

which is obviuosly what we want and also fixes the test. I did verify
that the tests fail afterwards without the change to daml2js.

changelog_begin
changelog_end
2020-07-14 19:22:55 +00:00
Gary Verhaegen
8176fb0c8d
fix the the typo (#6723)
```
s/the the /the /
```

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-14 16:55:33 +00:00
Moritz Kiefer
414ad8afdb
Type nested decoders with type arguments in daml2js (#6680)
Turns out you can easily intersect function types with object literals
to get what we want here.

While I am very annoyed by it, I don’t know how to write a test for
this. Afaik I can only test this by writing something that hits the
decoder directly but that doesn’t work since it’s impossible (afaik)
to write DAML code that generates DAML-LF that uses the nested type
directly in some API-relevant position (choice arg/return type, key
type, …). Of course, I could handwrite some DAML-LF but only Rémy is
allowed to do that.

changelog_begin
changelog_end
2020-07-14 09:03:32 +02:00
Stephen Compall
dba6ac77b3
include contract keys in the Scala codegen output plan when using --root (#6696)
* include DefTemplate's key types under the Ty type variable

* note that contract key types are included by folding over DefTemplates' Tys

- the topo sort from --root now correctly includes contract keys

* test that contract key dependencies get included in the Scala codegen plan

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-10 15:26:51 -04:00
Moritz Kiefer
abf957f806
Generate JS + typings to speed up dam2js (#6657)
* Generate JS + typings to speed up dam2js

This speeds up daml2js to the point where it’s basically instant on
the GSG (based on 3 runs before and after it’s somewhere between a
40-50x speedup).

Most of this is fairly straightforward. I looked at the generated code
from typescript and the docs for declaration files and adapted things.

There is one interesting point here:

We set the TypeScript configuration to commonjs + ES5. While ES6
modules work fine via `yarn start`, they unfortunately work less fine
in nodejs and in particular in jest. I spent some time trying to fix
it and in the end decided that this is not worth doing since all our
users have to do the same which sucks.

Therefore, the codegen also emits ES5 + commonjs so this is not a
breaking change.

The tests pass and I went through the GSG manually to check things
still work and also verified that types show up correctly in VSCode.

What I was sadly unable to do is to keep the ESLint test for the .d.ts
files. typescript-eslint really wants everything to belong to a
typescript project with a tsconfig.json which doesn’t make sense
here. I don’t think that’s a huge loss. We still have ESLint for the
JS files.

changelog_begin

- [daml2js] daml2js now generates JS + typescript declaration files
  directly instead of generating TypeScript code and invoking `yarn` to
  generate the JS + the declaration files. This does not require any
  changes to your code but it brings a significant speedup and removes the
  dependency on `yarn` for running `daml codegen js`.

changelog_end

* Update language-support/ts/codegen/src/TsCodeGenMain.hs

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>

* Update language-support/ts/codegen/src/TsCodeGenMain.hs

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-07-09 20:07:03 +00:00
Stephen Compall
c2b36b5fe3
support Scala-typed exercise-by-key in Scala codegen (#6660)
* declare key type in Scala codegen output

* add `key` type and function to TemplateCompanion

* template key exercise* case

* test idiomatic ExerciseByKey creation

* add changelog

CHANGELOG_BEGIN
- [Scala Codegen] Support for creating exercise-by-key commands, using same
  exercise functions as exist for contract-IDs and the ``.createAnd`` pattern.
  See `issue #6466 <https://github.com/digital-asset/daml/pull/6466>`_.
CHANGELOG_END
2020-07-09 13:14:40 -04:00
Moritz Kiefer
3b6f966e48
Set YARN_CACHE_FOLDER in all tests (#6669)
The default cache directories in yarn don’t work in the Bazel
sandbox. This results in Yarn creating tons of temp directories for
each test that are never cleared up.

This PR changes this to create actual temp directories that are
properly cleaned up.

changelog_begin
changelog_end
2020-07-09 13:11:07 +00:00
Moritz Kiefer
fbd24bd207
Lock down lodash version (#6650)
Crude hack but should hopefully unbreak CI for now.

changelog_begin
changelog_end
2020-07-08 12:02:24 +00:00
Stephen Compall
4cd419623a
replace traverseU and sequenceU with traverse and sequence (#6594)
* replace traverseU and sequenceU with traverse and sequence

- with -Ypartial-unification on, the extra Unapply typeclass lookup is
  unnecessary

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* limit imports; we only need *> and void
2020-07-07 15:01:58 +00:00
Andreas Herrmann
1bc119e99a
Update rules_haskell (#6600)
* Update rules_haskell

- Fixes the issue where a `sh_test` wrapping a `haskell_binary` couldn't
  add runfiles as is the case with other Bazel rules.

CHANGELOG_BEGIN
CHANGELOG_END

* Save the runfiles environment at start-up

To work around the fact that `withProgName` overwrites `argv[0]`.
See https://gitlab.haskell.org/ghc/ghc/-/issues/18418.

* damlc_compile_test include damlc runfiles

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-07-07 09:34:26 +00:00
Moritz Kiefer
75254eea3e
Add intermediate types to daml2js (#6615)
Previously, daml2js generated Text without any intermediate
representation. This both made the code pretty messy and it makes it
super hard to implement things like generating JS source + TS typings
instead of generating typescript.

This PR addresses this by first generating intermediate types which
are then rendered into Text in a separate step. This should hopefully
make it almost trivial to generate JS source + typings in the future
my implementing two rendering functions.

The types are somewhat adhoc atm. I expect that they will probably
change a bit anyway once we switch to JS + typings so I would like to
avoid bikeshedding the exact definitions too much.

I didn’t bother to preserve the pretty printing exactly as before. If
we really care about pretty output (why should we?), I would suggest
to switch to a proper pretty printing library (in a separate PR).

I apologize for the large PR. Not quite sure how to make it smaller.

changelog_begin
changelog_end
2020-07-07 10:18:15 +02:00
Robin Krom
5db06051d2
fix: language: broken links in documentation. (#6626)
CHANGELOG_BEGIN
CHANGELOG_END
2020-07-06 18:23:23 +02:00
Samir Talwar
28873913d9
Bazel: Upgrade Buildifier. (#6625)
Buildifier now comes with a handy attachment to catch single `\`
characters inside strings and replace them with `\\` if the escape
sequence is invalid. Skylark/Python will do this at runtime anyway; this
just makes it clearer what the actual behavior is.

I needed to change `\` characters at the end of lines to `\\` manually
in order to stop Buildifier from simply concatenating the lines
together. Everything else was automatic.

CHANGELOG_BEGIN
CHANGELOG_END
2020-07-06 16:07:47 +00:00
Stephen Compall
a51d0db8ff
set scalac -Xsource:2.13 -Ypartial-unification globally (#6469)
* add -Xsource:2.13, -Ypartial-unification to common_scalacopts

* add now-referenced scalaz-core where needed

* work around bad type signatures in scalatest Aggregating, Containing

* unused Any suppression

* work around bad partial-unification wrought by type alias

* remove unused Conversions import

- not required in 4f68cfc480 either, so unsure how it's survived this long

* work around Future.traverse; remove unused show import

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END

* remove unused bounds

* remove -Ypartial-unification and -Xsource:2.13 where they were explicitly passed

* longer comment on what the options do

- suggested by @stefanobaghino-da; thanks

* forget Future.traverse, just use scalaz, it knows how to do this
2020-06-24 16:51:24 -04:00
Samir Talwar
c5e1e39d23
bindings-rxjava: Return the Disposable from Bot.wire. (#6476)
* bindings-rxjava: Return the `Disposable` from `Bot.wire`.

And in `BotTest`, dispose of the connection.

We are seeing some spurious errors in runs of BotTest due to connections
shutting down in the wrong order. By explicitly disposing of the wiring
before shutting down the ledger client, we can hopefully suppress these
errors.

They're not causing test failures, but they do often obscure the real
failure.

CHANGELOG_BEGIN
- [RxJava Bindings] `Bot.wire` and `Bot.wireSimple` now return a
  `Disposable`, which can be used to shut down the flows. You are
  encouraged to call `.dispose()` before terminating the client.
CHANGELOG_END

* bindings-rxjava: Don't run `awaitTermination` in a loop.

When shutting down the ledger client, instead of calling
`channel.awaitTermination` in a loop, we just call it once with an
approximately-infinite timeout.

* bindings-rxjava: Use the loan pattern for disposing in BotTest.

* bindings-rxjava: Simplify BotTest a little further.
2020-06-24 15:09:27 +00:00
Leonid Rozenberg
ea344518e9
Group context and hook creation so that it is exportable. (#6451)
CHANGELOG_BEGIN
Export Ledger context and hook creation to enable nested interaction,
with different parties or different ledgers, within one React app.
CHANGELOG_END

* Group context and hook creation so that it is exportable.

* Use undefined as default state to avoid cast

* Word choice

* Document new functions

* Revert commit to build script

* Test nesting of contexts

* Document extra feature in README

* Reorganize code to preserve individual function documentation.

* Correct names to starting with lowercase in build.

* Single quote imports and spacing style

* Add copyright notice

* Spacing around useReload

* Use a good variable name

* Do not export by default

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-06-23 10:45:19 -04:00
Remy
cbe423fc6c
LF: rename library transaction-scalacheck to transaction-test-lib (#6347)
* LF: rename library transaction-scalacheck to transaction-test-lib

CHANGELOG_BEGIN
CHANGELOG_END

* move files in com/daml

* missing change in release/artifacts.yaml

* remove 'com/dam' from the path
2020-06-17 10:52:40 -04:00