#1983 F4 and PathEnv

SlimerDude Wed 1 Aug 2012

Hi,

Is it possible to use F4 with the PathEnv so that the built pods are put in a different place to the compiler?

Jens Wed 1 Aug 2012

I've wanted to do the same thing when fiddling around with the Fantom compiler. I use the embedded installation as the rel installation, and want the output pod in a separate dev installation.

SlimerDude Thu 2 Aug 2012

F4 -> Help -> About -> Installation Details -> Configuration shows

FAN_ENV=[java]org.fantom.internal.sys::EquinoxEnv

so using util::PathEnv directly looks out of the question.

ivan Thu 2 Aug 2012

The F4 itself runs on EquinoxEnv, but we have full control where to put compiled pods and it is possible to override environment variables of processes launched from F4.

I think we will solve this issue out of the box in F4 1.0.2 (should be released after two weeks), but the manual workaround is already available with current version of F4:

  1. Add outPodDir := `../../mydev/lib/fan/` to build.fan
  2. Go to Run -> Run Configurations, find your launch configuration under Fantom Script and add FAN_ENV and FAN_ENV_PATH variables under Environment tab

SlimerDude Sat 4 Aug 2012

Yeahokay... I guess that kinda works, except for transitive dependencies aren't picked up from the work lib dir (and it's a bit messy having to specify config for each project and launcher!)

Ooo! Oh! Ooo! A new shiny F4! The cat's out of the bag now, how exciting! What updates / features can we look forward too?

SlimerDude Tue 21 May 2013

Thought I'd try this again...

By hook or by crook, has anyone managed to make F4 import pods from any location other than the interpreter install?

F4 1.0.2 builds pods into the project's bin folder, which is nice. Run launchers can specify a FAN_ENV, which is fine. Referenced projects that are open are automatically added to your build path, which is great!

But the one thing I can't seem to do is make F4 reference a pod from outside the interpreter / fantom install dir. For instance, when you close a referenced project, or try to reference a pod from your FAN_ENV work dir.

I've tried making a fake interpreter library from my work dir and adding that to the project, but eclipse will only allow 1 interpreter library. :(

I've tried symlinking / junctioning an inner dir from the fantom install lib/fan dir, but nested dirs aren't scanned for pods.

Other than keeping ALL my projects open in F4 ALL the time (I'd rather not!), I'm not sure how else to accomplish this.

ivan Wed 22 May 2013

At first let me please illustrate a problem as I understand it.

Suppose there are two projects in workspace: lib and app. Both of them put their code into lib/bin/fan/bin/fan and everything works fine. But if we close lib project, then app project stops compiling and launching.

My usual workflow is to have projects I need to modify are open in workspace and the rest of projects just deployed to Fantom installation library (usually logical projects consist of more than one project in terms of IDE, so I typically have something like buildAll.fan to build all projects for production use).

Another simple manual solution might be to symlink compiled pods directly into Fantom lib folder, like this:

$ ln -s myworkspace/myproject/bin/fan/lib/fan/myproject.pod $FAN_HOME/lib/fan

Regarding changes in F4, right now I don't have idea what is the best approach for this could be. Ability to add additional Fantom installations either on project or global level seems to be obvious idea, but still it might be required to configure at which installation I wish my pod to be put when I change a project.

Another idea might be to switch to repositories, so that F4 always uses a hidden internal installation and all pods must be either come from workspace projects, or downloaded from Fantom repositories.

Thoughts?

SlimerDude Wed 22 May 2013

Ah, I've not tried symlinking the actual .pod file yet!

All the directory issues above stem from using PathEnv (see docLang::Env#PathEnv) whereby specifying extra directories (via the FAN_ENV_PATH environment variable) mean fantom will use those extra dirs when looking up pods and files.

My last post was because currently, F4 only looks in the interpreter installation folder for .pod files, and I would like it to also scan optional extra folders - such as the PathEnv dirs.

My ideas (in increasing order of correctness) are:

  • Have the Interpreter libraries also scan any FAN_ENV_PATH dirs.
  • Have an extra Path text box in the Edit Interpreter Dialog.
  • Create a new, different type of library that scans a given dir for pods.

I don't think using fanr repositories are the way forward, as fantom itself doesn't use them for compilation. To avoid confusion, everything F4 does should mimic what the standard fantom build does.

I don't mind where F4 currently builds the pod in bin/fan/lib, for I can do a cmd line build when I want it built into a different dir. (Though specifying an output folder, similar to Java builds, would probably be best all round solution.)

@Ivan: Just in case you think I'm not appreciative, thanks for doing a blinding job on F4! It's only because I use it on a daily basis that I want to tweak it!

ivan Wed 22 May 2013

Thank you for a positive feedback :) I wish I have more time to work on F4, there's a lot of things I'd like to improve.

By the way, F4 already uses output folder from Java project settings (but it appends its path with fan/lib/fan), therefore outDir from build.fan can be set to whatever suits the best for command line builds.

What I also think might work is to create a new project type like Fantom library – basically just a project with folders lib/fan for pods and etc for configs. So it would be possible to just drop binary pods into a library and configure projects to put pods inside it. And even if project is closed, last compiled version still will be available in library project.

SlimerDude Wed 22 May 2013

Nice idea Ivan, but either the other .pods aren't being picked up, or they're not exported.

Login or Signup to reply.