Pods
Overview
Pods are the top of Fantom's namespace as well as the unit of deployment. A pod's name is globally unique and is used to organize the top level of Fantom's namespace. In this respect pods serve the purpose of both a Java package and a JAR file (or .NET namespace and DLL).
Declaration
Pods themselves are always declared in source file called "pod.fan":
using someOtherPod ** ** Fandoc for the pod ** @podDepends = [Depend("sys 1.0"), Depend("someOtherPod 1.0")] @podSrcDirs = [`fan/`, `test/`] pod myPod { // symbols if any }
This syntax is consistent with type definitions except we use the context sensitive keyword pod
instead of class
. The pod facets are used to declare the pod's build time and runtime meta-data.
Pod Facets
All pods require @podSrcDirs
facet and any pod which contains code requires the @podDepends
facets. A summary of commonly uses facets:
podDepend
: list ofDepends
which specifiy the pod's dependencies. Dependencies are used at build time for static type checking, and runtime to ensure things are deployed correctly.podSrcDirs
: list of file Uris relative to "pod.fan" which contain Fantom source code for the pod.podResDirs
: list of file Uris relative to "pod.fan" which contain source files to bundle with the pod.podJavaDirs
: list of file Uris relative to "pod.fan" which contain Java source files for native code.podDotnetDirs
: list of file Uris relative to "pod.fan" which contain C# source files for native code.podJsDirs
: list of file Uris relative to "pod.fan" which contain JavaScript source files for native code.podIndexFacets
: facets to index for type database.js
: indicates the pod contains types annotated with the@js
facet which should be compiled to JavaScript during a full build.nodoc
: indicates the pod shouldn't included in auto-generated documenation.
These facets are generated by the compiler to indicate where, when, and by whom a pod was build:
podBuildTime
: time build was buildpodBuildHost
: name of machine used to build podpodBuildUser
: name of user used to build pod