#2844 About srcDirs of build.fan

CretinHo Wed 16 Jun

The build.fan generated by F4 has srcDirs like this:

srcDirs = [`fan/`]

Assuming I have the source file all in the current directory, the same as where build.fan located. How could I correctly set srcDirs?

If I set srcDirs like this:

srcDirs = [,]

It will complain it can't find the sources!

SlimerDude Wed 16 Jun

To compile source files in the current directory, try passing in the URI of the current directory to srcFiles:

srcDirs = [`./`]

CretinHo Thu 17 Jun

SlimerDude: srcDirs = [`./`] is right. But F4 generated build.fan doesn't work.

compile [test]

Compile [test]
  FindSourceFiles [2 files]

/home/test/Downloads/test/buildx.fan(1,1): Using 'build' which is not a declared dependency for 'test' BUILD FAILED [9ms]!

I have to add "build 1.0" to depends like this:

depends = [

"sys 1.0",
"build 1.0"

Then it worked. But I don't know why it always put the pod in $FAN_HOME/lib/fan

SlimerDude Thu 17 Jun

In a normal development workflow, pods are usually run, or tested immediately after being built. Hence the default is to install them to the local Fantom environment.

To have pods built to a different directory, change the outPodDir.

outPodDir = `/path/to/somewhere/`

Or use `./` for the current dir.

See BuildPod.outPodDir for details.

andy Thu 17 Jun

Look at the init tool for stubbing out a new pod source tree:


This creates a fan.props file which tells the compiler this is a PathEnv and to put output pods into your local <proj>/lib/fan folder.

CretinHo Thu 17 Jun

SlimerDude: Does F4 make use of the new init tool? I think not, because it was developed before this tool was created. Do you think refactor F4 to force it to make use of this new init tool is a good idea? I think this will ensure consistent between Fantom projects since there is only one tool to create the source tree.

BTW, in RingoJS we already have ringo-admin for a while.

CretinHo Thu 17 Jun

andy: I have posted many threads on this forums. Please let me know what is your thoughts about them (in their respective threads). Thanks.

Login or Signup to reply.