daml/dev-env/windows
Moritz Kiefer e40f62f88a
Revert "Switch to Bazel 5 (#12935)" (#12974)
This reverts commit 4c0118df4d.

This breaks passing -p to bazel test for Haskell tests, e.g.,

bazel test //compiler/damlc/tests:integration-v1dev --test_arg -p
--test_arg InterfaceEq

which breaks with something horrifying like

moritz@adjunction ~/daml (main)> bazel test //compiler/damlc/tests:integration-v1dev --test_arg -p --test_arg InterfaceEq
[dev-env] Building tools.bazel...
[dev-env] Built tools.bazel in /nix/store/m7gzlmr0pqjpl01ihgvazxgfs3sfwl61-bazel and linked to /home/moritz/daml/dev-env/var/gc-roots/bazel
[dev-env] Building tools.find...
[dev-env] Built tools.find in /nix/store/645v3545lcbx77wq7355rgdrgbhn5wx7-findutils-4.8.0 and linked to /home/moritz/daml/dev-env/var/gc-roots/find
INFO: Invocation ID: 034b3e45-851f-472e-ab71-b7f718829582
DEBUG: /home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/rules_haskell/haskell/private/versions.bzl:60:10: WARNING: bazel version is too recent. Supported versions range from 4.0.0 to 4.2.1, but found: 5.0.0- (@non-git)
/nix/store/dadkhf8vch2i2kvig962ilfr5j3chshr-go-1.17.6
/nix/store/pzh24n543i6jqa01hdmgqknlyf294bn1-bazel-nixpkgs-posix-toolchain
/nix/store/2hfwndk47wpvaib06qyhcdp83b423xvh-jq-1.6-bin
/nix/store/hjggs9s82qh7r5j8sgapn389hf24wdx8-bazel-nixpkgs-cc-toolchain
/nix/store/yxgg3bn4v288sc00kf09svrwz2r461c9-ghc-native-bignum-9.0.2
/nix/store/2hwx0jhcdsx3wfvmb50ih19jkh2ra4jh-glibc-locales-2.33-108
/nix/store/8wpmx049z8m0ffhy3jyi41qb6pbxwvy8-bazel-nixpkgs-java-runtime
ERROR: file 'external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.pic.o' is generated by these conflicting actions:
Label: @bazel_tools//src/tools/launcher:launcher
RuleClass: cc_binary rule
Configuration: 869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9, 8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c
Mnemonic: CppCompile
Action key: 3d79fe1470dcb842d5944c98dfe7a62715db6d86fdb12d3ff60af3bdf41b7996
Progress message: Compiling src/tools/launcher/dummy.cc
PrimaryInput: File:[/home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/bazel_tools[source]]src/tools/launcher/dummy.cc
PrimaryOutput: File:[[<execution_root>]bazel-out/k8-opt/bin]external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.pic.o
Owner information: ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9]}, ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c]}
MandatoryInputs: are equal
Outputs: are equal
ERROR: file 'external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o' is generated by these conflicting actions:
Label: @bazel_tools//src/tools/launcher:launcher
RuleClass: cc_binary rule
Configuration: 869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9, 8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c
Mnemonic: CppCompile
Action key: 9f46e824944add9e9951ef51ddb6cb4b744bc97f90b5749132179d1d1699dfa1
Progress message: Compiling src/tools/launcher/dummy.cc
PrimaryInput: File:[/home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/bazel_tools[source]]src/tools/launcher/dummy.cc
PrimaryOutput: File:[[<execution_root>]bazel-out/k8-opt/bin]external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o
Owner information: ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9]}, ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c]}
MandatoryInputs: are equal
Outputs: are equal
ERROR: com.google.devtools.build.lib.skyframe.ArtifactConflictFinder$ConflictException: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o, previous action: action 'Compiling src/tools/launcher/dummy.cc', attempted action: action 'Compiling src/tools/launcher/dummy.cc'

changelog_begin
changelog_end
2022-02-16 18:24:00 +00:00
..
bin open-sourcing daml 2019-04-04 09:33:38 +01:00
libexec Windows dev-env Powershell 7 compatibility (#10408) 2021-07-26 16:53:23 +02:00
manifests Revert "Switch to Bazel 5 (#12935)" (#12974) 2022-02-16 18:24:00 +00:00
.gitignore open-sourcing daml 2019-04-04 09:33:38 +01:00
build.ps1 open-sourcing daml 2019-04-04 09:33:38 +01:00
README.md Document the need for long file paths on Windows (#670) 2019-04-24 18:21:56 +00:00
test.ps1 open-sourcing daml 2019-04-04 09:33:38 +01:00
VERSION open-sourcing daml 2019-04-04 09:33:38 +01:00

Windows Dev-env

DADEW (DA Dev Env for Windows) is a tool, which can be used to setup a developer's environment on Windows machines.

How to use it?

First you need to enable long file paths by running the following command in an admin powershell:

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name LongPathsEnabled -Type DWord -Value 1

Then you need to install your local DADEW environment by running:

.\dev-env\windows\bin\dadew.ps1 install

In this step a Scoop command-line installer is downloaded and configured. DADEW by default resides in User's home directory in dadew folder, usually C:\Users\<user-id>\dadew\. This is one-off action, unless you uninstall your DADEW environment.

To sync your local environment with required target environment's tools run:

.\dev-env\windows\bin\dadew.ps1 sync <.dadew file>

or just

.\dev-env\windows\bin\dadew.ps1 sync

in case of .dadew file in current location.

This will fetch all required tools, if not already available, and make them ready to use, but they will not be present on the $PATH yet.

To make all sync'ed tools present on the $PATH

.\dev-env\windows\bin\dadew.ps1 enable

To disable run:

.\dev-env\windows\bin\dadew.ps1 disable

$PATH environment variable is changed only in the current session, so DADEW needs to be enabled each time new powershell session is created in order to get tools available.

DADEW environment can be also uninstalled by running:

.\dev-env\windows\bin\dadew.ps1 uninstall

which will remove all tools physically from the workstation.

To get an absolute path of a binary provided by this dadew run:

.\dev-env\windows\bin\dadew.ps1 which <app>

Versioning

DADEW is versioned. You can check which version you are running by calling:

.\dev-env\windows\bin\dadew.ps1 version

In order to sync with required tools from specific repo (specific .dadew file) you need to have the same or newer version of DADEW installed. The minimum version which is required in order to perform a sync can be check by calling:

.\dev-env\windows\bin\dadew.ps1 required-version <.dadew file>

or just

.\dev-env\windows\bin\dadew.ps1 required-version

in case of .dadew file in current location.

How to build?

PS C:\> ./build.ps1

This will create dev-env-windows/dist/dadew-<VERSION>.zip file.

How to test?

DADEW is tested with use of Pester 4.

To check if Pester is available on your Windows machine and what version is installed run:

Get-InstalledModule -Name Pester

this will print Windows module details, including version:

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
4.4.2      Pester                              PSGallery            Pester provides a framework for running BDD styl...

Version 4.x is required to run tests. If it's not present you can use simple script available at dev-env-windows/test/update-pester.ps1 to install required version of Pester.

Tests can be run using:

PS C:\> ./test.ps1