#2603 Override build.host in pod meta

jhughes Mon 1 May 2017

Is there a way to override the build.host meta in during compile time? I would prefer this to show something other than the computer/user name if possible.

SlimerDude Mon 1 May 2017

Not that I'm aware of - that meta is added deep inside the build process.

Your best bet is to override the compile target in build.fan and alter the .pod after its been built.

override Void compileFan() {
    podFile := outPodDir.plusName(podName + ".pod").toFile
    tmpDir  := ZipUtils.createTempDir
    // extract pod contents
    ZipUtils.unzip(podFile, tmpDir)
    // replace data in meta.props
    metaFile := tmpDir + `meta.props`
    props   := metaFile.readProps
    props["build.host"] = "wotever"  // PUT WHAT YOU WANT HERE
    // re-build the pod file
    ZipUtils.zip(tmpDir, podFile)

The ZipUtls class is available as a snippet on BitBucket. Just copy'n'paste the class directly into your build.fan file (because, unlike Java, .fan files may contain code multiple classes).

Login or Signup to reply.