diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..c624e62368 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,886 @@ +name: CI +on: [push, pull_request] + +env: + HAXE_VERSION: 4.2.5 + +jobs: + + linux: + runs-on: ubuntu-22.04 + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev g++-multilib gcc-multilib libasound2-dev libx11-dev libxext-dev libxi-dev libxrandr-dev libxinerama-dev libpulse-dev libmbedtls-dev libpng-dev libturbojpeg-dev libuv1-dev libvorbis-dev + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib --global update haxelib --quiet + haxelib install ../hxcpp-4.3.45.zip --quiet + haxelib install format --quiet + haxelib install hxp --quiet + + - name: Enable HXCPP compile cache + run: | + echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV + + - name: Rebuild Lime tools + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime rebuild tools -nocolor -verbose -nocffi + haxelib run lime setup -alias -y -nocffi + + - name: Rebuild Lime (Linux) + run: | + lime rebuild linux -32 -release -nocolor -verbose -nocffi + lime rebuild linux -64 -release -nocolor -verbose -nocffi + lime rebuild hl -clean -release -nocolor -verbose -nocffi + + - uses: actions/upload-artifact@v4 + with: + name: Linux-NDLL + path: | + ndll/Linux/ + !**/.gitignore + if-no-files-found: error + + - uses: actions/upload-artifact@v4 + with: + name: Linux64-NDLL + path: | + ndll/Linux64/ + !**/.gitignore + if-no-files-found: error + + - uses: actions/upload-artifact@v4 + with: + name: Linux64-Hashlink + path: | + templates/bin/hl/Linux64 + if-no-files-found: error + + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld linux -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage linux -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio linux -release -verbose -nocolor + + macos: + runs-on: macos-13 + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install HashLink dependencies + run: | + pushd project/lib/hashlink + brew update + rm /usr/local/bin/2to3* + rm /usr/local/bin/idle3* + rm /usr/local/bin/pydoc3* + rm /usr/local/bin/python3* + rm /usr/local/bin/pip3* + brew bundle + popd + + - name: Install Haxe dependencies + run: | + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet + haxelib install format --quiet + haxelib install hxp --quiet + + - name: Enable HXCPP compile cache + run: | + echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV + + - name: Rebuild Lime tools + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime rebuild tools -nocolor -verbose -nocffi + haxelib run lime setup -alias -y -nocffi + + - name: Rebuild Lime (macOS) + run: | + lime rebuild macos -clean -release -64 -nocolor -verbose -nocffi + lime rebuild macos -clean -release -arm64 -nocolor -verbose -nocffi + lime rebuild hl -clean -release -nocolor -verbose -nocffi + + - uses: actions/upload-artifact@v4 + with: + name: Mac64-NDLL + path: | + ndll/Mac64/ + !**/.gitignore + if-no-files-found: error + + - uses: actions/upload-artifact@v4 + with: + name: MacArm64-NDLL + path: | + ndll/MacArm64/ + !**/.gitignore + if-no-files-found: error + + - uses: actions/upload-artifact@v4 + with: + name: Mac64-Hashlink + path: | + templates/bin/hl/Mac64 + if-no-files-found: error + + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + # - name: Build HelloWorld sample + # run: | + # lime create HelloWorld -verbose -nocolor + # lime build HelloWorld macos -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage macos -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio macos -release -verbose -nocolor + + windows: + runs-on: windows-latest + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV + + - name: Install Haxe dependencies + run: | + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet + haxelib install format --quiet + haxelib install hxp --quiet + + - name: Enable HXCPP compile cache + run: | + echo "HXCPP_COMPILE_CACHE=C:\.hxcpp" >> $Env:GITHUB_ENV + + - name: Rebuild Lime tools + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime rebuild tools -nocolor -verbose -nocffi + haxelib run lime setup -alias -y -nocffi + + - name: Rebuild Lime (Windows) + run: | + lime rebuild windows -32 -release -nocolor -verbose -nocffi + lime rebuild windows -64 -release -nocolor -verbose -nocffi + lime rebuild hl -clean -release -nocolor -verbose -nocffi + + - uses: actions/upload-artifact@v4 + with: + name: Windows-NDLL + path: | + ndll/Windows/ + !**/.gitignore + if-no-files-found: error + + - uses: actions/upload-artifact@v4 + with: + name: Windows64-NDLL + path: | + ndll/Windows64/ + !**/.gitignore + if-no-files-found: error + + # - uses: actions/upload-artifact@v4 + # with: + # name: Windows-Hashlink + # path: | + # templates/bin/hl/Windows + # if-no-files-found: error + - uses: actions/upload-artifact@v4 + with: + name: Windows64-Hashlink + path: | + templates/bin/hl/Windows64 + if-no-files-found: error + + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld windows -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage windows -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio windows -release -verbose -nocolor + + android: + runs-on: ubuntu-22.04 + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Android NDK + uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r21e + + - uses: actions/setup-java@v4 + with: + distribution: "zulu" + java-version: 11 + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet + haxelib install format --quiet + haxelib install hxp --quiet + + - name: Enable HXCPP compile cache + run: | + echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV + + - name: Prepare Lime + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime setup -alias -y -nocffi -eval + + - name: Configure Android support + run: | + lime config ANDROID_SDK $ANDROID_HOME -eval + lime config ANDROID_NDK_ROOT ${{ steps.setup-ndk.outputs.ndk-path }} -eval + lime config JAVA_HOME $JAVA_HOME -eval + lime config ANDROID_SETUP true -eval + lime config -eval + + - name: Rebuild Lime (Android) + run: | + lime rebuild android -release -nocolor -verbose -nocffi -eval + + - uses: actions/upload-artifact@v4 + with: + name: Android-NDLL + path: | + ndll/Android/ + !**/.gitignore + if-no-files-found: error + + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor -eval + lime build HelloWorld android -release -verbose -nocolor -eval + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage android -release -verbose -nocolor -eval + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio android -release -verbose -nocolor -eval + ios: + runs-on: macos-13 + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet + haxelib install format --quiet + haxelib install hxp --quiet + + - name: Enable HXCPP compile cache + run: | + echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV + + - name: Prepare Lime + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime setup -alias -y -nocffi -eval + + - name: Rebuild Lime (iOS) + run: | + lime rebuild ios -clean -release -verbose -nocolor -eval + + - uses: actions/upload-artifact@v4 + with: + name: iPhone-NDLL + path: | + ndll/iPhone/ + !**/.gitignore + if-no-files-found: error + + - name: Install samples + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + # - name: Build HelloWorld sample + # run: | + # lime create HelloWorld -verbose -nocolor -eval + # lime build HelloWorld ios -simulator -release -verbose -nocolor -eval + + - name: Build SimpleImage sample (Simulator) + run: | + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage ios -simulator -release -verbose -nocolor -eval + + - name: Build SimpleAudio sample (Device) + run: | + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio ios -release -nosign -verbose -nocolor -eval + + package-haxelib: + needs: [linux, macos, windows, android, ios] + runs-on: ubuntu-22.04 + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet + haxelib install format --quiet + haxelib install hxp --quiet + haxelib install svg --quiet + haxelib install openfl --quiet + + - name: Enable HXCPP compile cache + run: | + echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV + + - name: Rebuild Lime tools + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime rebuild tools -nocolor -verbose -nocffi + haxelib run lime setup -alias -y -nocffi + cp project/lib/hashlink/other/osx/entitlements.xml templates/bin/hl/entitlements.xml + mkdir templates/bin/hl/include + cp project/lib/hashlink/src/hlc.h templates/bin/hl/include/hlc.h + cp project/lib/hashlink/src/hl.h templates/bin/hl/include/hl.h + cp project/lib/hashlink/src/hlc_main.c templates/bin/hl/include/hlc_main.c + + - uses: actions/download-artifact@v4 + with: + name: Android-NDLL + path: ndll/Android/ + + - uses: actions/download-artifact@v4 + with: + name: iPhone-NDLL + path: ndll/iPhone/ + + - uses: actions/download-artifact@v4 + with: + name: Linux-NDLL + path: ndll/Linux/ + + - uses: actions/download-artifact@v4 + with: + name: Linux64-NDLL + path: ndll/Linux64/ + + - uses: actions/download-artifact@v4 + with: + name: Mac64-NDLL + path: ndll/Mac64/ + + - uses: actions/download-artifact@v4 + with: + name: MacArm64-NDLL + path: ndll/MacArm64/ + + - uses: actions/download-artifact@v4 + with: + name: Windows-NDLL + path: ndll/Windows/ + + - uses: actions/download-artifact@v4 + with: + name: Windows64-NDLL + path: ndll/Windows64/ + + # - uses: actions/download-artifact@v4 + # with: + # name: Windows-Hashlink + # path: templates/bin/hl/Windows + + - uses: actions/download-artifact@v4 + with: + name: Windows64-Hashlink + path: templates/bin/hl/Windows64 + + - uses: actions/download-artifact@v4 + with: + name: Mac64-Hashlink + path: templates/bin/hl/Mac64 + + - uses: actions/download-artifact@v4 + with: + name: Linux64-Hashlink + path: templates/bin/hl/Linux64 + + - name: Rebuild Lime svg.n + working-directory: tools + run: | + haxe svg.hxml + + - uses: actions/upload-artifact@v4 + with: + name: lime-haxelib + path: | + ./ + !project/ + !haxe-*-*/ + !neko-*-*/ + !.git/ + if-no-files-found: error + + docs: + runs-on: ubuntu-22.04 + steps: + + - uses: actions/checkout@v4 + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + haxelib install dox --quiet + haxelib dev lime ${{ github.workspace }} + + - name: Build docs + working-directory: docs + run: | + haxe build.hxml + + - uses: actions/upload-artifact@v4 + with: + name: lime-docs + path: docs/pages + if-no-files-found: error + + flash-samples: + runs-on: ubuntu-22.04 + steps: + + - uses: actions/checkout@v4 + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + haxelib install format --quiet + haxelib install hxp --quiet + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Prepare Lime + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime setup -alias -y -nocffi -eval + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor -eval + lime build HelloWorld flash -release -verbose -nocolor -eval + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage flash -release -verbose -nocolor -eval + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio flash -release -verbose -nocolor -eval + + air-samples: + runs-on: windows-latest + strategy: + matrix: + haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.6] + steps: + + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ matrix.haxe-version }} + + - uses: joshtynjala/setup-adobe-air-action@v2 + with: + air-version: "33.1" + accept-license: true + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV + + - name: Install Haxe dependencies + run: | + curl --output ../hxcpp-4.3.45.zip --location https://github.com/HaxeFoundation/hxcpp/releases/download/v4.3.45/hxcpp-4.3.45.zip + haxelib install ../hxcpp-4.3.45.zip --quiet + haxelib install format --quiet + haxelib install hxp --quiet + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - name: Prepare Lime + run: | + haxelib dev lime ${{ github.workspace }} + haxelib run lime setup -alias -y -nocffi -eval + haxelib run lime config AIR_SDK ${{ env.AIR_HOME }} -eval + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor -eval + lime build HelloWorld air -release -verbose -nocolor -eval + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor -eval + lime build SimpleImage air -release -verbose -nocolor -eval + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor -eval + lime build SimpleAudio air -release -verbose -nocolor -eval + + hashlink-samples: + needs: package-haxelib + strategy: + matrix: + os: [windows-latest, ubuntu-22.04, macos-13] + runs-on: ${{ matrix.os }} + steps: + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ env.HAXE_VERSION }} + + - name: Set HAXEPATH (Windows) + if: runner.os == 'Windows' + run: | + echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV + - name: Set HAXEPATH (Mac/Linux) + if: runner.os != 'Windows' + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - uses: actions/download-artifact@v4 + with: + name: lime-haxelib + path: lime-haxelib + + - name: Prepare Lime + run: | + haxelib dev lime lime-haxelib + haxelib run lime setup -alias -y -nocffi + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld hl -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage hl -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio hl -release -verbose -nocolor + + hashlinkc-samples: + needs: package-haxelib + strategy: + matrix: + os: [windows-latest, ubuntu-22.04, macos-13] + runs-on: ${{ matrix.os }} + steps: + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: 4.3.3 # minimum required version for HL/C is 4.3.3 + + - name: Set HAXEPATH (Windows) + if: runner.os == 'Windows' + run: | + echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV + - name: Set HAXEPATH (Mac/Linux) + if: runner.os != 'Windows' + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - uses: actions/download-artifact@v4 + with: + name: lime-haxelib + path: lime-haxelib + + - name: Prepare Lime + run: | + haxelib dev lime lime-haxelib + haxelib run lime setup -alias -y -nocffi + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld hlc -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage hlc -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio hlc -release -verbose -nocolor + + html5-samples: + needs: package-haxelib + runs-on: ubuntu-22.04 + strategy: + matrix: + haxe-version: [3.4.7, 4.0.5, 4.1.5, 4.2.5, 4.3.6] + steps: + + - uses: actions/checkout@v4 + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ matrix.haxe-version }} + + - name: Set HAXEPATH + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + haxelib install genes --quiet + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - uses: actions/download-artifact@v4 + with: + name: lime-haxelib + path: lime-haxelib + + - name: Prepare Lime + run: | + haxelib dev lime lime-haxelib + haxelib run lime setup -alias -y -nocffi + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld html5 -release -verbose -nocolor + + - name: Build HelloWorld variants + if: ${{ matrix.haxe-version != '3.4.7' }} + run: | + lime build HelloWorld html5 -clean -release -verbose -nocolor --haxelib=genes + lime build HelloWorld html5 -clean -release -verbose -nocolor -minify -terser + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage html5 -release -verbose -nocolor + + - name: Build SimpleImage variants + if: ${{ matrix.haxe-version != '3.4.7' }} + run: | + lime build SimpleImage html5 -clean -release -verbose -nocolor --haxelib=genes + lime build SimpleImage html5 -clean -release -verbose -nocolor -minify -terser + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio html5 -release -verbose -nocolor + + - name: Build SimpleAudio variants + if: ${{ matrix.haxe-version != '3.4.7' }} + run: | + lime build SimpleAudio html5 -clean -release -verbose -nocolor --haxelib=genes + lime build SimpleAudio html5 -clean -release -verbose -nocolor -minify -terser + + neko-samples: + needs: package-haxelib + strategy: + matrix: + haxe-version: [3.4.7, 4.2.5] + os: [windows-latest, ubuntu-22.04, macos-13] + runs-on: ${{ matrix.os }} + steps: + + - uses: krdlab/setup-haxe@v1 + with: + haxe-version: ${{ matrix.haxe-version }} + + - name: Set HAXEPATH (Windows) + if: runner.os == 'Windows' + run: | + echo "HAXEPATH=$Env:HAXE_STD_PATH\.." >> $Env:GITHUB_ENV + - name: Set HAXEPATH (Mac/Linux) + if: runner.os != 'Windows' + run: | + echo "HAXEPATH=$HAXE_STD_PATH/.." >> $GITHUB_ENV + + - name: Install Haxe dependencies + run: | + haxelib git lime-samples https://github.com/openfl/lime-samples --quiet + + - uses: actions/download-artifact@v4 + with: + name: lime-haxelib + path: lime-haxelib + + - name: Prepare Lime + run: | + haxelib dev lime lime-haxelib + haxelib run lime setup -alias -y -nocffi + + - name: Build HelloWorld sample + run: | + lime create HelloWorld -verbose -nocolor + lime build HelloWorld neko -release -verbose -nocolor + + - name: Build SimpleImage sample + run: | + lime create SimpleImage -verbose -nocolor + lime build SimpleImage neko -release -verbose -nocolor + + - name: Build SimpleAudio sample + run: | + lime create SimpleAudio -verbose -nocolor + lime build SimpleAudio neko -release -verbose -nocolor + + notify: + runs-on: ubuntu-22.04 + needs: [package-haxelib, docs, android, flash-samples, air-samples, hashlink-samples, hashlinkc-samples, html5-samples, ios, linux, macos, neko-samples, windows] + if: ${{ github.repository == 'openfl/lime' && github.event_name != 'pull_request' }} + steps: + - name: Notify Discord + uses: nobrayner/discord-webhook@v1 + with: + github-token: ${{ secrets.github_token }} + discord-webhook: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff63737f75..c483f354e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,3 +16,24 @@ You may consider creating a branch specific to the fix or improvement you wish t It is our goal to help Lime evolve as a clean, easy-to-use (but powerful) layer for cross-platform development. Thanks for being a part of making this possible! +## Versioning and Branching Guidelines + +We follow Semantic Versioning (semver): MAJOR.MINOR.PATCH. + +### Patch Updates (x.x.x) + +All bug fixes should be submitted to the current stable development branch (e.g., develop). + +These changes are released as patch versions (e.g., 8.2.3 → 8.2.4). + +### Minor Updates (x.x.0) + +All new features (non-breaking) should be submitted to the next minor development branch, named x.x.x-dev. + +For example, if the current version is 8.2.2, features targeting 8.3.0 should go into 8.3.0-dev. + +### Major Updates (x.0.0) + +Any breaking changes or major version updates must be submitted to the next major development branch, named x.0.0-dev. + +For example, breaking changes intended for 9.0.0 go into 9.0.0-dev. diff --git a/LICENSE.md b/LICENSE.md index 726f005e6c..2e2eed9183 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ MIT License =========== -Copyright (c) 2013-2024 Joshua Granick and other Lime contributors +Copyright (c) 2013-2025 Joshua Granick and other Lime contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000000..cc698419e6 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,27 @@ +# Maintainer Collaboration Guidelines + +## Ownership Boundaries +Core ownership includes final authority on major project direction, branding, external representation (e.g., website, GitHub org settings), and financial decisions. Project leadership roles should support this structure, not compete with it. +Joshua Granick remains the primary owner of OpenFL and related projects under its umbrella, including all copyrights, branding, and rights to external representations. + +## Commit Transparency +All commits — especially those involving the website or project structure — should be clearly described. Avoid vague or misleading commit messages. + +## No Unilateral Decisions +Significant changes to the public-facing site, GitHub structure, or future policies (including donation links) must be discussed with the core team before being merged. +High contribution volume does not entitle anyone to override team consensus or operate outside the established process. We value impact, but we expect humility and collaboration in return. + +## Respect Other Maintainers’ Work +Reverting, overwriting, or contradicting another maintainer’s contribution must go through discussion first — ideally via PR, not direct commit. + +## Escalation Policy +If collaboration issues persist after a discussion, core owners may revoke elevated roles or privileges to protect the health of the project. This isn’t personal — it’s structural. + +## Donations & Monetization +Any personal monetization links (Patreon, Ko-fi, etc.) require approval by the core **owners**. We want to keep funding equitable and transparent. + +## Communication First +If you disagree with a decision or direction, bring it up in team chat or discussion threads — not by taking action in silence. + +## We Are a Team +Leadership means contributing to both the codebase and the culture. If you’re not supporting both, you’re not fulfilling the role. diff --git a/NOTICE.md b/NOTICE.md index a2f4b4de68..a806789ebd 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -2,7 +2,7 @@ Notices ======= ### Lime -Copyright (c) 2013-2024 Joshua Granick and other Lime contributors +Copyright (c) 2013-2025 Joshua Granick and other Lime contributors This product bundles cairo 1.15.2, which is available under an "MPL 1.1" license. For details, see [project/lib/cairo/](project/lib). diff --git a/README.md b/README.md index 992c2ee1d0..c6803fb1a5 100644 --- a/README.md +++ b/README.md @@ -107,3 +107,12 @@ Lime currently supports the following targets: lime test hl Desktop builds are currently designed to be built on the same host OS + + +Join the Community +================== + +Have a question? Want a new place to hang out? + + * [Forums](https://community.openfl.org/c/lime/19) + * [Discord](https://discordapp.com/invite/tDgq8EE) diff --git a/docs/ImportAll.hx b/docs/ImportAll.hx index be172c7d09..e0039724f6 100644 --- a/docs/ImportAll.hx +++ b/docs/ImportAll.hx @@ -112,6 +112,7 @@ import lime.net.HTTPRequest; import lime.net.HTTPRequestHeader; import lime.net.HTTPRequestMethod; import lime.net.URIParser; +import lime.system.BackgroundWorker; import lime.system.CFFI; import lime.system.CFFIPointer; import lime.system.Clipboard; @@ -125,6 +126,7 @@ import lime.system.Sensor; import lime.system.SensorType; import lime.system.System; import lime.system.ThreadPool; +import lime.system.WorkOutput; import lime.text.harfbuzz.HB; import lime.text.harfbuzz.HBBlob; import lime.text.harfbuzz.HBBuffer; @@ -169,6 +171,7 @@ import lime.ui.Window; import lime.ui.WindowAttributes; import lime.utils.ArrayBuffer; import lime.utils.ArrayBufferView; +import lime.utils.AssetBundle; import lime.utils.AssetCache; import lime.utils.AssetLibrary; import lime.utils.AssetManifest; diff --git a/project/Build.xml b/project/Build.xml index b6d9bfde2b..e2ce6a2347 100755 --- a/project/Build.xml +++ b/project/Build.xml @@ -389,7 +389,7 @@ - + diff --git a/project/lib/cairo b/project/lib/cairo index b43e7c6f3c..200441e685 160000 --- a/project/lib/cairo +++ b/project/lib/cairo @@ -1 +1 @@ -Subproject commit b43e7c6f3cf7855e16170a06d3a9c7234c60ca94 +Subproject commit 200441e6855854eb4dbf338e44d67b00ababe07f diff --git a/project/lib/curl b/project/lib/curl index 462196e6b4..c12fb3ddaf 160000 --- a/project/lib/curl +++ b/project/lib/curl @@ -1 +1 @@ -Subproject commit 462196e6b4a47f924293a0e26b8e9c23d37ac26f +Subproject commit c12fb3ddaf48e709a7a4deaa55ec485e4df163ee diff --git a/project/lib/curl-files.xml b/project/lib/curl-files.xml index 5e01a10fe6..06fecab8a6 100644 --- a/project/lib/curl-files.xml +++ b/project/lib/curl-files.xml @@ -1,4 +1,7 @@ + + + @@ -23,7 +26,22 @@ - + + +
+ + + +
+ + + + + + +
+ +
@@ -41,7 +59,6 @@ - @@ -58,12 +75,12 @@ + - @@ -76,12 +93,12 @@ - + @@ -89,6 +106,7 @@ + @@ -103,6 +121,7 @@ + @@ -113,6 +132,7 @@ + diff --git a/project/lib/custom/jpeg/jconfigint.h b/project/lib/custom/jpeg/jconfigint.h index 69767e9176..632329a8b7 100644 --- a/project/lib/custom/jpeg/jconfigint.h +++ b/project/lib/custom/jpeg/jconfigint.h @@ -23,10 +23,10 @@ #define VERSION "2.0.7" /* The size of `size_t', as computed by sizeof. */ -#if defined(RASPBERRYPI) -#define SIZEOF_SIZE_T 4 -#else +#if (__WORDSIZE == 64) || defined(_WIN64) #define SIZEOF_SIZE_T 8 +#else +#define SIZEOF_SIZE_T 4 #endif /* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */ diff --git a/project/lib/custom/mbedtls_hxcpp/mbedtls_config.h b/project/lib/custom/mbedtls_hxcpp/mbedtls_config.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/project/lib/efsw b/project/lib/efsw index 41feca17c0..62f785c56b 160000 --- a/project/lib/efsw +++ b/project/lib/efsw @@ -1 +1 @@ -Subproject commit 41feca17c0a4ec85b78552d8cb7eb641149b8735 +Subproject commit 62f785c56b7a34f035193d4cb831921347b586b8 diff --git a/project/lib/freetype-files.xml b/project/lib/freetype-files.xml index c9e9e69e58..722fc2508d 100644 --- a/project/lib/freetype-files.xml +++ b/project/lib/freetype-files.xml @@ -16,6 +16,7 @@ + @@ -79,6 +80,7 @@ + diff --git a/project/lib/harfbuzz b/project/lib/harfbuzz index afcae83a06..7b27c8edd4 160000 --- a/project/lib/harfbuzz +++ b/project/lib/harfbuzz @@ -1 +1 @@ -Subproject commit afcae83a064843d71d47624bc162e121cc56c08b +Subproject commit 7b27c8edd46c674e01dd226fa9e1aa7549f5c436 diff --git a/project/lib/harfbuzz-files.xml b/project/lib/harfbuzz-files.xml index 63fcb4c3c8..e5e634a249 100644 --- a/project/lib/harfbuzz-files.xml +++ b/project/lib/harfbuzz-files.xml @@ -32,15 +32,18 @@ - + + + + @@ -64,6 +67,9 @@ + + + diff --git a/project/lib/mbedtls-files.xml b/project/lib/mbedtls-files.xml index 486b01653a..3b5c90dcc6 100644 --- a/project/lib/mbedtls-files.xml +++ b/project/lib/mbedtls-files.xml @@ -2,7 +2,7 @@ - + diff --git a/project/lib/openal-files.xml b/project/lib/openal-files.xml index d07ad13bae..23d61be4f4 100644 --- a/project/lib/openal-files.xml +++ b/project/lib/openal-files.xml @@ -1,7 +1,13 @@ +
+ +
+ + + @@ -155,7 +161,6 @@
- diff --git a/project/lib/png b/project/lib/png index a40189cf88..0024abd279 160000 --- a/project/lib/png +++ b/project/lib/png @@ -1 +1 @@ -Subproject commit a40189cf881e9f0db80511c382292a5604c3c3d1 +Subproject commit 0024abd279d3a06435c0309a3f4172eed7c7a19a diff --git a/project/lib/tinyfiledialogs b/project/lib/tinyfiledialogs index 2681e426dd..b736119e5d 160000 --- a/project/lib/tinyfiledialogs +++ b/project/lib/tinyfiledialogs @@ -1 +1 @@ -Subproject commit 2681e426ddaebc8e2764a7823b4b9d69564d1684 +Subproject commit b736119e5de13b32001b63614dd65f8966e6adb8 diff --git a/project/lib/zlib b/project/lib/zlib index 21767c654d..51b7f2abda 160000 --- a/project/lib/zlib +++ b/project/lib/zlib @@ -1 +1 @@ -Subproject commit 21767c654d31d2dccdde4330529775c6c5fd5389 +Subproject commit 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index 2503398bca..016aab7546 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -2426,28 +2426,28 @@ namespace lime { } - float lime_key_code_from_scan_code (float scanCode) { + int lime_key_code_from_scan_code (int scanCode) { return KeyCode::FromScanCode (scanCode); } - HL_PRIM float HL_NAME(hl_key_code_from_scan_code) (float scanCode) { + HL_PRIM int HL_NAME(hl_key_code_from_scan_code) (int scanCode) { return KeyCode::FromScanCode (scanCode); } - float lime_key_code_to_scan_code (float keyCode) { + int lime_key_code_to_scan_code (int keyCode) { return KeyCode::ToScanCode (keyCode); } - HL_PRIM float HL_NAME(hl_key_code_to_scan_code) (float keyCode) { + HL_PRIM int HL_NAME(hl_key_code_to_scan_code) (int keyCode) { return KeyCode::ToScanCode (keyCode); @@ -4276,8 +4276,8 @@ namespace lime { DEFINE_HL_PRIM (_I32, hl_joystick_get_num_hats, _I32); DEFINE_HL_PRIM (_TIMAGEBUFFER, hl_jpeg_decode_bytes, _TBYTES _BOOL _TIMAGEBUFFER); DEFINE_HL_PRIM (_TIMAGEBUFFER, hl_jpeg_decode_file, _STRING _BOOL _TIMAGEBUFFER); - DEFINE_HL_PRIM (_F32, hl_key_code_from_scan_code, _F32); - DEFINE_HL_PRIM (_F32, hl_key_code_to_scan_code, _F32); + DEFINE_HL_PRIM (_I32, hl_key_code_from_scan_code, _I32); + DEFINE_HL_PRIM (_I32, hl_key_code_to_scan_code, _I32); DEFINE_HL_PRIM (_VOID, hl_key_event_manager_register, _FUN (_VOID, _NO_ARG) _TKEY_EVENT); DEFINE_HL_PRIM (_BYTES, hl_locale_get_system_locale, _NO_ARG); DEFINE_HL_PRIM (_TBYTES, hl_lzma_compress, _TBYTES _TBYTES); diff --git a/project/src/backend/sdl/SDLSystem.cpp b/project/src/backend/sdl/SDLSystem.cpp index 8a099e88b8..bab1517bfe 100644 --- a/project/src/backend/sdl/SDLSystem.cpp +++ b/project/src/backend/sdl/SDLSystem.cpp @@ -38,10 +38,10 @@ #include #include -#ifdef HX_WINDOWS #include #include -#endif + +using wstring_convert = std::wstring_convert>; namespace lime { @@ -115,13 +115,15 @@ namespace lime { case APPLICATION: { char* path = SDL_GetBasePath (); - #ifdef HX_WINDOWS - std::wstring_convert> converter; - result = new std::wstring (converter.from_bytes(path)); - #else - result = new std::wstring (path, path + strlen (path)); - #endif - SDL_free (path); + + if (path != nullptr) { + + wstring_convert converter; + result = new std::wstring (converter.from_bytes(path)); + SDL_free (path); + + } + break; } @@ -129,13 +131,15 @@ namespace lime { case APPLICATION_STORAGE: { char* path = SDL_GetPrefPath (company, title); - #ifdef HX_WINDOWS - std::wstring_convert> converter; - result = new std::wstring (converter.from_bytes(path)); - #else - result = new std::wstring (path, path + strlen (path)); - #endif - SDL_free (path); + + if (path != nullptr) { + + wstring_convert converter; + result = new std::wstring (converter.from_bytes(path)); + SDL_free (path); + + } + break; } @@ -149,11 +153,9 @@ namespace lime { #elif defined (HX_WINDOWS) - char folderPath[MAX_PATH] = ""; - SHGetFolderPath (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, folderPath); - //WIN_StringToUTF8 (folderPath); - std::wstring_convert> converter; - result = new std::wstring (converter.from_bytes (folderPath)); + WCHAR folderPath[MAX_PATH] = L""; + SHGetFolderPathW (NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, folderPath); + result = new std::wstring (folderPath); #elif defined (IPHONE) @@ -163,15 +165,14 @@ namespace lime { char const* home = getenv ("HOME"); - if (home == NULL) { + if (home != NULL) { - return 0; + std::string path = std::string (home) + std::string ("/Desktop"); + wstring_convert converter; + result = new std::wstring (converter.from_bytes(path)); } - std::string path = std::string (home) + std::string ("/Desktop"); - result = new std::wstring (path.begin (), path.end ()); - #endif break; @@ -186,11 +187,9 @@ namespace lime { #elif defined (HX_WINDOWS) - char folderPath[MAX_PATH] = ""; - SHGetFolderPath (NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, folderPath); - //WIN_StringToUTF8 (folderPath); - std::wstring_convert> converter; - result = new std::wstring (converter.from_bytes (folderPath)); + WCHAR folderPath[MAX_PATH] = L""; + SHGetFolderPathW (NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, folderPath); + result = new std::wstring (folderPath); #elif defined (IPHONE) @@ -207,7 +206,8 @@ namespace lime { if (home != NULL) { std::string path = std::string (home) + std::string ("/Documents"); - result = new std::wstring (path.begin (), path.end ()); + wstring_convert converter; + result = new std::wstring (converter.from_bytes(path)); } @@ -224,11 +224,9 @@ namespace lime { #elif defined (HX_WINDOWS) - char folderPath[MAX_PATH] = ""; - SHGetFolderPath (NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, folderPath); - //WIN_StringToUTF8 (folderPath); - std::wstring_convert> converter; - result = new std::wstring (converter.from_bytes (folderPath)); + WCHAR folderPath[MAX_PATH] = L""; + SHGetFolderPathW (NULL, CSIDL_FONTS, NULL, SHGFP_TYPE_CURRENT, folderPath); + result = new std::wstring (folderPath); #elif defined (HX_MACOS) @@ -264,11 +262,9 @@ namespace lime { #elif defined (HX_WINDOWS) - char folderPath[MAX_PATH] = ""; - SHGetFolderPath (NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, folderPath); - //WIN_StringToUTF8 (folderPath); - std::wstring_convert> converter; - result = new std::wstring (converter.from_bytes (folderPath)); + WCHAR folderPath[MAX_PATH] = L""; + SHGetFolderPathW (NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, folderPath); + result = new std::wstring (folderPath); #elif defined (IPHONE) @@ -285,7 +281,8 @@ namespace lime { if (home != NULL) { std::string path = std::string (home); - result = new std::wstring (path.begin (), path.end ()); + wstring_convert converter; + result = new std::wstring (converter.from_bytes(path)); } diff --git a/project/src/net/curl/CURLBindings.cpp b/project/src/net/curl/CURLBindings.cpp index 861bb8536f..f6cb9f6e77 100644 --- a/project/src/net/curl/CURLBindings.cpp +++ b/project/src/net/curl/CURLBindings.cpp @@ -57,6 +57,19 @@ namespace lime { std::map xferInfoValues; Mutex curl_gc_mutex; + void free_header_values (const std::vector* values) { + + if (values) { + + for (auto it = values->begin (); it != values->end (); ++it) { + + free (*it); + + } + + } + + } void gc_curl (value handle) { @@ -121,6 +134,7 @@ namespace lime { std::vector* values = headerValues[handle]; headerCallbacks.erase (handle); headerValues.erase (handle); + free_header_values (values); delete callback; delete values; @@ -254,6 +268,7 @@ namespace lime { std::vector* values = headerValues[handle]; headerCallbacks.erase (handle); headerValues.erase (handle); + free_header_values (values); delete callback; delete values; @@ -581,6 +596,7 @@ namespace lime { } + free_header_values (values); values->clear (); } @@ -688,6 +704,7 @@ namespace lime { } + free_header_values (values); values->clear (); } @@ -1074,6 +1091,11 @@ namespace lime { writeBufferPosition[handle] = 0; writeBufferSize[handle] = 0; + CURLcode setopt_result = curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); + if(setopt_result != CURLE_OK) { + printf("Failed to set CURLOPT_ACCEPT_ENCODING: %s\n", curl_easy_strerror(setopt_result)); + } + curl_gc_mutex.Unlock (); return handle; @@ -1125,6 +1147,11 @@ namespace lime { writeBufferPosition[handle] = 0; writeBufferSize[handle] = 0; + CURLcode setopt_result = curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); + if(setopt_result != CURLE_OK) { + printf("Failed to set CURLOPT_ACCEPT_ENCODING: %s\n", curl_easy_strerror(setopt_result)); + } + curl_gc_mutex.Unlock (); return handle; @@ -1681,8 +1708,9 @@ namespace lime { { curl_gc_mutex.Lock (); - if (headerCallbacks.find (handle) == headerCallbacks.end ()) { + if (headerCallbacks.find (handle) != headerCallbacks.end ()) { + free_header_values (headerValues[handle]); delete headerCallbacks[handle]; delete headerValues[handle]; @@ -2108,8 +2136,9 @@ namespace lime { { curl_gc_mutex.Lock (); - if (headerCallbacks.find (handle) == headerCallbacks.end ()) { + if (headerCallbacks.find (handle) != headerCallbacks.end ()) { + free_header_values (headerValues[handle]); delete headerCallbacks[handle]; delete headerValues[handle]; @@ -2889,4 +2918,4 @@ extern "C" int lime_curl_register_prims () { return 0; -} \ No newline at end of file +} diff --git a/project/src/text/Font.cpp b/project/src/text/Font.cpp index 8234ccad30..3318901bc1 100644 --- a/project/src/text/Font.cpp +++ b/project/src/text/Font.cpp @@ -1052,6 +1052,10 @@ namespace lime { while (*characters != 0) { character = readNextChar (characters); + + if (character == -1) + break; + index = FT_Get_Char_Index ((FT_Face)face, character); val_array_push (indices, alloc_int (index)); @@ -1064,22 +1068,30 @@ namespace lime { unsigned long character; int index; int count = 0; - - // TODO: Determine array size first + const char* characters_start = characters; while (*characters != 0) { character = readNextChar (characters); + + if (character == -1) + break; + count++; } hl_varray* indices = (hl_varray*)hl_alloc_array (&hlt_i32, count); int* indicesData = hl_aptr (indices, int); + characters = characters_start; while (*characters != 0) { character = readNextChar (characters); + + if (character == -1) + break; + *indicesData++ = FT_Get_Char_Index ((FT_Face)face, character); } diff --git a/project/src/text/harfbuzz/HarfbuzzBindings.cpp b/project/src/text/harfbuzz/HarfbuzzBindings.cpp index 5b1270c850..cd5b5b892e 100644 --- a/project/src/text/harfbuzz/HarfbuzzBindings.cpp +++ b/project/src/text/harfbuzz/HarfbuzzBindings.cpp @@ -258,14 +258,20 @@ namespace lime { void lime_hb_buffer_add_utf8 (value buffer, HxString text, int itemOffset, int itemLength) { - hb_buffer_add_utf8 ((hb_buffer_t*)val_data (buffer), text.c_str (), text.length, itemOffset, itemLength); + int textLength = text.length; + if (hxs_encoding (text) == hx::StringUtf16) { + // hxs_utf8 doesn't give us the length, so treat it as null terminated + textLength = -1; + } + + hb_buffer_add_utf8 ((hb_buffer_t*)val_data (buffer), hxs_utf8 (text, nullptr), textLength, itemOffset, itemLength); } HL_PRIM void HL_NAME(hl_hb_buffer_add_utf8) (HL_CFFIPointer* buffer, hl_vstring* text, int itemOffset, int itemLength) { - hb_buffer_add_utf8 ((hb_buffer_t*)buffer->ptr, text ? hl_to_utf8 (text->bytes) : NULL, text ? text->length : 0, itemOffset, itemLength); + hb_buffer_add_utf8 ((hb_buffer_t*)buffer->ptr, text ? hl_to_utf8 (text->bytes) : NULL, -1, itemOffset, itemLength); } diff --git a/project/src/utils/Bytes.cpp b/project/src/utils/Bytes.cpp index 3a6333c619..79cfb49b65 100644 --- a/project/src/utils/Bytes.cpp +++ b/project/src/utils/Bytes.cpp @@ -178,52 +178,45 @@ namespace lime { } - void Bytes::Set (value bytes) { - - mutex.Lock (); - - if (val_is_null (bytes)) { - - if (usingValue.find (this) != usingValue.end ()) { - - usingValue.erase (this); - - } - - length = 0; - b = 0; - - } else { - - hadValue[this] = true; - usingValue[this] = true; - - length = val_int (val_field (bytes, id_length)); - - if (length > 0) { - - value _b = val_field (bytes, id_b); - - if (val_is_string (_b)) { - - b = (unsigned char*)val_string (_b); - - } else { - - b = (unsigned char*)buffer_data (val_to_buffer (_b)); - - } - - } else { - - b = 0; - - } - - } - - mutex.Unlock (); - + void Bytes::Set(value bytes) { + + int newLength = 0; + unsigned char* newB = 0; + bool isNull = val_is_null(bytes); + + if (!isNull) { + + //here we can extract the values before calling our mutex to avoid potential deadlock or contention + value lengthVal = val_field(bytes, id_length); + value bVal = val_field(bytes, id_b); + + newLength = val_int(lengthVal); + + if (newLength > 0) { + + if (val_is_string(bVal)) { + newB = (unsigned char*)val_string(bVal); + } else { + newB = (unsigned char*)buffer_data(val_to_buffer(bVal)); + } + } + } + + //and now it should be save to lock + mutex.Lock(); + + if (isNull) { + usingValue.erase(this); + length = 0; + b = 0; + } else { + hadValue[this] = true; + usingValue[this] = true; + length = newLength; + b = newB; + } + + mutex.Unlock(); } @@ -311,4 +304,4 @@ namespace lime { } -} \ No newline at end of file +} diff --git a/src/haxe/Timer.hx b/src/haxe/Timer.hx index 1b80cf5ed0..425eab35fd 100644 --- a/src/haxe/Timer.hx +++ b/src/haxe/Timer.hx @@ -270,19 +270,7 @@ class Timer public function stop():Void { - if (mRunning) - { - mRunning = false; - - for (i in 0...sRunningTimers.length) - { - if (sRunningTimers[i] == this) - { - sRunningTimers[i] = null; - break; - } - } - } + mRunning = false; } @:noCompletion private function __check(inTime:Float) diff --git a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx index d6f741f3a2..3625782886 100644 --- a/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx +++ b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx @@ -64,7 +64,8 @@ class HTML5HTTPRequest if (parent.method == POST) { - request.upload.addEventListener("progress", progress, false); + if(request.upload != null) + request.upload.addEventListener("progress", progress, false); } else { diff --git a/src/lime/_internal/backend/html5/HTML5Thread.hx b/src/lime/_internal/backend/html5/HTML5Thread.hx index 022a085da1..9f744e59e1 100644 --- a/src/lime/_internal/backend/html5/HTML5Thread.hx +++ b/src/lime/_internal/backend/html5/HTML5Thread.hx @@ -96,7 +96,7 @@ class HTML5Thread { var thread:HTML5Thread = new HTML5Thread(url.href, new Worker(url.href)); // Run `job` on the new thread. - thread.sendMessage(job); + thread.sendMessage(#if !haxe4 cast #end job); return thread; #else @@ -416,7 +416,7 @@ abstract WorkFunction(WorkFunctionData) from Wor else { #if !macro - this.sourceCode = (cast this.func:Function).toString(); + this.sourceCode = (cast this.func #if haxe4 :Function #end).toString(); if (this.sourceCode.indexOf("[native code]") < 0) { // All set. diff --git a/src/lime/_internal/backend/native/NativeApplication.hx b/src/lime/_internal/backend/native/NativeApplication.hx index 4e4df21de6..5eb029ce71 100644 --- a/src/lime/_internal/backend/native/NativeApplication.hx +++ b/src/lime/_internal/backend/native/NativeApplication.hx @@ -102,9 +102,9 @@ class NativeApplication if (pauseTimer > -1) { var offset = System.getTimer() - pauseTimer; - for (i in 0...Timer.sRunningTimers.length) + for (timer in Timer.sRunningTimers) { - if (Timer.sRunningTimers[i] != null) Timer.sRunningTimers[i].mFireAt += offset; + if (timer.mRunning) timer.mFireAt += offset; } pauseTimer = -1; } @@ -598,16 +598,13 @@ class NativeApplication if (Timer.sRunningTimers.length > 0) { var currentTime = System.getTimer(); - var foundNull = false; - var timer; + var foundStopped = false; - for (i in 0...Timer.sRunningTimers.length) + for (timer in Timer.sRunningTimers) { - timer = Timer.sRunningTimers[i]; - - if (timer != null) + if (timer.mRunning) { - if (timer.mRunning && currentTime >= timer.mFireAt) + if (currentTime >= timer.mFireAt) { timer.mFireAt += timer.mTime; timer.run(); @@ -615,15 +612,15 @@ class NativeApplication } else { - foundNull = true; + foundStopped = true; } } - if (foundNull) + if (foundStopped) { Timer.sRunningTimers = Timer.sRunningTimers.filter(function(val) { - return val != null; + return val.mRunning; }); } } diff --git a/src/lime/_internal/backend/native/NativeCFFI.hx b/src/lime/_internal/backend/native/NativeCFFI.hx index 1bbc4a68d4..ee2eda46bc 100644 --- a/src/lime/_internal/backend/native/NativeCFFI.hx +++ b/src/lime/_internal/backend/native/NativeCFFI.hx @@ -219,9 +219,9 @@ class NativeCFFI @:cffi private static function lime_jpeg_decode_file(path:String, decodeData:Bool, buffer:Dynamic):Dynamic; - @:cffi private static function lime_key_code_from_scan_code(scanCode:Float32):Float32; + @:cffi private static function lime_key_code_from_scan_code(scanCode:Int):Int; - @:cffi private static function lime_key_code_to_scan_code(keyCode:Float32):Float32; + @:cffi private static function lime_key_code_to_scan_code(keyCode:Int):Int; @:cffi private static function lime_key_event_manager_register(callback:Dynamic, eventObject:Dynamic):Void; @@ -509,10 +509,10 @@ class NativeCFFI "lime_jpeg_decode_bytes", "oboo", false)); private static var lime_jpeg_decode_file = new cpp.CallableBool->cpp.Object->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_jpeg_decode_file", "sboo", false)); - private static var lime_key_code_from_scan_code = new cpp.Callablecpp.Float32>(cpp.Prime._loadPrime("lime", "lime_key_code_from_scan_code", - "ff", false)); - private static var lime_key_code_to_scan_code = new cpp.Callablecpp.Float32>(cpp.Prime._loadPrime("lime", "lime_key_code_to_scan_code", - "ff", false)); + private static var lime_key_code_from_scan_code = new cpp.CallableInt>(cpp.Prime._loadPrime("lime", "lime_key_code_from_scan_code", + "ii", false)); + private static var lime_key_code_to_scan_code = new cpp.CallableInt>(cpp.Prime._loadPrime("lime", "lime_key_code_to_scan_code", + "ii", false)); private static var lime_key_event_manager_register = new cpp.Callablecpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_key_event_manager_register", "oov", false)); private static var lime_lzma_compress = new cpp.Callablecpp.Object->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_lzma_compress", "ooo", @@ -1143,12 +1143,12 @@ class NativeCFFI return null; } - @:hlNative("lime", "hl_key_code_from_scan_code") private static function lime_key_code_from_scan_code(scanCode:hl.F32):hl.F32 + @:hlNative("lime", "hl_key_code_from_scan_code") private static function lime_key_code_from_scan_code(scanCode:Int):Int { return 0; } - @:hlNative("lime", "hl_key_code_to_scan_code") private static function lime_key_code_to_scan_code(keyCode:hl.F32):hl.F32 + @:hlNative("lime", "hl_key_code_to_scan_code") private static function lime_key_code_to_scan_code(keyCode:Int):Int { return 0; } diff --git a/src/lime/_internal/graphics/ImageCanvasUtil.hx b/src/lime/_internal/graphics/ImageCanvasUtil.hx index 539bce20cc..3102bcc2c1 100644 --- a/src/lime/_internal/graphics/ImageCanvasUtil.hx +++ b/src/lime/_internal/graphics/ImageCanvasUtil.hx @@ -189,13 +189,10 @@ class ImageCanvasUtil if (!image.transparent) { - if (!image.transparent) buffer.__srcCanvas.setAttribute("moz-opaque", "true"); - buffer.__srcContext = untyped #if haxe4 js.Syntax.code #else __js__ #end ('buffer.__srcCanvas.getContext ("2d", { alpha: false })'); - } - else - { - buffer.__srcContext = buffer.__srcCanvas.getContext("2d"); + buffer.__srcCanvas.setAttribute("moz-opaque", "true"); } + + buffer.__srcContext = buffer.__srcCanvas.getContext("2d", {alpha: image.transparent}); } #end } diff --git a/src/lime/graphics/Image.hx b/src/lime/graphics/Image.hx index 97385cdc3a..f528d5d50e 100644 --- a/src/lime/graphics/Image.hx +++ b/src/lime/graphics/Image.hx @@ -1483,6 +1483,11 @@ class Image __fromBase64(Base64.encode(bytes), type, onload); return true; #elseif (lime_cffi && !macro) + if (bytes == null || bytes.length == 0) + { + return false; + } + var imageBuffer:ImageBuffer = null; #if !cs diff --git a/src/lime/media/AudioManager.hx b/src/lime/media/AudioManager.hx index c554f11a0b..2ce67a71ac 100644 --- a/src/lime/media/AudioManager.hx +++ b/src/lime/media/AudioManager.hx @@ -44,10 +44,12 @@ class AudioManager var alc = context.openal; var device = alc.openDevice(); - var ctx = alc.createContext(device); - - alc.makeContextCurrent(ctx); - alc.processContext(ctx); + if (device != null) + { + var ctx = alc.createContext(device); + alc.makeContextCurrent(ctx); + alc.processContext(ctx); + } } #end } diff --git a/src/lime/media/openal/AL.hx b/src/lime/media/openal/AL.hx index ef61198aa4..383d2ccf7e 100644 --- a/src/lime/media/openal/AL.hx +++ b/src/lime/media/openal/AL.hx @@ -203,7 +203,8 @@ class AL public static inline var EFFECT_VOCAL_MORPHER:Int = 0x0007; public static inline var EFFECT_PITCH_SHIFTER:Int = 0x0008; public static inline var EFFECT_RING_MODULATOR:Int = 0x0009; - public static inline var FFECT_AUTOWAH:Int = 0x000A; + public static inline var FFECT_AUTOWAH:Int = 0x000A; // TODO: deprecate and remove + public static inline var EFFECT_AUTOWAH:Int = 0x000A; public static inline var EFFECT_COMPRESSOR:Int = 0x000B; public static inline var EFFECT_EQUALIZER:Int = 0x000C; /* Auxiliary Effect Slot properties. */ diff --git a/src/lime/system/System.hx b/src/lime/system/System.hx index 90c08574c8..56f9a709ec 100644 --- a/src/lime/system/System.hx +++ b/src/lime/system/System.hx @@ -373,7 +373,7 @@ class System #end /** - Opens a file with the suste, default application. + Opens a file with the system default application. In a web browser, opens a URL with target `_blank`. **/ diff --git a/src/lime/tools/FlashHelper.hx b/src/lime/tools/FlashHelper.hx index bbae4fd0ce..9cc436f858 100644 --- a/src/lime/tools/FlashHelper.hx +++ b/src/lime/tools/FlashHelper.hx @@ -167,7 +167,7 @@ class FlashHelper var frameData = frameDataWriter.getBytes(); - var snd:format.swf.Sound = + var snd:format.swf.Data.Sound = { sid: cid, format: SFMP3, @@ -255,7 +255,7 @@ class FlashHelper { var sampleCount = Std.int(wav.data.length / (hdr.bitsPerSample / 8)); - var snd:format.swf.Sound = + var snd:format.swf.Data.Sound = { sid: cid, format: SFLittleEndianUncompressed, diff --git a/src/lime/tools/IOSHelper.hx b/src/lime/tools/IOSHelper.hx index 5c17937c00..85ca47bae7 100644 --- a/src/lime/tools/IOSHelper.hx +++ b/src/lime/tools/IOSHelper.hx @@ -342,6 +342,7 @@ class IOSHelper System.runCommand("", "open", ["-a", "Simulator", "--args", "-CurrentDeviceUDID", currentDeviceID]); } + waitForDeviceState("xcrun", ["simctl", "boot", currentDeviceID]); waitForDeviceState("xcrun", ["simctl", "uninstall", currentDeviceID, project.meta.packageName]); waitForDeviceState("xcrun", ["simctl", "install", currentDeviceID, applicationPath]); waitForDeviceState("xcrun", ["simctl", "launch", currentDeviceID, project.meta.packageName]); @@ -361,6 +362,9 @@ class IOSHelper applicationPath = workingDirectory + "/build/" + configuration + "-iphoneos/" + project.app.file + ".app"; } + var requireIPad = project.config.getString("ios.device", "universal") == "ipad"; + var requireIPhone = project.config.getString("ios.device", "universal") == "iphone"; + var xcodeVersion = Std.parseFloat(getXcodeVersion()); if (!Math.isNaN(xcodeVersion) && xcodeVersion >= 16) { // ios-deploy doesn't work with newer iOS SDKs where it can't @@ -390,11 +394,21 @@ class IOSHelper } break; } + if (deviceUUID == null || deviceUUID.length == 0) { - Log.error("No device connected"); + // devices running iOS 16 and older don't support + // xcrun devicectl, so if no device was found, try falling + // back to ios-deploy + fallbackLaunch(project, applicationPath); + // Log.error("No device connected"); return; } + if (Log.verbose) + { + Log.info("Detected iOS device UUID: " + deviceUUID); + } + System.runCommand("", "xcrun", ["devicectl", "device", "install", "app", "--device", deviceUUID, FileSystem.fullPath(applicationPath)]); // Check if device is unlocked before launching (required for console logging) @@ -402,23 +416,50 @@ class IOSHelper System.runCommand("", "xcrun", ["devicectl", "device", "process", "launch", "--console", "--device", deviceUUID, project.meta.packageName]); } else { - var templatePaths = [ - Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end) - ].concat(project.templatePaths); - var launcher = System.findTemplate(templatePaths, "bin/ios-deploy"); - Sys.command("chmod", ["+x", launcher]); - - System.runCommand("", launcher, [ - "install", - "--noninteractive", - "--debug", - "--bundle", - FileSystem.fullPath(applicationPath) - ]); + // continue using ios-deploy if Xcode version is 15 or older + fallbackLaunch(project, applicationPath); } } } + private static function findDeviceUUIDWithFilters(filters:Array):String + { + var listDevicesOutput = System.runProcess("", "xcrun", + [ + "devicectl", "list", "devices", + "--hide-default-columns", "--columns", "Identifier", + "--filter", filters.join(" AND ") + ]); + var ready = false; + for (line in listDevicesOutput.split("\n")) + { + if (!ready) + { + ready = StringTools.startsWith(line, "----"); + continue; + } + return line; + } + return null; + } + + private static function fallbackLaunch(project:HXProject, applicationPath:String):Void + { + var templatePaths = [ + Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end) + ].concat(project.templatePaths); + var launcher = System.findTemplate(templatePaths, "bin/ios-deploy"); + Sys.command("chmod", ["+x", launcher]); + + System.runCommand("", launcher, [ + "install", + "--noninteractive", + "--debug", + "--bundle", + FileSystem.fullPath(applicationPath) + ]); + } + public static function sign(project:HXProject, workingDirectory:String):Void { initialize(project); diff --git a/src/lime/tools/Keystore.hx b/src/lime/tools/Keystore.hx index 878ba70a6a..65a0a6f31a 100644 --- a/src/lime/tools/Keystore.hx +++ b/src/lime/tools/Keystore.hx @@ -26,9 +26,9 @@ class Keystore if (keystore != null) { if (keystore.path != null && keystore.path != "") path = keystore.path; - if (keystore.password != null) path = keystore.password; - if (keystore.alias != null) path = keystore.alias; - if (keystore.aliasPassword != null) path = keystore.aliasPassword; + if (keystore.password != null) password = keystore.password; + if (keystore.alias != null) alias = keystore.alias; + if (keystore.aliasPassword != null) aliasPassword = keystore.aliasPassword; } } } diff --git a/src/lime/tools/XCodeHelper.hx b/src/lime/tools/XCodeHelper.hx index 62109c5bee..7abd0c08dd 100644 --- a/src/lime/tools/XCodeHelper.hx +++ b/src/lime/tools/XCodeHelper.hx @@ -5,8 +5,17 @@ import lime.tools.HXProject; class XCodeHelper { - private static inline var DEFAULT_IPAD_SIMULATOR = "ipad-air"; + // different computers may have different sets of simulators installed + // so there isn't necessarily a reasonable default for ipads + private static var DEFAULT_IPAD_SIMULATOR_NAMES = [ + "ipad", + "ipad-air" + ]; + private static var DEFAULT_IPAD_AIR_SIMULATOR_FALLBACK_REGEX = ~/ipad-air-.+/g; + private static var DEFAULT_IPAD_SIMULATOR_FALLBACK_REGEX = ~/ipad-.+/g; + // this should be a standard iPhone of a particular generation private static var DEFAULT_IPHONE_SIMULATOR_REGEX = ~/iphone-\d+/g; + private static var DEFAULT_IPHONE_SIMULATOR_FALLBACK_REGEX = ~/iphone-.+/g; private static function extractSimulatorFlagName(line:String):String { @@ -90,20 +99,72 @@ class XCodeHelper if (currentDevice == null) { - if (project.targetFlags.exists("ipad")) + if (project.targetFlags.exists("ipad") || project.config.getString("ios.device", "universal") == "ipad") { - currentDevice = devices.get(DEFAULT_IPAD_SIMULATOR); + for (device in DEFAULT_IPAD_SIMULATOR_NAMES) + { + // try to find a relatively standard ipad simulator + currentDevice = devices.get(device); + if (currentDevice != null) + { + break; + } + } + // if we couldn't find one of the default names, let's try to + // find any iPad Air, which should be a reasonable default + if (currentDevice == null) + { + for (device in devices.keys()) + { + if (DEFAULT_IPAD_AIR_SIMULATOR_FALLBACK_REGEX.match(device)) + { + currentDevice = devices.get(device); + break; + } + } + } + // worst case, if we still haven't found a good name, choose the + // first ipad that we find. it could be a mini or pro, which + // might not necessarily be ideal, but it's better than nothing. + if (currentDevice == null) + { + for (device in devices.keys()) + { + if (DEFAULT_IPAD_SIMULATOR_FALLBACK_REGEX.match(device)) + { + currentDevice = devices.get(device); + break; + } + } + } } else { for (device in devices.keys()) { + // try to find a standard iphone, which should have an name + // like iphone-15 or iphone-16 if (DEFAULT_IPHONE_SIMULATOR_REGEX.match(device)) { currentDevice = devices.get(device); break; } } + // of we can't find a standard iphone for some reason, choose + // the first iphone- name that we find. it could be a plus, pro, + // se, or something that might not necessarily be ideal, but + // it's better than nothing at all. + if (currentDevice == null) + { + for (device in devices.keys()) + { + if (DEFAULT_IPHONE_SIMULATOR_FALLBACK_REGEX.match(device)) + { + currentDevice = devices.get(device); + break; + } + } + } } } diff --git a/src/lime/ui/FileDialog.hx b/src/lime/ui/FileDialog.hx index d5bc70d990..014c11b8b5 100644 --- a/src/lime/ui/FileDialog.hx +++ b/src/lime/ui/FileDialog.hx @@ -14,6 +14,7 @@ import hl.Bytes as HLBytes; import hl.NativeArray; #end #if sys +import sys.FileSystem; import sys.io.File; #end #if (js && html5) @@ -98,8 +99,31 @@ class FileDialog { if (type == null) type = FileDialogType.OPEN; + #if sys + if (defaultPath != null && defaultPath.length > 0 + && FileSystem.exists(defaultPath) + && FileSystem.isDirectory(defaultPath)) + { + // if the default path is a directory, and the default path doesn't + // end with a separator, tiny file dialogs may open its parent + // directory instead. + var lastChar = defaultPath.charAt(defaultPath.length - 1); + #if windows + if (lastChar != "/" && lastChar != "\\") + { + defaultPath = defaultPath + "\\"; + } + #else + if (lastChar != "/") + { + defaultPath = defaultPath + "/"; + } + #end + } + #end + #if desktop - var worker = new ThreadPool(#if (windows && hl) SINGLE_THREADED #end); + var worker = new ThreadPool(#if windows SINGLE_THREADED #end); worker.onComplete.add(function(result) { @@ -148,6 +172,7 @@ class FileDialog var path = null; #if (!macro && lime_cffi) + trace(defaultPath); path = CFFI.stringValue(NativeCFFI.lime_file_dialog_open_file(title, filter, defaultPath)); #end @@ -224,7 +249,7 @@ class FileDialog public function open(filter:String = null, defaultPath:String = null, title:String = null):Bool { #if (desktop && sys) - var worker = new ThreadPool(#if (windows && hl) SINGLE_THREADED #end); + var worker = new ThreadPool(#if windows SINGLE_THREADED #end); worker.onComplete.add(function(path:String) { @@ -287,7 +312,7 @@ class FileDialog } #if (desktop && sys) - var worker = new ThreadPool(#if (windows && hl) SINGLE_THREADED #end); + var worker = new ThreadPool(#if windows SINGLE_THREADED #end); worker.onComplete.add(function(path:String) { diff --git a/src/lime/ui/KeyCode.hx b/src/lime/ui/KeyCode.hx index 1843e6d4f5..36bdedf7de 100644 --- a/src/lime/ui/KeyCode.hx +++ b/src/lime/ui/KeyCode.hx @@ -2,6 +2,14 @@ package lime.ui; import lime._internal.backend.native.NativeCFFI; +/** + Used by keyboard event listeners to identify which key was pressed + down or released. + + @see `lime.ui.Window.onKeyDown` + @see `lime.ui.Window.onKeyUp` + @see `lime.ui.ScanCode` +**/ @:access(lime._internal.backend.native.NativeCFFI) #if (haxe_ver >= 4.0) enum #else @:enum #end abstract KeyCode(Int) from Int to Int from UInt to UInt { @@ -246,7 +254,7 @@ import lime._internal.backend.native.NativeCFFI; { #if (lime_cffi && !macro) var code:Int = scanCode; - return Std.int(NativeCFFI.lime_key_code_from_scan_code(code)); + return NativeCFFI.lime_key_code_from_scan_code(code); #else return KeyCode.UNKNOWN; #end @@ -256,7 +264,7 @@ import lime._internal.backend.native.NativeCFFI; { #if (lime_cffi && !macro) var code:Int = keyCode; - return Std.int(NativeCFFI.lime_key_code_to_scan_code(code)); + return NativeCFFI.lime_key_code_to_scan_code(code); #else return ScanCode.UNKNOWN; #end diff --git a/src/lime/ui/ScanCode.hx b/src/lime/ui/ScanCode.hx index 52cca0a5da..1d115499ed 100644 --- a/src/lime/ui/ScanCode.hx +++ b/src/lime/ui/ScanCode.hx @@ -2,6 +2,14 @@ package lime.ui; import lime._internal.backend.native.NativeCFFI; +/** + May be used to identify the scan code associated with the `KeyCode` passed + to keyboard event listeners. + + @see `lime.ui.Window.onKeyDown` + @see `lime.ui.Window.onKeyUp` + @see `lime.ui.KeyCode` +**/ @:access(lime._internal.backend.native.NativeCFFI) @:access(lime.ui.KeyCode) #if (haxe_ver >= 4.0) enum #else @:enum #end abstract ScanCode(Int) from Int to Int from UInt to UInt diff --git a/src/lime/ui/Window.hx b/src/lime/ui/Window.hx index 3d8d9adac1..0e2cf69075 100644 --- a/src/lime/ui/Window.hx +++ b/src/lime/ui/Window.hx @@ -67,27 +67,69 @@ class Window public var onFocusOut(default, null) = new EventVoid>(); public var onFullscreen(default, null) = new EventVoid>(); public var onHide(default, null) = new EventVoid>(); + + /** + Fired when the user presses a key down when this window has focus. + **/ public var onKeyDown(default, null) = new EventKeyModifier->Void>(); + + /** + Fired when the user releases a key that was down. + **/ public var onKeyUp(default, null) = new EventKeyModifier->Void>(); public var onKeyDownPrecise(default, null) = new EventKeyModifier->haxe.Int64->Void>(); public var onKeyUpPrecise(default, null) = new EventKeyModifier->haxe.Int64->Void>(); public var onLeave(default, null) = new EventVoid>(); + + /** + Fired when the window is maximized. + **/ public var onMaximize(default, null) = new EventVoid>(); + + /** + Fired when the window is minimized. + **/ public var onMinimize(default, null) = new EventVoid>(); + + /** + Fired when the user pressed a mouse button down. + **/ public var onMouseDown(default, null) = new EventFloat->MouseButton->Void>(); + + /** + Fired when the mouse is moved over the window. + **/ public var onMouseMove(default, null) = new EventFloat->Void>(); public var onMouseMoveRelative(default, null) = new EventFloat->Void>(); + + /** + Fired when the user releases a mouse button that was pressed down. + **/ public var onMouseUp(default, null) = new EventFloat->Int->Void>(); + + /** + Fired when the user interacts with the mouse wheel. + **/ public var onMouseWheel(default, null) = new EventFloat->MouseWheelMode->Void>(); + + /** + Fired when the window is moved to a new position. + **/ public var onMove(default, null) = new EventFloat->Void>(); public var onRender(default, null) = new EventVoid>(); public var onRenderContextLost(default, null) = new EventVoid>(); public var onRenderContextRestored(default, null) = new EventVoid>(); + + /** + Fired when the window is resized with new dimensions. + **/ public var onResize(default, null) = new EventInt->Void>(); + public var onRestore(default, null) = new EventVoid>(); public var onShow(default, null) = new EventVoid>(); public var onTextEdit(default, null) = new EventInt->Int->Void>(); public var onTextInput(default, null) = new EventVoid>(); + public var opacity(get, set):Float; public var parameters:Dynamic; public var resizable(get, set):Bool; diff --git a/src/lime/utils/Assets.hx b/src/lime/utils/Assets.hx index 30b2825e21..4fe32674b7 100644 --- a/src/lime/utils/Assets.hx +++ b/src/lime/utils/Assets.hx @@ -181,7 +181,23 @@ class Assets } /** - * Gets an instance of an embedded bitmap + * Gets an instance of an embedded bitmap. + * + * _Note:_ This method may behave differently, depending on the target + * platform. On targets that can quickly create a new image synchronously, + * every call to `Assets.getImage()` with the same ID will return a new + * `Image` instance. However, on other targets where creating images + * synchronously is unacceptably slow, or where images may not be created + * synchronously and must be created asynchronously, every call to + * `Assets.getImage()` with the same ID may return a single, shared `Image` + * instance. + * + * With that in mind, modifying or disposing the contents of the `Image` + * returned by `Assets.getImage()` may affect the results of future calls to + * Assets.getImage()` on some targets. To access an `Image` instance that + * may be modified without affecting future calls to `Assets.getImage()`, + * call the `Image` instance's `clone()` method to manually create a copy. + * * @usage var bitmap = new Bitmap(Assets.getBitmapData("image.jpg")); * @param id The ID or asset path for the bitmap * @param useCache (Optional) Whether to use BitmapData from the cache(Default: true) diff --git a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java index 90765a94b1..8492772e67 100644 --- a/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java +++ b/templates/android/template/app/src/main/java/org/haxe/lime/GameActivity.java @@ -21,6 +21,7 @@ import android.view.View; import android.view.WindowManager; import android.webkit.MimeTypeMap; +import android.Manifest; import org.haxe.extension.Extension; import org.libsdl.app.SDLActivity; diff --git a/templates/cpp/static/BuildMain.xml b/templates/cpp/static/BuildMain.xml index 1342c8a9b0..6813ce32dc 100644 --- a/templates/cpp/static/BuildMain.xml +++ b/templates/cpp/static/BuildMain.xml @@ -2,6 +2,10 @@ + + + + @@ -11,6 +15,8 @@ + + ::foreach ndlls:: ::end:: @@ -35,6 +41,7 @@ +
diff --git a/templates/cpp/static/Main.cpp b/templates/cpp/static/Main.cpp index 290d63baaa..3afe99351d 100644 --- a/templates/cpp/static/Main.cpp +++ b/templates/cpp/static/Main.cpp @@ -1,6 +1,6 @@ #include -#if defined(HX_WINDOWS) && !defined(HXCPP_DEBUG) +#if defined(HX_WINDOWS) && !defined(HXCPP_DEBUGGER) #include #endif @@ -14,7 +14,7 @@ ::foreach ndlls::::if (registerStatics):: extern "C" int ::nameSafe::_register_prims ();::end::::end:: -#if defined(HX_WINDOWS) && !defined(HXCPP_DEBUG) +#if defined(HX_WINDOWS) && !defined(HXCPP_DEBUGGER) int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { #else extern "C" int main(int argc, char *argv[]) { diff --git a/templates/ios/template/{{app.file}}.xcodeproj/project.pbxproj b/templates/ios/template/{{app.file}}.xcodeproj/project.pbxproj index ef1168e24d..f58099a789 100644 --- a/templates/ios/template/{{app.file}}.xcodeproj/project.pbxproj +++ b/templates/ios/template/{{app.file}}.xcodeproj/project.pbxproj @@ -418,6 +418,7 @@ "\"$(SRCROOT)/::APP_FILE::/lib/x86_64\"", ); OTHER_LDFLAGS = ( + "-lmbedtls_hxcpp", "$(inherited)", ::foreach ndlls:: "-l::name::", ::end:: @@ -478,6 +479,7 @@ "\"$(SRCROOT)/::APP_FILE::/lib/x86_64\"", ); OTHER_LDFLAGS = ( + "-lmbedtls_hxcpp", "$(inherited)", ::foreach ndlls:: "-l::name::", ::end:: diff --git a/templates/ios/template/{{app.file}}/haxe/BuildHxcppMbedtls.xml b/templates/ios/template/{{app.file}}/haxe/BuildHxcppMbedtls.xml new file mode 100644 index 0000000000..5c2ddf007c --- /dev/null +++ b/templates/ios/template/{{app.file}}/haxe/BuildHxcppMbedtls.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/templates/ios/template/{{app.file}}/haxe/makefile b/templates/ios/template/{{app.file}}/haxe/makefile index 137e47b647..30f0826927 100644 --- a/templates/ios/template/{{app.file}}/haxe/makefile +++ b/templates/ios/template/{{app.file}}/haxe/makefile @@ -5,18 +5,10 @@ endif HAXE_BUILDS := $(ARCHS:%=build-haxe-%) -ifeq ("$(ACTION)","clean") -default: clean -else -default: $(HAXE_BUILDS) -endif - ifeq ("$(CONFIGURATION)","Debug") BUILD_STYLE := Debug endif -default: debug_print - ifeq ("$(BUILD_STYLE)","Debug") DEBUG := -debug CONFIG := Debug @@ -31,17 +23,40 @@ ifeq ("$(HAXE_OS)","iphonesimulator") endif CONFIG := $(CONFIG)-$(HAXE_OS) +LIB_DEST := $(DEBUG)/libApplicationMain.a +LIB_MBEDTLS_DEST := $(DEBUG)/libmbedtls_hxcpp.a + +SIMULATOR_ARCH = i386 x86_64 + +SUFFIX_i386 = +SUFFIX_x86_64 = -64 +SUFFIX_armv6 = +SUFFIX_armv7 = -v7 +SUFFIX_arm64 = -64 + +HXCPP_FLAGS_i386 = -D simulator +HXCPP_FLAGS_x86_64 = -D simulator -D HXCPP_M64 +HXCPP_FLAGS_armv6 = -D HXCPP_ARMV6 +HXCPP_FLAGS_armv7 = -D HXCPP_ARMV7 +HXCPP_FLAGS_arm64 = -D HXCPP_ARM64 + +ifeq ("$(ACTION)","clean") +default: clean +else +default: $(HAXE_BUILDS) +endif + +default: debug_print + debug_print: @echo "Make $(HAXE_BUILDS)" -LIB_BASE := build/$(CONFIG)/::CPP_LIBPREFIX::ApplicationMain$(DEBUG) -LIB_DEST := $(DEBUG)/libApplicationMain.a - -build-haxe-i386: - @echo "Haxe simulator build: $(CONFIG)" - haxe Build.hxml -D simulator -cpp build/$(CONFIG) $(DEBUG) - cd build/$(CONFIG); ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml $(DEBUG) -options Options.txt - cp build/$(CONFIG)/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).iphonesim.a ../lib/i386$(LIB_DEST) +$(HAXE_BUILDS): build-haxe-%: + @echo "Haxe $(if $(filter $*,$(SIMULATOR_ARCH)),simulator,device) build: $(CONFIG)$(SUFFIX_$*)" + haxe Build.hxml $(HXCPP_FLAGS_$*) -cpp build/$(CONFIG)$(SUFFIX_$*) $(DEBUG) + cd build/$(CONFIG)$(SUFFIX_$*); ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; \ + haxelib run ::CPP_BUILD_LIBRARY:: Build.xml haxe -Ddestination=$(CURDIR)/../lib/$*$(LIB_DEST) \ + -options Options.txt $(DEBUG) touch ../Classes/Main.mm build-haxe-x86_64: @@ -74,3 +89,6 @@ build-haxe-arm64: clean: rm -rf build + +.PHONY: default debug_print clean $(HAXE_BUILDS) +.SUFFIXES: diff --git a/templates/tvos/PROJ.xcodeproj/project.pbxproj b/templates/tvos/PROJ.xcodeproj/project.pbxproj index 3775430246..b56e5cf0b7 100644 --- a/templates/tvos/PROJ.xcodeproj/project.pbxproj +++ b/templates/tvos/PROJ.xcodeproj/project.pbxproj @@ -337,6 +337,7 @@ "\"$(SRCROOT)/::APP_FILE::/lib/x86_64\"", ); OTHER_LDFLAGS = ( + "-lmbedtls_hxcpp", ::foreach ndlls:: "-l::name::", ::end:: ::foreach linkedLibraries:: "-l::__current__::", @@ -385,6 +386,7 @@ "\"$(SRCROOT)/::APP_FILE::/lib/x86_64\"", ); OTHER_LDFLAGS = ( + "-lmbedtls_hxcpp", ::foreach ndlls:: "-l::name::", ::end:: ::foreach linkedLibraries:: "-l::__current__::", diff --git a/templates/tvos/PROJ/haxe/BuildHxcppMbedtls.xml b/templates/tvos/PROJ/haxe/BuildHxcppMbedtls.xml new file mode 100644 index 0000000000..5c2ddf007c --- /dev/null +++ b/templates/tvos/PROJ/haxe/BuildHxcppMbedtls.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/templates/tvos/PROJ/haxe/makefile b/templates/tvos/PROJ/haxe/makefile index c1125e6d7e..77286dae24 100644 --- a/templates/tvos/PROJ/haxe/makefile +++ b/templates/tvos/PROJ/haxe/makefile @@ -5,18 +5,10 @@ endif HAXE_BUILDS := $(ARCHS:%=build-haxe-%) -ifeq ("$(ACTION)","clean") -default: clean -else -default: $(HAXE_BUILDS) -endif - ifeq ("$(CONFIGURATION)","Debug") BUILD_STYLE := Debug endif -default: debug_print - ifeq ("$(BUILD_STYLE)","Debug") DEBUG := -debug CONFIG := Debug @@ -31,25 +23,42 @@ ifeq ("$(HAXE_OS)","appletvsimulator") endif CONFIG := $(CONFIG)-$(HAXE_OS) -debug_print: - @echo "Make $(HAXE_BUILDS)" - -LIB_BASE := build/$(CONFIG)/::CPP_LIBPREFIX::ApplicationMain$(DEBUG) LIB_DEST := $(DEBUG)/libApplicationMain.a +LIB_MBEDTLS_DEST := $(DEBUG)/libmbedtls_hxcpp.a -build-haxe-x86_64: - @echo "Haxe simulator build: $(CONFIG)-64" - haxe Build.hxml -D simulator -D HXCPP_M64 -cpp build/$(CONFIG)-64 $(DEBUG) - cd build/$(CONFIG)-64; ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml $(DEBUG) -options Options.txt - cp build/$(CONFIG)-64/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).appletvsim-64.a ../lib/x86_64$(LIB_DEST) - touch ../Classes/Main.mm +SIMULATOR_ARCH = x86_64 + +SUFFIX_arm64 = -64 +SUFFIX_x86_64 = -64 -build-haxe-arm64: - @echo "Haxe device build: $(CONFIG)-64" - haxe Build.hxml -D HXCPP_ARM64 -cpp build/$(CONFIG)-64 $(DEBUG) - cd build/$(CONFIG)-64; ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; haxelib run ::CPP_BUILD_LIBRARY:: Build.xml $(DEBUG) -options Options.txt - cp build/$(CONFIG)-64/::CPP_LIBPREFIX::ApplicationMain$(DEBUG).appletvos-64.a ../lib/arm64$(LIB_DEST) +HXCPP_FLAGS_x86_64 = -D simulator -D HXCPP_M64 +HXCPP_FLAGS_arm64 = -D HXCPP_ARM64 + +ifeq ("$(ACTION)","clean") +default: clean +else +default: $(HAXE_BUILDS) +endif + +default: debug_print + +debug_print: + @echo "Make $(HAXE_BUILDS)" + +$(HAXE_BUILDS): build-haxe-%: + @echo "Haxe $(if $(filter $*,$(SIMULATOR_ARCH)),simulator,device) build: $(CONFIG)$(SUFFIX_$*)" + haxe Build.hxml $(HXCPP_FLAGS_$*) -cpp build/$(CONFIG)$(SUFFIX_$*) $(DEBUG) + cd build/$(CONFIG)$(SUFFIX_$*); ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; \ + haxelib run ::CPP_BUILD_LIBRARY:: Build.xml haxe -Ddestination=$(CURDIR)/../lib/$*$(LIB_DEST) \ + -options Options.txt $(DEBUG) touch ../Classes/Main.mm + cd build/$(CONFIG)$(SUFFIX_$*); ::HAXELIB_PATH:: export HXCPP_NO_COLOR=1; \ + ::CPP_CACHE_WORKAROUND:: haxelib run ::CPP_BUILD_LIBRARY:: $(CURDIR)/BuildHxcppMbedtls.xml \ + -Ddestination=$(CURDIR)/../lib/$*$(LIB_MBEDTLS_DEST) \ + -options $(CURDIR)/build/$(CONFIG)$(SUFFIX_$*)/Options.txt $(DEBUG) clean: rm -rf build + +.PHONY: default debug_print clean $(HAXE_BUILDS) +.SUFFIXES: diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index a5a11fadb9..ea960923cc 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -952,6 +952,12 @@ class CommandLineTools Log.println(" " + Log.accentColor + "Options:" + Log.resetColor); Log.println(""); + if (command == "setup") + { + Log.println(" \x1b[1m-cli\x1b[0;3m/\x1b[0m\x1b[1m-alias\x1b[0m -- Set up " + defaultLibraryName + " alias only, skipping haxelib installs"); + Log.println(" \x1b[1m-noalias\x1b[0m -- Do not set up " + defaultLibraryName + " alias"); + } + if (isBuildCommand) { Log.println(" \x1b[1m-D\x1b[0;3mvalue\x1b[0m -- Specify a define to use when processing other commands"); @@ -1514,6 +1520,11 @@ class CommandLineTools target = System.hostPlatform; targetFlags.set("cpp", ""); + if (target == Platform.MAC) + { + overrides.haxedefs.set("macos", ""); + } + case "neko": target = System.hostPlatform; targetFlags.set("neko", ""); @@ -1814,6 +1825,13 @@ class CommandLineTools args.push("-notoolscheck"); + var projectDirectory = Path.directory(projectFile); + var localRepository = Path.combine(projectDirectory, ".haxelib"); + if (FileSystem.exists(localRepository) && FileSystem.isDirectory(localRepository) && StringTools.startsWith(path, localRepository)) + { + args.push("-nolocalrepocheck"); + } + Sys.setCwd(path); var args = [Path.combine(path, "run.n")].concat(args); args.push(workingDirectory); diff --git a/tools/platforms/IOSPlatform.hx b/tools/platforms/IOSPlatform.hx index 64e763c711..b70788b7ba 100644 --- a/tools/platforms/IOSPlatform.hx +++ b/tools/platforms/IOSPlatform.hx @@ -331,25 +331,10 @@ class IOSPlatform extends PlatformTarget context.IOS_COMPILER = project.config.getString("ios.compiler", "clang"); context.CPP_BUILD_LIBRARY = project.config.getString("cpp.buildLibrary", "hxcpp"); - var json = Json.parse(File.getContent(Haxelib.getPath(new Haxelib("hxcpp"), true) + "/haxelib.json")); - - var version = Std.string(json.version); - var versionSplit = version.split("."); - - while (versionSplit.length > 2) - versionSplit.pop(); - - if (Std.parseFloat(versionSplit.join(".")) > 3.1) - { - context.CPP_LIBPREFIX = "lib"; - } - else - { - context.CPP_LIBPREFIX = ""; - } + context.CPP_CACHE_WORKAROUND = "unset HXCPP_COMPILE_CACHE;"; context.IOS_LINKER_FLAGS = ["-stdlib=libc++"].concat(project.config.getArrayString("ios.linker-flags")); - context.IOS_NON_EXEMPT_ENCRYPTION = project.config.getBool("ios.non-exempt-encryption", true); + context.IOS_NON_EXEMPT_ENCRYPTION = project.config.getBool("ios.non-exempt-encryption", false); switch (project.window.orientation) { diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx index 6c540b4303..771afd738d 100644 --- a/tools/platforms/MacPlatform.hx +++ b/tools/platforms/MacPlatform.hx @@ -706,7 +706,7 @@ class MacPlatform extends PlatformTarget continue; } } - if (Lambda.exists(homebrewDirs, dirPath -> StringTools.startsWith(resolvedLibPath, dirPath))) + if (Lambda.exists(homebrewDirs, function(dirPath:String):Bool { return StringTools.startsWith(resolvedLibPath, dirPath); })) { homebrewDependencyPaths.push(libPath); pathsToSearchForHomebrewDependencies.push(resolvedLibPath); diff --git a/tools/platforms/TVOSPlatform.hx b/tools/platforms/TVOSPlatform.hx index db27a1e109..729c1fdb65 100644 --- a/tools/platforms/TVOSPlatform.hx +++ b/tools/platforms/TVOSPlatform.hx @@ -262,22 +262,7 @@ class TVOSPlatform extends PlatformTarget context.IOS_COMPILER = project.config.getString("tvos.compiler", "clang"); context.CPP_BUILD_LIBRARY = project.config.getString("cpp.buildLibrary", "hxcpp"); - var json = Json.parse(File.getContent(Haxelib.getPath(new Haxelib("hxcpp"), true) + "/haxelib.json")); - - var version = Std.string(json.version); - var versionSplit = version.split("."); - - while (versionSplit.length > 2) - versionSplit.pop(); - - if (Std.parseFloat(versionSplit.join(".")) > 3.1) - { - context.CPP_LIBPREFIX = "lib"; - } - else - { - context.CPP_LIBPREFIX = ""; - } + context.CPP_CACHE_WORKAROUND = "unset HXCPP_COMPILE_CACHE;"; context.IOS_LINKER_FLAGS = ["-stdlib=libc++"].concat(project.config.getArrayString("tvos.linker-flags")); context.IOS_NON_EXEMPT_ENCRYPTION = project.config.getBool("tvos.non-exempt-encryption", true); diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 66628cac3d..a8df2f3764 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -383,7 +383,7 @@ class WindowsPlatform extends PlatformTarget var visualStudioPath = StringTools.trim(vswhereOutput); var vcvarsallPath = visualStudioPath + "\\VC\\Auxiliary\\Build\\vcvarsall.bat"; // this command sets up the environment variables and things that visual studio requires - var vcvarsallCommand = [vcvarsallPath, "x64"].map(arg -> ~/([&|\(\)<>\^ ])/g.replace(arg, "^$1")); + var vcvarsallCommand = [vcvarsallPath, "x64"].map(function(arg:String):String { return ~/([&|\(\)<>\^ ])/g.replace(arg, "^$1"); }); // this command runs the cl.exe c compiler from visual studio var clCommand = ["cl.exe", "/Ox", "/Fe:" + executablePath, "-I", Path.combine(targetDirectory, "obj"), Path.combine(targetDirectory, "obj/ApplicationMain.c")]; for (file in System.readDirectory(applicationDirectory)) @@ -398,7 +398,7 @@ class WindowsPlatform extends PlatformTarget } clCommand.push("/link"); clCommand.push("/subsystem:windows"); - clCommand = clCommand.map(arg -> ~/([&|\(\)<>\^ ])/g.replace(arg, "^$1")); + clCommand = clCommand.map(function(arg:String):String { return ~/([&|\(\)<>\^ ])/g.replace(arg, "^$1"); }); // combine both commands into one command = ["cmd.exe", "/s", "/c", vcvarsallCommand.join(" ") + " && " + clCommand.join(" ")]; } diff --git a/tools/utils/PlatformSetup.hx b/tools/utils/PlatformSetup.hx index 9dee297a59..52d489a9e7 100644 --- a/tools/utils/PlatformSetup.hx +++ b/tools/utils/PlatformSetup.hx @@ -816,11 +816,6 @@ class PlatformSetup setupHaxelib(new Haxelib("lime")); } - if (System.hostPlatform == MAC) - { - ConfigHelper.writeConfigValue("MAC_USE_CURRENT_SDK", "1"); - } - if (targetFlags.exists("noalias")) { return; @@ -880,13 +875,16 @@ class PlatformSetup var installedCommand = false; var answer = YES; - if (targetFlags.exists("y")) - { - Sys.println("Do you want to install the \"lime\" command? [y/n/a] y"); - } - else + if (!(targetFlags.exists("alias") || targetFlags.exists("cli"))) { - answer = CLIHelper.ask("Do you want to install the \"lime\" command?"); + if (targetFlags.exists("y")) + { + Sys.println("Do you want to install the \"lime\" command? [y/n/a] y"); + } + else + { + answer = CLIHelper.ask("Do you want to install the \"lime\" command?"); + } } if (answer == YES || answer == ALWAYS) @@ -1079,11 +1077,6 @@ class PlatformSetup setupHaxelib(new Haxelib("openfl")); } - if (System.hostPlatform == MAC) - { - ConfigHelper.writeConfigValue("MAC_USE_CURRENT_SDK", "1"); - } - if (targetFlags.exists("noalias")) { return; @@ -1133,13 +1126,16 @@ class PlatformSetup var installedCommand = false; var answer = YES; - if (targetFlags.exists("y")) - { - Sys.println("Do you want to install the \"openfl\" command? [y/n/a] y"); - } - else + if (!(targetFlags.exists("alias") || targetFlags.exists("cli"))) { - answer = CLIHelper.ask("Do you want to install the \"openfl\" command?"); + if (targetFlags.exists("y")) + { + Sys.println("Do you want to install the \"openfl\" command? [y/n/a] y"); + } + else + { + answer = CLIHelper.ask("Do you want to install the \"openfl\" command?"); + } } if (answer == YES || answer == ALWAYS) @@ -1242,6 +1238,8 @@ class PlatformSetup var message = "Absolute path to a custom version of HashLink."; if (ConfigHelper.getConfigValue("HL_PATH") == null) { message += " Leave empty to use Lime's default bundled version."; + } else { + message += " Leave empty to keep the currently configured version. To restore Lime's default bundled version, run the command: lime config remove HL_PATH"; } getDefineValue("HL_PATH", message); if (System.hostPlatform == MAC)