Haxe: openfl test works but not lime build - intellij-idea

I'm in the process of moving all my projects to individual modules in IntelliJ rather than having one module in the entire git repo, and my IntelliJ builds stopped working. I notice it uses lime builds even though my module is set to openfl (and always has as far as I know)
openfl test flash -debug
this works
lime build GassyRickAstley.xml flash -debug -verbose
this does not. Full gist of both -v
Lime Command-Line Tools (2.9.1)
Initializing project...
Using project file: GassyRickAstley.xml
Warning: Could not read HXCPP config: /Users/booboo/.hxcpp_config.xml
Using target platform: FLASH
Running command: UPDATE
- Embedding asset: removed for brevity
- Copying template file: removed for brevity
Running command: BUILD
- Running command: haxe -main ApplicationMain -cp /usr/local/lib/haxe/lib/flixel/git -D flixel=4.3.0 -cp /usr/local/lib/haxe/lib/openfl/3,6,1 -D openfl=3.6.1 -cp /usr/local/lib/haxe/lib/lime/2,9,1 -D lime=2.9.1 -cp /usr/local/lib/haxe/lib/actuate/1,8,7 -D actuate=1.8.7 -cp /usr/local/lib/haxe/lib/ash/1,5,4/src -D ash=1.5.4 -cp source -cp lib -cp /usr/local/lib/haxe/lib/openfl/3,6,1/extern -cp ../Krakel/source -cp ../../lib/HxAssert/src -D native-trace -D HXCPP_QUIET -D openfl-next -D tools=2.9.1 -D flash-use-stage -D no-compilation -D openfl-flash -D verbose=1 -D web --macro flixel.system.macros.FlxDefines.run() -swf-lib export/flash/obj/assets.swf -swf-version 11.8 -swf export/flash/bin/GassyRickAstley.swf -cp export/flash/haxe -debug
georges-mbp:Gassy Rick Astley booboo$
It doesn't seem like anything went wrong, but I'm pretty shit with analyzing terminal output.
For now I can just build manually, but not having breakpoints is gonna get pretty lame, pretty fast. Any help is appreciated.
Bonus question. When I run/test the project in open fl and close the game's window the active terminal process never ends. I have to close the terminal, reopen and cd my directory again. is there a way around this?

It looks like it may have worked. openfl test flash is similar to running openfl build flash && openfl run flash, which in turn should behave practically the same as lime build flash && lime run flash.
I think your lime build flash command is working properly, but is exiting because the application has finished building. If you use lime test flash instead, it might build-and-run for you, as the other command does?

Related

How to compile and run kotlin using notepad++ and NPPExec

1.Can i do it
2.Can any body tellme a ready "script(NPPExec script)" to compile and run it.
3.So far i tried following these c and cpp styled script as fallows below
npp save
kotlinc "$(FULL_CURRENT_PATH)" -include-runtime -d "$(CURRENT_DIRECTORY)\$(NAME_PART).jar"
npp_run java -jar $(CURRENT_DIRECTORY)\$(NAME_PART).jar
and
npp save
kotlinc "$(FULL_CURRENT_PATH)" -include-runtime -d "$(CURRENT_DIRECTORY)\$(NAME_PART).jar"
java -jar $(CURRENT_DIRECTORY)\$(NAME_PART).jar"""
Didn't succeed though.

CMake incremental compilation through toolchain upgrade

I am trying to find a way to enable incremental compilation with CMake through a toolchain upgrade. Here is the problematic scenario :
Branch main uses g++-9 (using CMAKE_CXX_COMPILER=g++-9)
A new branch uses g++-10 (using CMAKE_CXX_COMPILER=g++-10)
Commits are happening on both branches
Incremental builds on one branch work fine
Switching to the other branch and explicitly invoking CMake fails
My question is the following : I'm looking for the proper way to make the invocation of CMake succeed and rebuild all the project from scratch when a toolchain change happens.
Here is a script that will make it quick and easy to reproduce the problem. This script requires Docker. It will create folders Sources and Build at the location where it is executed to avoid littering your filesystem. It then creates Dockerfiles to build docker containers with both g++ and cmake. It then creates a dummy Hello World C++ CMake project. Finally, it creates a folder for build artifacts and then executes the build with g++-9 and then g++-10. The second build fails because CMake generates an error.
#!/bin/bash
set -e
mkdir -p Sources
mkdir -p Build
# Creates a script that will be executed inside the docker container to perform builds
cat << EOF > Sources/Compile.sh
cd /Build \
&& cmake /Sources \
&& make \
&& ./IncrementalBuild
EOF
# Creates a Dockerfile that will be used to have both gcc-9 and cmake
cat << EOF > Sources/Dockerfile-gcc9
FROM gcc:9
RUN apt-get update && apt-get install -y cmake
RUN ln -s /usr/local/bin/g++ /usr/local/bin/g++-9
ADD Compile.sh /Compile.sh
RUN chmod +x /Compile.sh
ENTRYPOINT /Compile.sh
EOF
# Creates a Dockerfile that will be used to have both gcc-10 and cmake
cat << EOF > Sources/Dockerfile-gcc10
FROM gcc:10
RUN apt-get update && apt-get install -y cmake
RUN ln -s /usr/local/bin/g++ /usr/local/bin/g++-10
ADD Compile.sh /Compile.sh
RUN chmod +x /Compile.sh
ENTRYPOINT /Compile.sh
EOF
# Creates a dummy C++ program that will be compiled
cat << EOF > Sources/main.cpp
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
EOF
# Creates CMakeLists.txt that will be used to compile the dummy C++ program
cat << EOF > Sources/CMakeLists.txt
cmake_minimum_required(VERSION 3.9)
project(IncrementalBuild CXX)
add_executable(IncrementalBuild main.cpp)
set_target_properties(IncrementalBuild PROPERTIES CXX_STANDARD 17)
EOF
# Build the docker images with both Dockerfiles created earlier
docker build -t cmake-gcc:9 -f Sources/Dockerfile-gcc9 Sources
docker build -t cmake-gcc:10 -f Sources/Dockerfile-gcc10 Sources
# Run a build with g++-9
echo ""
echo "### Compiling with g++-9 and then running the result..."
docker run --rm --user $(id -u):$(id -g) -v $(pwd)/Sources:/Sources -v $(pwd)/Build:/Build -e CXX=g++-9 cmake-gcc:9
echo ""
# Run a build with g++-10
echo "### Compiling with g++-10 and then running the result..."
docker run --rm --user $(id -u):$(id -g) -v $(pwd)/Sources:/Sources -v $(pwd)/Build:/Build -e CXX=g++-10 cmake-gcc:10
echo ""
# Print success if we reach this point
echo "SUCCESS!"
I'm looking for the proper way to make the invocation of CMake succeed and rebuild all the project from scratch when a toolchain change happens.
The proper way is to use a fresh binary directory. Either remove the binary directory when changing and let it recreate or just use a separate different directory for each toolchain.
Use Build/gcc10 binary directory for gcc10 build and Build/gcc9 for gcc9 builds.
No need to cd Build and mkdir with nowadays cmake - use cmake -S. -BBuild. Also do not use make - prefer cmake --build Build to let you switch generator later.
"If you change the toolchain, you should start with a fresh build. There are too many things that assume the toolchain doesn’t change and while you may be able to find workarounds which appear to work, I recommend you always use a fresh build tree for a different toolchain. This same logic also applies if you update the existing toolchain in-place (e.g. you update to a newer version of GCC on Linux, a newer version of Xcode on macOS, etc.). CMake queries compiler capabilities and caches the results. If you change the toolchain in a way that CMake can’t catch, then you end up with stale cached capabilities being used for the new/updated toolchain. Please don’t do that." - Craig Scott
So essentially I don't think it's possible. You just need to blow away your build. The best thing you can do is alert users if CMake isn't doing it for you.
Perhaps reply on this also:
https://discourse.cmake.org/t/how-to-change-toolchain-without-breaking-developer-workflows/1166
Or start another discourse.

Android Gradle save log output to file

Using Android and Gradle how can I save the console messages of gradlew tasks to a file? For example when running 'gradlew connectedCheck -i' how do I save the run times and any failures to a file?
In bash/command line run:
./gradlew connectedCheck -i 2>&1 | tee file.txt
In Powershell on Windows where tee is typically not available, you can do the same thing with the normal redirection operator (looks similar to BASH, but does indeed work):
./gradlew connectedCheck -i 2>&1 > file.txt
As far as I know this should work all the way back to Powershell 2.0, only because we still use it at work on some of our older servers. I can't find docs for anything older than v3.0, for which the documentation is here:
about_Redirection | Microsoft Docs

Nacl And Pnacl from terminal on chrome device

I've built hello world program by nacl and pnacl tools from NACL_SDK.
And now I want to test it.
I've mad a html page and js script which are working with my nexe and pexe and in browser everything is working fine.
But how can I launch my programs from console?
And how can I write stdout to file?
To run a nexe-program my-app.nexe from console and redirect output to file output.log use the following command:
$NACL_SDK/tools/sel_ldr.py my-app.nexe > output.log
sel_ldr.py is just a helper script. If you pass a --verbose option to it, you'll see a real command used to run your program. It's something like this:
$NACL_SDK/tools/nacl_helper_bootstrap_x86_64 $NACL_SDK/tools/sel_ldr_x86_64 \
--r_debug=0xXXXXXXXXXXXXXXXX --reserved_at_zero=0xXXXXXXXXXXXXXXXX -a \
-B $NACL_SDK/tools/irt_core_x86_64.nexe my-app.nexe

OCUnit Application Test with Simulator in terminal

Is it possible to start an application test that runs in the simulator with a terminal command(s)?
Thanks
Yes, I got it to work. My solution is somehow rough and might not be suitable in every case.
Disclaimer: This solution requires to edit system files. It works for
me, but may mess up XCode's unit testing stack, especially if you
do not understand what you are doing.
In /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests
replace
if [ "${TEST_HOST}" != "" ]; then
Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)."
else
with
if [ "${TEST_HOST}" != "" ]; then
mkdir -p "${BUILT_PRODUCTS_DIR}/Documents"
mkdir -p "${BUILT_PRODUCTS_DIR}/Library/Caches"
mkdir -p "${BUILT_PRODUCTS_DIR}/Library/Preferences"
mkdir -p "${BUILT_PRODUCTS_DIR}/tmp"
export CFFIXED_USER_HOME="${BUILT_PRODUCTS_DIR}/"
RunTestsForApplication "${TEST_HOST}" "${TEST_BUNDLE_PATH}"
else
You may move the fixed user home to a different location, but I think you would need to move the .app and .octest bundles along.
Add -RegisterForSystemEvents to the OTHER_TEST_FLAGS build setting of your test bundle.
Make sure your test bundle contains a run script build phase with the contents
# Run the unit tests in this test bundle.
"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
Create a new scheme for your tests.
You should be able to run the tests from the command line using the standard xcodebuild:
xcodebuild -workspace $(WORKSPACE_NAME).xcworkspace -scheme $(TEST_SCHEME) -configuration debug -sdk iphonesimulator
The simulator must not be running, at the time you what to run the tests.
I hope this information is complete, if something doesn't work as expected please ask.
You can ensure that the Simulator isn't running with this:
osascript -e 'tell app "iPhone Simulator" to quit'
You can determine if the Simulator is active with this:
sh -c 'ps -xaco command | grep "iPhone Simulator"'
Worked perfectly, thanks!
Automated testing is back in action on our Jenkins CI-server!
Just had to fix my TEST_HOST=${BUNDLE_LOADER}. Do this if you get errors about "no such file" when running the tests.
It seems that with Xcode 4.5GM, running application tests in the simulator is now supported.