Skip to content

Instantly share code, notes, and snippets.

@kLabz
Created June 2, 2019 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kLabz/e29722b3425ad2f36341d86d3612c117 to your computer and use it in GitHub Desktop.
Save kLabz/e29722b3425ad2f36341d86d3612c117 to your computer and use it in GitHub Desktop.
[Haxe] Use lix projects without lix
  • Place lix-to-install and lix-to-haxelib in a directory being in your $PATH (~/.bin for example, which you may have to add to your $PATH) and chmod them with chmod +x.

  • Generate a install.hxml file by running this in your project: lix-to-install > install.hxml

  • Install dependencies via haxelib (needs HaxeFoundation/haxelib#456): haxelib install --skipdeps --always install.hxml

#!/bin/sh
# TODO: handle other install types
HAXELIB_VERSION=$(cat $1 | grep 'lix --silent download "haxelib:' | cut -d '"' -f 2 | cut -d ':' -f 2 | sed 's/#/:/' | sed 's,/,,')
if [ ! -z $HAXELIB_VERSION ]; then
echo "-lib $HAXELIB_VERSION"
else
LIB_NAME=$(basename -s .hxml $1)
GIT_URL=$(cat $1 | grep 'lix --silent download "gh:' | cut -d '"' -f 2 | sed 's/#/.git#/' | sed 's,gh://github.com/,git@github.com:,')
if [ -z $GIT_URL ]; then
GIT_URL=$(cat $1 | grep 'lix --silent download "https://github.com' | cut -d '"' -f 2 | sed 's,/archive/,.git#,' | sed 's,https://github.com/,git@github.com:,' | sed 's/.tar.gz//')
fi
if [ -z $GIT_URL ]; then
echo "# error: cannot find version for $LIB_NAME"
else
echo "-lib $LIB_NAME:git:$GIT_URL"
fi
fi
#!/bin/sh
if [ ! -e haxe_libraries ]; then
echo "Cannot find haxe_libraries; aborting."
exit 1
fi
find haxe_libraries/*.hxml | xargs -n 1 lix-to-haxelib
@kLabz
Copy link
Author

kLabz commented Jun 2, 2019

I might move these to https://github.com/kLabz/haxe-manager (in extra) if/when my PR on haxelib gets merged and released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment