Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .build/dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

(name affinescript)

(version 0.1.0)
(version 0.1.1)

(generate_opam_files true)

Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ jobs:
- name: Install dependencies
run: opam install . --deps-only --yes

- name: Bake release version into source (#297)
# Single source of truth for the compiler version string lives
# in `lib/version.ml`; `dune-project` mirrors it for opam. The
# release workflow rewrites both from the tag so every emitted
# binary self-reports the right number (--version, REPL banner,
# LSP serverInfo, ONNX producer_version).
run: |
v="${GITHUB_REF_NAME#v}"
sed -i "s/^let value = .*/let value = \"$v\"/" lib/version.ml
sed -i "s/^(version .*)/(version $v)/" .build/dune-project
echo "Baked version: $v"
grep '^let value' lib/version.ml
grep '^(version' .build/dune-project

- name: Build release
run: opam exec -- dune build --release

Expand Down
4 changes: 2 additions & 2 deletions affinescript.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "0.1.0"
version: "0.1.1"
synopsis:
"A programming language with affine types, dependent types, row polymorphism, and extensible effects"
description:
Expand All @@ -23,7 +23,7 @@ doc: "https://github.com/hyperpolymath/affinescript"
bug-reports: "https://github.com/hyperpolymath/affinescript/issues"
depends: [
"ocaml" {>= "4.14"}
"dune" {>= "3.14" & >= "3.14"}
"dune" {>= "3.14"}
"menhir" {>= "20231231"}
"sedlex" {>= "3.2"}
"ppx_deriving" {>= "5.2"}
Expand Down
5 changes: 3 additions & 2 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

let () = Fmt_tty.setup_std_outputs ()

(** Version string *)
let version = "0.1.0"
(** Version string (single source of truth — see lib/version.ml; baked
from the release tag by .github/workflows/release.yml). *)
let version = Affinescript.Version.value

(** Read file contents *)
let read_file path =
Expand Down
1 change: 1 addition & 0 deletions lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
types
unify
value
version
wasm
wasm_encode
wasm_gc
Expand Down
2 changes: 1 addition & 1 deletion lib/lsp_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ let handle_initialize (id : Yojson.Basic.t) (_params : Yojson.Basic.t) : unit =
]);
("serverInfo", `Assoc [
("name", `String "affinescript");
("version", `String "0.1.0");
("version", `String Version.value);
]);
]
))
Expand Down
2 changes: 1 addition & 1 deletion lib/onnx_codegen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ let generate (program : program) (_symbols : Symbol.t) : string =
let model = {
Onnx_proto.m_ir_version = 7; (* ONNX 1.10+ *)
m_producer_name = "affinescript";
m_producer_version = "0.1.0";
m_producer_version = Version.value;
m_opset_import = [{ op_domain = ""; op_version = 13 }];
m_graph = graph;
} in
Expand Down
2 changes: 1 addition & 1 deletion lib/repl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ let print_prompt () =

(** Print the REPL banner *)
let print_banner () =
print_endline "AffineScript REPL v0.1.0";
Printf.printf "AffineScript REPL v%s\n" Version.value;
print_endline "Type :help for help, :quit to exit";
print_endline ""

Expand Down
19 changes: 19 additions & 0 deletions lib/version.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(* SPDX-License-Identifier: MIT OR AGPL-3.0-or-later *)
(* Single source of truth for the compiler version string.
*
* Replaces the five hardcoded "0.1.0" sites that used to drift behind
* the release tag (issue #297):
*
* bin/main.ml — `affinescript --version`
* lib/repl.ml — REPL banner
* lib/lsp_server.ml — LSP `initialize` response
* lib/onnx_codegen.ml — ONNX `producer_version` field on emitted models
*
* The value below is baked at *build* time by the release workflow:
* `.github/workflows/release.yml` sed-substitutes this line (and the
* `(version …)` field in `dune-project`) to match `${GITHUB_REF_NAME}`
* before running `dune build --release`. When building from a non-
* release commit, this reflects whatever was last committed to main,
* matching `dune-project`'s declared version. *)

let value = "0.1.1"
Loading