Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

successX now correctly shows html output for nim doc, nim jsondoc; fix #13121 #13116

Merged
merged 8 commits into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/docgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,7 @@ proc writeOutput*(d: PDoc, useWarning = false) =
if not writeRope(content, outfile):
rawMessage(d.conf, if useWarning: warnCannotOpenFile else: errCannotOpenFile,
outfile.string)
d.conf.outFile = outfile.extractFilename.RelativeFile

proc writeOutputJson*(d: PDoc, useWarning = false) =
runAllExamples(d)
Expand All @@ -1089,6 +1090,7 @@ proc writeOutputJson*(d: PDoc, useWarning = false) =
if open(f, d.destFile.string, fmWrite):
write(f, $content)
close(f)
d.conf.outFile = d.destFile.extractFilename.RelativeFile
else:
localError(d.conf, newLineInfo(d.conf, AbsoluteFile d.filename, -1, -1),
warnUser, "unable to open file \"" & d.destFile.string &
Expand Down
2 changes: 1 addition & 1 deletion compiler/lineinfos.nim
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const
warnUser: "$1",
hintSuccess: "operation successful: $#",
# keep in sync with `pegSuccess` see testament.nim
hintSuccessX: "$loc LOC; $sec sec; $mem; $build build; $project proj; $output out",
hintSuccessX: "$loc LOC; $sec sec; $mem; $build build; proj: $project; out: $output",
hintCC: "CC: \'$1\'", # unused
hintLineTooLong: "line too long",
hintXDeclaredButNotUsed: "'$1' is declared but not used",
Expand Down
3 changes: 2 additions & 1 deletion compiler/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ proc mainCommand*(graph: ModuleGraph) =
else: "Debug"
let sec = formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3)
let project = if optListFullPaths in conf.globalOptions: $conf.projectFull else: $conf.projectName
let output = if optListFullPaths in conf.globalOptions: $conf.getOutFileFull else: $conf.outFile
var output = $conf.absOutFile
if optListFullPaths notin conf.globalOptions: output = output.AbsoluteFile.extractFilename
rawMessage(conf, hintSuccessX, [
"loc", loc,
"sec", sec,
Expand Down
2 changes: 0 additions & 2 deletions compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ type
severity: Severity) {.closure, gcsafe.}
cppCustomNamespace*: string

proc getOutFileFull*(a: ConfigRef): AbsoluteFile = a.outDir / a.outFile

proc hcrOn*(conf: ConfigRef): bool = return optHotCodeReloading in conf.globalOptions

template depConfigFields*(fn) {.dirty.} =
Expand Down
15 changes: 13 additions & 2 deletions compiler/pathutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,27 @@ when true:

proc `==`*[T: AnyPath](x, y: T): bool = eqImpl(x.string, y.string)

template postProcessBase(base: AbsoluteDir): untyped =
# xxx: as argued here https://github.com/nim-lang/Nim/pull/10018#issuecomment-448192956
# empty paths should not mean `cwd` so the correct behavior would be to throw
# here and make sure `outDir` is always correctly initialized; for now
# we simply preserve pre-existing external semantics and treat it as `cwd`
when false:
doAssert isAbsolute(base.string), base.string
base
else:
if base.isEmpty: getCurrentDir().AbsoluteDir else: base

proc `/`*(base: AbsoluteDir; f: RelativeFile): AbsoluteFile =
timotheecour marked this conversation as resolved.
Show resolved Hide resolved
#assert isAbsolute(base.string)
let base = postProcessBase(base)
assert(not isAbsolute(f.string))
result = AbsoluteFile newStringOfCap(base.string.len + f.string.len)
var state = 0
addNormalizePath(base.string, result.string, state)
addNormalizePath(f.string, result.string, state)

proc `/`*(base: AbsoluteDir; f: RelativeDir): AbsoluteDir =
#assert isAbsolute(base.string)
let base = postProcessBase(base)
assert(not isAbsolute(f.string))
result = AbsoluteDir newStringOfCap(base.string.len + f.string.len)
var state = 0
Expand Down