remove the restriction that module names need to be unique per Nimble… (#11064)
* remove the restriction that module names need to be unique per Nimble package * make tests green again * use the 'response' linker file also on Unix in order to fix megatest
This commit is contained in:
parent
44ec66bd48
commit
0121dda9ba
9 changed files with 47 additions and 23 deletions
|
|
@ -29,9 +29,6 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
|
|||
for file in walkFiles(d / "*.nimble"):
|
||||
result = file.splitFile.name
|
||||
break packageSearch
|
||||
for file in walkFiles(d / "*.babel"):
|
||||
result = file.splitFile.name
|
||||
break packageSearch
|
||||
# we also store if we didn't find anything:
|
||||
when not defined(nimNoNilSeqs):
|
||||
if result.isNil: result = ""
|
||||
|
|
@ -41,10 +38,19 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
|
|||
dec parents
|
||||
if parents <= 0: break
|
||||
|
||||
proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string =
|
||||
# foo/../bar becomes foo7_7bar
|
||||
result = relativeTo(path, conf.projectPath, '/').string.multiReplace(
|
||||
{"/": "7", "..": "_", "7": "77", "_": "__"})
|
||||
|
||||
proc withPackageName*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile =
|
||||
let x = getPackageName(conf, path.string)
|
||||
if x.len == 0:
|
||||
result = path
|
||||
else:
|
||||
let (p, file, ext) = path.splitFile
|
||||
result = p / RelativeFile((x & '_' & file) & ext)
|
||||
if x == "stdlib":
|
||||
# Hot code reloading now relies on 'stdlib_system' names etc.
|
||||
result = p / RelativeFile((x & '_' & file) & ext)
|
||||
else:
|
||||
result = p / RelativeFile(fakePackageName(conf, path))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue