#2816 How to find Build class by Type

Jay Herron Wed 18 Nov 2020

Hi,

I've noticed that I cannot access the Build class of pods via:

Type.find("<podName>::Build")

I assume that getting this class type is possible, since it's done by the compiler. Is there another way to get it?

Thanks!

SlimerDude Thu 19 Nov 2020

Hi Jay,

If you're talking about the build.fan file, it's because that file is NOT part of the pod. It is just a script used to build the pod.

I don't know what you're doing, but it sounds highly unusual (and possibly wrong!) but your options are:

  1. If it's code you need, then move it into the pod. (Obviously!)
  2. If it's data you need, then move it to the meta and / or index maps and use Pod.meta() and Env.index() to retrieve. (This is what pod meta was designed for.)
  3. If you really need the Build class compiled into the pod, then (I'm pretty sure) you could update the srcDirs to include it.
srcDirs = [`fan/`, `build.fan`]

But then your pod would have a dependency on the build pod, which is kinda odd.

I talk about the differences between scripts and pods in Hello Fantom! Hello World! and How To Build And Run a Fantom App - but maybe I should rewrite them to make the distinction clearer.

Steve.

Login or Signup to reply.