Erlang and Toolchains - erlang

Has anyone worked out an ultra efficient workflow and toolset for Erlang? Debugging, prototyping, browsing, version control, etc.
I'm extremely impressed with Smalltalk's integrated image system, but was wondering if something could be even approaching it with Erlang.

Erlang has a very robust development chain, especially if you are an EMACS maven. There is an Erlang specific build system, there is robust support for packaging your application and its dependencies for deployment and don't forget OTP.
As for tools, there is Dialyzer, real time tracing on running systems, hot code loading ( you can enable and disable or add logging to a running system without restarting it, for example ), remote code execution, there is so much to learn it is dizzying when you start out.

Editor: you can use whatever you want. I used emacs for my first year of erlang, but I'm currently using gedit.
Version Control: I like git. It seems that most of the erlang community agrees (most projects are hosted on github).
Workflow: I'd recommend getting familiar with rebar.
Here is an example of a rebar-flavored Makefile:
REBAR := ./rebar
.PHONY: all deps doc test clean release
all: deps
$(REBAR) compile
deps:
$(REBAR) get-deps
doc:
$(REBAR) doc skip_deps=true
test:
$(REBAR) eunit skip_deps=true
clean:
$(REBAR) clean
release: all test
dialyzer --src src/*.erl deps/*/src/*.erl
Here are some basic pointers:
Put your unit tests in the same modules as the code they are testing. See the rebar wiki for details.
Add {cover_enabled, true} to your rebar.config file. Every time you run make test you get a coverage report in HTML!
Add your project's dependencies to your rebar.config and you can fetch and build them when you run make deps.
Make sure to comment your code with edoc. If you do, rebar can build all of your docs when your run make doc.

I wonder about the difference between Sinan/Faxien and Rebar, too. From my notes, I remember that Sinan/Faxien was more about creating a project template, and dependency management, while Rebar was more useful for creating a module template... My notes are here, are several years old, and are aimed at bootstrapping erlang newbies (like me).
-Todd

Related

Does Bazel actually require Python?

The Bazel install instructions say that Python is required. However, I used the Linux installer without Python and it seems to work.
Does Bazel actually require Python for non-Python builds, such as C++ and Go?
I believe it doesn't, and your success to build without Python proves that.

Bazel list of tools in-scope for targets running shell commands

Is there a list of tools that are assumed to be always in the PATH when a Bazel target runs a shell command?
This is relevant for creating isolated build environments. AFAIU (see https://github.com/NixOS/nixpkgs/pull/50765#issuecomment-440009735) by default Bazel picks up tools from /bin and /usr/bin when in strict mode.
But what can ultimately be assumed about the minimal content of those? For example, I saw awk to be used liberally. But then git as well, which sounds border-line.
I imagine the exact set might correspond to whatever Google-internal Bazel expects to find in Google's build images bin directories. At least for BUILD rules open-sourced by Google.
Is there such a definitive list? Thank you.
As far as I can tell, your assessment of the tool usage is correct, and unfortunately I'm not aware of such a list.
There should be one, and Bazel should treat the shell as a toolchain. Alas nobody is working on that at the moment. See https://github.com/bazelbuild/bazel/issues/5265.

Setting up your module with Travis CI

Anyone got a boilerplate the world can use for Travis CI build testing for modules?
I havn't used Travis CI before but I got it hooked up however all my builds are failing, and the logs just say phpunit exited with code 1. I assume I'm definitely missing something and I have a feeling I need to download all silverstripe composer dependecies but have no idea where to start
I'm wanting it to run tests against (mymodule)/tests folder and hoping it's possible
The section on "Connecting to CI" isn't very helpful!
To set up with travis you'll need to use the travis-support module.
It's quite straightforward to do with a boilerplate .travis.yml which you can see on pretty much any SilverStripe module that's using travis. Here's a pretty standard one.
That file will test against PHP 5.3-5.6 as well as against SilverStripe versions 3.1.x-dev (latest 3.1 development version) all the way to 3.x-dev (3.5 development version).
You'll also need to customise the final line to run the correct test suite.

How do I install Rascal

Can someone tell me how to install Rascal?
The install instruction say - Eclipse Indigo for RCP/RAP - got it.
Then Install New Software and put in the repository address:
http://update.rascal-mpl.org/stable/
- done that
Check "Contact all update sites during install to find required software" - ok
Hit Next, and it complains can't find Jetty, so set up its repo, can't find some Http lib, and on it goes.
What I have done, after I temporarily gave up on Eclipse, is to compile using the Maven build.
This makes me think, is a dependency missing from the Developer Dependencies list? That being the 'rascal-master' project, which contains not much more than the top-level pom.xml file?
I downloaded that too, and tried to build. It did not work because Tycho could not resolve dependencies correctly, it ended up looking for pdb.values:0.0.0 instead of the correct version, I don't know how it managed to zero out the version.
I notice that there is a Jenkins build server, which presumably runs off the Maven poms? It might be an idea to update the Developer Dependencies page with an accurate list of what needs checked out to build from scratch with Maven. It should be as easy as check out some projects, then type 'mvn install' and it all works nicely. Perhaps that is already the case on the build server, but I can't get into the configurations to see how that works.
In the end I removed Tycho from the build, and found enough dependencies in the Maven central repo by hand to get it building, and just put in statements for each of them.
It really is a sad state of affairs the way that Eclipse disrespects the Maven repository, by creating their own and using their own format and tool; Tycho will not download stuff from Eclipse and put it in your local repository, from where you could use it in a more sane way.
The installation instructions seems to be outdated. I can confirm that Rascal will not install with Eclipse Indigo due to dependency errors. It works fine with Eclipse Juno for RCP/RAP.
Ouch, that's a painfull experience, it should not have been this hard, I will look into this.
As workaround: see Rascal Developer dependencies , if you install these dependencies by hand, it should work.
If you continue experiencing installation problems, leave a Github issue, since that is more suited for back and forward conversations.
To use Maven, you also need to insert the following into the pom.xml of rascal-master (replacing the old modules section if there is one):
<modules>
<module>../pdb</module>
<module>../pdb.ui</module>
<module>../pdb.values</module>
<module>../imp.runtime</module>
<module>../imp.pom</module>
<module>../ambidexter</module>
<module>../rascal</module>
<module>../rascal-eclipse</module>
<module>../rascal-shell</module>
<module>../rascal-feature</module>
<module>../rascal-update-site</module>
</modules>
Then run "mvn clean install" or "mvn clean install -DskipTests=true" from inside rascal-master.

How can I load a Rebar plugin for 'pre-compile' from a dependency?

I have a number of applications that need a header file to be generated before compilation. This seemed to be a perfect candidate for a Rebar plugin, so I created a plugin with a pre_compile function, put it in a Git repository, and listed it as a dependency in rebar.config in the other applications.
However, the plugin must be compiled before it can be loaded, so when I run rebar compile -v I find that rebar complains about not finding the plugin, then compiles the dependency, and then fails to compile my application because the header file has not been generated.
Is there a way to accomplish what I'm trying to achieve with a Rebar plugin, or do I need to find another way to do it?
The plugin_dir option is your friend:
{plugin_dir, "deps/my_plugin/src"}.
That makes Rebar try to compile the plugin from that source directory if it can't find it in the code path already.

Resources