Skip to content

Commit

Permalink
Add winget instructions
Browse files Browse the repository at this point in the history
+ Add GitForTesting renew Git credentials instructions

Part of diskuv/dkml-installer-ocaml#79
  • Loading branch information
Jonah Beckford committed Nov 23, 2023
1 parent f149449 commit b5dc6db
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 17 deletions.
42 changes: 38 additions & 4 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
the highest Stage number. Many stages require a re-configuration based on
values obtained from the prior stages, so do not skip any targets.

Notes:
1. When you get to `Package-Stage10-GitPushForTesting`, make sure you do `git fetch` in
the `dkml` project to renew your Git credentials if you have leased Git credentials.

Errata:
1. For Stage2-DuneFlavor, you may need to run it twice. The first time you
may encounter:
1. For Stage2-DuneFlavor, you may need to run it multiple times. The first times you
may encounter flakiness:

```text
[build] [ERROR] Could not update repository "default": "...\\build\\pkg\\bump\\msys64\\usr\\bin\\mv.exe ...\\build\\pkg\\bump\\.ci\\o\\repo\\default.new ...\\build\\pkg\\bump\\.ci\\o\\repo\\default" exited with code 1 "/usr/bin/mv: cannot move '...\build\pkg\bump\.ci\o\repo\default.new' to '...\build\pkg\bump\.ci\o\repo\default': Permission denied"
Expand All @@ -28,9 +32,39 @@
```text
[build] # File "installer/bin/runner_user.ml", line 1, characters 9-54:
[build] # 1 | let () = Dkml_component_network_ocamlcompiler.register ()
[build] # 1 | let () = Dkml_component_ocamlcompiler_common.register ()
[build] # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[build] # Error: Unbound module Dkml_component_network_ocamlcompiler
[build] # Error: Unbound module Dkml_component_ocamlcompiler_common
```
6. Finish with the CMake target `-PublishAssets`.
## Editing Source Code
### Visual Studio Code
You can edit OCaml code after you have built the `Package-Stage04-FullFlavor` target.
In Visual Studio Code:
1. Go to View > Command Palette and select `OCaml: Select a Sandbox for this Workspace`.
2. Choose "Custom"
3. Enter the following (with the paths changed to reflect your project directory, and the correct DkML version number):
```powershell
Y:\source\dkml\build\pkg\bump\.ci\sd4\bs\bin\opam.exe list --switch 2.1.0 --root Y:/source/dkml/build/pkg/bump/.ci/o -- $prog $args
```

### Dune Build

You can go into directories to build each project you want to edit. For example:

```powershell
cd build\_deps\dkml-runtime-apps-src
Y:\source\dkml\build\pkg\bump\.ci\sd4\bs\bin\opam.exe exec --switch 2.1.0 --root Y:\source\dkml\build\pkg\bump\.ci\o -- dune build
```

### Git

You can do `git commit` in each `build/_deps/*-src` directory. There are `Package-Stage*` targets that will push in changes
at the appropriate times.
42 changes: 29 additions & 13 deletions contributors/changes/v2.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,19 @@ for their GitHub Actions / GitLab CI:

### Major Changes

* Installation directory has changed from `<LOCALAPPDATA>/Programs/DiskuvOCaml` to `<LOCALAPPDATA>/Programs/DkML`
* Opam upgraded from 2.2.0 `alpha0` to 2.2.0 `alpha3`.
* The installer no longer auto-installs Visual Studio Build Tools, and a `setup*.exe` installer is no longer provided.
Instead we use ["wget"](https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget) as described
in [New Install Steps](#new-install-steps):

> Windows Package Manager **winget** command-line tool is available on Windows 11 and
> modern versions of Windows 10 as a part of the **App Installer**.
>
> You can [get App Installer from the Microsoft Store].
> If it's already installed, make sure it is updated with the latest version.
[get App Installer from the Microsoft Store]: https://www.microsoft.com/p/app-installer/9nblggh4nns1#activetab=pivot:overviewtab

### Known Issues

Expand All @@ -32,28 +44,18 @@ for their GitHub Actions / GitLab CI:

### New Install Steps

The installer no longer auto-installs Visual Studio Build Tools, and a `setup*.exe` installer is no longer provided.
Instead we use ["wget"](https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget):

> Windows Package Manager **winget** command-line tool is available on Windows 11 and
> modern versions of Windows 10 as a part of the **App Installer**.
>
> You can [get App Installer from the Microsoft Store].
> If it's already installed, make sure it is updated with the latest version.
[get App Installer from the Microsoft Store]: https://www.microsoft.com/p/app-installer/9nblggh4nns1#activetab=pivot:overviewtab

So Windows 11 users already have `winget`, but Windows 10 users will need to [get App Installer from the Microsoft Store].
Windows 11 users already have `winget`, but Windows 10 users will need to [get App Installer from the Microsoft Store].

Then run these three steps from the Command Prompt or PowerShell:

```powershell
# Visual Studio 2019 Build Tools
# ------------------------------
#
# You can change "--installPath" if you need disk space (3GB+), but do not use spaces or parentheses. Bad: C:\Program Files (x86)
# You can review what components are installed at:
# https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019
winget install Microsoft.VisualStudio.2019.BuildTools --override "--wait --quiet --addProductLang En-us --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"
winget install Microsoft.VisualStudio.2019.BuildTools --override "--wait --quiet --installPath C:\VS --addProductLang En-us --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"
# Git for Windows
# ---------------
Expand All @@ -74,6 +76,20 @@ The practical consequence is that the first time you run `opam`, `dune` or `dkml
2. The opam root will be initialized.
3. The global "playground" switch will be installed.

You can do those steps now with a **new** Command Prompt or PowerShell windows:

```powershell
# IMPORTANT: If you run Windows in a VirtualBox, or have a computer manufactured before 2013 (ie. pre-Haswell or
# pre-Piledriver CPU), run the following instead to avoid https://github.com/ocaml/ocaml/issues/12513:
# dkml init --system --enable-imprecise-c99-float-ops
dkml init --system
```

Minor benefits of this new install approach:

* System wide configuration options can be provided directly to `dkml init --system <more options>` rather than
through user-written configuration files.

### Internal Changes

### Upgraded Packages
Expand Down
1 change: 1 addition & 0 deletions pkg/bump/WindowsSandbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmake_path(NATIVE_PATH TOOLSDIR TOOLSDIR_NATIVE)
configure_file(config.in.wsb config.wsb @ONLY)
configure_file(installer-native.in.cmd ${TOOLSDIR}/installer-native.cmd @ONLY NEWLINE_STYLE DOS)
configure_file(installer-byte.in.cmd ${TOOLSDIR}/installer-byte.cmd @ONLY NEWLINE_STYLE DOS)
configure_file(install-winget.in.ps1 ${TOOLSDIR}/install-winget.ps1 @ONLY)
configure_file(test.in.cmd ${TOOLSDIR}/test.cmd @ONLY NEWLINE_STYLE DOS)
file(COPY proj1 proj2 script1 DESTINATION ${TOOLSDIR})

Expand Down
12 changes: 12 additions & 0 deletions pkg/bump/WindowsSandbox/install-winget.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox

$progressPreference = 'silentlyContinue'
Write-Information "Downloading WinGet and its dependencies..."
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx -OutFile Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

$progressPreference = 'Continue'

0 comments on commit b5dc6db

Please sign in to comment.