Source Code Google Gradle Plugin for Creating Android

I want to know how the program for Android works. Do you know where I can download the source code for the com.android.build.gradle build plugin?

+11
source share
4 answers

If you have Android Studio, the android gradle plugin and an Android application installed, you can find the source code for the gradle plugin on your own development machine.

  • cd to your home directory
  • cd in .gradle / caches / modules-2 / files-2.1 / com.android.tools.build / gradle -core /
  • use a deep search tool (for example, find) to search for a file with a name like gradle -core-2.3.1-sources.jar '(Note: in this example, "2.3.1" has only one possibility. You may have a different version. On There may be several versions of your computer.)

In other words, the downloaded module module jar files are stored in gradle along a path that looks something like this:

~ / .gradle / caches / modules-2 / files-2.1 / com.android.tools.build / gradle -core / 2.3.1 / 59c72f62795f6ce6dd95c0b2e91c16dc16a1c8c7 / gradle -core-2.3.1-sources. jar

(On your computer, the hash and version in this way may differ.)

You can copy this jar file to another place and then unzip it to view the actual source files for the android gradle plugin:

./com/Android/assemblies/gradle/api/AndroidArtifactVariant.java. / com / android / build / gradle / api / AndroidSourceDirectorySet.java. / com / android / build / gradle / api / AndroidSourceFile.java. / com / android / build / gradle / api / AndroidSourceSet.java. / com / android / build / gradle / api / ApkOutputFile.java
./com/android/build/gradle/api/ApkVariant.java. / com / android / build / gradle / api / ApkVariantOutput.java. / com / android / build / gradle / api / ApplicationVariant.java. / com / android / build / gradle / api / AtomVariant.java. / com / android / build / gradle / api / AtomVariantOutput.java. / com / android / build / gradle / api / BaseVariant.java. / com / android / build / gradle / api / BaseVariantOutput.java
,,.

+11
source

Is this the one that you are looking for?

+3
source

Install gradle 2.3.1 as exmple, you can download the gradle plugin source code as follows:

$ mkdir gradle_2.3.0

$ cd gradle_2.3.0

$ repo init -u https://android.googlesource.com/platform/manifest -b gradle_2.3.0

$ repo sync

+1
source

Instructions for creating the gradle plugin are given here;

http://tools.android.com/build/gradleplugin

which directs you to use the repo to get the source, and also tells you that the plugin can be found in the tools / database.

What you can clone or browse online here;

https://android.googlesource.com/platform/tools/base/

+1
source

Source: https://habr.com/ru/post/1013598/


All Articles