Commit Graph

293 Commits

Author SHA1 Message Date
Moritz Kiefer
7deca903bb Add documentation for DAML script and bundle it in the SDK (#3527) 2019-11-19 17:19:57 +00:00
Moritz Kiefer
e2cd2c1fc9 Move packaging tests to a separate test suite (#3484)
* Move packaging tests to a separate test suite

Originally, we had these as part of the integration test suite since
`bazel run damlc build` couldn’t locate `ghc-pkg` but that has been
fixed for a while.

Moving it to a separate test suite speeds things up as the integration
tests are rerun very often and also makes development much more
convenient since the new test suite supports `-p` properly to filter
to specific tests.

For now, I’ve left the upgrading tests as part of the integration
tests. I expect that we probably want to factor those out to another
test suite as well.

* fix warnings
2019-11-15 12:45:37 +00:00
Gerolf Seitz
172ce90597
Upload codegen fat-jars to maven central (#3476) 2019-11-14 18:40:54 +01:00
Robin Krom
cd1533b270 language: fix for tuple types in source generation (#3449)
* language: fix for tuple types in source generation

We correct the source generation from dalfs containing TupleN data
types. A test is added to the integration tests of daml assistant and
the `generate-src` command is improved to make this test possible.

* check that tuple type comes from DA.Types

* check that compilation succeeded

* pattern match golf

* check for tuples between 2 and 20
2019-11-14 13:46:07 +00:00
Robin Krom
f2cc138204
language: reexport module in data dependencies (#3457)
This change allows to only import `module A` from the instances package
if data dependencies are present instead of  `module A` and `module
AInstances`.
2019-11-14 14:20:09 +01:00
Robin Krom
6cf3a5276f
language: introduce data-imports (#3399)
* language: introduce data-imports

Right now the user experience for importing dalfs and dars from
different sdks is quiet confusing. This PR tries to solve this. We add
an additional field `data-imports` to daml.yaml. These imports can come
from different SDK's and we will generate interface files containing the
data types and their Template instances.

This also simplifies the migration command, as it now always imports the
respective packages as `data-imports`.
2019-11-08 16:32:30 +01:00
Robin Krom
6943165c84
language: cross sdk dalf/dar imports (#3358)
* language: cross sdk dalf/dar imports

The final piece for cross sdk imports. With this PR we can import the
data types of packages and dalfs that were created with different sdks.

This is done by generating interface files from dalfs and an 'instances'
package that contains the template instance definitions of template data
types. The instances itself are defined via the `external` keyword,
which is inlined to proper daml-lf instance definitions given in the
respective dalf package.

We test that cross sdk imports work by importing the `simple-dalf` in
the daml-assistant integation tests and running a scenario.
2019-11-06 19:35:40 +01:00
Robin Krom
f4960603c9
language: dont hide modules without aliases (#3356)
Currently we hide modules, for which we don't define an alias, when we
specify one alias for *one* module. With this change, all modules
without aliases are still exposed.
2019-11-06 15:17:50 +01:00
Robin Krom
cff6db7b31
language: refactoring of iface file generation and package db setup. (#3342)
* language: refactoring of iface file generation and package db setup.

This is a refactoring of the damlc part that creates the package
database and the code generation for interface files. This is a
preparation for the cross sdk imports.
We also add an internal command to damlc to generate generic instances
code and use simple copying via {..} in the migration command. An
additional test checks that migration via generics still works.

* Update compiler/damlc/daml-compiler/src/DA/Daml/Compiler/Upgrade.hs

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* clearer description for generate-gen-src

* updated documentation

* correct copy/pasta mistake

* added a comment on different build options in migration command.

* Update compiler/damlc/lib/DA/Cli/Damlc.hs

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* resolve dalf paths from dar manifest

* added a comment on different headers in upgrade modules.

* removed monoid instance for ExtractedDar
2019-11-06 12:23:58 +01:00
nickchapman-da
ac8bf9f062
changes to allow daml-assistant/integration-tests to be added into top-level repl (#3346) 2019-11-05 18:45:04 +00:00
Andreas Herrmann
2bd1db490a
Replace bazel-deps by rules_jvm_external (#3253)
* Update bazel-common to fix javadoc issues

Specifically, to fix the following error

```
ERROR: /home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel:7:1: in javadoc_library rule //ledger-api/rs-grpc-bridge:rs-grpc-bridge_javadoc:
Traceback (most recent call last):
        File "/home/aj/tweag.io/da/da-bazel-1.1/ledger-api/rs-grpc-bridge/BUILD.bazel", line 7
                javadoc_library(name = 'rs-grpc-bridge_javadoc')
        File "/home/aj/.cache/bazel/_bazel_aj/5f825ad28f8e070f999ba37395e46ee5/external/com_github_google_bazel_common/tools/javadoc/javadoc.bzl", line 27, in _javadoc_library
                dep.java.transitive_deps
object of type 'JavaSkylarkApiProvider' has no field 'transitive_deps'
```

* Define Maven deps using rules_jvm_external

* Pin artifacts

* Remove bazel-deps generated targets

* Remove bazel-deps

* Switch to rules_jvm_external targets

* update bazel documentation

* pom_file: There are no more bazel-deps targets

* BAZEL-JVM.md `maven_install` typo
2019-10-28 13:53:14 +01:00
associahedron
b7e6088bcd
Delete temp directory in get-daml.sh (#3233)
* Delete temp directory after get-daml.sh

* Revert dockerfile change from #3224
2019-10-18 17:02:02 +01:00
associahedron
a90a1e1e8e Add Numeric support to migrate. (#3195)
* Add Numeric support to migrate

* Generate GHC.Types definitions based on LF version.

* Add a migration test with Numerics.
2019-10-16 15:56:49 +00:00
Robin Krom
29424af721
language: dalf imports and a test (#3176)
* language: dalf imports and a test

This adds the possibility to directly import dalfs in a project. We test
that we can import the `simple-dalf` in the daml-assistant integation
tests. For now we only check that data type generation works, not yet
the template instance.

The following was fixed: When rewriting package self references, this
changes the hash of the package later on and leads to different package
hashes. Also we need to be careful to write the orignal binary
representation to this and not re-encode it because the encoding might
have changed with a different sdk.

* addressing moritz's comments.

* windows doesnt like bazel paths
2019-10-15 17:20:53 +02:00
Moritz Kiefer
dbddead461
Add a first draft of documentation for DAML triggers (#3181)
* Add a first draft of documentation for DAML triggers

The API will still change in a bunch of ways but I’d rather get some
docs in place now and update them as we change things than not have
any docs at all.

* Fix path to daml.yaml

* s/bot/trigger/

* fix source code markers

* Fix tests

* Update docs/source/triggers/index.rst

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2019-10-15 16:50:43 +02:00
Remy
e45b585307 daml-lf: repackage daml-lf archive proto (daml_lf -> daml_lf_dev) (#3169) 2019-10-15 09:36:11 +00:00
Remy
d64df4b5f7 daml-lf: clean achive bazel build (#3175)
* clean the mess in daml-lf achive bazel build

* add release note

* Address Moritz's comments

* more release notes
2019-10-15 08:36:46 +00:00
Robin Krom
09fa4cf588
language: fix: don't look for daml files in hidden directories (#3144)
* language: fix: don't look for daml files in hidden directories

Fixes #3134. When locating daml source files, we need to make sure we're
not recursing into the .daml directory, because it contains source files
of the dependencies.

* Update daml-assistant/integration-tests/src/Main.hs

Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
2019-10-10 12:33:19 +02:00
Robin Krom
f28dc104ca
language: create the package database from dalfs (#3140)
This moves the creation of a package database from given dalfs out of
the migrate command and into the init command. In particular, this makes
the process of creating a package database independent of the migrate
command.

It also changes the way this package database is created to be only
dependend on given dalf files.
2019-10-09 17:40:03 +02:00
Moritz Kiefer
f18c393866 Fix location of interface files in created dars (#3137)
fixes #3135
2019-10-09 08:39:50 +00:00
Andreas Herrmann
98bb580aa2 Bundle packages with SDK releases (#3056)
* Enable SDK daml-lib package dependencies

* integration-test: SDK daml-libs dependency

* trigger --> daml-trigger

Rename the trigger library package to match other builtin packages.

* Bundle daml-trigger.dar in SDK release tarball

* Describe SDK bundled packages in changelog

* Push case match inside expand

Addressing review comment
8208277747 (r329428240)
2019-09-30 09:15:11 +00:00
Anup Kalburgi
3686162c02
Adding visual -web command (#3009)
adding the visual-web command to damlc
2019-09-27 10:26:20 -04:00
Leonid Shlyapnikov
5f9a48c534
Flattening results of the /contracts/search (#2987)
* Flattening results of the `/contracts/search`,

returning a `ActiveContract` instead of `GetActiveContractsResponse`

* Fixing the test,

it is an empty array instead of empty GetActiveContractResponse object

* Updating examples

* Updating release notes

* Update unreleased.rst

Accepting suggested changes

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>

* Resolving master merge conflicts
2019-09-25 10:14:22 -04:00
Moritz Kiefer
8ad74da20b
Support passing additional options to sandbox/navigator/json-api in daml start (#3002)
This should make `daml start` a bit more useful since you don’t have
to switch to starting all processes separately once you start
deviating from the defaults, e.g., I found myself wanting to specify a
custom ledger id during the hackathon. This is part 1 of ##2993.
2019-09-24 18:39:16 +02:00
Moritz Kiefer
1d593f2a16 Deduce pkgname in damlc migrate from dalf not dar (#3000)
The filename of the dar is not something that you should rely on as
evidenced by the fact that we have a -o option to change it to
something completely different.
2019-09-24 15:13:57 +00:00
Moritz Kiefer
9decc6b25f Fix getSrcRoot for A/B.daml (#2989)
Previuosly we would return A for module A.B in A/B.daml which resulted
in us including /B.daml in the DAR instead of /A/B.daml.
2019-09-24 00:31:52 +00:00
Moritz Kiefer
bf3f0063d2
Get rid of ./build.sh scripts for damlc migrate (#2984)
Now that we have the build-options fields that makes for a much nicer
interface.
2019-09-23 19:08:30 +02:00
Moritz Kiefer
2ab06da199 Use a consistant include dir for cwd (#2978)
* Use a consistant include dir for cwd

See https://github.com/digital-asset/ghcide/pull/114 for the actual
fix.
This PR just bumps ghcide and adds a regression test. I’ll change the
revision before merging, I just want to test CI for now.

fixes #2929

* Switch to proper ghcide revision

* writeIfacesAndHie no longer exists

* Add changelog entry

* Maybe I should try to compile code before committing but I don’t want to

* Fix ghcide exe
2019-09-23 14:33:06 +00:00
Moritz Kiefer
2de32b7419
Include all daml files in dar if source points to a file (#2970)
Previously, we only included the source file itself but not its
dependencies which didn’t make much sense.

This fixes #2960
2019-09-23 11:14:35 +02:00
Robin Krom
0f015e965f
language: support for automatic embeddings/projections in migation (#2893)
* language: support for automatic embeddings/projections in migation

This adds support to automatically generate embeddings/projections if an
optional field to a contract template is added. This allows generation
of migration contracts for these kind of updates.

* only project None entries

* added a test for optional field embedding/projection.
2019-09-16 14:31:38 +02:00
Leonid Shlyapnikov
d237040822 DAML Assistant json-api logback configuration (#2797)
* filter out exception stack traces logged at debug

* Adding logback.xml for DAML Assistant release

* Fixing readme

* Fixing readme

* Use the config file in the assistant
2019-09-09 11:13:50 +02:00
Moritz Kiefer
2e29d3c0d9
Integrate the HTTP JSON API with the assistant (#2792) 2019-09-06 15:48:15 +02:00
Andreas Herrmann
ed39800a9f Rename hazel_deps to hackage_deps (#2789)
* hazel_deps --> hackage_deps

Mechanical change:

```
sed -i 's/hazel_deps/hackage_deps/g' $(ag -l hazel_deps)
```

* Hazel dependencies --> Hackage dependencies
2019-09-06 09:01:09 +00:00
Remy
20649cf78e ledger-api: rename decimal field to numeric in value Proto (#2688)
* add Numeric.java

* ledger-api: rename `decimal` field to `numeric` in value protobuf

* Address Gerolf's comment

* ledger-api: add missing renammings

* ledger-api: relax syntax of numbers that can be sent as numerics

* extractor:  fix

* leger-api: change format of number though ledger api

* daml-lf: fix numeric regexp

* ledger: fix tests
2019-08-29 22:51:33 +00:00
Robin Krom
7fca591df0
replace main file with a pointer to the source root (#2687)
* language: compile everything in the source directory

This removes the need to specify a 'main'. Instead we 'source' in
daml.yaml should point to the source root directory.
2019-08-29 13:42:33 +02:00
associahedron
d9e42d9798 Robuster logic for --install-assistant=auto (#2656)
* Robuster logic for --install-assistant=auto

* Handle Windows correctly
2019-08-26 10:02:19 +00:00
associahedron
8b3f746da9
Dont occlude --port flag in daml ledger navigator (#2590) 2019-08-21 09:58:22 +01:00
Robin Krom
2374b8c231
Migrate same package name (#2564)
* language: smoothing out the migration experience

Some improvements to make the migration process simpler when migrating
between packages with the same name, e.g. foo-1.0.0 -> foo-2.0.0. This
is the main use case.
2019-08-20 11:02:41 +02:00
Robin Krom
f209950f0b
language: append the version to the output dar name by default. (#2559)
* language: append the version to the output dar name by default.

We now by default output foo-1.0.0.dar instead just foo.dar. Also the
maven coordinate default naming got removed.

* fixing integration tests and quickstart.dar occurences
2019-08-15 18:07:52 +02:00
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
Robin Krom
db59c228c1
language: tests: tests for merging and non-toplevel main files (#2515)
We add tests for the `merge-dars` command and check that we can handle
main files that are not at the top source level.
2019-08-13 15:47:41 +02:00
Moritz Kiefer
bdd665fcf8
Only change project root once (#2459)
* Only change project root once

As described in #2449, calling withProjectRoot' twice breaks with
relative paths and is also just silly so this PR fixes this by
factoring out the actual logic from init from execInit which does the
project root thingy.

* Add a regression test
2019-08-08 19:56:04 +02:00
Moritz Kiefer
9df8c7878e Add link to deploy URL in daml ledger --help and daml deploy --help (#2451)
* Add link to deploy URL in  daml ledger --help and daml deploy --help

* Update daml-assistant/daml-helper/src/DA/Daml/Helper/Main.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-08-08 08:41:22 +00:00
Moritz Kiefer
9cd58e24fa
Fix VSCode invocation in "daml studio" (#2445)
Despite, a lot of searching around, I couldn’t find any information on
why exactly quoting "code" causes issues but removing the quotes seems
to fix the issue ¯\_(ツ)_/¯
2019-08-07 16:38:03 +02:00
associahedron
0673ceecac Fix daml ledger navigator configuration. (#2430)
* Fix daml ledger navigator

* Add newline after dots
2019-08-06 17:57:52 +00:00
associahedron
8590dfacb9
--json flag for daml ledger list-parties (#2426)
* --json flag for daml ledger list-parties

* use TL.putStrLn

* lint
2019-08-06 15:37:53 +01:00
associahedron
342a620f98
Implement deploy in terms of allocate-parties and upload-dar. (#2422)
* implement deploy in terms of allocate parties and upload dar

* Update release notes
2019-08-06 14:46:27 +01:00
associahedron
72a7bc63a6
Organizing SDK ledger commands, adding ledger upload-dar and ledger navigator commands. (#2416)
* Add deploy-navigator command to daml helper.

* Rebase

* Organize ledger commands

* Sandbox /= Remote Ledger, should not use that config.
2019-08-06 12:41:43 +01:00
Moritz Kiefer
dd41683381 Escape shell arguments in daml-helper (#2417)
This fixes another case of spaces in usernames breaking things
2019-08-06 11:16:57 +00:00
Moritz Kiefer
656d8f4a19 Handle ExitCodeException in wrapErr (#2415)
This is thrown by typed-process when the child process exits with a
non-zero exitcode.

fixes #2414
2019-08-06 08:49:25 +00:00
nickchapman-da
d5a94625e8 daml deploy: small changes and code cleanup (#2398) 2019-08-05 15:48:47 +00:00
nickchapman-da
299d0c1b98
daml deploy, now with party management (#2384)
* daml deploy, now with party management

* address some review comments
2019-08-05 13:07:37 +01:00
Moritz Kiefer
705f014a88 Fix daml build for usernames with spaces (#2392)
* Fix daml build for usernames with spaces

This PR fixes two issues caused by having spaces in your username:

1. On Windows, we need to quote the path to the daml binary in the
batch wrapper (quotes are not valid in usernames, so no need to worry
about escaping them).

2. Invoking ghc-pkg via callCommand broke since shells are
terrible. Luckily, we can easily get away with just using callProcess
here.

* Update compiler/damlc/lib/DA/Cli/Damlc.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>
2019-08-05 08:49:40 +00:00
Gary Verhaegen
d45671f926
clarify help text on assistant (#2382) 2019-08-02 14:33:30 +01:00
Robin Krom
3db5230a43
language: put hash in package directories (#2268)
* language: put hash in package directories

We put the package id of the main dalf of a package into the directory
names, where we store the files of that package in the package database.
This way we make sure that two equally named packages don't overwrite
their dependencies and files.
2019-07-31 14:31:45 +02:00
Moritz Kiefer
50a04397e4
Supporting producing sdist tarballs for the HS ledger bindings (#2336)
* Supporting producing sdist tarballs for the HS ledger bindings

The README.md has an explanation for how you can use this.

This should hopefully allow others to experiment with the bindings.
2019-07-30 14:34:16 +02:00
nickchapman-da
b90862ebec
improve haskell module hierarchy to be more consistent (#2319) 2019-07-29 15:55:55 +01:00
associahedron
573424f561 Add a daml deploy integration test. (#2299)
* Add a daml deploy test

* Use different template for proj2 in daml deploy test

* added --host localhost
2019-07-26 15:26:15 +00:00
nickchapman-da
49e21660f1
support --host option for daml deploy command (#2285) 2019-07-25 12:26:07 +01:00
nickchapman-da
b30228ab95
{-# LANGUAGE OverloadedStrings #-} is now on by default (#2270) 2019-07-24 08:09:26 +01:00
Martin Huschenbett
d6b8ea17de Fix the source field in daml.yaml produced by daml init (#2250)
Currently, if you do `daml init foo` and there's a file `foo/Main.daml`,
you'd end up with a file `foo/daml.yaml` whose `source` entry is
`foo/Main.daml`when it should actually just be `Main.daml`.

This PR fixes this problem.
2019-07-22 16:56:36 +00:00
Robin Krom
c8e0f51e90
Address martin comments (#2242)
addressing martin's comments
2019-07-22 13:48:29 +02:00
Moritz Kiefer
e570c10599 Remove dependency on ghc from daml-helper (#2233)
GHCi gets confused if both ghc and ghc-lib are exposed and there is no
reason why we should depend on ghc here anyway.
2019-07-19 19:33:11 +00:00
Robin Krom
8dd80cf112
language: add a 'main' option to the migration command (#2229)
We add an additional argument "main" to the migrate command to put the
right main filepath into the project config.
2019-07-19 16:32:53 +02:00
nickchapman-da
c0d6ac2a24
minimal quick fix for quickstart template, and test! (#2224) 2019-07-19 08:57:21 +01:00
nickchapman-da
49a6607160
daml deploy: first version (#2176)
* daml deploy: first version

* fix build: replace callCommand with runProcess_

* abstract/share: doBuild, getDarPath

* hide deploy command for now

* make sandbox port configurable for both deploy & start daml-helper commands
2019-07-17 14:09:55 +01:00
Moritz Kiefer
623e641ec9
Wait for child process to exit in the daml assistant and daml-helper (#2162)
fixes #2142

It turns out that typed-process has the behavior we want so rather
than rolling our own version of `withCreateProcess`, I just switched
to that.
2019-07-16 18:21:00 +02:00
Robin Krom
aff7f1bc67
Generate interface files from dalf (#2151)
* language: upgrading: generating interface files
2019-07-16 13:46:43 +02:00
Gary Verhaegen
e2d9541c8c bundle vsix in sdk tarball (#2113) 2019-07-12 21:35:05 +00:00
Moritz Kiefer
23723a6fc4 Fix extraction of Maven tarball in integration tests (#2119)
extractTarball tries to restore the ownership stored in the
tarball. This goes wrong when the tarball is fetched from CI since the
uid/gid might not exist locally.
2019-07-12 10:04:31 +00:00
Moritz Kiefer
75ea177e87
Run exception handlers on SIGTERM in daml assistant (#2069) 2019-07-09 15:44:09 +02:00
Rohan Jacob-Rao
48f5153b74 Fix VSCode path for mac in daml assistant (#2051)
* Fix VSCode path for mac in daml assistant

* Release note
2019-07-08 22:26:36 +00:00
Michał Majcherski
3751ce9cee
Fix Maven calls in daml-assistant integration tests on Windows (#2027)
* Fix Maven calls in daml-assistant integration tests on Windows

* Cleanup daml-assistant integration tests
2019-07-08 16:38:35 +02:00
Moritz Kiefer
bb3a98bf61
Move code in daml-tools outside of daml-foundations (#2033) 2019-07-08 11:40:48 +02:00
Andreas Herrmann
df7bff6288 Update to bazel-0.27 (#1957)
* Bazel: 0.24.0 -> 0.27.0

* Update rules_haskell for Bazel 0.27 compatibility

* Update bazel-deps and bazel-watcher

* Windows escape JVM flags

* load commands at top of .bzl file

Bazel 0.27 no longer allows load commands that are not at the beginning
of the file.

* Update Bazel rules

* subpackage boundary

* native is not defined in BUILD files

* yarn: @bazel/hide-bazel-files

Seems to be required since latest rules_nodejs version. Otherwise, yarn
fails with errors about existing BUILD or BUILD.bazel files.

* grpc-java plugin visibility

* Update fat_cc_library

* Nix Python3 toolchain

* Iteration over depset

* dev_env_package: Create symlinks one level deeper

To prevent symlinking the BUILD file as well. The nested BUILD file
confuses Bazel as of 0.27 and rules_nodejs cannot find the node
executable anymore.

* Update rules_nodejs

* Add managed_directories for node_modules

* hie-bios: Extract bazel-genfiles from bazel info

Bazel 0.27 changed the genfiles location which breaks the hie-core test
on macOS.

* update cc_wrapper to Bazel 0.27

* bazel info -> bazel info bazel-genfiles

* Fix typo in BUILD

Co-Authored-By: Stefano Baghino <43749967+stefanobaghino-da@users.noreply.github.com>
2019-07-05 14:04:47 +00:00
Moritz Kiefer
5087cc4be2
Bring release instructions up to date and inline test plan (#1972) 2019-07-02 15:53:37 +02:00
Fran
365ac2f94c
Use published extension by default in daml studio. (#1965)
* Use published extension by default in daml studio.

* Implement suggestions.

* Add release notes.
2019-07-02 11:29:19 +01:00
Moritz Kiefer
6bd76d80e1 Use the default dar path in the quickstart-java example (#1963) 2019-07-01 15:43:53 +00:00
Moritz Kiefer
af795d14ca Combine all artifacts output by damlc in .daml (#1959)
Fixes #1241
2019-07-01 15:07:30 +00:00
Robin Krom
e578f91efb
language: upgades: generate upgade code from dalfs (#1940)
* language: upgades: generate upgade code from dalfs

This switches the `migrate` command to read dalf files instead source to
generate upgrade code. The dalf files are read, data types are converted
back to haskell source, and from this we can generate generic instances
again.

There are two known issues that we want to address next:
  - Duplicate generic instance definitions will make the build fail.
  I.e this only works for data declarations that have no generic
  instances
  - Data declarations of the form `data Foo = Foo ()` can not be
  converted back to haskell source.
2019-07-01 14:44:53 +02:00
Andreas Herrmann
93d8e01db2
Update rules_haskell and static GHC (#1515)
* Update rules_haskell and static GHC

Remove patches that have been upstreamed or are no longer required.
Update still required patches to match the new rules_haskell version.

Previously we patched rules_haskell to coerce GHC into using static
Haskell libraries in most places. In particular we moved hs-libraries
entries into extra-libraries entries in the package configuration files.
A much cleaner approach is to compile GHC with a static RTS, then GHC
will by itself choose to load static Haskell libraries.

* Remove haskell_cc_import

* da-hs-daml-cli -> daml-cli

* da-hs-damlc-app -> damlc-app
2019-07-01 13:26:19 +02:00
Fran
074dadaf12 Use install script in integration test for unix. (#1952)
* Use install script in unix integration test.

* Fix waitForProcess
2019-07-01 09:21:04 +00:00
Michał Majcherski
7878120d5b
Fix hanging FFI call to scenario service problem on Windows (#1868)
* windows: hanging GRPC FFI call problem resolution

* windows: fix visual test

* windows: enabled back again some of disabled daml-assitant tests

* marking daml_ghc_integration_test as large
2019-06-26 11:45:52 +02:00
Robin Krom
05d80eeeb4
language: upgrades: no generics for data types having the instances already (#1840)
language: upgrades: dont derive generics for data types having the instances already

We only derive generic instances on the fly for data types that don't
have them already.
2019-06-25 18:17:34 +02:00
Fran
ce03f6a514
Remove navigator configs (#1859) 2019-06-25 12:32:03 +01:00
Fran
1648bba736 Exit from daml start if on-start command returns non-zero code. (#1857) 2019-06-25 09:45:08 +00:00
Fran
4cf5343dbb
Add support for da_haskell_repl targets in da-ghci (#1847)
* Add support for haskell_repl targets in da-ghci

* Change default target

* Revert newline loss.

* bazel fetch before bazel query

* Make a top level repl target the default.

* Add da_haskell_repl dependency in //BUILD

* Fix syntax error

* Fix bazel formatting...

* Rename DamlHelper modules to make //:repl work

* DamlHelper -> DamlHelper.Run

* Update the import in DamlHelper.Main

* Fix bazel rules again

* Update DamlHelper import in integration-tests
2019-06-24 16:39:41 +01:00
Robert Autenrieth
868a72b93a
Add support for DAML_PROJECT in Navigator (#1458)
* Add circe-yaml

* Add new helper library to load SDK config files

* Add support for DAML_PROJECT in navigator

Fixes #1128
2019-06-24 17:06:20 +02:00
Fran
d8c6239edc
Add options for scripting with daml start (#1837)
* Add more options to daml start

* Add release note for new options.
2019-06-24 14:57:01 +01:00
Fran
6318b3f858
Handle SIGINT in daml commands. (#1807)
* Raise UserInterrupt whenever SIGTERM happens when spawning processes in daml-helper.

* Avoid redundant installSignalHandlers

* Copyright header

* Update lint rules.

* Move installSignalHandlers to main
2019-06-24 08:25:12 +01:00
Robin Krom
b91c95d268
Write generic instances to separate modules on the fly (#1804)
* language: generate module containing generic instances

The migrate command generates generic instances of data types and puts
them in a separate module. For now this only works if the data type
doesn't have a generic instance already, we'll deal with this case in
the next PR.
2019-06-21 17:37:13 +02:00
Fran
728c1c9204
Implement daml install --install-assistant flag. (#1761)
* Add --install-assistant option

* Better doc on iActivate

* Determine whether to install assistant based on new flag

* Fix logic and update install warning

* Remove --activate from install.sh

* Add missing ]

* Change deprecation warning.

* Add release notes for new option.

* Update help text for install-assistant

* Fix release notes
2019-06-19 14:00:13 +01:00
Robin Krom
ca163d708e
language: feature: initial implementation of a 'migrate' command (#1707)
* language: feature: initial implementation of a 'migrate' command

We add a 'migrate' command to daml assistant that generates a project
that allows to migrate contract instances from package1 to package2.
This first version reads both package1 and package2 from source. As a
next step we read only the dalfs from package1, because it might have
been created with a different compiler.
2019-06-17 16:40:08 +02:00
Fran
e848b29cb4
Simplify daml version output (#1700)
* Simplify daml version output

* Make sure project version is really from daml.yaml

* Calculate latest version more thoroughly.

* Only show latest version if available
2019-06-17 12:19:56 +01:00
Fran
04f77626f9
Better error messages in daml-assistant when reading sdk-version from daml.yaml (#1677)
* Better errors for malformed daml.yaml

* Better error messages when reading sdk-version field.

* Lint
2019-06-14 18:24:12 +01:00
Fran
aa84930061
Strip env vars when calling vscode (#1667) 2019-06-14 13:13:53 +01:00
Fran
3eb2fd659a
Sort template list in daml new --list (#1599)
* Sort template list in daml new --list

* sort after takeFileName
2019-06-12 13:08:44 +01:00
Fran
9842570618 Tweak the "outdated DAML SDK in project" warning. (#1573) 2019-06-10 09:43:35 -04:00
Michał Majcherski
905410e1fd windows: daml-assistant tests (#1528) 2019-06-05 11:56:11 -04:00
Fran
161c1de31c
Implement daml uninstall command. (#1525)
* Define uninstall function.

* Add uninstall command.

* Change uninstall success messages.
2019-06-05 10:29:12 +02:00
Fran
8bc5387641
Display version number in yellow line. (#1499) 2019-06-04 09:31:25 +02:00
Fran
8d731fac39
Add version param to get-daml.sh (#1488)
* Add version param to get-daml.sh

* Deal with missing param better.
2019-06-03 14:47:27 +02:00
Moritz Kiefer
b16d94e958
Create VSCode extension directory on all platforms (#1470)
This is just as necessary when creating a symlink on Unix systems as
it is necessary on Windows.

fixes #1469
2019-05-31 14:44:50 +02:00
Moritz Kiefer
464ef86e0e Disable damlc test on Windows since it’s flaky (#1450) 2019-05-29 12:51:43 +00:00
Andreas Herrmann
1a80106753
damlc test --files (#1409)
* Add test case for damlc test-files

* Separate damlc test-files from damlc test

* Fix rules_daml/daml.bzl daml_test

* damlc test-files --> damlc test --files

The project options are still relevant for the --files case, as it may
be necessary to change into the project root directory in order to
locate the project package database.
2019-05-28 15:36:42 +02:00
A. F. Mota
34d8d705c7
Better error message for install --force failure on Windows. (#1422)
* Remove ghci[d].sh

* Add a nice error message on windows for install --force
2019-05-28 13:47:10 +02:00
Moritz Kiefer
53c5351144
Add a --project-root option damlc to specify the project root (#1401)
This was already possible before via the DAML_PROJECT environment
variable but for users that want to call damlc directly, e.g., via
damlc.jar a CLI flag can be more convenient.
2019-05-27 18:09:43 +02:00
A. F. Mota
2329b1b97a
Display warnings in daml build. (#1375)
* Display warnings in daml build.

* Prevent errors from showing twice.

* Use flagYesNoAuto for scenario service.
2019-05-24 14:36:48 +02:00
A. F. Mota
489244886c List all available versions, and persist version data. (#1339)
* List all available versions.

* Add --all flag in daml version

* Save version list to cache

* Update version cacheing logic.

* Linting error

* PR revisions.

* Update release notes.

* Update daml-assistant/src/DAML/Assistant/Version.hs

* Update docs/source/support/release-notes.rst

Co-Authored-By: Beth Aitman <bethaitman@users.noreply.github.com>
2019-05-23 14:33:07 +00:00
Moritz Kiefer
1c580d84a5
Make exposed-modules field in daml.yaml optional (#1345)
If unspecified, we expose all modules in the project.

Fixes #1328
2019-05-23 15:37:37 +02:00
Moritz Kiefer
d15f952dcc
Display daml-helper exceptions in a readable way (#1258)
This address part 2 of #1221.
2019-05-21 09:24:31 +02:00
Moritz Kiefer
d7209f3a09
Set program name of daml-helper to daml (#1256)
This prevents "daml new --help" and similar commands from showing
"daml-helper" instead of "daml".
2019-05-20 18:27:03 +02:00
A. F. Mota
db155477a5
Remove Data.SemVer workaround. (#1246) 2019-05-20 14:38:59 +02:00
A. F. Mota
128b8bed54
Add daml clean command (#1237)
* Add daml clean command

* Show what is removed during daml clean.

* Dont relativize
2019-05-20 13:11:35 +02:00
A. F. Mota
7013853694
Remove command kludge and prevent daml version from auto-installing. (#1229)
* Remove command kludge and prevent daml version auto-installing.

* Lint.

* Fix tests.

* Get rid of getMinimalDamlEnv.
2019-05-20 09:46:39 +02:00
A. F. Mota
9f184244f9 Add a couple failure modes to daml new. (#1212)
* Add a couple failure modes to daml new.

* Explain projectName == targetFolder check.

* Fix runNew documentation.
2019-05-17 11:13:38 +00:00
Gabor Aranyossy
e70cbfe65c eliminating some mutable state (#1130)
* no var no problem

further refactor

introduced InfraState

a bit less vars

encapsulating closes

SandboxServer starts automatically

rebase fixup

collecting state into a single object

some cleanup

removing exposed materializer

LedgerBackend is closed in SandboxServer

changed ownership of Ledger

fixing perf tests

fixing some compile errors

formatting

removing unused method

fixing integration test to use correct dar file

fixing issue with PostgresFixture and SandboxResource

Fix integration tests on Windows

* fixing rebase artifacts
2019-05-16 08:52:14 +00:00
Moritz Kiefer
7afc8af554
Add --open-browser flag to daml start (#1176)
I went with the yes/no/auto approach we already use in the assistant
and moved the logic for that to da-hs-base.
2019-05-16 10:28:49 +02:00
Moritz Kiefer
e48d5ccb22
Improve error messages on missing VSCode and missing Java (#1157)
* Improve error messages on missing VSCode and missing Java

* Better error messages
2019-05-15 17:18:03 +02:00
A. F. Mota
40f40d940a
Idempotent daml installs. (#1136) 2019-05-15 13:32:18 +02:00
Moritz Kiefer
ad10f98020
Fix SDK integration tests on Windows (#1125)
* Fix SDK integration tests on Windows

* Switch to Haskell-based tar extraction
2019-05-14 21:55:45 +02:00
A. F. Mota
f72fdf3552 Better error handling in get-daml.sh (#1121)
* Better error handling in get-daml.sh

* Use set -eu

* Review suggestions

* ORIGDIR is unused.
2019-05-14 10:54:05 +00:00
Moritz Kiefer
99a7b24b3b Add an option to not modify PATH in daml install --activate (#1119)
* Add an option to not modify PATH in daml install --activate

This is particularly useful in test suites where you install to a
temporary directory that should not be added to the registry.

* Use yes/no/auto

* Make check more robust
2019-05-14 09:01:35 +00:00
A. F. Mota
838b81d3da
Make daml version display installed SDK versions like da list. (#1114)
* Separate version logic out of DAML.Assistant.Env.

* Refactoring some of the exception handling.

* Update daml version command.

* Uncommit linting atrocity.
2019-05-14 08:46:55 +02:00
A. F. Mota
f7a0dd250a Open browser on daml start. (#1103) 2019-05-13 17:36:08 +00:00
Andreas Herrmann
c3a651364f Handle module root . and non-normal source paths (#1073)
* Handle module root `.` and non-normal source paths

* Add regression test for #1048
2019-05-13 08:54:40 +02:00
A. F. Mota
2d682f489e Implement daml init command. (#1080)
* Started working on daml init.

* Implement daml init.

* Nicer messages and nicer field generation.

* Cleaning up a duped definition.

* Review revisions
2019-05-10 16:32:41 +00:00
Moritz Kiefer
eb3b9a7ec4
Add an integration test for daml packages (#1050) 2019-05-09 16:45:40 +02:00
A. F. Mota
9cc18edd07
Catch all synchronous exceptions when making network requests. (#1038)
* Catch all synchronous exceptions when making network requests.

* Wrap all of getLatestVersion.

* wrapErr wraps sync exceptions as well.

* Pass through exit codes.
2019-05-09 14:41:45 +02:00
A. F. Mota
5c8e1e0ef2
Make daml-sdk-head work alongside daml installation. (#997)
* Make daml-sdk-head work alongside daml installation.

* Delete any exsting legacy .daml-head installation.

* Do daml-head.cmd on windows.
2019-05-08 16:14:52 +02:00
Moritz Kiefer
b5eb7ce52b
Move DAR created in "daml start" to dist/ (#993)
fixes #992
2019-05-08 10:14:05 +02:00
Moritz Kiefer
75be2e708d
Show help on errors in daml-assistant and daml-helper (#974) 2019-05-07 15:39:31 +02:00
A. F. Mota
2d2159cd0a Fix getDispatchEnv / getDamlEnv re-entrancy. (#951)
* Add two failing getDispatchEnv tests.

* Fix getDispatchEnv idempotency.

* Fix new test formatting.

* Make getDamlAssistantPath look in env first.

* Fix daml env var overriding.

* Test all the Nothing cases of env var dispatching.

* Fix dispatchEnv and getDamlEnv for Nothings.

* Add hlint rule to avoid future setEnv debacles.

* Fix other uses of setEnv.

* Fix type error.

* Fix reviewer comments

* setEnv comment
2019-05-06 19:25:30 +00:00
A. F. Mota
2d63d27da0 Move the dispatch env vars to the end. (#880) 2019-05-06 16:10:13 +02:00
Moritz Kiefer
66541f18d0
Upgrade to new Stackage snapshot (#941)
I also started an Upgrading.md document. I’ll add the documentation
for upgrading nixpkgs in a separate PR.
2019-05-06 15:45:31 +02:00
Moritz Kiefer
3f6ae21fbc
Output a note about the new project in "daml new" (#935) 2019-05-06 14:34:24 +02:00
Neil Mitchell
e36e1074e0 Rename the runTests function to main, since it serves as a main (#910) 2019-05-04 09:37:23 +00:00
A. F. Mota
e8ebbe6c91
Disable version nagging and avoid looking at unnecessary information in daml install. (#857)
* Do not ask user to install when they are already running the install command.

* Avoid looking at unecessary information when doing daml install.

* Update daml-assistant/exe/DAML/Assistant.hs

Co-Authored-By: associahedron <231829+associahedron@users.noreply.github.com>

* Remove unnecessary import.
2019-05-03 11:06:34 +02:00
A. F. Mota
12e8baa93f Simplify daml new template release process and add a simpler default template. (#850)
* Skeleton template.

* Add quickstart-java template.

* Update release rule

* Add Main.daml in skeleton template.

* Change default template for daml new.

* Update templates/BUILD.bazel

* Fix bazel rule formatting.

* Update integration test to use quickstart-java template.
2019-05-03 08:17:15 +00:00
A. F. Mota
0353c26929 Make the new version check time configurable. (#859) 2019-05-03 00:24:06 +00:00
A. F. Mota
e37d3eca9c
Pass project path as argument to vs code in daml studio. (#852)
* Pass project path (or cwd) as argument to vs code in daml studio.

* Remove unnecessary windows command tweak.
2019-05-02 18:21:55 +02:00
A. F. Mota
aa2d7a8dff
Add outdated version warnings in daml-assistant. (#758)
* Add outdated version warnings

* Fix stable version calculation.

* Cache latest sdk version.

* Rename test1 and test2.

* Catch HttpExceptions and TLSExceptions where appropriate.
2019-05-02 15:12:31 +02:00
A. F. Mota
087b2c4f3f Use open -a on mac for daml studio. (#836) 2019-05-02 14:11:29 +02:00
Moritz Kiefer
6ac0931a25
Fix daml studio on Windows if .vscode/extensions does not exist (#829) 2019-05-02 11:13:09 +02:00
Moritz Kiefer
b0478bbdbe
Fix permissions in "daml new" (#827)
* Fix permissions in "daml new"

I accidentally added the permissions stuff to the wrong use of copyDirectory
2019-05-02 10:22:06 +02:00
Martin Huschenbett
370b58d2fd
Turn on a few more hlint hints (#800) 2019-04-30 20:46:52 +02:00
Moritz Kiefer
c597becd2c
Support SDK install when TMP_DIR is a on a different filesystem (#770)
* Support SDK install when TMP_DIR is a on a different filesystem

fixes #746
2019-04-30 11:35:53 +02:00
Moritz Kiefer
f4b79c7518
Update path automatically on Windows in "daml install --activate" (#757) 2019-04-29 17:10:17 +02:00
Moritz Kiefer
4d4bbd8028
Move code shared between lib and tests to a DAML assistant library (#749)
* Move code shared between lib and tests to a DAML assistant library

Previously we were compiling the same code twice, once for the binary
and once for the test suite.

* Move tests and binary to separate directories

The lack of sandboxing on Windows in combination with
-Wmissing-home-modules breaks our Windows build otherwise.
2019-04-29 10:21:01 +02:00
K5
451858335f
Simplify daml assistant interface. (#725)
* Simplify daml assistant interface.

* Update descriptions based on suggestions

* Build dar in proper place.
2019-04-29 09:14:51 +01:00