Skip to content

Instantly share code, notes, and snippets.

@ncannasse
Last active May 20, 2020 22:19
Show Gist options
  • Save ncannasse/0ede10ee2eadd0ff2acbc21445d76b09 to your computer and use it in GitHub Desktop.
Save ncannasse/0ede10ee2eadd0ff2acbc21445d76b09 to your computer and use it in GitHub Desktop.

Haxe FrontEnd

Reads haxelib-lock.json (if exists)

Reads <file> (if called with -lock-file <file>) which will partially override haxelib-lock.json

Takes arguments (hxml files or anything else)

Expand hxml files to their actual content

Resolve -lib <name> into -cp <path> -D <name>=<version> using the algorithm below

Resolve haxec binary using the algorithm below

Calls haxec with all expanded arguments

Library resolution

Here's the format of lock file as written by package manager:

{
   mylib : { version : "1.5.3", path : "${haxelib}/mylib/1.5.3", dependencies : ["otherlib"] }
}

When -lib mylib is found, front end will replace it with -D mylib=1.5.3 -cp /path/to/haxelib/mylib/1.5.3 + dependencies

The ${env_path} path is resolved:

  • using ENV_PATH env var (if defined)
  • special case for ${haxelib}: use HAXELIB_LIBRARY_PATH or if not defined read $(HOME)/.haxelib file content

Special case for library resolution when no haxelib.json or override file exists

  • use HAXELIB_LIBRARY_PATH or if not defined read ${haxelib}/mylib/.current
  • set default path to ${haxelib}/mylib/<current>

haxec resolution

Look into lock files if there's a haxec library, and use this path for haxec binary If no lock file is present or no haxec section :

  • use HAXEC_PATH
  • if not defined, look for haxec in PATH
  • if not defined, use special case for library "haxec" resolution (see "Library Resolution")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment