Gradle Source One

Source: Internet
Author: User

Key code executed by Gradle Org.gradle.initialization.DefaultGradleLauncher.java

   private void Dobuildstages (Stage upTo) {//Evaluate init scripts initscripthandler.executescripts (gradle        );        Evaluate settings script settingsinternal settings = settingshandler.findandloadsettings (Gradle);        buildlistener.settingsevaluated (settings); Load Build Buildloader.load (Settings.getrootproject (), Settings.getdefaultproject (), Gradle, SETTINGS.GETROOTCLA        Ssloaderscope ());        Buildlistener.projectsloaded (Gradle);        Configure build Buildconfigurer.configure (Gradle);        if (!gradle.getstartparameter (). Isconfigureondemand ()) {buildlistener.projectsevaluated (gradle);        } modelconfigurationlistener.onconfigure (Gradle);        if (UpTo = = stage.configure) {return;        }//Populate task Graph Buildexecuter.select (gradle);        if (Gradle.getstartparameter (). Isconfigureondemand ()) {buildlistener.projectsevaluated (gradle); }//ExeCute build buildexecuter.execute ();        Taskscompletionlistener.ontasksfinished (Gradle);    Assert upTo = = Stage.build; }

From the annotations we can see several key steps of Gradle

A. Evaluate Init scripts

1.InitScriptHandler through

    Protected Initscripthandler Createinitscripthandler () {        return new Initscripthandler (                new Defaultinitscriptprocessor (                        get (scriptpluginfactory.class),                        get (scripthandlerfactory.class)                )        );    }
Specify a
Defaultinitscriptprocessor <span style= "font-family:arial, Helvetica, Sans-serif;" > object to do its processor</span>


2. Specify Script finder (in Org.gradle.startParameter.java)

From C:\Users\xxx\.gradle\init.gradle <-user_home

C:\Users\xxx\.gradle\init.d folder EndsWith ". Gradle" <-user_home

C:\gradle-2.2.1\init.d folder EndsWith ". Gradle" <-gradle_home



3. Call the DEFAULTINITSCRIPTPROCESSOR.PROCESSS function to handle


Gradle Source One

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.