Skip to content

Commit 7f809ca

Browse files
committed
Migrate CHANGES from gitlab dktool
1 parent 89d62fc commit 7f809ca

File tree

1 file changed

+179
-0
lines changed

1 file changed

+179
-0
lines changed

CHANGES.md

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Changes
2+
3+
## 0.2.0
4+
5+
- Support `.mli` interface files
6+
- Libraries can have a `open__.ml` module that will be pre-opened for every script in the library.
7+
This module is the correct place to supply the DkCoder required module imports without changing existing OCaml code:
8+
9+
```ocaml
10+
module Printf = Tr1Stdlib_V414CRuntime.Printf
11+
module Bos = Tr1BosStd.Bos
12+
module Bogue = Tr1Bogue_Std.Bogue
13+
```
14+
15+
- A bugfix for SDL logging is included and SDL logging is now enabled.
16+
- Module and library names ending with `__` are reserved for DkCoder internal use.
17+
- `DkDev_Std` is a reserved "Us" library. You cannot redefine this library. Any library that starts with `Dk` is also reserved.
18+
- Add implicit modules (see below)
19+
- Make `__MODULE_ID__` value available to scripts so they can see their own fully qualified module identifiers (ex. `SanetteBogue_Snoke.X.Y.Snoke`)
20+
- Make `__LIBRARY__` value available to scripts so they can see which library they belong (ex. `SanetteBogue_Snoke`)
21+
- Make `__FILE__` value be the Unix-style (forward slashes) relative path of the script to the script directory (ex. `SanetteBogue_Snoke/X/Y/Snoke.ml`).
22+
- `Stdlib.Format` was moved from Tr1Stdlib_V414Base to Tr1Stdlib_V414CRuntime because `Format.printf` does C-based file I/O.
23+
- The `dune` generator and the internal DuneUs generator will use fixed length encoding of the library names.
24+
This partially mitigates very long paths created by Dune that fail on Windows path limits.
25+
- Added `Tr1Tezt_C` and `Tr1Tezt_Core`.
26+
- No Runner module is provided since that only connects to Unix.
27+
- The `Process` module has been removed since it assumes Windows and its dependency `Lwt_process` is buggy on Windows.
28+
- A `ProcessShexp` is bundled that is a cross-platform, almost API-equivalent of Tezt's `Process`.
29+
- No `spawn_with_stdin` since difficult to bridge I/O channels between Lwt and Shexp.
30+
- No `?runner` parameters since Runner is Unix-only.
31+
- There is an extra method `spawn_of` that accepts a `Shexp.t` process
32+
- A `ProcessCompat` is bundled that does not assume Windows but still uses a buggy `Lwt_process`. Use for porting old code only.
33+
- The Debug builds are no longer bundled due to Microsoft not allowing those to be distributed. Also speeds install time. Anyone with source code access (ie. DkSDK subscribers) can do debug builds and get meaningful stack traces.
34+
- End of life and a grace period for a version are enforced with messages and errors. They respect the SOURCE_DATE_EPOCH environment variable so setting it to `1903608000` (Apr 28, 2030) can test what it looks like.
35+
36+
### 0.2.0 - Implicit Modules
37+
38+
Implicit modules are modules that are automatically created if you use them. Unlike explicit modules, their content can be based on the structure of the project.
39+
40+
#### 0.2.0 - Tr1Assets.LocalDir
41+
42+
The `v ()` function will populate a cache folder containing all non-ml source code in the `assets__` subfolder of the library directory.
43+
The `v ()` function will return the cache folder.
44+
45+
```ocaml
46+
val v : unit -> string
47+
(** [v ()] is the absolute path of a cache folder containing all the files
48+
in the `assets__` subfolder of the library directory.
49+
50+
For example, in a project:
51+
52+
{v
53+
<project>
54+
├── dk
55+
├── dk.cmd
56+
└── src
57+
└── SanetteBogue_Snoke
58+
├── Snoke.ml
59+
└── assets__
60+
├── SnakeChan-MMoJ.ttf
61+
├── images
62+
│ ├── apple.png
63+
│ └── snoke_title.png
64+
└── sounds
65+
└── sol.wav
66+
v}
67+
68+
the ["Snoke.ml"] script would have access to a cached directory from
69+
[v ()] that contains:
70+
71+
{v
72+
<v ()>
73+
├── SnakeChan-MMoJ.ttf
74+
├── images
75+
│ ├── apple.png
76+
│ └── snoke_title.png
77+
└── sounds
78+
└── sol.wav
79+
v}
80+
*)
81+
```
82+
83+
#### 0.2.0 - Tr1EntryName
84+
85+
```ocaml
86+
(** The name of the DkCoder library the entry script belongs to.
87+
Ex: SanetteBogue_Snoke *)
88+
val library : string
89+
90+
(** The simple name of the entry script.
91+
Ex: Snoke *)
92+
val simple_name : string
93+
94+
(** The fully qualfied module name for the entry script.
95+
Ex: SanetteBogue_Snoke.Snoke *)
96+
val module_name : string
97+
```
98+
99+
Using the `Tr1EntryName` module, you can mimic the following Python:
100+
101+
```python
102+
if __name__ == "__main__":
103+
print("Hello, World!")
104+
```
105+
106+
with
107+
108+
```ocaml
109+
let () =
110+
if Tr1EntryName.module_id = __MODULE_ID__ then
111+
Tr1Stdlib_V414Io.StdIo.print_endline "Hello, World!"
112+
```
113+
114+
That means you can isolate side-effects when importing other scripts.
115+
116+
#### 0.2.0 - Tr1Version
117+
118+
```ocaml
119+
(** The fully qualified [Run] module corresponding to the current version.
120+
Ex: DkRun_V0_1.Run *)
121+
val run_module : string
122+
123+
val run_env_url_base : string option
124+
(** The base URL necessary when if launching with {!run_module} when
125+
[run_module = "DkRun_Env.Run"]. *)
126+
127+
val major_version : int
128+
val minor_version : int
129+
```
130+
131+
### Known problems
132+
133+
#### Windows hung processes
134+
135+
Exiting scripts with Ctrl-C on Windows only exits the Windows batch script, not the actual subprocess.
136+
137+
For now `taskkill /f /im ocamlrunx.exe` will kill these hung processes.
138+
139+
#### Windows STATUS_ACCESS_VIOLATION
140+
141+
On first install for Windows running the `./DkHelloScript/dk DkRun_V0_2.Run -- DkHelloScript_Std.Y33Article --serve`
142+
example gives:
143+
144+
```text
145+
[00:00:22.564] [SUCCESS] (3/18) reproducibility or quick typing
146+
[00:00:22.564] Starting test: focus on what you run
147+
[00:00:22.566] [.\dk.cmd#3] '.\dk.cmd' DkRun_V0_2.Run '--generator=dune' -- DkHelloScript_Std.AndHelloAgain
148+
[ERROR][2024-04-29T00:00:43Z] /Run/
149+
Failed to run
150+
C:\Users\WDAGUtilityAccount\DkHelloScript\src\DkHelloScript_Std\Y33Article.ml
151+
(DkHelloScript_Std.Y33Article). Code fa10b83d.
152+
153+
Problem: The DkHelloScript_Std.Y33Article script exited with
154+
STATUS_ACCESS_VIOLATION (0xC0000005) - The instruction at 0x%08lx
155+
referenced memory at 0x%08lx. The memory could not be %s.
156+
Solution: Scroll up to see why.
157+
```
158+
159+
Rerunning it works.
160+
161+
### Punted past 0.2.0
162+
163+
- Fetch and use "Them" libraries
164+
- Adds --cmake-exe (DKCODER_CMAKE_EXE envar) and --ninja-exe (DKCODER_NINJA_EXE envvar) to Run command.
165+
- Libraries can have a `lib__.ml` module that can provide documentation for the library (ex. `MyLibrary_Std`) through a top comment:
166+
167+
```ocaml
168+
(** This is the documentation for your library. *)
169+
170+
(* Anything else inside lib__.ml will trigger an error *)
171+
```
172+
173+
Documentation hover tips are refreshed on the next run command (ex. `./dk DkHelloScript_Std.N0xxLanguage.Example051`)
174+
- Running `DkDev_Std.ExtractSignatures` will update `dkproject.jsonc` with an `exports` field that has codept signatures.
175+
The `dkproject.jsonc` will be created if not present.
176+
177+
## 0.1.0
178+
179+
Initial version.

0 commit comments

Comments
 (0)