diff --git a/common/dub.sdl b/common/dub.sdl new file mode 100644 index 0000000..e917760 --- /dev/null +++ b/common/dub.sdl @@ -0,0 +1,7 @@ +name "common" +stringImportPaths "../bin" +preGenerateCommands "rdmd \"$PACKAGE_DIR/dubhash.d\"" +sourcePaths "src" +importPaths "src" + +dependency "msgpack-d" version="~>1.0.0-beta.7" diff --git a/dubhash.d b/common/dubhash.d similarity index 85% rename from dubhash.d rename to common/dubhash.d index 7f11ca5..1c03b07 100644 --- a/dubhash.d +++ b/common/dubhash.d @@ -11,13 +11,13 @@ import std.string; void main() { auto dir = environment.get("DUB_PACKAGE_DIR"); - auto hashFile = dir.buildPath("bin", "dubhash.txt"); + auto hashFile = dir.buildPath("..", "bin", "dubhash.txt"); auto gitVer = executeShell("git -C " ~ dir ~ " describe --tags"); auto ver = (gitVer.status == 0 ? gitVer.output.strip : "v" ~ dir.dirName.baseName.findSplitAfter( environment.get("DUB_ROOT_PACKAGE") ~ "-")[1]).ifThrown("0.0.0") .chain(newline).to!string.strip; - dir.buildPath("bin").mkdirRecurse; + dir.buildPath("..", "bin").mkdirRecurse; if (!hashFile.exists || ver != hashFile.readText.strip) hashFile.write(ver); } diff --git a/src/dcd/common/constants.d b/common/src/dcd/common/constants.d similarity index 100% rename from src/dcd/common/constants.d rename to common/src/dcd/common/constants.d diff --git a/src/dcd/common/constants2.d b/common/src/dcd/common/constants2.d similarity index 100% rename from src/dcd/common/constants2.d rename to common/src/dcd/common/constants2.d diff --git a/src/dcd/common/dcd_version.d b/common/src/dcd/common/dcd_version.d similarity index 100% rename from src/dcd/common/dcd_version.d rename to common/src/dcd/common/dcd_version.d diff --git a/src/dcd/common/messages.d b/common/src/dcd/common/messages.d similarity index 100% rename from src/dcd/common/messages.d rename to common/src/dcd/common/messages.d diff --git a/src/dcd/common/socket.d b/common/src/dcd/common/socket.d similarity index 100% rename from src/dcd/common/socket.d rename to common/src/dcd/common/socket.d diff --git a/constants-gen/generator.d b/constants-gen/generator.d index 20d185d..6675063 100755 --- a/constants-gen/generator.d +++ b/constants-gen/generator.d @@ -206,7 +206,7 @@ immutable ConstantCompletion[] traits = [ string part3 = "];"; - auto file = File("../src/dcd/common/constants2.d", "w"); + auto file = File("../common/src/dcd/common/constants2.d", "w"); file.writeln(part1); foreach (pragma_; pragmas.sorted) file.writeln('\t', pragma_, ","); diff --git a/dub.json b/dub.json index 37827f1..be04c88 100644 --- a/dub.json +++ b/dub.json @@ -9,13 +9,11 @@ "dependencies": { "dsymbol": "~>0.9.0", "libdparse": "~>0.13.0", - "msgpack-d": "~>1.0.0-beta.7", + ":common": "*", "stdx-allocator": "~>2.77.5", "emsi_containers": "~>0.8.0-alpha.15" }, - "stringImportPaths" : [ - "bin" - ], + "subPackages": ["common"], "versions": ["built_with_dub"], "configurations": [ { @@ -29,7 +27,7 @@ { "name": "client", "targetType": "executable", - "targetPath": "bin/", + "targetPath": "bin/", "targetName": "dcd-client", "excludedSourceFiles": [ "src/dcd/server/*" @@ -38,14 +36,11 @@ { "name": "server", "targetType": "executable", - "targetPath": "bin/", + "targetPath": "bin/", "targetName": "dcd-server", "excludedSourceFiles": [ "src/dcd/client/*" ] } - ], - "preGenerateCommands" : [ - "rdmd \"$PACKAGE_DIR/dubhash.d\"" ] } diff --git a/makefile b/makefile index 2bf0be9..f28f86f 100644 --- a/makefile +++ b/makefile @@ -31,7 +31,7 @@ clean: rm -f *.o CLIENT_SRC := \ - $(shell find src/dcd/common -name "*.d")\ + $(shell find common/src/dcd/common -name "*.d")\ $(shell find src/dcd/client -name "*.d")\ $(shell find msgpack-d/src/ -name "*.d") @@ -62,7 +62,7 @@ override LDC_CLIENT_FLAGS += $(DFLAGS) override GDC_CLIENT_FLAGS += $(DFLAGS) SERVER_SRC := \ - $(shell find src/dcd/common -name "*.d")\ + $(shell find common/src/dcd/common -name "*.d")\ $(shell find src/dcd/server -name "*.d")\ $(shell find ${DSYMBOL_DIR}/src -name "*.d")\ $(shell find ${STDXALLOC_DIR}/source -name "*.d")\