Dub.loadSingleFilePackage

Loads a single file package.

Single-file packages are D files that contain a package recipe comment at their top. A recipe comment must be a nested /+ ... +/ style comment, containing the virtual recipe file name and a colon, followed by the recipe contents (what would normally be in dub.sdl/dub.json).

  1. void loadSingleFilePackage(NativePath path)
  2. void loadSingleFilePackage(string path)
    class Dub
    void
    loadSingleFilePackage
    (
    string path
    )

Examples

/+ dub.sdl:
   name "test"
   dependency "vibe-d" version="~>0.7.29"
+/
import vibe.http.server;

void main()
{
	auto settings = new HTTPServerSettings;
	settings.port = 8080;
	listenHTTP(settings, &hello);
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
	res.writeBody("Hello, World!");
}

The script above can be invoked with "dub --single test.d".

Meta