Ok,
So I was able to understand that I'm not supposed to be able to read the file in skylark (I think it's to facilitate determinism on the one hand and fast analysis on the other hand).
I think but really really not sure that I need to get this file added to the runfiles but I'm not sure how...
What I currently do is:
1. create a file which contains the content I'm interested in (ctx.new_file and ctx.action). This isn't declared in the outputs since it's a temp file for the file AFAIC.
2. create a test launcher, an executable file which starts jvm (using ctx.file_action)
3. use a common method to the scala rules which builds an executable.
The problem I face is that the file created at #1 is missing. I first thought it was because it's on the classpath generated in #2 so I added it there but I can't find it anywhere on the filesystem so I think that I might have an additional two problems:
1. The file isn't created
2. The file isn't exposed to the test (runfiles?)
The problem can be #1, #2 or both.
This is the code: