CINXE.COM

cleanBuild.sh - platform/frameworks/support - Git at Google

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>cleanBuild.sh - platform/frameworks/support - Git at Google</title><link rel="stylesheet" type="text/css" href="/+static/base.css"><link rel="stylesheet" type="text/css" href="/+static/prettify/prettify.css"><!-- default customHeadTagPart --></head><body class="Site"><header class="Site-header"><div class="Header"><a class="Header-image" href="/"><img src="//www.gstatic.com/images/branding/lockups/2x/lockup_git_color_108x24dp.png" width="108" height="24" alt="Google Git"></a><div class="Header-menu"> <a class="Header-menuItem" href="https://accounts.google.com/AccountChooser?faa=1&amp;service=gerritcodereview&amp;continue=https://android.googlesource.com/login/platform/frameworks/support/%2B/fa760ddce6f309471c5687bcd68cdf75be23e0f0/cleanBuild.sh">Sign in</a> </div></div></header><div class="Site-content"><div class="Container "><div class="Breadcrumbs"><a class="Breadcrumbs-crumb" href="/?format=HTML">android</a> / <a class="Breadcrumbs-crumb" href="/platform/">platform</a> / <a class="Breadcrumbs-crumb" href="/platform/frameworks/">frameworks</a> / <a class="Breadcrumbs-crumb" href="/platform/frameworks/support/">support</a> / <a class="Breadcrumbs-crumb" href="/platform/frameworks/support/+/fa760ddce6f309471c5687bcd68cdf75be23e0f0">fa760ddce6f309471c5687bcd68cdf75be23e0f0</a> / <a class="Breadcrumbs-crumb" href="/platform/frameworks/support/+/fa760ddce6f309471c5687bcd68cdf75be23e0f0/">.</a> / <span class="Breadcrumbs-crumb">cleanBuild.sh</span></div><div class="u-sha1 u-monospace BlobSha1">blob: 5b330b99184f584d4078c74ae48cd315b5dcfd10 [<a href="/platform/frameworks/support/+/fa760ddce6f309471c5687bcd68cdf75be23e0f0/cleanBuild.sh">file</a>] [<a href="/platform/frameworks/support/+log/fa760ddce6f309471c5687bcd68cdf75be23e0f0/cleanBuild.sh">log</a>] [<a href="/platform/frameworks/support/+blame/fa760ddce6f309471c5687bcd68cdf75be23e0f0/cleanBuild.sh">blame</a>]</div><table class="FileContents"><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="1"></td><td class="FileContents-lineContents" id="1"><span class="com">#!/bin/bash</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="2"></td><td class="FileContents-lineContents" id="2"><span class="kwd">set</span><span class="pln"> </span><span class="pun">-</span><span class="pln">e</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="3"></td><td class="FileContents-lineContents" id="3"></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="4"></td><td class="FileContents-lineContents" id="4"><span class="pln">DO_PROMPT</span><span class="pun">=</span><span class="pln">true</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="5"></td><td class="FileContents-lineContents" id="5"><span class="kwd">if</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="str">&quot;$1&quot;</span><span class="pln"> </span><span class="pun">==</span><span class="pln"> </span><span class="str">&quot;-y&quot;</span><span class="pln"> </span><span class="pun">];</span><span class="pln"> </span><span class="kwd">then</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="6"></td><td class="FileContents-lineContents" id="6"><span class="pln"> DO_PROMPT</span><span class="pun">=</span><span class="pln">false</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="7"></td><td class="FileContents-lineContents" id="7"><span class="pln"> shift</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="8"></td><td class="FileContents-lineContents" id="8"><span class="kwd">fi</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="9"></td><td class="FileContents-lineContents" id="9"></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="10"></td><td class="FileContents-lineContents" id="10"><span class="pln">goals</span><span class="pun">=</span><span class="str">&quot;$@&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="11"></td><td class="FileContents-lineContents" id="11"></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="12"></td><td class="FileContents-lineContents" id="12"><span class="kwd">function</span><span class="pln"> usage</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="13"></td><td class="FileContents-lineContents" id="13"><span class="pln"> echo</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="14"></td><td class="FileContents-lineContents" id="14"><span class="pln"> echo </span><span class="str">&quot;Usage: $0 [-y] &lt;tasks&gt;&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="15"></td><td class="FileContents-lineContents" id="15"><span class="pln"> echo </span><span class="str">&quot;Runs a clean build of &lt;tasks&gt;&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="16"></td><td class="FileContents-lineContents" id="16"><span class="pln"> echo</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="17"></td><td class="FileContents-lineContents" id="17"><span class="pln"> echo</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="18"></td><td class="FileContents-lineContents" id="18"><span class="pln"> echo </span><span class="str">&quot;For example:&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="19"></td><td class="FileContents-lineContents" id="19"><span class="pln"> echo</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="20"></td><td class="FileContents-lineContents" id="20"><span class="pln"> echo </span><span class="str">&quot; $0 assembleRelease # or any other arguments you would normally give to ./gradlew&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="21"></td><td class="FileContents-lineContents" id="21"><span class="pln"> echo</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="22"></td><td class="FileContents-lineContents" id="22"><span class="pln"> echo</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="23"></td><td class="FileContents-lineContents" id="23"><span class="pln"> echo </span><span class="str">&quot;-y&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="24"></td><td class="FileContents-lineContents" id="24"><span class="pln"> echo </span><span class="str">&quot; Don&#39;t prompt the user to confirm that they want to run a clean build&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="25"></td><td class="FileContents-lineContents" id="25"><span class="pln"> exit </span><span class="lit">1</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="26"></td><td class="FileContents-lineContents" id="26"><span class="pun">}</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="27"></td><td class="FileContents-lineContents" id="27"></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="28"></td><td class="FileContents-lineContents" id="28"><span class="kwd">if</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="str">&quot;$goals&quot;</span><span class="pln"> </span><span class="pun">==</span><span class="pln"> </span><span class="str">&quot;&quot;</span><span class="pln"> </span><span class="pun">];</span><span class="pln"> </span><span class="kwd">then</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="29"></td><td class="FileContents-lineContents" id="29"><span class="pln"> usage</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="30"></td><td class="FileContents-lineContents" id="30"><span class="kwd">fi</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="31"></td><td class="FileContents-lineContents" id="31"></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="32"></td><td class="FileContents-lineContents" id="32"><span class="kwd">if</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="pun">!</span><span class="pln"> </span><span class="pun">-</span><span class="pln">e </span><span class="str">&quot;./gradlew&quot;</span><span class="pln"> </span><span class="pun">];</span><span class="pln"> </span><span class="kwd">then</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="33"></td><td class="FileContents-lineContents" id="33"><span class="pln"> echo </span><span class="str">&quot;Error; ./gradlew does not exist. Must cd to a dir containing a ./gradlew first&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="34"></td><td class="FileContents-lineContents" id="34"><span class="pln"> </span><span class="com"># so that this script knows which gradlew to use (in frameworks/support or frameworks/support/ui)</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="35"></td><td class="FileContents-lineContents" id="35"><span class="pln"> exit </span><span class="lit">1</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="36"></td><td class="FileContents-lineContents" id="36"><span class="kwd">fi</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="37"></td><td class="FileContents-lineContents" id="37"></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="38"></td><td class="FileContents-lineContents" id="38"><span class="kwd">function</span><span class="pln"> confirm</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="39"></td><td class="FileContents-lineContents" id="39"><span class="pln"> </span><span class="com"># Confirm whether the user wants to run this script instead of diagnose-build-failure.sh</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="40"></td><td class="FileContents-lineContents" id="40"><span class="pln"> </span><span class="com"># Recall that we already mentioned the existence of diagnose-build-failure.sh above</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="41"></td><td class="FileContents-lineContents" id="41"><span class="pln"> echo</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="42"></td><td class="FileContents-lineContents" id="42"><span class="pln"> echo </span><span class="str">&quot;Press &lt;Enter&gt; to run a clean build (./gradlew --clean $goals) or Ctrl-C to cancel&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="43"></td><td class="FileContents-lineContents" id="43"><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="str">&quot;$DO_PROMPT&quot;</span><span class="pln"> </span><span class="pun">==</span><span class="pln"> </span><span class="str">&quot;true&quot;</span><span class="pln"> </span><span class="pun">];</span><span class="pln"> </span><span class="kwd">then</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="44"></td><td class="FileContents-lineContents" id="44"><span class="pln"> read response</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="45"></td><td class="FileContents-lineContents" id="45"><span class="pln"> </span><span class="kwd">fi</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="46"></td><td class="FileContents-lineContents" id="46"><span class="pun">}</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="47"></td><td class="FileContents-lineContents" id="47"><span class="pln">confirm</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="48"></td><td class="FileContents-lineContents" id="48"></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="49"></td><td class="FileContents-lineContents" id="49"><span class="pln">scriptDir</span><span class="pun">=</span><span class="str">&quot;$(cd $(dirname $0) &amp;&amp; pwd)&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="50"></td><td class="FileContents-lineContents" id="50"><span class="pln">checkoutDir</span><span class="pun">=</span><span class="str">&quot;$(cd $scriptDir/../.. &amp;&amp; pwd)&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="51"></td><td class="FileContents-lineContents" id="51"><span class="pln">export OUT_DIR</span><span class="pun">=</span><span class="str">&quot;$checkoutDir/out&quot;</span></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="52"></td><td class="FileContents-lineContents" id="52"></td></tr><tr class="u-pre u-monospace FileContents-line"><td class="u-lineNum u-noSelect FileContents-lineNum" data-line-number="53"></td><td class="FileContents-lineContents" id="53"><span class="pun">./</span><span class="pln">gradlew </span><span class="pun">--</span><span class="pln">clean $goals</span></td></tr></table><script nonce="UAbdy0Z252iz37kbRNgj2Q">for (let lineNumEl of document.querySelectorAll('td.u-lineNum')) {lineNumEl.onclick = () => {window.location.hash = `#${lineNumEl.getAttribute('data-line-number')}`;};}</script></div> <!-- Container --></div> <!-- Site-content --><footer class="Site-footer"><div class="Footer"><span class="Footer-poweredBy">Powered by <a href="https://gerrit.googlesource.com/gitiles/">Gitiles</a>| <a href="https://policies.google.com/privacy">Privacy</a>| <a href="https://policies.google.com/terms">Terms</a></span><span class="Footer-formats"><a class="u-monospace Footer-formatsItem" href="?format=TEXT">txt</a> <a class="u-monospace Footer-formatsItem" href="?format=JSON">json</a></span></div></footer></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10