Commit Graph

21 Commits

Author SHA1 Message Date
dylant-da
a0fe6fe532
Fix version caching (#17581)
* Make at least one call API if there is no cache

* document why we don't use /repos/{owner}/{repo}/releases/latest

* Refactoring

* Improve name - envLatestStableSdkVersion is only used in one location

* `daml install latest` overrides update-check in daml-config.yaml

* Improve comments for cacheAvailableSdkVersions

* lint

* Drop lookup for UpdateCheckNever

https://dev.azure.com/digitalasset/daml/_build/results?buildId=151669&view=logs&jobId=870bb40c-6da0-5bff-67ed-547f10fa97f2&j=870bb40c-6da0-5bff-67ed-547f10fa97f2&t=fdc575a5-c2b4-5f52-8465-2c7aa3e12574
reports
daml: Snapshot versions list from https://api.github.com/repos/digital-asset/daml/releases does not contain valid JSON
  context: Fetching list of available SDK versions
  details: Error in $: expected Array, but encountered Object

I assume this is because the request returned some sort of failure
2023-10-17 17:32:05 +01:00
dylant-da
760f879e35
Extract available snapshot versions from Github (#17029)
* Extract available snapshot versions from Github

* Refactor slightly, add comments

* Implement caching

* Make getLatest commands query the minimum number of times from Github

* lint

* filter out prereleases, fix naming

* Fix outdated reference `extractVersionsFromSnapshots` to extractReleases

* Retrieve all versions so that getLatest can prune old versions' patches

* Hide --snapshots, --all, and --force-reload flags from daml version

* Get isPrerelease check correct way around

* Thread UseCache to `daml install` and other commands

* Refactor getEnvLatestStableSdkVersion to defer sdk version extraction

* store envLatestStableSdkVersion thunk in struct so tests can override it

* Read environment var early in getLatestStableSdkVersion

I implemented this with `overrideWithEnvVarMaybe`, but it required some
rather opaque abuse of `fmap pure`, `sequence`, and `join`

* Replace hidden with internal so flags don't show up in help
2023-06-28 12:04:00 +00:00
Gary Verhaegen
151e12b81a
bump copyright (#16002)
This is the result of:

- Updating `./COPY` to say `2023`.
- Running `./dev-env/bin/dade-copyright-headers update .`
2023-01-04 18:21:15 +01:00
Gary Verhaegen
d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00
Robin Krom
32ca8fb831
telemetry: use an extra cache directory for telemetry (#8439)
* telemetry: use an extra cache directory for telemetry

If the sdk's `.daml` directory is not writable, telemetry fails and
kills the IDE. We add a new assistant environment variable "DAML_CACHE".
If set, this directory is used for telemetry cache data.

Fixes #8396.

CHANGELOG_BEGIN
CHANGELOG_END

* try creating directory

* check for already existing machine id file

* set DAML_CACHE to read-only in assistant integration tests
2021-01-15 11:44:18 +01:00
Gary Verhaegen
a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00
Sofia Faro
c3d99c1695
Dont look for daml.yaml during SDK install. (#8167)
* Dont look for daml.yaml in SDK install.

Unless you're running "daml install project".

Fixes #5720

changelog_begin
changelog_end

* use pattern synonym for raw install target
2020-12-04 13:07:30 +00:00
Robin Krom
e865ea7d5b
assistant: prompt users to automatically update PATH (#7910)
* assistant: prompt users to automatically update PATH

We ask the Max/Linux users on installation if we should update their
PATH environment variable to point to the assistant binary and
automatically do so when the answer is affirmative.

CHANGELOG_BEGIN
CHANGELOG_END

* set .profile insetad .bashrc

* add a case for sh

* fix tests

CHANGELOG_BEGIN
CHANGELOG_END

* use imports only on nix systems

* update windows updatePath function for YesNoAuto flag.

CHANGELOG_BEGIN
CHANGELOG_END
2020-11-06 17:07:40 +01:00
Sofia Faro
25f158edb6
Make paths in assistant environment absolute. (#7142)
Part of #6977. This PR adds some assistant tests, but regression tests and documentation should be added before the issue is closed.

changelog_begin
changelog_end
2020-08-17 07:45:37 +01:00
associahedron
adef6192ca
Use relative symlink in daml install on unix. (#5596)
* Use relative symlink in daml install on unix.

Fixes #5568

changelog_begin
changelog_end

* fix typo
2020-04-17 13:08:49 +01:00
associahedron
36e8c8fccd
Add snapshot version support in daml-assistant. (#5410)
* Add snapshot version support in daml-assistant.

changelog_begin

- [DAML SDK] ``daml version`` can now list the available snapshot
versions by passing the flag ``--snapshots=yes``.

- [DAML SDK] ``daml install latest`` can now include the latest snapshot version by passing the flag ``--snapshots=yes``.

changelog_end

* Keep backward-compatible --all behavior

* Fix comment

* Delete spurious punctuation
2020-04-03 10:56:17 +00: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
Moritz Kiefer
a84311ac39
Change withEnv to not clear the whole env (#5281)
The way we use `withEnv` it is really intended to set a few
environment variables in an already existing environment instead of
clearing everything before. This PR changes it to do only that.

changelog_begin
changelog_end

closes #5280
2020-03-30 12:21:25 -04: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
Andreas Herrmann
f3f39a23a3
daml-assistant tests: fix flaky test on Windows (#4945)
* daml-assistant tests: fix flaky test on Windows

```
bazel test //daml-assistant:test --test_arg=--quickcheck-replay=425714
```
failed on Windows in the test-case:
```
tail . ascendents == ascendents . takeDirectory
```
In that case the two path components given two the test case shrink to
`p1 = "a"` and `p2 = "\\"`. Confusingly, on Windows
```
isRelative "\\" == True
```
while
```
"a" </> "\\" = "\\"
```
This is documented behaviour on Windows, see [1] and [2].

Using `p1 </> p2 /= p2` instead of `isRelative p2` works around this.

[1]: https://hackage.haskell.org/package/filepath-1.4.2.1/docs/System-FilePath-Posix.html#v:-60--47--62-
[2]: https://hackage.haskell.org/package/filepath-1.4.2.1/docs/System-FilePath-Posix.html#v:isRelative

* Fix ascendants test group name

`ascendants` is defined in `DA.Daml.Project.Util`, not
`DA.Daml.Assistant`.

CHANGELOG_BEGIN
CHANGELOG_END

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-03-11 16:04:31 +00:00
associahedron
d9cb5099de
A first draft at telemetry for daml-assistant. (#4506)
* Report assistant commands and errors via a logger.

CHANGELOG_BEGIN
CHANGELOG_END

* Hook up daml-assistant to a GCP logger.

* fix test case

* fix more tests

* Check opted in status in assistant.

* Anonimize args that have unexpected characters.

* More agressive anonimization

* add missing containers dependency
2020-02-14 15:46:25 +00:00
Moritz Kiefer
d1449e78c7
Add Zsh completions for the assistant (#3980)
* Add Zsh completions for the assistant

This is slightly more annoying for users since at least on Linux there
doesn’t seem to be a user-writable directory that is in `$fpath` by
default. I think on Zsh we could probably write them to
/usr/local/share/zsh/site-functions but I’d rather avoid platform
specific logic here. I would expect that Zsh users are usually
somewhat comfortable with modifying the config and this also matches
other installation instructions, e.g.,
https://github.com/zsh-users/zsh-completions#manual-installation.

On the plus side, the completions look significantly nicer in Zsh
since they include the description of commands.

CHANGELOG_BEGIN
- [DAML Assistant] Zsh completions for the DAML Assistant are now
  installed as part of ``daml install``. To activate them you need to
  add ``~/.daml/zsh`` to your ``$fpath``, e.g., by adding
  ``fpath=(~/.daml/zsh $fpath)`` to the beginning of your ``~/.zshrc``
  before you call ``compinit``.
CHANGELOG_END

* Fix tests

* Update daml-assistant/src/DA/Daml/Assistant/Install/Completion.hs

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

Co-authored-by: associahedron <231829+associahedron@users.noreply.github.com>
2020-01-08 14:58:13 +01:00
associahedron
e055ad8038 daml-assistant: Install bash completion scripts on Linux and Mac. (#3946)
* Improve bash completions for daml-assistant.

* Install bash completion script automatically

* Better default logic for bash completions

* specifically -> explicitly

* Copyright headers

* Better hook logic and refactoring

* Handle non-standard installations more robustly.

* Handle CI env & add changelog note.

CHANGELOG_BEGIN

- [DAML Assistant] Bash completions for the DAML assistant are now
available via ``daml install``. These will be installed automatically
on Linux and Mac. If you use bash and have bash completions installed,
these bash completions let you use the tab key to autocomplete
many DAML Assistant commands, such as ``daml install`` and
``daml version``.

CHANGELOG_END

* Mention bash completion in assistant docs

* Remove promises
2020-01-06 15:51:32 +00: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
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
nickchapman-da
b90862ebec
improve haskell module hierarchy to be more consistent (#2319) 2019-07-29 15:55:55 +01:00