<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    It does look cleaner, and I guess every little bit helps. If you
    want to file a cleanup enhancement, we can take a look, but it won't
    be a very high priority.<br>
    <br>
    -- Kevin<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 1/20/2023 6:51 AM, Scott Palmer
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAL3e5iGTV56yssHbEq4xToVLYjqnhAjV7FzE_ao2AxFEHZrivA@mail.gmail.com">
      
      <div dir="ltr">Are small simplifying changes to the gradle scripts
        welcome?
        <div><br>
        </div>
        <div>E.g. instead of:</div>
        <div>
          <div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre"><div><span style="color:rgb(86,156,214)">def</span> <span style="color:rgb(156,220,254)">inStream</span> = <span style="color:rgb(197,134,192)">new</span> <span style="color:rgb(78,201,176)">java.io.BufferedReader</span>(<span style="color:rgb(197,134,192)">new</span> <span style="color:rgb(78,201,176)">java.io.InputStreamReader</span>(<span style="color:rgb(197,134,192)">new</span> <span style="color:rgb(78,201,176)">java.lang.ProcessBuilder</span>(<span style="color:rgb(156,220,254)">JAVA</span>, <span style="color:rgb(206,145,120)">"-fullversion"</span>).<span style="color:rgb(220,220,170)">start</span>().<span style="color:rgb(220,220,170)">getErrorStream</span>()));</div><div><span style="color:rgb(197,134,192)">try</span> {</div><div>    <span style="color:rgb(78,201,176)">String</span> <span style="color:rgb(156,220,254)">v</span> = <span style="color:rgb(156,220,254)">inStream</span>.<span style="color:rgb(220,220,170)">readLine</span>().<span style="color:rgb(220,220,170)">trim</span>();</div><div>    <span style="color:rgb(197,134,192)">if</span> (<span style="color:rgb(156,220,254)">v</span> != <span style="color:rgb(86,156,214)">null</span>) {</div><div>        <span style="color:rgb(78,201,176)">int</span> <span style="color:rgb(156,220,254)">ib</span> = <span style="color:rgb(156,220,254)">v</span>.<span style="color:rgb(220,220,170)">indexOf</span>(<span style="color:rgb(206,145,120)">"full version </span><span style="color:rgb(215,186,125)">\"</span><span style="color:rgb(206,145,120)">"</span>);</div><div>        <span style="color:rgb(197,134,192)">if</span> (<span style="color:rgb(156,220,254)">ib</span> != <span style="color:rgb(181,206,168)">-1</span>) {</div><div>            <span style="color:rgb(78,201,176)">String</span> <span style="color:rgb(156,220,254)">str</span> = <span style="color:rgb(156,220,254)">v</span>.<span style="color:rgb(220,220,170)">substring</span>(<span style="color:rgb(156,220,254)">ib</span>);</div><div>            <span style="color:rgb(78,201,176)">String</span> <span style="color:rgb(156,220,254)">ver</span> = <span style="color:rgb(156,220,254)">str</span>.<span style="color:rgb(220,220,170)">substring</span>(<span style="color:rgb(156,220,254)">str</span>.<span style="color:rgb(220,220,170)">indexOf</span>(<span style="color:rgb(206,145,120)">"</span><span style="color:rgb(215,186,125)">\"</span><span style="color:rgb(206,145,120)">"</span>) + <span style="color:rgb(181,206,168)">1</span>, <span style="color:rgb(156,220,254)">str</span>.<span style="color:rgb(220,220,170)">size</span>() - <span style="color:rgb(181,206,168)">1</span>);</div>
<div>            <span style="color:rgb(220,220,170)">defineProperty</span>(<span style="color:rgb(206,145,120)">"jdkRuntimeVersion"</span>, <span style="color:rgb(156,220,254)">ver</span>)</div><div>            <span style="color:rgb(86,156,214)">def</span> <span style="color:rgb(156,220,254)">jdkVersionInfo</span> = <span style="color:rgb(220,220,170)">parseJavaVersion</span>(<span style="color:rgb(156,220,254)">ver</span>)</div><div>            <span style="color:rgb(220,220,170)">defineProperty</span>(<span style="color:rgb(206,145,120)">"jdkVersion"</span>, <span style="color:rgb(156,220,254)">jdkVersionInfo</span>[<span style="color:rgb(181,206,168)">0</span>])</div><div>            <span style="color:rgb(220,220,170)">defineProperty</span>(<span style="color:rgb(206,145,120)">"jdkBuildNumber"</span>, <span style="color:rgb(156,220,254)">jdkVersionInfo</span>[<span style="color:rgb(181,206,168)">1</span>])</div>
<div>            <span style="color:rgb(106,153,85)">// Define global properties based on the version of Java</span></div><div>            <span style="color:rgb(106,153,85)">// For example, we could define a "jdk18OrLater" property as</span></div><div>            <span style="color:rgb(106,153,85)">// follows that could then be used to implement conditional build</span></div><div>            <span style="color:rgb(106,153,85)">// logic based on whether we were running on JDK 18 or later,</span></div><div>            <span style="color:rgb(106,153,85)">// should the need arise.</span></div><div><span style="color:rgb(106,153,85)">//            def status = compareJdkVersion(jdkVersion, "18")</span></div><div><span style="color:rgb(106,153,85)">//            ext.jdk18OrLater = (status >= 0)</span></div><div>        }</div><div>    }</div><div>} <span style="color:rgb(197,134,192)">finally</span> {</div><div>    <span style="color:rgb(156,220,254)">inStream</span>.<span style="color:rgb(220,220,170)">close</span>();</div><div>}</div></div>
          <br class="gmail-Apple-interchange-newline">
        </div>
        <div>this:<br>
        </div>
        <div>
          <div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre"><div style="line-height:18px"><div><span style="color:rgb(86,156,214)">def</span> <span style="color:rgb(156,220,254)">verMatch</span> = [<span style="color:rgb(156,220,254)">JAVA</span>, <span style="color:rgb(206,145,120)">"-fullversion"</span>].<span style="color:rgb(220,220,170)">execute</span>().<span style="color:rgb(156,220,254)">err</span>.<span style="color:rgb(156,220,254)">text</span> =~ <span style="color:rgb(209,105,105)">/full version "([^"]+)/</span></div><div><span style="color:rgb(197,134,192)">if</span> (<span style="color:rgb(156,220,254)">verMatch</span>.<span style="color:rgb(220,220,170)">find</span>()) {</div><div>    <span style="color:rgb(78,201,176)">String</span> <span style="color:rgb(156,220,254)">ver</span> = <span style="color:rgb(156,220,254)">verMatch</span>.<span style="color:rgb(220,220,170)">group</span>(<span style="color:rgb(181,206,168)">1</span>);</div><div>    <span style="color:rgb(220,220,170)">defineProperty</span>(<span style="color:rgb(206,145,120)">"jdkRuntimeVersion"</span>, <span style="color:rgb(156,220,254)">ver</span>)</div><div>    <span style="color:rgb(86,156,214)">def</span> <span style="color:rgb(156,220,254)">jdkVersionInfo</span> = <span style="color:rgb(220,220,170)">parseJavaVersion</span>(<span style="color:rgb(156,220,254)">ver</span>)</div><div>    <span style="color:rgb(220,220,170)">defineProperty</span>(<span style="color:rgb(206,145,120)">"jdkVersion"</span>, <span style="color:rgb(156,220,254)">jdkVersionInfo</span>[<span style="color:rgb(181,206,168)">0</span>])</div><div>    <span style="color:rgb(220,220,170)">defineProperty</span>(<span style="color:rgb(206,145,120)">"jdkBuildNumber"</span>, <span style="color:rgb(156,220,254)">jdkVersionInfo</span>[<span style="color:rgb(181,206,168)">1</span>])</div>
<div>    <span style="color:rgb(106,153,85)">// Define global properties based on the version of Java</span></div><div>    <span style="color:rgb(106,153,85)">// For example, we could define a "jdk18OrLater" property as</span></div><div>    <span style="color:rgb(106,153,85)">// follows that could then be used to implement conditional build</span></div><div>    <span style="color:rgb(106,153,85)">// logic based on whether we were running on JDK 18 or later,</span></div><div>    <span style="color:rgb(106,153,85)">// should the need arise.</span></div><div><span style="color:rgb(106,153,85)">//            def status = compareJdkVersion(jdkVersion, "18")</span></div><div><span style="color:rgb(106,153,85)">//            ext.jdk18OrLater = (status >= 0)</span></div><div>}</div></div></div>
        </div>
        <div><br>
        </div>
        <div>or instead of:</div>
        <div>
          <div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre"><div><span style="color:rgb(156,220,254)">ext</span>.<span style="color:rgb(156,220,254)">HAS_JAVAFX_MODULES</span> = <span style="color:rgb(86,156,214)">false</span>;</div><div><span style="color:rgb(86,156,214)">def</span> <span style="color:rgb(156,220,254)">inStream2</span> = <span style="color:rgb(197,134,192)">new</span> <span style="color:rgb(78,201,176)">java.io.BufferedReader</span>(<span style="color:rgb(197,134,192)">new</span> <span style="color:rgb(78,201,176)">java.io.InputStreamReader</span>(<span style="color:rgb(197,134,192)">new</span> <span style="color:rgb(78,201,176)">java.lang.ProcessBuilder</span>(<span style="color:rgb(156,220,254)">JAVA</span>, <span style="color:rgb(206,145,120)">"--list-modules"</span>).<span style="color:rgb(220,220,170)">start</span>().<span style="color:rgb(220,220,170)">getInputStream</span>()));</div><div><span style="color:rgb(197,134,192)">try</span> {</div><div>    <span style="color:rgb(78,201,176)">String</span> <span style="color:rgb(156,220,254)">v</span>;</div><div>    <span style="color:rgb(197,134,192)">while</span> ((<span style="color:rgb(156,220,254)">v</span> = <span style="color:rgb(156,220,254)">inStream2</span>.<span style="color:rgb(220,220,170)">readLine</span>()) != <span style="color:rgb(86,156,214)">null</span>) {</div><div>        <span style="color:rgb(156,220,254)">v</span> = <span style="color:rgb(156,220,254)">v</span>.<span style="color:rgb(220,220,170)">trim</span>();</div><div>        <span style="color:rgb(197,134,192)">if</span> (<span style="color:rgb(156,220,254)">v</span>.<span style="color:rgb(220,220,170)">startsWith</span>(<span style="color:rgb(206,145,120)">"javafx.base"</span>)) <span style="color:rgb(156,220,254)">ext</span>.<span style="color:rgb(156,220,254)">HAS_JAVAFX_MODULES</span> = <span style="color:rgb(86,156,214)">true</span>;</div><div>    }</div><div>} <span style="color:rgb(197,134,192)">finally</span> {</div><div>    <span style="color:rgb(156,220,254)">inStream2</span>.<span style="color:rgb(220,220,170)">close</span>();</div><div>}</div></div>
        </div>
        <div><br>
        </div>
        <div>this:</div>
        <div>
          <div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre"><div><span style="color:rgb(156,220,254)">ext</span>.<span style="color:rgb(156,220,254)">HAS_JAVAFX_MODULES</span> = [<span style="color:rgb(156,220,254)">JAVA</span>, <span style="color:rgb(206,145,120)">'--list-modules'</span>].<span style="color:rgb(220,220,170)">execute</span>().<span style="color:rgb(156,220,254)">text</span>.<span style="color:rgb(220,220,170)">contains</span>(<span style="color:rgb(206,145,120)">'javafx.base'</span>)</div></div>
          <br class="gmail-Apple-interchange-newline">
        </div>
        <div>... much simpler and seems to work just as well.</div>
        <div><br>
        </div>
        <div>They don't do much more than improve readability and reduce
          the line count though, so I'm not sure if anyone cares.</div>
        <div><br>
        </div>
        <div>Scott</div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>