dlang / dub

Package and build management system for D
MIT License
672 stars 230 forks source link

Support of dmd compiler switch -mv #1728

Open andre2007 opened 5 years ago

andre2007 commented 5 years ago

From DMD compiler info site

-mv=package.module= Use path/filename as the source file for package.module. This is used when the source file path and names are not the same as the package and module hierarchy. The rightmost components of the path/filename and package.module can be omitted if they are the same.

Example: A folder contains app.d and a sub folder source with file terminal.d. File terminal.d is defined with module arsd.terminal. You can compile this scenario using command dmd -Isource -mv='arsd.terminal=terminal.d' app.d

It should be possible to define these mappings in dub.json / dub.sdl. Use case is e.g. the dub package arsd-official which causes several issues due to its layout. Being able to defines theses mappings could solve the issues.

Suggestions:

{
    "moduleMappings": ["arsd.terminal=terminal.d"]
}
rikkimax commented 2 years ago

For GDC it is -fmodule-file

It should be a map not an array too.

WebFreak001 commented 2 years ago

map syntax:

{
    "moduleMappings": {
        "arsd.terminal": "terminal.d"
    }
}