dlang / dub

Package and build management system for D
MIT License
677 stars 227 forks source link

Setting mainSourceFile should not require sourceFiles #258

Closed ghost closed 10 years ago

ghost commented 10 years ago

Typically dub will complain when I don't specify mainSourceFile, but when I have example code where the only sources I need is one single file then using mainSourceFile alone is not enough, e.g.:

        {
            "name": "ProcessAPI",
            "platforms": ["windows"],
            "targetName": "ProcessAPI",
            "targetType": "executable",
            "targetPath" : "bin",
            "mainSourceFile": "examples/ProcessAPI.d",
            "importPaths": [
                "src"
            ],
        },

This will create a linker error, even though mainSourceFile is the only file I need. As a workaround I have to duplicate the work and write sourceFiles:

        {
            "name": "ProcessAPI",
            "platforms": ["windows"],
            "targetName": "ProcessAPI",
            "targetType": "executable",
            "targetPath" : "bin",
            "mainSourceFile": "examples/ProcessAPI.d",
            "sourceFiles": [
                "examples/ProcessAPI.d",
            ],
            "importPaths": [
                "src"
            ],
        },

I'd rather avoid having to copy-paste a lot.

ghost commented 10 years ago

Btw, are comment lines supported in a package file? Thought # might work, but no dice. The package format page doesn't seem to mention comments.

MrSmith33 commented 10 years ago

JSON doesn't support comments.

etcimon commented 10 years ago

In another ticket it was talked about how comments could fit in and Sönke suggested SDL which does seem like a more proper fit for dub project files because it also has more features (tags, namespaces, attributes, comments, with values: dates, times, strings, numbers, floats, arrays...).

https://github.com/Abscissa/SDLang-D

it looks like xml & json merged together: <tag ns:attribute="value" ns2:attribute2="2014/04/15"><othertag person="name" /></tag>

would be:

tag ns:attribute="value" \ -- notice the line break
ns2:attribute2=2014/04/15 {
    othertag person="name" # some comment
     // othertag person="name2" => 2 entries make an array?
    /* notag because:commented="out" */
}

which D can use as a tree and loop through / select based on attributes and namespaces, and I like this option, it wouldn't be breaking to add it aside