Commit Graph

532 Commits

Author SHA1 Message Date
Robert Autenrieth
1128833ab5
Write a config on startup (#5591)
* Write a config on startup

CHANGELOG_BEGIN
CHANGELOG_END

* Rename things

* Make the initial ledger config configurable

* Demote log level for unsupported config writes

* Update ledger/sandbox/src/main/scala/com/digitalasset/platform/apiserver/services/admin/ApiConfigManagementService.scala

Co-Authored-By: Miklos <57664299+miklos-da@users.noreply.github.com>

* Update ledger/sandbox/src/main/scala/com/digitalasset/platform/configuration/LedgerConfiguration.scala

Co-Authored-By: Miklos <57664299+miklos-da@users.noreply.github.com>

* Move code around

* Delay config submissions on kvutils ledgers

Co-authored-by: Miklos <57664299+miklos-da@users.noreply.github.com>
2020-04-21 20:35:42 +00:00
Moritz Kiefer
7c031f25f7
Upgrade rules_nodejs to version 1.6.0 (#5539)
* Upgrade rules_nodejs to version 1.6.0

closes #5367

This includes the fixes for the issues in jest that we’ve been seeing.

changelog_begin
changelog_end

* Fix eslint rules

* A bit of progress

* Try to add LinkablePackageInfo (doesn’t seem to work yet)

* Add rootDirs

* revert da_ts_library

* da_ts_library: add LinkablePackageInfo info

* Remove react hook workaround

Since rules_nodejs 1.6.0 this fails with the following error:
```
  ● Test suite failed to run

    Configuration error:

    Could not locate module react mapped as:
    /.../execroot/com_github_digital_asset_daml/bazel-out/k8-opt/bin/language-support/ts/daml-react/test.sh.runfiles/com_github_digital_asset_daml/node_modules/react/umd/react.development.js.

    Please check your configuration for these entries:
    {
      "moduleNameMapper": {
        "/^react$/": "/.../execroot/com_github_digital_asset_daml/bazel-out/k8-opt/bin/language-support/ts/daml-react/test.sh.runfiles/com_github_digital_asset_daml/node_modules/react/umd/react.development.js"
      },
      "resolver": null
    }

      49 | // like a promis without being one.
      50 | /* eslint-disable @typescript-eslint/no-floating-promises */
    > 51 | var react_1 = __importStar(require("react"));
         |                            ^
      52 | var react_hooks_1 = require("@testing-library/react-hooks");
      53 | var index_1 = __importStar(require("./index"));
      54 | var events_1 = require("events");

      at createNoMappedModuleFoundError (../../../../../../../../../../../node_modules/jest-resolve/build/index.js:501:17)
      at Object.<anonymous> (index.test.js:51:28)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.88s
Ran all test suites within paths "language-support/ts/daml-react/DamlLedger.d.ts", "language-support/ts/daml-react/DamlLedger.js", "language-support/ts/daml-react/context.d.ts", "language-support/ts/daml-react/context.js", "language-support/ts/daml-react/hooks.d.ts", "language-support/ts/daml-react/hooks.js", "language-support/ts/daml-react/index.d.ts", "language-support/ts/daml-react/index.js", "language-support/ts/daml-react/index.test.d.ts", "language-support/ts/daml-react/index.test.js".
=
```

* rootDirs is not needed for tsc

This is only required for ts_project

* Update yarn Bazel packages

* docs/theme add missing dependencies

* Remove unused attribute module_root

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-04-17 12:03:33 +00:00
Shayne Fletcher
05f8b4b8ad
suppress type synonym for Key when it's undefined (#5587)
changelog_begin
changelog_end
2020-04-16 13:39:08 -04:00
Shayne Fletcher
843c6d5d0f
Add ledger associated type synonyms (#5571)
changelog_begin
changelog_end
2020-04-16 14:12:45 +00:00
Shayne Fletcher
7b52823b60
stop hard coding ports (#5553)
changelog_begin
changelog_end
2020-04-14 14:15:57 -04:00
Shayne Fletcher
6cd5280867
add support for daml2js to write daml-ledger code (#5550)
changelog_begin
changelog_end
2020-04-14 16:14:49 +00:00
Robin Krom
6f017cbd39
language: reconnect websocket on closed connection (#5416)
This change adds a simple retry logic to the ledger websocket methods.

If the connection is closed, and the connection was previously healthy,
meaning it was live and running for more than 30 seconds, we try to
reconnect to the stream.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-14 10:32:36 +00:00
Rohan Jacob-Rao
7fafe6a08a
GSG: test messaging feature and remove copied code snippets (#5507)
* Diff with messaging feature and some noise manually removed

* Bazel target to use patch file in other build targets

* Patch file as data dep for integration tests

* Attempt to patch and test messaging feature in create-daml-app test

changelog_begin
changelog_end

* Use exports_files instead of filegroup

* Remove file existence checks that don't make sense

* Add patch to dev_env and reference it from integration tests

* Include patch on windows for later

* Set up yarn env again after codegen

* Restore file check

* Fix typo in comment on util function

* Add Tasty steps to make process explicit

* Use messaging patch for code snippets in GSG

* Use messaging code from template instead of copy

* Remove copied message code

* Refactor script to copy template code with messaging patch

* No need to retry second yarn install (only local deps should be updated)
2020-04-11 19:53:44 +00:00
Martin Huschenbett
06632267e9
Haskell: Add assertFileExists to DA.Test.Util (#5520)
* Haskell: Add assertFileExists to DA.Test.Util

This PR adds a helper function `assertFileExists` that captures the
`doesFileExist ... >>= assertBool ...` pattern that is very common in
our Haskell test suites. It also adds the inverse
`assertFileDoesNotExist` function. Both functions are now used where
appropriate.

CHANGELOG_BEGIN
CHANGELOG_END

* Add directory dependency to test-util lib

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-09 15:29:31 +00:00
Martin Huschenbett
a469d9471b
daml2js: Write all dependencies into package.json (#5490)
* daml2js: Write all dependencies into package.json

The dependencies of the generated packages on `@daml/types` and
`@mojotech/json-type-validation` somehow got lost either during a
refactoring or when changing how we depend on other generated packages.

The tests simply running `daml2ts` did not catch this because we write
a temporary `package.json` one level higher up in the directory tree
in order to `yarn install` the dependencies only once.

The tests using the generated packages also did not catch this since
they depend on `@daml/types`, which in turn depends on
`@mojotech/json-type-validation`, themselves and hence had both packages
in scope.

In other words, this is very tricky to test. We try to alleviate this
problem by sharing the code for generating the dependencies between the
function writing the actual `package.json` files and the one writing
the temporary `package.json`. This makes sure that these dependencies
do not get out of sync again.

CHANGELOG_BEGIN
CHANGELOG_END

* Adjust tests

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-08 11:44:05 +00:00
Gerolf Seitz
cadaa59ad8
Fix redirects, java-bindings javadoc, and live-preview.sh (#5446)
* Fix redirects, java-bindings javadoc, and live-preview.sh

- javadoc_library now supports sources from filegroups as well
- //language-support/java:javadoc now generates javadoc for ledger-api, java bindings, rxjava bindings
- live-preview.sh refers to the correct javadoc target //language-support/java:javadoc
- removed leading / from redirects.map

* Only generate daml-lf javadocs if not on windows

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-07 09:53:26 +02:00
Martin Huschenbett
28627a665f
Refactor daml-assitant ITs regarding yarn (#5453)
There are multiple tests that setup an environment for yarn to find
our TypeScript libraries. This PR unifies this setup by providing a
single function to set it up.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-06 18:28:39 +02:00
Leonid Shlyapnikov
26c476d3cd
Commenting out local maven repository config (#5452)
changelog_begin
changelog_end
2020-04-06 11:55:13 -04:00
Robin Krom
a413c1cec9
Replace file globs in ts package BUILD files (#5424)
* language: remove file globs from ts library BUILD files

We replace them with toplevel `sources` definition, since sadly
filegroups don't work here.

CHANGELOG_BEGIN
CHANGELOG_END

* update app-arch section regarding daml2js

* remove files field in tsconfigs
2020-04-06 13:07:27 +02:00
Remy
943919585e
Java Codegen: fix template code generation (#5443)
* Java Codegen: fix template code generation

* changelog

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-06 08:56:51 +00:00
Leonid Shlyapnikov
0842866f25
Scala codegen examples: removing bintray repository, relying on daml.yaml and -Dda.sdk.version (#5436)
* Removing bintray repository, relying on daml.yaml and -Dda.sdk.version

to resolve DA SDK version.

changelog_begin
changelog_end

* Fixing scalafmt

* cleanup

* Adding local maven repo, you can run examples against local dev SDK 0.0.0
2020-04-06 06:33:30 +00:00
Gerolf Seitz
a2d785e3ee
Use com.daml as root package (#5343)
Packages com.digitalasset.daml and com.daml have been unified under com.daml

Ledger API and DAML-LF DEV protos have also been moved from `com/digitalasset`
to `com/daml` on the file system.
Protos for already released DAML LF versions (1.6, 1.7, 1.8) stay in the
package `com.digitalasset`.

CHANGELOG_BEGIN
[SDK] All Java and Scala packages starting with
``com.digitalasset.daml`` and ``com.digitalasset`` are now consolidated
under ``com.daml``. Simply changing imports should be enough to
migrate your code.
CHANGELOG_END
2020-04-05 19:49:57 +02:00
Martin Huschenbett
a5b41245b0
dam2js: Write better package.json files (#5417)
If we don't provide a license field, `yarn install` issues a warning.
Since sharing the code generated by `daml2js` with others doesn't
make sense in the current state, I've chosen the most conservative
license, namely "UNLICENSED", such that our users don't accidentally
license their code to others.

In the long run, we should make this field configurable.

This PR also improves the description of the generated packages and
makes the temporary `package.json` used by `daml2js` private.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-03 11:58:31 +00:00
Martin Huschenbett
2a10109ed2
daml2js: Remove the -p flag (#5402)
The `-p` flag was used to provide the path to the `package.json` which
constitutes the root of a yarn workspace. Since we don't use yarn
workspaces anymore, this flag is now useless and the PR removes the
last traces of it.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-03 08:24:28 +00:00
Martin Huschenbett
31c78d57d8
Rename daml2ts to daml2js (#5394)
This is pretty much a search and replace over the whole repo, including
file names.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-03 08:58:23 +02:00
Moritz Kiefer
2b036f596d
Fix yarn invocation in daml2ts on Windws (#5391)
The details are in a source code comment but roughly it boils down to
`proc` vs `shell` looking things up in PATH differently.

changelog_begin
changelog_end
2020-04-02 21:33:57 +00:00
Robin Krom
100375e777
Update ts packages docs (#5375)
* language: docs: fix links in README's and update docs of useQuery

This fixes the broken links to the generated documentation and updates
the docs on `useQuery`, `useStreamQuery`.

CHANGELOG_BEGIN
CHANGELOG_END

* added two examples for useQuery/useStreamQuery without a query parameter
2020-04-02 15:36:08 +00:00
Robin Krom
d4073b94a0
Signal live streaming with 'live' event (#5329)
* language: daml-ledger: emit live events on streams

We handle the 'offset' field of the JSON API correctly and inform
downstream consumers with a 'live' event once we know that the stream is
live updating.

CHANGELOG_BEGIN
CHANGELOG_END

* Update language-support/ts/daml-ledger/index.ts

Co-Authored-By: Martin Huschenbett <martin.huschenbett@posteo.me>

* Fix tests

CHANGELOG_BEGIN
CHANGELOG_END

* Run build-and-lint-test only on Linux

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Martin Huschenbett <martin.huschenbett@posteo.me>
2020-04-02 15:31:26 +00:00
Martin Huschenbett
c627c7e74c
@daml/react: Fix name of loading flag in README (#5370)
The actual name of the flag is `loading`. For some reason the README
claims it's `isLoading`. This PR fixes the README.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-02 12:04:55 +00:00
nickchapman-da
ddc11a7063
Refactor deployment tests: (#5342)
- Move deployment tests (deployTest, fetchTest) out of integration-tests.
- Use DA.Test.Sandbox where appropriate.
- Split out code for useful test patterns: i.e. calling commands quietly, getFreePort.

changelog_begin
changelog_end
2020-04-02 10:17:21 +01:00
Samir Talwar
4b9b2e8e61
Reduce the default maximum heap size for all Scala processes. (#5350)
* bazel_tools: Set `unused_dependency_checker_mode` in one place.

* bazel_tools: Set the default max heap size for Scala processes to 2GB.

And the default initial max heap size to 512MB.

CHANGELOG_BEGIN
CHANGELOG_END

* bazel_tools: Set the `scalac` heap size to 2GB and stack size to 2MB.

* bazel_tools: Delete `da_scala_macro_library`, as it's unused.

* bazel_tools: Revert the description of `da_scala_library_suite`.

Misread it.
2020-04-01 19:14:20 +00:00
Shayne Fletcher
6daf37c4da
Make 'callProcessSilent' a test library function (#5323)
changelog_begin
changelog_end
2020-04-01 11:42:00 +00:00
Martin Huschenbett
921d0efd40
TS libs: Fail linting on warnings (#5332)
Currently, we happily accept warnings of the linter as if nothing was
wrong. This PR makes the linter fail on warnings. It also moves the
linter configs into their own files to unclutter the `package.json`
files we ship to our users a bit.

Ane we fix all the warnings we now get from the linter.

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-01 11:41:35 +00:00
Gerolf Seitz
329320bad9
Organize maven coordinates (#5272)
* Use com.daml as groupId for all artifacts

CHANGELOG_BEGIN
[SDK] Changed the groupId for Maven artifacts to ``com.daml``.
CHANGELOG_END

* Add 2 additional maven related checks to the release binary

1. Check that all maven upload artifacts use com.daml as the groupId
2. Check that all maven upload artifacts have a unique artifactId

* Address @cocreature's comments in https://github.com/digital-asset/daml/pull/5272#pullrequestreview-385026181
2020-04-01 11:41:18 +02:00
Gerolf Seitz
9b5c5e23b9
Make wall clock time the default time mode for sandbox (#5301)
CHANGELOG_BEGIN
[Sandbox] Wall Clock Time mode (``--wall-clock-time``) is now the
default.
CHANGELOG_END
2020-04-01 08:53:16 +02:00
Moritz Kiefer
b43b8d8672
Fix build-and-lint tests (#5320)
Hardcoding the version breaks as soon as we make a release PR where
the version is not 0.0.0.

changelog_begin
changelog_end
2020-03-31 20:20:56 +02:00
Shayne Fletcher
6e94197544
Upgrade daml2ts test to a more recent davl (#5316)
changelog_begin
changelog_end
2020-03-31 18:10:46 +00:00
Samir Talwar
52dbcf5d95
postgresql-testing: "Lock" ports when starting PostgreSQL. (#5310)
* http-json: Ask for a free port by specifying port 0.

This will avoid race conditions.

* bindings-akka-testing: Delete RandomPorts; it's unused.

* ports: Fix the Bazel test glob.

* ports: Move FreePort to postgresql-testing and add a test case.

* postgresql-testing: Make `FreePort.find()` return a `Port`.

* postgresql-testing: Lock free ports until the server starts.

This uses a `FileLock`, which should work well on all our
supported operating systems as long as everyone agrees to use it.

CHANGELOG_BEGIN
CHANGELOG_END

* postgresql-testing: Try to find a free port 10 times, then give up.

* postgresql-testing: Use a shared directory for the port lock.

* postgresql-testing: Try an alternative way of getting `%LOCALAPPDATA%`.
2020-03-31 17:13:02 +00:00
Robin Krom
8e9a8388ad
language:daml-ledger: tests for streaming methods (#5180)
This adds tests mocking a websocket server to test the
`streamFetchByKey` and `streamQuery` methods of the ledger class.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-31 16:03:19 +00:00
Shayne Fletcher
5cd3311a90
Mark build-and-lint-test flaky (#5309)
changelog_begin
changelog_end
2020-03-31 14:07:17 +00:00
Martin Huschenbett
bb1c5ed039
TypeScript libs: Enforce return type annotations (#5287)
For some reason the lint that catches missing return type annotations
was turned off. It's turned on now.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-31 09:28:23 +00:00
Andreas Herrmann
89a9f5c7d2
tarball reproducibility (#5258)
* integration-tests reproducibility

* package-app reproducibility

* Make remaining tar czf reproducible

* package-app

CHANGELOG_BEGIN
CHANGELOG_END

* Reproducibility of remaing tar invocation

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-31 10:09:52 +02:00
Shayne Fletcher
de03006470
Use sandbox '--port-file' (#5284)
* increase timeout to eternal

changelog_begin
changelog_end

* Switch to using --port-file for sandbox

changelog_begin
changelog_end
2020-03-30 15:24:42 -04:00
Shayne Fletcher
2722e7ce95
Move 'withEnv', call it from daml2ts tests (#5276)
* Move 'withEnv', call it from daml2ts tests

changelog_begin
changelog_end

* Fix withEnv call to ensure that TASTY_NUM_THREADs is set

withEnv replaces the whole environment so we need to set everything we
care about.

* withEnv replaces the whole environment so we need to set everything we
care about.

* Apparently applying the same fix has destabilized Windows

* Try even harder to get daml assistant tests passing on Windows again

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2020-03-30 17:20:47 +00:00
Martin Huschenbett
72e0cb6374
@daml/react: Remove unused dependencies (#5283)
The `package.json` lists some dependencies which used to be
dependencies in the past but aren't anymore.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-30 16:53:23 +00:00
Martin Huschenbett
e11fced8c9
daml2ts: Update the TypeScript version (#5269)
Update the TypeScript version we're using in `daml2ts` and its support
libraries. Also update the versions of ESLint and its TypeScript
plugin we're using for linting the generated code. (And remove more
occurrences of `HashMap Text Text` at the same time.)

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-30 11:27:40 +00:00
Robert Autenrieth
f8cd628c2f
Remove old time model from ledger config (#5216)
* Remove old time model from ledger config

CHANGELOG_BEGIN
- [Ledger API] Fields related to the old ledger time
  model have been removed from the configuration
  management service and the ledger configuration service.
CHANGELOG_END

* Update ledger/ledger-api-test-tool/src/main/scala/com/daml/ledger/api/testtool/tests/LedgerConfigurationService.scala

Co-Authored-By: Gerolf Seitz <gerolf.seitz@digitalasset.com>

Co-authored-by: Gerolf Seitz <gerolf.seitz@digitalasset.com>
2020-03-30 08:46:22 +02:00
Robert Autenrieth
d57f78c9ef
Remove useless timeProvider in quickstart (#5247)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-28 13:25:29 +01:00
Remy
1b37f6c482
DAML-LF: redesign absolute contract ids (#5207)
CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 19:07:42 +01:00
Martin Huschenbett
454bd127a0
daml2ts: Don't use HashMap Text Text anywhere (#5252)
As I said previously, all instances of the dreaded `HashMap Text Text`
can go away if write our code more direct. Here we go.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 15:51:42 +00:00
Martin Huschenbett
b398272fee
daml2ts: Don't reinvent assertInfixOf in tests (#5245)
Instead use the version from `DA.Test.Util`.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 11:58:53 +00:00
Martin Huschenbett
98f37dbe48
daml2ts: Make tests more concise (#5243)
We do not need to have templates in the `.daml` files we generate
during these templates, any serializable type is good enough. Thus,
let's make the tests shorter by using a simple serializable type
instead of templates.

Also make the tests easier to debug when expected failures of `daml2ts`
do not happen in the anticipated way.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 11:06:41 +00:00
Martin Huschenbett
d48698e43b
daml2ts: Fix the A:X vs A.B bug (#5226)
* daml2ts: Fix the A:X vs A.B bug

Currently, the TypeScript generated by `daml2ts` does not compile when
there are a modules `A` and `A.B` which both contain serializable types.
(Note: there can't be a type called `B` in `A` due to the name collision
check.)

Since fixing this within the current layout using TypeScript
namespaces would be very challenging since we would need to inject
subnamespaces into existing namespaces. Thus, we switch the code
generation to use ES2015 modules. Since TypeScript namespaces are
considered (somewhat) deprecated, this is a good move anyway.

As a result of this change to ES2015 we need to write `index.ts` files
at each node of the module hierarchy. These `index.ts` files reexport
the module at the current node (if present) and all child modules.

At the same time we also remove the default export of the top-level
`index.ts` file. It is not clear if they are actually useful and to
add them to the new scheme requires a technique that feels like a hack.

To give an example, assume we have modules `A` and `A.B.C`. We now write
the following directory structure:
```
src/
+- index.ts             <- reexports A
+- A/
   +- index.ts          <- reexports module.ts and B
   +- module.ts
   +- B/
      +- index.ts       <- reexport C
      +- C/
         +- index.ts    <- reexports module.ts
         +- module.ts
```
If you import the package like
```typescript
import * as foo from '@daml.js/foo-1.0.0';
```
you can acces the `A` and `A.B.C` modules as `foo.A` and `foo.A.B.C`.

CHANGELOG_BEGIN
CHANGELOG_END

* Adapt build-and-lint-test

CHANGELOG_BEGIN
CHANGELOG_END

* Add new test

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 10:27:18 +01:00
Gary Verhaegen
1872c668a5
replace DAML Authors with DA in copyright headers (#5228)
Change requested by Manoj.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 01:26:10 +01:00
Shayne Fletcher
8bb9f4b5c7
Don't write .eslintrc.json files (#5218)
* Factor out daml2ts utilities

changelog_begin
changelog_end

* Stop writing .eslintrc.json files into daml2ts packages

changelog_begin
changelog_end
2020-03-26 14:42:59 -04:00