Commit Graph

126 Commits

Author SHA1 Message Date
Moritz Kiefer
53f25599d0 Send session ping telemetry messages (#3997)
* Send session ping telemetry messages

This PR adds telemetry information that is sent regularly (every 5
minutes) while users are active (they’ve opened, closed or changed a
file). This allows us to track how long user sessions are.

This PR does not include any additional information in the session
ping but we plan to add more in the future.

The ping messages can be found in big query by filtering for
`jsonPayload.type = "session_ping"`.

CHANGELOG_BEGIN
CHANGELOG_END

* add copyright header
2020-01-09 14:34:23 +00:00
associahedron
ec769ede31
damldocs: Add --exclude-instances option and exclude HasField instance docs from stdlib. (#3962)
* Refactor transform options

* Finish refactoring and implement --exclude-interface

* Exclude HasField instances from stdlib docs.

CHANGELOG_BEGIN

- [DAML SDK] ``daml damlc docs`` now accepts a ``--exclude-instances``
option to exclude unwanted instance docs by class name.

CHANGELOG_END

* s/excludeInstances/excludeInterfaces/g

* Review comments
2020-01-07 15:32:46 +00:00
Moritz Kiefer
42c586f8d4
Bump ghcide (#3943)
* Bump ghcide

* Fix ghcide build

* Include bugfix for Windows
2020-01-04 07:51:51 +01:00
Gary Verhaegen
878429e3bf
update copyright notices to 2020 (#3939)
copyright update 2020

* update template
* run script: `dade-copyright-headers update .`
* update script
* manual adjustments
* exclude frozen proto files from further header checks (by adding NO_AUTO_COPYRIGHT files)
2020-01-02 21:21:13 +01:00
Moritz Kiefer
2059c4d146
Move stable types from DA.Internal.Template to a separate module (#3876)
* Move stable types from DA.Internal.Template to a separate module

This is in preparation for splitting them into a separate LF package
with a stable package id.

* Fix visualization

* Fix data dependencies
2019-12-17 21:23:04 +01:00
Moritz Kiefer
52e594a2e9
Move optWriteIface to compile-specific options (#3861)
Originally, this made sense as a flag in Options since we read it
during typechecking to write out interfaces on the fly. But now, we
write this is only used in execCompile so having this be a global
option that is ignored anywhere but in `compile` is rather confusing.
2019-12-17 11:05:28 +01:00
Moritz Kiefer
ddef6c7bce Document packaging code (#3860)
This documents some of the edge cases in the packaging code that I’ve
had trouble understanding so that the next person hopefully has an
easier time with this.

There is also some minor cleanup in this PR.
2019-12-16 13:44:19 +00:00
Moritz Kiefer
e3830106ad
Fix package names in depends field in pkg configs (#3810)
* Fix package names in depends field in pkg configs

Previously, we derived this based on the DAR name which breaks if you
use -o with rather confusing error messages. Now, we read it from the
`Name` field in the manifest that we added in
https://github.com/digital-asset/daml/pull/3805.

CHANGELOG_BEGIN

- [DAML Compiler] Fix an issue where transitive package dependencies
  resulted in packages not being found, if the DAR name was changed with
  `-o`.

CHANGELOG_END

* Fix package dependencies
2019-12-11 11:49:50 +01:00
Moritz Kiefer
e769264ddf Move all datatypes out of daml-prim (#3791)
* Move all datatypes out of daml-prim

This moves the remaining two modules DA.Types and GHC.Tuple to
separate LF packages with stable identifiers.

The only data types remaining are the ones for typeclasses which will
disappear once we move this to type synonyms.

CHANGELOG_BEGIN

- [DAML Compiler] The modules DA.Types and GHC.Tuple from daml-prim
have been moved to separate packages.

CHANGELOG_END

* Fix codegen tests

* Fix DarReader test

* Fix kvutils tests

* Fix jdbcdao tests

* Fix hs ledger bindings tests
2019-12-10 09:19:16 +01:00
Moritz Kiefer
321032a0f2 Create a new type for package imports (#3765)
My brain can’t handle 3-tuples with strings and booleans, so this PR
introduces a new record type to make those fields clearer.
2019-12-06 14:02:59 +00:00
Moritz Kiefer
3f12e60b12 Refactor packaging logic (#3749)
* Refactor packaging logic

This is a first step towards cleaning up the packaging logic and
adding some comments to make it clearer what is going on. There are no
functional changes in this PR.

There is more stuff here that we can and should cleanup but I will
leave that for separate PRs.

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

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

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

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

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

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

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

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

* Document topological sorting

* Undo requiredE change
2019-12-06 09:55:27 +00:00
Robin Krom
3f666792b1 language: suffix all dalfs dependencies in a dar with the pkgid. (#3668)
* language: suffix all dalfs dependencies in a dar with the pkgid.

This makes sure that dalf dependencies are not accidentally overwritten
when two packages with equally named dalfs are imported.

* factor out parseUnitId
2019-12-05 11:47:45 +00:00
Moritz Kiefer
ba30e86911
Split wired-in modules into separate LF packages (#3696)
This is a first step towards making sure that the package ids for
types defined in daml-prim and daml-stdlib don’t change. This PR
mostly adds all the necessary infrastructure for that and moves
GHC.Types and GHC.Prim to make sure it works.

Until data-dependencies are really solid and we have verified that we
no longer have performance issues with an increasing number of Haskell
packages, we still include the source files in daml-prim and then just
rewrite the references.

We will also need to add tests that these packages really have stable
ids but I’ll leave that for separate PRs since this doesn’t make that
much sense anyway until all of the types have moved to stable
packages.

CHANGELOG_BEGIN

- [DAML Compiler] The modules GHC.Prim and GHC.Types from daml-prim
have been moved to separate packages.

CHANGELOG_END
2019-12-04 16:42:48 +01:00
Martin Huschenbett
054fcd22f2 Remove component version from damlc output (#3709)
The component version is a relic from before we went to a mono repo.
It's completely useless now.
2019-12-03 14:06:49 +00:00
Moritz Kiefer
5a3b5f498a Fix SDK versions in trigger and daml-script dars (#3706)
* Fix SDK versions in trigger and daml-script dars

* Fix SDK versions in tests
2019-12-03 07:28:49 +00:00
associahedron
e696c34fc0
Let damlc docs see build-options. (#3695)
CHANGELOG_BEGIN

- [DAML SDK] ``damlc docs`` now takes into account the project's ``build-options`` from ``daml.yaml``.

CHANGELOG_END
2019-12-02 15:07:15 +00:00
Moritz Kiefer
75c9b1bf91
Simplify template desugaring (#3670)
* Introduce a simpler template desugaring without support for generic templates

This adapts the LF conversion to the new template desugaring
introduced in our GHC fork. The guiding principle is that we use the
typeclasses directly to avoid generating, typechecking and converting
redundant code caused by indirections. I updated the template
desugaring documentation so that is probably a good starting point for
reviewing this.

* Address review comments

* Fix daml doc tests

* Fix data dependency tests

* Switch to new ghc-lib release
2019-11-29 16:13:15 +01:00
Robin Krom
d90eb357ad
language: upgrades: prefix stdlib imports everywhere. (#3633) 2019-11-26 19:28:11 +01:00
associahedron
367a1d8ceb Set Sdk-Version in DAR Manifest to compiler SDK version. (#3587)
* Set Sdk-Version in DAR Manifest to compiler SDK version.

CHANGELOG_BEGIN

- [DAML Compiler] Bugfix: The Sdk-Version field in a DAR manifest file
now matches the SDK version of the compiler, not the sdk-version field
from daml.yaml. These are usually the same, but they could be different
if you set the DAML_SDK_VERSION environment variable before running
``daml init`` or ``daml build``.

CHANGELOG_END

* Fallback to daml.yaml if env var not set

* add yaml dependency

* Always require sdk-version, and emit warning on mismatch with env var

* More explicit about where override comes from

* Add packaging regression test
2019-11-22 16:25:58 +00:00
Moritz Kiefer
61739bc49e Move non-upgrading code to a separate DataDependencies module (#3552) 2019-11-20 16:43:10 +00:00
Robin Krom
3d960c708f language: make only needed packages visible for cross sdk imports (#3503)
* language: make only needed packages visible for cross sdk imports

This gives us more control over what packages are visible in the package
database during cross sdk imports and makes sure we're not accidentally
picking up the wrong one.

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

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

* deal with evil dalf imports
2019-11-18 21:08:33 +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
Moritz Kiefer
db1b12dbab Move packaging logic to a separate module (#3481)
It has grown large enough that by now it definitely deserves to be in
its own module.

This PR does not change any of the actual code, it simply moves it around.
2019-11-14 21:14:59 +00: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
Martin Huschenbett
00afadeed8
Remove a bunch of unused CLI option parsers from damlc (#3440) 2019-11-13 13:27:31 +01:00
Martin Huschenbett
de14f0c53f Remove an inaccurate FIXME (#3412)
I didn't really read the code around the FIXME. After spending a few moments
on it, I'm now convinces the current behaviour is the right behaviour. I
can't think of a short way to explain it in a comment without inflicting my
my previous confusion on others. Thus, I just remove the FIXME.
2019-11-11 16:31:34 +00:00
Martin Huschenbett
6fe3df57cd Rewrite PRSelf when loading a dependency package (#3406)
When buidling simple project that has our favourite large project as a
dependency, this decreased
- total allocations from 63GB to 57GB
- run time from 34.0s to 31.5s
2019-11-11 08:52:07 +00: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
Moritz Kiefer
d7f5b3b436 Add support for on-disk incremental builds in damlc build (#3378)
* Add support for on-disk incremental builds in damlc build

* Normalise file paths of internal modules because Windows

* stop stealing my $s hlint

* Apparently jars are also called exe

* Address review comments

* Bump to proper ghcide revision
2019-11-07 16:56:42 +00:00
Robin Krom
85019835af language: dont change directory for generation of ifaces (#3379)
We don't need to change the directory to generate the interface files.
2019-11-07 15:52:17 +00: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
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
Rohan Jacob-Rao
00fc6bf100 Log when user views scenario results (#3271)
* Extend Priority type with Telemetry value

* Include Telemetry logging level in logger

* Log viewing of scenario results

* Update ghcide with telemetry logging level
2019-10-28 23:42:20 +00:00
Moritz Kiefer
319d43ac26
Clear package db before reinitializing it (#3241)
fixes #3240
2019-10-21 14:04:10 -04:00
associahedron
1d52cdb4bc
Add damlc test to list of cammands that care about build-options (#3227) 2019-10-21 11:36:21 +01:00
Moritz Kiefer
36719717fa
Update to current state of progress reporting in LSP (#3211)
* Update to current state of progress reporting in LSP

* fix ide-debug-driver

* Fix tests

* Fix build of ghcide executable
2019-10-17 16:14:49 +02: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
Remy
e45b585307 daml-lf: repackage daml-lf archive proto (daml_lf -> daml_lf_dev) (#3169) 2019-10-15 09:36:11 +00:00
Remy
217405e883 daml-lf: Move archive protofile to a more usual place. (#3166)
* move daml-lf archive protobug to a more usual place

* formatting

* fix kvutils proto

* fix csharp namespace
2019-10-14 13:22:22 +00: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
Robin Krom
0671d7b905
language: add internal command for generating source from dalf. (#3129)
* language: add internal command for generating source from dalf.

We add an internal command for generating DAML source code from .dalf
packages. Also adds an internal flag to tell the compiler, that it is
compiling generated source.
2019-10-08 17:35:33 +02:00
Moritz Kiefer
a25c2e9de3
Avoid normalizing include dirs (#3103)
* Avoid normalizing include dirs

Fixes #3099

See https://github.com/digital-asset/ghcide/pull/152 for the
corresponding PR in ghcide

* bump to proper ghcide rev

* bump haskell-lsp rev
2019-10-04 10:41:44 +02: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
Moritz Kiefer
5e9c950164 Fix damlc build error messages if LOCALE_ARCHIVE is not set (#3041)
* Fix damlc build error messages if LOCALE_ARCHIVE is not set

* Fix tests

* fix more tests
2019-09-26 12:00:44 +00:00
Moritz Kiefer
dade80afe1 Add a --target flag to the IDE (#3019)
It is really annoying to not be able to load code that requires 1.dev
in the IDE.
2019-09-25 11:45:14 +00:00
Remy
23c3c33fe1
scenario-service: run no validation, when called from ide (#3003) 2019-09-25 11:06:47 +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
78e51090df Fix Windows CPP issues (#2991)
The issue was actually not really related to CPP but to the lack of
sandboxing on Windows. That resulted in us overwriting Prelude.hi from
the 1.dev rule with the Prelude.hi from the 1.6 rule in some cases
which caused the error we were seeing.

fixes #2983
2019-09-24 13:42:48 +00:00