Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/original/4.3_bugfix'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/main.yml
#	Makefile
#	extra/github-actions/build-mac.yml
#	extra/github-actions/build-windows.yml
#	extra/github-actions/test-windows.yml
#	extra/github-actions/workflows/main.yml
  • Loading branch information
RobDangerous committed Aug 8, 2024
2 parents 0ff7948 + 760c0dd commit e188006
Show file tree
Hide file tree
Showing 119 changed files with 1,219 additions and 339 deletions.
1 change: 1 addition & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ INSTALL_NEKO:
ARG PREFIX=/usr/local
RUN bash -c "ln -s \"$NEKOPATH\"/{neko,nekoc,nekoml,nekotools} \"$PREFIX/bin/\""
RUN bash -c "ln -s \"$NEKOPATH\"/libneko.* \"$PREFIX/lib/\""
RUN bash -c "ln -s \"$NEKOPATH\"/*.h \"$PREFIX/include/\""
RUN mkdir -p "$PREFIX/lib/neko/"
RUN bash -c "ln -s \"$NEKOPATH\"/*.ndll \"$PREFIX/lib/neko/\""
RUN ldconfig
Expand Down
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PACKAGE_FILE_NAME=haxe_$(COMMIT_DATE)_$(COMMIT_SHA)
HAXE_VERSION=$(shell $(CURDIR)/$(HAXE_OUTPUT) -version 2>&1 | awk '{print $$1;}')
HAXE_VERSION_SHORT=$(shell echo "$(HAXE_VERSION)" | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+")

NEKO_VERSION=2.3.0
NEKO_VERSION=2.4.0
NEKO_MAJOR_VERSION=$(shell echo "$(NEKO_VERSION)" | grep -oE "^[0-9]+")
NEKO_VERSION_TAG=v$(shell echo "$(NEKO_VERSION)" | sed "s/\./-/g")

Expand Down Expand Up @@ -155,19 +155,29 @@ xmldoc:
$(INSTALLER_TMP_DIR):
mkdir -p $(INSTALLER_TMP_DIR)

$(INSTALLER_TMP_DIR)/neko-osx64.tar.gz: $(INSTALLER_TMP_DIR)
wget -nv https://github.com/HaxeFoundation/neko/releases/download/$(NEKO_VERSION_TAG)/neko-$(NEKO_VERSION)-osx64.tar.gz -O installer/neko-osx64.tar.gz
# Can be 'universal', 'arm64', or 'x86_64'
ifndef PACKAGE_INSTALLER_MAC_ARCH
PACKAGE_INSTALLER_MAC_ARCH:=$(shell uname -m)
endif

$(INSTALLER_TMP_DIR)/neko-osx.tar.gz: $(INSTALLER_TMP_DIR)
NEKO_ARCH_SUFFIX=$$(if [ "$(PACKAGE_INSTALLER_MAC_ARCH)" = "x86_64" ]; then \
echo 64; \
else \
echo "-$(PACKAGE_INSTALLER_MAC_ARCH)"; \
fi); \
wget -nv https://github.com/HaxeFoundation/neko/releases/download/$(NEKO_VERSION_TAG)/neko-$(NEKO_VERSION)-osx$$NEKO_ARCH_SUFFIX.tar.gz -O installer/neko-osx.tar.gz

# Installer

package_installer_mac: $(INSTALLER_TMP_DIR)/neko-osx64.tar.gz package_unix
package_installer_mac: $(INSTALLER_TMP_DIR)/neko-osx.tar.gz package_unix
$(eval OUTFILE := $(shell pwd)/$(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_installer.tar.gz)
$(eval PACKFILE := $(shell pwd)/$(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_bin.tar.gz)
$(eval VERSION := $(shell $(CURDIR)/$(HAXE_OUTPUT) -version 2>&1))
bash -c "rm -rf $(INSTALLER_TMP_DIR)/{resources,pkg,tgz,haxe.tar.gz}"
mkdir $(INSTALLER_TMP_DIR)/resources
# neko - unpack to change the dir name
cd $(INSTALLER_TMP_DIR)/resources && tar -zxvf ../neko-osx64.tar.gz
cd $(INSTALLER_TMP_DIR)/resources && tar -zxvf ../neko-osx.tar.gz
mv $(INSTALLER_TMP_DIR)/resources/neko* $(INSTALLER_TMP_DIR)/resources/neko
cd $(INSTALLER_TMP_DIR)/resources && tar -zcvf neko.tar.gz neko
# haxe - unpack to change the dir name
Expand Down
7 changes: 7 additions & 0 deletions Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ PACKAGE_FILES=$(HAXE_OUTPUT) $(HAXELIB_OUTPUT) std \
"$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep libmbedtls.dll | sed -e 's/^\s*//')" \
"$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep libmbedx509.dll | sed -e 's/^\s*//')"

# haxelib should depends on haxe, but we don't want to do that...
haxelib_win:
cd $(CURDIR)/extra/haxelib_src && \
HAXE_STD_PATH=$$(cygpath -m $(CURDIR)/std) $(CURDIR)/$(HAXE_OUTPUT) client.hxml && \
nekotools boot run.n
mv extra/haxelib_src/run$(EXTENSION) $(HAXELIB_OUTPUT)

echo_package_files:
echo $(PACKAGE_FILES)

Expand Down
41 changes: 41 additions & 0 deletions extra/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
2024-08-07 4.3.6

Bugfixes:

display : do not define "display" for json rpc diagnostics (#11746)
cpp : null check interfaces (#11743)
hl : ignore WANT_READ/WANT_WRITE errors when the socket is known to be blocking (#11655)
hl : fix weird compiler error (#11690)
jvm : fix --java out -D jvm deprecation warning (#11739)
macro : Context.reportError should not abort build macros (#11741)

2024-07-18 4.3.5

General improvements:

all : macOS universal binaries
display : migrated diagnostics to Json RPC (#11707)
macro : expose TVar VStatic flag in macros. (#11683)

Bugfixes:

all : fix `@:structInit` with getter + setter (#11662)
all : add missing recursion when checking abstract casts (#11676)
all : fail nicer if unify_min can't find a common type (#11684)
all : fix pretty errors failure (#11700)
all : disallow local statics when inlining (#11725)
display : unused pattern variables should be marked as unused (#7282)
display : diagnostics miss "used without being initialized" errors (#7931)
display : recursive inline is not supported on enum abstract constructor (#11177)
display : Void as value error disappears on second compilation (#11184)
display : false positives of "This cast has no effect, but some of its sub-expressions" (#11203)
cpp : inherit `@:unreflective` on generic classes
hl : fix bit shift + assignment in while loop header (#10783)
hl : fix do-while loop in genhl+hlopt (#11461)
hl/c : use uint64 instead of uint64_t for shift cast (#11721)
macro : don't choke on namePos for reification pattern matching (#11671)

Deprecation / future version handling:

macro : `Compiler.include()` warning when used outside init macros

2024-03-04 4.3.4

General improvements:
Expand Down
2 changes: 1 addition & 1 deletion extra/EnvVarUpdate.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
!ifndef Un${StrFuncName}_INCLUDED
${Un${StrFuncName}}
!endif
!define un.${StrFuncName} "${Un${StrFuncName}}"
!define un.${StrFuncName} '${Un${StrFuncName}}'
!macroend

!insertmacro _IncludeStrFunction StrTok
Expand Down
23 changes: 8 additions & 15 deletions extra/github-actions/build-mac.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
- name: Install dependencies
env:
# For compatibility with macOS 10.13
ZLIB_VERSION: 1.3
ZLIB_VERSION: 1.3.1
MBEDTLS_VERSION: 2.28.5
PCRE2_VERSION: 10.42
run: |
set -ex
brew uninstall [email protected] || echo
brew uninstall [email protected] || echo
brew untap local/openssl || echo
brew untap local/python2 || echo
brew update
# brew unlink python@2
brew bundle --file=tests/Brewfile --no-upgrade || brew link --overwrite awscli
brew install libunistring
brew install cpanminus
brew bundle --file=tests/Brewfile --no-upgrade
cpanm IPC::System::Simple
cpanm String::ShellQuote
curl -L https://www.zlib.net/zlib-$ZLIB_VERSION.tar.gz | tar xz
curl -L https://github.com/madler/zlib/releases/download/v$ZLIB_VERSION/zlib-$ZLIB_VERSION.tar.gz | tar xz
cd zlib-$ZLIB_VERSION
./configure
make && make install
sudo make && sudo make install
cd ..
curl -L https://github.com/ARMmbed/mbedtls/archive/v$MBEDTLS_VERSION.tar.gz | tar xz
cd mbedtls-$MBEDTLS_VERSION
make && make install
sudo make && sudo make install
cd ..
curl -L https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VERSION/pcre2-$PCRE2_VERSION.tar.gz | tar xz
cd pcre2-$PCRE2_VERSION
./configure --enable-unicode --enable-pcre2-8 --enable-pcre2-16 --enable-pcre2-32 --enable-unicode-properties --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-jit
make && make install
sudo make && sudo make install
cd ..
- name: Install OCaml libraries
Expand All @@ -38,10 +31,10 @@
set -ex
opam init # --disable-sandboxing
opam update
opam switch create 4.08.1
opam switch create ${{env.OCAML_VERSION}}
eval $(opam env)
opam env
opam pin add ctypes 0.17.1 --yes
opam pin add ctypes ${{env.CTYPES}} --yes
opam pin add haxe . --no-action
opam install haxe --deps-only --assume-depexts
opam list
Expand Down
2 changes: 2 additions & 0 deletions extra/github-actions/install-neko-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
tar -xf $RUNNER_TEMP/neko_latest.tar.gz -C $RUNNER_TEMP
NEKOPATH=`echo $RUNNER_TEMP/neko-*-*`
sudo mkdir -p /usr/local/bin
sudo mkdir -p /usr/local/include
sudo mkdir -p /usr/local/lib/neko
sudo ln -s $NEKOPATH/{neko,nekoc,nekoml,nekotools} /usr/local/bin/
sudo ln -s $NEKOPATH/libneko.* /usr/local/lib/
sudo ln -s $NEKOPATH/include/* /usr/local/include/
sudo ln -s $NEKOPATH/*.ndll /usr/local/lib/neko/
echo "NEKOPATH=$NEKOPATH" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions extra/github-actions/install-nsis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
- name: choco install nsis
uses: nick-invision/retry@v2
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
max_attempts: 10
command: choco install --no-progress nsis.portable --version 3.02 -y
command: choco install --no-progress nsis.portable --version 3.09 -y

- name: choco install things
shell: pwsh
Expand Down
20 changes: 13 additions & 7 deletions extra/github-actions/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

- name: Cache opam
id: cache-opam
uses: actions/cache@v3.0.11
uses: actions/cache@v4
with:
path: ~/.opam/
key: ${{ runner.os }}-${{ matrix.ocaml }}-${{ hashFiles('./haxe.opam', './libs/') }}
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
FORCE_COLOR: 1
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -141,7 +141,7 @@ jobs:

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all
Expand Down Expand Up @@ -211,22 +211,28 @@ jobs:
ROBBOT_PASS: ${{ secrets.ROBBOT_PASS }}

mac-build:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-13]
runs-on: ${{ matrix.os }}
env:
PLATFORM: mac
PLATFORM: mac${{ matrix.os == 'macos-14' && '-arm64' || '' }}
OPAMYES: 1
MACOSX_DEPLOYMENT_TARGET: 10.13
OCAML_VERSION: 5.1.1
CTYPES: 0.21.1
steps:
- uses: actions/checkout@main
with:
submodules: recursive

- name: Cache opam
id: cache-opam
uses: actions/cache@v3.0.11
uses: actions/cache@v4
with:
path: ~/.opam/
key: ${{ runner.os }}-${{ hashFiles('./haxe.opam', './libs/') }}
key: ${{ matrix.os }}-${{ hashFiles('./haxe.opam', './libs/') }}

@import install-neko-unix.yml
@import build-mac.yml
2 changes: 1 addition & 1 deletion extra/release-checklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- Make sure CHANGES.txt has a proper date set!
- Make sure `version` in globals.ml has the correct value
- Update `version` in `./opam`
- Update `version` in `haxe.opam`
- Check if the protocolVersion in displayJson.ml has to be updated
- Make an empty GitHub release in https://github.com/HaxeFoundation/haxe/releases (do this first because we need the tag for the builds)
- Wait for the CI to build (check https://build.haxe.org/builds/haxe/)
Expand Down
4 changes: 2 additions & 2 deletions haxe.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
opam-version: "2.0"
name: "haxe"
version: "4.3.4"
version: "4.3.6"
synopsis: "Multi-target universal programming language"
description: """
Haxe is an open source toolkit based on a modern,
Expand All @@ -22,7 +22,7 @@ depends: [
("ocaml" {>= "5.0"} & ("camlp5" {build}))
| ("ocaml" {>= "4.08" & < "5.0"} & ("camlp5" {build & = "8.00.03"}))
"ocamlfind" {build}
"dune" {>= "1.11"}
"dune" {>= "1.11" & < "3.16"}
"sedlex" {>= "2.0"}
"xml-light"
"extlib" {>= "1.7.8"}
Expand Down
30 changes: 20 additions & 10 deletions src/compiler/compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ open Globals
open Common
open CompilationContext

let run_or_diagnose ctx f arg =
let run_or_diagnose ctx f =
let com = ctx.com in
let handle_diagnostics ?(depth = 0) msg kind =
ctx.has_error <- true;
add_diagnostics_message ~depth com msg kind Error;
DisplayOutput.emit_diagnostics ctx.com
match com.report_mode with
| RMLegacyDiagnostics _ -> DisplayOutput.emit_legacy_diagnostics ctx.com
| RMDiagnostics _ -> DisplayOutput.emit_diagnostics ctx.com
| _ -> die "" __LOC__
in
if is_diagnostics com then begin try
f arg
f ()
with
| Error.Error(msg,p,depth) ->
handle_diagnostics ~depth (Error.error_msg p msg) DKCompilerMessage
Expand All @@ -20,7 +23,7 @@ let run_or_diagnose ctx f arg =
handle_diagnostics (located (Lexer.error_msg msg) p) DKParserError
end
else
f arg
f ()

let run_command ctx cmd =
let t = Timer.timer ["command";cmd] in
Expand Down Expand Up @@ -126,6 +129,7 @@ module Setup = struct
| Java ->
Java.before_generate com;
if defined com Define.Jvm then begin
if not actx.jvm_flag then com.warning WDeprecated com.warning_options ("--java out.jar -D jvm is deprecated; use --jvm out.jar directly") null_pos;
add_std "jvm";
com.package_rules <- PMap.remove "jvm" com.package_rules;
end;
Expand Down Expand Up @@ -279,7 +283,7 @@ let do_type ctx tctx actx =
if com.display.dms_kind <> DMNone then DisplayTexpr.check_display_file tctx cs;
List.iter (fun cpath -> ignore(tctx.Typecore.g.Typecore.do_load_module tctx cpath null_pos)) (List.rev actx.classes);
Finalization.finalize tctx;
) ();
);
com.stage <- CTypingDone;
(* If we are trying to find references, let's syntax-explore everything we know to check for the
identifier we are interested in. We then type only those modules that contain the identifier. *)
Expand All @@ -293,23 +297,25 @@ let finalize_typing ctx tctx =
let t = Timer.timer ["finalize"] in
let com = ctx.com in
com.stage <- CFilteringStart;
let main, types, modules = run_or_diagnose ctx Finalization.generate tctx in
let main, types, modules = run_or_diagnose ctx (fun () -> Finalization.generate tctx) in
com.main <- main;
com.types <- types;
com.modules <- modules;
t()

let filter ctx tctx =
let filter ctx tctx before_destruction =
let t = Timer.timer ["filters"] in
DeprecationCheck.run ctx.com;
Filters.run ctx.com tctx ctx.com.main;
run_or_diagnose ctx (fun () -> Filters.run tctx ctx.com.main before_destruction);
t()

let compile ctx actx =
let com = ctx.com in
(* Set up display configuration *)
DisplayProcessing.process_display_configuration ctx;
let restore = disable_report_mode com in
let display_file_dot_path = DisplayProcessing.process_display_file com actx in
restore ();
(* Initialize target: This allows access to the appropriate std packages and sets the -D defines. *)
let ext = Setup.initialize_target ctx com actx in
com.config <- get_config com; (* make sure to adapt all flags changes defined after platform *)
Expand All @@ -331,8 +337,12 @@ let compile ctx actx =
end;
DisplayProcessing.handle_display_after_typing ctx tctx display_file_dot_path;
finalize_typing ctx tctx;
DisplayProcessing.handle_display_after_finalization ctx tctx display_file_dot_path;
filter ctx tctx;
if is_diagnostics com then
filter ctx tctx (fun () -> DisplayProcessing.handle_display_after_finalization ctx tctx display_file_dot_path)
else begin
DisplayProcessing.handle_display_after_finalization ctx tctx display_file_dot_path;
filter ctx tctx (fun () -> ());
end;
if ctx.has_error then raise Abort;
Generate.check_auxiliary_output com actx;
com.stage <- CGenerationStart;
Expand Down
12 changes: 11 additions & 1 deletion src/compiler/displayOutput.ml
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,22 @@ let handle_type_path_exception ctx p c is_import pos =
api.send_result (DisplayException.fields_to_json ctx fields kind (DisplayTypes.make_subject None pos));
end

let emit_diagnostics com =
let emit_legacy_diagnostics com =
let dctx = Diagnostics.run com in
let s = Json.string_of_json (DiagnosticsPrinter.json_of_diagnostics com dctx) in
DisplayPosition.display_position#reset;
raise (Completion s)

let emit_diagnostics com =
(match com.Common.json_out with
| None -> die "" __LOC__
| Some api ->
let dctx = Diagnostics.run com in
let diagnostics = DiagnosticsPrinter.json_of_diagnostics com dctx in
DisplayPosition.display_position#reset;
api.send_result diagnostics;
raise Abort (* not reached because send_result always raises *))

let emit_statistics tctx =
let stats = Statistics.collect_statistics tctx [SFFile (DisplayPosition.display_position#get).pfile] true in
let s = Statistics.Printer.print_statistics stats in
Expand Down
Loading

0 comments on commit e188006

Please sign in to comment.