Closed joffrey-bion closed 1 year ago
I tried to adapt Karakum for Windows. I checked it on kotlin-wrappers, so it seems it works now. Could you also check if it works for you?
Hi. Thanks again for making this change!
So I checked again with 1.0.0-alpha.20
, and with the same input config:
{
"input": "<nodeModules>/@blueprintjs/icons/lib/esm/index.d.ts",
"output": "src/jsMain/generated",
"libraryName": "blueprintjs-icons"
}
I get the following generated config:
{
"input" : "C:/Projects/kotlin-blueprintjs/build/js/node_modules/@blueprintjs/icons/lib/esm/index.d.ts",
"output" : "C:\\Projects\\kotlin-blueprintjs\\kotlin-blueprintjs-icons\\src\\jsMain\\generated",
"libraryName" : "blueprintjs-icons",
"cwd" : "C:\\Projects\\kotlin-blueprintjs\\build\\js\\packages\\kotlin-blueprintjs-kotlin-blueprintjs-icons"
}
Which is a bit weird. Shouldn't we generate a proper Windows path for the input
field in the config?
I'm assuming Karakum itself should deal with the Windows paths in the config on its own. If I were not using the Gradle plugin, I would probably want to either use Windows paths everywhere in the config, or linux paths everywhere in the config (likely the latter).
In any case, this seems to work (in the sense that the path is correctly read by Karakum from the Gradle-generated config, so it seems good enough for now. Thanks! (feel free to close this issue, and if further problems appear due to these paths, we can always reopen)
Shouldn't we generate a proper Windows path for the input field in the config?
It is fully proper glob pattern, it works for Windows too, globs are not paths, in globs \
symbol means escaping, so using \
as path separator in globs is bad idea. So, rule is simple: if it is path, Gradle plugin will generate OS specific string for you (because it is simple and it works), if it is glob pattern, it will use posix separator.
If you write config by hand, just use posix separator, it works on Windows, because I normalize all paths and convert them to posix style on configuration phase.
So, rule is simple: if it is path, Gradle plugin will generate OS specific string for you (because it is simple and it works), if it is glob pattern, it will use posix separator.
Ah ok, got it. It's clear now, thanks!
By the way, it might be worth documenting the different properties of the config and what they mean, including that input
is not a path but a glob pattern
Yea, its definitely true, I need more documentation, I am going to document next thing in near feature: Gradle plugin, Karakum plugins (and other extensions) and configuration of course.
Since Karakum's config is likely to be checked in version control, it would be best if it supported Linux-style relative paths even on Windows.
At the moment, the Gradle plugin seems to concatenate Windows absolute paths with the Linux relative path from the config (e.g. when substituting
<nodeModules>
). This happens for everything except theoutput
property, which is correctly converted.Example input config
<project>/karakum.config.json
:Output config in
<project>/build/karakum/karakum.config.json
:When this happens, the input file is actually not found and nothing is generated. This happens silently by the way, no error in the build log, and the build doesn't fail: