Skip to content

Commit

Permalink
Auto-generate defines and metas from JSON files (HaxeFoundation#8195)
Browse files Browse the repository at this point in the history
* defines in JSON

* metadata in JSON

* move JSON to src-json

* prebuild script

* remove defines/metas into auto-generated modules

* makefile that works (somehow)

* forgot a comment

* use tabs instead of spaces

* remove unnecessary Platform, UsedOn constructors

* fix CI, attempt 1

* fix CI, attempt 2

* fix CI, attempt 3

* debug makefile

* fix CI, attempt 4

* fix CI, attempt 5

* update define and meta JSON

* [skip ci] gitignore prebuild
  • Loading branch information
Aurel300 authored and Simn committed May 23, 2019
1 parent 334aaf9 commit 7f095f0
Show file tree
Hide file tree
Showing 11 changed files with 1,955 additions and 614 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/haxelib*
/haxedoc*
/lib
/prebuild

/src/syntax/lexer.ml
/libs/xml-light/xml_lexer.ml
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ install_linux: &install_linux
# Build haxe
- make package_src -s
- opam config exec -- make -s STATICLINK=1 libs
- opam config exec -- make -s STATICLINK=1 prebuild
- opam config exec -- make -s -j STATICLINK=1 haxe
- opam config exec -- make -s haxelib
- make package_bin -s
Expand Down Expand Up @@ -140,6 +141,7 @@ install_osx: &install_osx
- ocamlopt -v
# Build haxe
- make -s STATICLINK=1 "LIB_PARAMS=/usr/local/opt/zlib/lib/libz.a /usr/local/lib/libpcre.a" libs
- make -s STATICLINK=1 "LIB_PARAMS=/usr/local/opt/zlib/lib/libz.a /usr/local/lib/libpcre.a" prebuild
- make -s -j STATICLINK=1 "LIB_PARAMS=/usr/local/opt/zlib/lib/libz.a /usr/local/lib/libpcre.a" haxe
- make -s haxelib
- make package_bin -s
Expand Down
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ MAKEFILENAME?=Makefile
PLATFORM?=unix

OUTPUT=haxe
PREBUILD_OUTPUT=prebuild
EXTENSION=
LFLAGS=
STATICLINK?=0
Expand Down Expand Up @@ -130,7 +131,16 @@ else
echo let version_extra = None > _build/src/compiler/version.ml
endif

build_src: | $(BUILD_SRC) _build/src/syntax/grammar.ml _build/src/compiler/version.ml
_build/src/core/defineList.ml: src-json/define.json prebuild
./$(PREBUILD_OUTPUT) define $< > $@

_build/src/core/metaList.ml: src-json/meta.json prebuild
./$(PREBUILD_OUTPUT) meta $< > $@

build_src: | $(BUILD_SRC) _build/src/syntax/grammar.ml _build/src/compiler/version.ml _build/src/core/defineList.ml _build/src/core/metaList.ml

prebuild: _build/src/core/json/json.ml _build/src/prebuild/main.ml
$(COMPILER) -safe-string -linkpkg -g -o $(PREBUILD_OUTPUT) -package sedlex -package extlib -I _build/src/core/json _build/src/core/json/json.ml _build/src/prebuild/main.ml

haxe: build_src
$(MAKE) -f $(MAKEFILENAME) build_pass_1
Expand Down Expand Up @@ -297,10 +307,10 @@ clean_libs:
$(foreach lib,$(EXTLIB_LIBS),$(MAKE) -C libs/$(lib) clean &&) true

clean_haxe:
rm -f -r _build $(OUTPUT)
rm -f -r _build $(OUTPUT) $(PREBUILD_OUTPUT)

clean_tools:
rm -f $(OUTPUT) haxelib
rm -f $(OUTPUT) $(PREBUILD_OUTPUT) haxelib

clean_package:
rm -rf $(PACKAGE_OUT_DIR)
Expand All @@ -315,4 +325,4 @@ FORCE:
.ml.cmo:
$(CC_CMD)

.PHONY: haxe libs haxelib
.PHONY: prebuild haxe libs haxelib
1 change: 1 addition & 0 deletions Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PLATFORM=win
MAKEFILENAME=Makefile.win
include Makefile
OUTPUT=haxe.exe
PREBUILD_OUTPUT=prebuild.exe
EXTENSION=.exe
PACKAGE_SRC_EXTENSION=.zip

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ install:

build_script:
- 'cd %APPVEYOR_BUILD_FOLDER%'
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -s -f Makefile.win libs && make -j -s -f Makefile.win haxe && make -s -f Makefile.win haxelib"'
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && make -s -f Makefile.win libs && make -s -f Makefile.win prebuild && make -j -s -f Makefile.win haxe && make -s -f Makefile.win haxelib"'
- 'set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%'
- 'set HAXEPATH=%APPVEYOR_BUILD_FOLDER%'
- '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && cygcheck haxe.exe"'
Expand Down
Loading

0 comments on commit 7f095f0

Please sign in to comment.