Call nix-build when files in a directory change? - compilation

Stack has
stack build --file-watch
which automatically recompiles a Haskell project whenever files change. Does nix have something analogous with nix-build, or is there a well-known tool which can help achieve these?

Nix does not provide this functionality by itself. Lorri comes close, but its focus is on providing an instant "nix-shell" via direnv. It is not currently suitable for building and testing your project like stack build --file-watch does. If you're interested, you could create an issue to discuss such a feature with the authors.

Related

Compiling and debugging erlang code- for custom ejabberd modules?

This is a very specific and niche question- but something that'll probably help people working on existing codebases.
Current Scenario
We are running ejabberd 18.01 on prod- and we can't really change this right away. Our current setup for running custom modules is this- either modify existing modules from the source code, or make our own custom modules that are compiled using the erlang compiler that's bundled in with the installer from here. We use erlide as our IDE in Eclipse.
We compile the custom files in in erlide, into a separate directory from where our ejabberd .beam files are; and then transfer the files manually from there to the ebin folder in ejabberd. This is done so that we have VCS for our modified module files.
We aren't using rebar3, and I have zero clue as to how to implement in a heavily modified existing codebase without breaking something. Our only legitimate way of debugging is to put loggers at every step of the process, compile, transfer files, and restart the server- which drastically increases dev time.
It is a genuine nightmare to work with, and resources on ejabberd as well as erlang is scarce- we mostly have the docs to go by, and barely any SO questions relevant.
Any suggestions, resources that can help me setup something to help especially for debugging, would be highly appreciated. Maybe something in vscode would be great. Transferring files I've still managed with inotify, but debugging makes me want to tear my hair out. Please help. Thank you.
P.S.- This is all on Ubuntu 20.04, if relevant. Erlang/OTP version - 20.02, erts- 9.2. Please ask for any further clarifications if required.

what are the current build tools available today which are language agnostic?

Our current system is in .Net world and we are in the process of moving to FeF world (Angular) and we might keep the back end either in .net or change it to some flavor of JVM. We do not know about the server side yet but for sure, we will keep it as .Net for some time till we sort out the technology issues.
One thing I want to do during this time to do is build a CI system with language agnostic build tools. We use NAnt/MSBuild today. I would like to know as of now what are all active build tools out there, which can work with any language? I did find the following, but not sure how many are all active today. I am not trying to find which is best or not, all I want to know is the tool set and I will evaluate them based on our project requirements. I want to make sure I did not miss some build tool because I do not know the Java world.
Current list
Make
Rake
Gradle
BuildR
I did find this question but it is 5 years old.
Thanks
Interestingly if you look at the visual studio files in a text editor you will see that they are indeed build scripts. They are actually msbuild.

How can I set User Defined Build Settings for XCode in premake?

I need premake to set the EXCLUDED_SOURCE_FILE_NAMES and INCLUDED_SOURCE_FILE_NAMES variables for my XCode project. Anybody knows how to do this?
There isn't a way to do that directly, but if you provide more details on what you are trying to achieve there might be a workaround. You are already aware of the excludes() API?
In response to additional information in comment: Ah, a unity build then. That isn't directly supported yet, no, though it is coming up quick on the roadmap now. The way most people handle it currently is as a separate project. Not as convenient or elegant, but does allow Debug, Release etc. configurations of the unity build, which can useful too.

What is the cleanest way to set the environmental variable DYLD_FRAMEWORK_PATH for a release build?

I have custom frameworks in my app bundle for WebKit, WebCore, and JavaScriptCore. I would like all other frameworks that depend on the system versions of WebKit, WebCore, or JavaScriptCore to use my custom versions also. For instance my custom version of Webkit loads private system frameworks that in turn depend on the system version of WebKit. This means both my WebKit and the system WebKit get loaded, and usually a crash happens shortly after.
The way I understand this should be done, is to set the DYLD_FRAMEWORK_PATH environmental variable before your app bundle begins execution (Search order for loading frameworks can be found here: http://code.google.com/p/macdependency/wiki/SearchPaths). You can set environmental variables in code with setenv, but it won't take effect for the currently running process. I would have to re-launch the process again for it to take effect. I would like to avoid this too.
So my question is what is the best way to set the DYLD_FRAMEWORK_PATH before the execution of the my app bundle? This has to work in a release app bundle too. Is there a way to run a script whenever someone clicks on my app bundle before the executable starts running. Or is there any other suggestions out there?
Thanks in advance.
Jeff Wolski has the right idea by referring directly to Apple's documentation on the subject. This thread also provides excellent advice on how to get that going in Xcode, including corner cases associated with alternative methods of specification (for example, by using ~/.bash_profile directly for your user).
My reason for chiming in is you also asked for a script that might be able to assist you (and a bounty provider appears to have the same issue). It turns out Webkit references such a script in its documentation, which you might want to pick apart from the applicable Webkit source code. This should give you additional guidance on how, at least according to the developers, you should do this properly.
Best of luck with your project(s).
I would recommend environment.plist or the LSEnvironment key in the info.plist. Check out the link below.
https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html
WebKit currently has a script to do this for you, called run-webkit-app. See http://trac.webkit.org/browser/trunk/Tools/Scripts/run-webkit-app
Newer versions of ld understand the -dyld_env flag, which inserts a LC_DYLD_ENVIRONMENT load command into the binary (and as such applies essentially as early as possible in app execution). Perhaps adding -Wl,-dyld_env,DYLD_FRAMEWORK_PATH=/folder/encosing/WebKit/and/related/frameworks to your compiler flags might do what you want?

GUI based debugger for Ruby?

Is there any GUI based debugger for Ruby? Just a debugger. I do not want a full IDE like NetBeans because they tend to get your project dirty with extra files.
thanks!
Check out Mr. Guid, which uses GTK+ and is cross-platform.
In netbeans you can tell it to put the netbeans project files in a separate directory or you can easily ignore the nbproject directory with your project's vcs. Netbeans has by far the best integrated debugging I have seen and there are many other great reasons to give it a try. Don't worry about netbeans using a project folder. I highly doubt you'll be able to find a better free GUI debugger.
If the code completion stuff gets in your way with netbeans it is easy to turn off and only request code completion when you want it (ctrl+space). That was my biggest gripe with netbeans.
I haven't used it in about a year, but I liked Arachno Ruby

Resources