Not quite sure if that is what you need but anyways. Sbt task are written in scala code, so we can just find that file and then read the content:
import java.io.File
import java.io.FileNotFoundException
def recursiveListFiles(f: File): Array[File] = {
val these = f.listFiles
if(these != null)
these ++ these.filter(_.isDirectory).flatMap(recursiveListFiles)
else Array[File]()
}
val projectFiles = recursiveListFiles(new File("."))
val manifestFile = projectFiles
.filter(f => f.getCanonicalPath.endsWith("AndroidManifest.xml"))
.toList.headOption
.getOrElse(
throw new FileNotFoundException("Your project doesn't contain manifest")
)
val manifestXML = scala.xml.XML.loadFile(manifestFile)
val pkg = manifestXML.attribute("package").getOrElse("")