RejectedSoftware Forums

Sign up

Trying to build two applications from one package

Hello,

I have thre source files in one directory:
gem.d
mc4ka.d
mc4kb.d

and I would like to bulld two executables. Both mc4ka.d and mk4kb.d have main() functions. Is this possible at all?

I realise that I could put these files in diffrent directories and make them all packages, but that seems like a big job for a small demo.

So far I have this, but can't get sub dependancies working. It just gives an error saying it can't build target none.

{
    "name": "mc4ka",
    "targetType" : "executable",
    "sourcePaths" : ["there are none"],
    "sourceFiles" : ["source/gem.d", "source/mc4ka.d"],
    "importPaths" : ["source"],
    "dependencies": {
        "derelict" : "~master",
    }
}

NOTE dub asserts if sourcePaths is empty

Re: Trying to build two applications from one package

On Wed, 16 Oct 2013 20:38:57 GMT, Jason Spashett wrote:

Hello,

I have thre source files in one directory:
gem.d
mc4ka.d
mc4kb.d

and I would like to bulld two executables. Both mc4ka.d and mk4kb.d have main() functions. Is this possible at all?

I realise that I could put these files in diffrent directories and make them all packages, but that seems like a big job for a small demo.

So far I have this, but can't get sub dependancies working. It just gives an error saying it can't build target none.

...

The following should work in theory, but there is currently no way to select a sub package for building. I'll try to get that added later today:

{
	"name": "mc4k",
	"targetType": "none",
	"dependencies": {
		"derelict": "~master"
	},
	"subPackages": [
		{
			"name": "a",
			"targetType": "executable",
			"excludedSourceFiles": ["source/mc4kb.d"]
		},
		{
			"name": "b",
			"targetType": "executable",
			"excludedSourceFiles": ["source/mc4ka.d"]
		}
	]
}

Re: Trying to build two applications from one package

On Thu, 17 Oct 2013 05:40:46 GMT, Sönke Ludwig wrote:

The following should work in theory, but there is currently no way to select a sub package for building. I'll try to get that added later today:

{
	"name": "mc4k",
	"targetType": "none",
	"dependencies": {
		"derelict": "~master"
	},
	"subPackages": [
		{
			"name": "a",
			"targetType": "executable",
			"excludedSourceFiles": ["source/mc4kb.d"]
		},
		{
			"name": "b",
			"targetType": "executable",
			"excludedSourceFiles": ["source/mc4ka.d"]
		}
	]
}

With DUB master you can now do dub build mc4k:a and dub build mc4k:b to build the individual sub packages.

Implemented by https://github.com/rejectedsoftware/dub/commit/e152d71c8133e79af068a5a7281d29bcd5484b1f.

Re: Trying to build two applications from one package

On Thu, 17 Oct 2013 08:08:21 GMT, Sönke Ludwig wrote:

On Thu, 17 Oct 2013 05:40:46 GMT, Sönke Ludwig wrote:

The following should work in theory, but there is currently no way to select a sub package for building. I'll try to get that added later today:

{
	"name": "mc4k",
	"targetType": "none",
	"dependencies": {
		"derelict": "~master"
	},
	"subPackages": [
		{
			"name": "a",
			"targetType": "executable",
			"excludedSourceFiles": ["source/mc4kb.d"]
		},
		{
			"name": "b",
			"targetType": "executable",
			"excludedSourceFiles": ["source/mc4ka.d"]
		}
	]
}

With DUB master you can now do dub build mc4k:a and dub build mc4k:b to build the individual sub packages.

Implemented by https://github.com/rejectedsoftware/dub/commit/e152d71c8133e79af068a5a7281d29bcd5484b1f.

Thanks. That was quick. I will take a look at this now. I am not very familiar with dub yet.

Re: Trying to build two applications from one package

On Thu, 17 Oct 2013 21:22:30 GMT, Jason Spashett wrote:

On Thu, 17 Oct 2013 08:08:21 GMT, Sönke Ludwig wrote:

On Thu, 17 Oct 2013 05:40:46 GMT, Sönke Ludwig wrote:

The following should work in theory, but there is currently no way to select a sub package for building. I'll try to get that added later today:

{
	"name": "mc4k",
	"targetType": "none",
	"dependencies": {
		"derelict": "~master"
	},
	"subPackages": [
		{
			"name": "a",
			"targetType": "executable",
			"excludedSourceFiles": ["source/mc4kb.d"]
		},
		{
			"name": "b",
			"targetType": "executable",
			"excludedSourceFiles": ["source/mc4ka.d"]
		}
	]
}

With DUB master you can now do dub build mc4k:a and dub build mc4k:b to build the individual sub packages.

Implemented by https://github.com/rejectedsoftware/dub/commit/e152d71c8133e79af068a5a7281d29bcd5484b1f.

Thanks. That was quick. I will take a look at this now. I am not very familiar with dub yet.

That works, thanks. typing dub build yeilds;

Error: Main package has target type "none" - stopping build.

is there any syntax to build both at the same time?

Re: Trying to build two applications from one package

Am 17.10.2013 23:45, schrieb Jason Spashett:

That works, thanks. typing dub build yeilds;

Error: Main package has target type "none" - stopping build.

is there any syntax to build both at the same time?

Not currently, but it's planned. See also issue
#97
.

Re: Trying to build two applications from one package

On Fri, 18 Oct 2013 00:25:57 +0200, Sönke Ludwig wrote:

Am 17.10.2013 23:45, schrieb Jason Spashett:

That works, thanks. typing dub build yeilds;

Error: Main package has target type "none" - stopping build.

is there any syntax to build both at the same time?

Not currently, but it's planned. See also issue
#97
.

I see yes. Thanks for your help Sönke.