<table><tr><td style="">mwolff requested changes to this revision.<br />mwolff added inline comments.<br />This revision now requires changes to proceed.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D5447">View Revision</a></tr></table><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D5447#inline-115408">View Inline</a><span style="color: #4b4d51; font-weight: bold;">iruntime.h:85</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">virtual</span> <span class="n">QString</span> <span style="color: #004012">findExecutable</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span><span style="color: #aa2211">&</span> <span class="n">executableName</span><span class="p">,</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">const</span> <span class="n">QStringList</span><span style="color: #aa2211">&</span> <span class="n">paths</span> <span style="color: #aa2211">=</span> <span class="n">QStringList</span><span class="p">())</span> <span style="color: #aa4000">const</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">you can remove the <tt style="background: #ebebeb; font-size: 13px;">paths</tt> arg - it's currently never used as far as I can see. we can add it if need be in the future</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D5447#inline-113574">View Inline</a><span style="color: #4b4d51; font-weight: bold;">arrowd</span> wrote in <span style="color: #4b4d51; font-weight: bold;">androidruntime.cpp:98</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">getenv</tt> there is <tt style="background: #ebebeb; font-size: 13px;">IRuntime::getenv()</tt>. If I understand it right, it returns paths inside the RT, just what we need.</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">yes, a path in the runtime is by definition not a <tt style="background: #ebebeb; font-size: 13px;">pathInHost</tt>. So <tt style="background: #ebebeb; font-size: 13px;">getenv("PATH")</tt> will give use e.g. <tt style="background: #ebebeb; font-size: 13px;">/usr/bin</tt> but then we need to map that into, say, <tt style="background: #ebebeb; font-size: 13px;">/opt/android/something/usr/bin</tt>, no?</p>
<p style="padding: 0; margin: 8px;">also, I just notice: please use <tt style="background: #ebebeb; font-size: 13px;">QByteArrayLiteral</tt> around <tt style="background: #ebebeb; font-size: 13px;">"PATH"</tt></p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D5447#inline-113575">View Inline</a><span style="color: #4b4d51; font-weight: bold;">arrowd</span> wrote in <span style="color: #4b4d51; font-weight: bold;">compilerfactories.cpp:51</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">Hmm. But the second arg of <tt style="background: #ebebeb; font-size: 13px;">createCompiler</tt> is called <tt style="background: #ebebeb; font-size: 13px;">path</tt>, and whole this patch is about passing a full path there.</p>
<p style="padding: 0; margin: 8px;">Probably, in presence of such thing as runtimes, we need to revise Compiler's API and do something about <tt style="background: #ebebeb; font-size: 13px;">path()</tt> method?</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">afaik it's called path since it can be a user-provided absolute path. But the builtin compiler defaults all want to do dynamic lookups. so no, I think it's fine to keep the API but again - don't hardcode an absolute path in the host here - it should be a name that's checked in either the runtime or the host</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D5447#inline-113566">View Inline</a><span style="color: #4b4d51; font-weight: bold;">mwolff</span> wrote in <span style="color: #4b4d51; font-weight: bold;">compilerprovider.cpp:264</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">remove the <tt style="background: #ebebeb; font-size: 13px;">QFileInfo</tt> and <tt style="background: #ebebeb; font-size: 13px;">.fileName()</tt> here, just use the path like previously. note how the path could be an absolute path not inside the PATH, your patch would break this</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">see this comment again</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D5447#inline-115407">View Inline</a><span style="color: #4b4d51; font-weight: bold;">dockerruntime.cpp:253</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="n">QString</span> <span class="n">DockerRuntime</span><span style="color: #aa2211">::</span><span class="n">findExecutable</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span><span style="color: #aa2211">&</span> <span class="n">executableName</span><span class="p">,</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">const</span> <span class="n">QStringList</span><span style="color: #aa2211">&</span> <span class="n">paths</span><span class="p">)</span> <span style="color: #aa4000">const</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">QStringList</span> <span class="n">rtPaths</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">open brace on its own line</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D5447#inline-113576">View Inline</a><span style="color: #4b4d51; font-weight: bold;">arrowd</span> wrote in <span style="color: #4b4d51; font-weight: bold;">dockerruntime.cpp:256</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p style="padding: 0; margin: 8px;">also, the code is identical, so share it trough some "runtime helper header"</p></blockquote>
<p style="padding: 0; margin: 8px;">Where to put it?</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">hmm good question. but see my comment above - since paths is never filled, we can simplify this code a lot and then the code duplication is potentially not that bad anymore.</p>
<p style="padding: 0; margin: 8px;">but I would be OK with a trivial <tt style="background: #ebebeb; font-size: 13px;">runtimehelpers.h</tt> with an inline implementation of this function for now. bonus points if you make this a proper static lib</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D5447#inline-115410">View Inline</a><span style="color: #4b4d51; font-weight: bold;">dockerruntime.cpp:258</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">auto</span> <span class="n">envPaths</span> <span style="color: #aa2211">=</span> <span class="n">getenv</span><span class="p">(</span><span style="color: #766510">"PATH"</span><span class="p">).</span><span class="n">split</span><span class="p">(</span><span style="color: #766510">':'</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">std</span><span style="color: #aa2211">::</span><span class="n">transform</span><span class="p">(</span><span class="n">envPaths</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">envPaths</span><span class="p">.</span><span class="n">end</span><span class="p">(),</span> <span class="n">rtPaths</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="p">[](</span><span class="n">QByteArray</span> <span class="n">p</span><span class="p">)</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">all duplicated code paths that use transform will crash: you have to resize rtPaths to the correct size, or use a back_inserter</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D5447">https://phabricator.kde.org/D5447</a></div></div><br /><div><strong>To: </strong>arrowd, mwolff, arichardson<br /><strong>Cc: </strong>skalinichev, apol, kdevelop-devel<br /></div>