title: How to make Android Studio/Gradle build from an updated source file?
body: <p>In my previous Windows/Eclipse/ant project development method I had a means of producing a time-limited release apk from the command line. I would like to reproduce this functionality with my new Ubuntu/Android Studio/Gradle setup.</p>
  
  <p>This is how the old system worked:</p>
  
  <p>I had a .bat file which ran a runnable jar which I wrote (and can also create on my new machine). That jar takes two arguments expiry date and where to put the output file. The jar's output is called Timekey.java and it looks like:</p>
  
  <pre><code>package uk.co.myname.timekey;
  public final class  Timekey{
     public static final String EXPIRY_DATE = 
     "the encrypted string";
     public String getExpiryDate() {
        return EXPIRY_DATE;
     }
  }
  //  Plain date : 2020-01-01.00_00_00
  </code></pre>
  
  <p>I have my build.xml checking for the presence of this file</p>
  
  <pre><code>&lt;target name="-check-timekey"&gt;
              &lt;echo&gt;"${timelimit_src}/Timekey.java"&lt;/echo&gt;
              &lt;available file="${timelimit_src}/Timekey.java" property="timekey.present" /&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>and if present it sets the src</p>
  
  <pre><code>&lt;if condition="${timekey.present}"&gt;
                      &lt;src path="${timelimit_src}" /&gt;
  </code></pre>
  
  <p>Thus I can produce an apk which will only run up to the date entered as a parameter to the batch file. The encryption is not military grade but good enough to defeat amateurs and should stop the de-obfuscation fiends.</p>
  
  <p>Any ideas on how to implement this with gradle will be most welcome. I know how to run the jar from a bash script but swapping source directories, just for command line release builds has me stumped</p>