Open andrey-zherikov opened 1 year ago
I'm not seeing anything wrong, both all:a
and all:b
add MY_VERSION
.
There is no situation where the version would not be applied.
Sorry, I didn't pay attention during copy-paste and provided wrong example.
The thing is that I have 3 sub packages: one library and two executables that depend on it; one executable defines version. The problem is that both executables as well as a library get the version defined which is unexpected. I expect version to be defined only for one sub package.
Here is correct example:
mkdir -p {l,a,b}/source
# top level project
cat <<EOF >dub.json
{
"license": "BSL-1.0",
"name": "all",
"targetType":"none",
"dependencies":{
"all:l":"*",
"all:a":"*",
"all:b":"*"
},
"subPackages": [
"l",
"a",
"b"
]
}
EOF
# library
cat <<EOF >l/dub.json
{
"name": "l",
"targetType":"library"
}
EOF
# executable that defines version
cat <<EOF >a/dub.json
{
"name": "a",
"targetType":"executable",
"versions": ["MY_VERSION"],
"dependencies":{
"all:l":"*"
},
}
EOF
# executable without version
cat <<EOF >b/dub.json
{
"name": "b",
"targetType":"executable",
"dependencies":{
"all:l":"*"
},
}
EOF
echo "void foo() {}" >l/source/src.d
echo "void main() {}" | tee {a,b}/source/app.d >/dev/null
dub build -v | grep MY_VERSION
Output:
/usr/bin/dmd -lib -of/home/andrey/.dub/cache/all/~master/+l/build/library-debug-gVn44vagq5bsE1r9pPxkiQ/liball_l.a -debug -g -w -version=MY_VERSION -version=Have_all_l -Il/source/ l/source/src.d -vcolumns
/usr/bin/dmd -c -of/home/andrey/.dub/cache/all/~master/+a/build/-debug-hiJcs1-SeTS8y8-ChV0T0g/all_a.o -debug -g -w -version=MY_VERSION -version=Have_all_a -version=Have_all_l -Ia/source/ -Il/source/ a/source/app.d -vcolumns
/usr/bin/dmd -c -of/home/andrey/.dub/cache/all/~master/+b/build/-debug-sxmJ5-Yy5yjLua-L92xTMA/all_b.o -debug -g -w -version=Have_all_b -version=Have_all_l -version=MY_VERSION -Ib/source/ -Il/source/ b/source/app.d -vcolumns
As you can see -version=MY_VERSION
is defined for all subpackages
System information
Bug Description
When a subPackage declares some
version
and depends on another subPackage, that version is populated to dependent package.How to reproduce?
Output:
Note
-version=MY_VERSION
parameter while compilinga/source/app.d
Expected Behavior
No
-version=MY_VERSION
in compilation of dependency.