Gradle's real achitecture

satya - 7/17/2018, 9:30:06 AM

Gradle's real architecture

Gradle's real architecture

Search for: Gradle's real architecture

satya - 7/17/2018, 9:31:04 AM

Steep learning curve: critical look at Gradle as a build system

Steep learning curve: critical look at Gradle as a build system

satya - 7/17/2018, 9:36:53 AM

Gradle project, plugin and task interaction

Gradle project, plugin and task interaction

Search for: Gradle project, plugin and task interaction

satya - 7/17/2018, 9:43:17 AM

There is no exposition of this on the web so far

may be in youtube videos

videos really slows down learning (for me)

How to projects, plugins, and tasks interact?

what is configured?

What is executed?

What is gradle's philosophy and architecture?

The how, that explains how it ticks?

By knowing what everything else derives meaning?

satya - 7/17/2018, 9:43:38 AM

perhaps understanding its plugins makes this clear

perhaps understanding its plugins makes this clear

satya - 7/17/2018, 9:49:54 AM

What I grasped

Convention

Execution (via tasks) assuming convention

Configuring execution to (to describe dependencies or altering convention)

satya - 7/17/2018, 9:50:07 AM

Very early I warn

Very early I warn

satya - 7/17/2018, 9:59:56 AM

what are the basic entities of gradle

what are the basic entities of gradle

Search for: what are the basic entities of gradle

satya - 7/17/2018, 10:08:18 AM

Gradle topic

Tasks:Search On Web

Configurations:Search On Web

Dependencies:Search On Web

Artifacts:Search On Web

Repositories:Search On Web

satya - 7/17/2018, 10:33:37 AM

Configurations are described here

Configurations are described here

satya - 7/17/2018, 10:49:59 AM

Dependencies are explained here

Dependencies are explained here

satya - 7/17/2018, 10:50:15 AM

Gradle GMV syntax explanation

Gradle GMV syntax explanation

Search for: Gradle GMV syntax explanation

satya - 7/17/2018, 10:55:52 AM

Finally located a picture in gradle docs

satya - 7/17/2018, 10:57:45 AM

Another note on configuration

A build script developer can declare dependencies for different scopes e.g. just for compilation of source code or for executing tests. In Gradle, the scope of a dependency is called a configuration

satya - 7/17/2018, 10:58:51 AM

More on module dependency

If you declare a module dependency, Gradle looks for a module metadata file (.module, .pom or ivy.xml) in the repositories. If such a module metadata file exists, it is parsed and the artifacts of this module (e.g. hibernate-3.0.5.jar) as well as its dependencies (e.g. cglib) are downloaded. If no such module metadata file exists, Gradle may look, depending on the metadata sources definitions, for an artifact file called hibernate-3.0.5.jar directly. In Maven, a module can have one and only one artifact. In Gradle and Ivy, a module can have multiple artifacts. Each artifact can have a different set of dependencies.

satya - 7/17/2018, 11:03:12 AM

Gradle configurations compile runtime, where are these defined?

Gradle configurations compile runtime, where are these defined?

Search for: Gradle configurations compile runtime, where are these defined?

satya - 7/17/2018, 11:11:32 AM

For the java plugin these are documented here

For the java plugin these are documented here

satya - 7/17/2018, 11:15:03 AM

How can I add a local jar file as a gradle dependency?

How can I add a local jar file as a gradle dependency?

Search for: How can I add a local jar file as a gradle dependency?

satya - 7/18/2018, 8:22:32 AM

Here are how various dependencies are added


apply plugin: 'java'
//so that we can use 'compile', 'testCompile' for dependencies

dependencies {
  //for dependencies found in artifact repositories you can use
  //the group:name:version notation
  compile 'commons-lang:commons-lang:2.6'
  testCompile 'org.mockito:mockito:1.9.0-rc1'

  //map-style notation:
  compile group: 'com.google.code.guice', name: 'guice', version: '1.0'

  //declaring arbitrary files as dependencies
  compile files('hibernate.jar', 'libs/spring.jar')

  //putting all jars from 'libs' onto compile classpath
  compile fileTree('libs')
}

satya - 7/18/2018, 8:45:19 AM

Here is an interesting way of using project extensions

Here is an interesting way of using project extensions

satya - 7/18/2018, 8:46:40 AM

Quick summary

Define a class with executable methods that can operate on any aspect of Gradle build

Register the class with Gradle as an extension

You can execute methods of that class as a closure whose delegate is that class instance

satya - 7/18/2018, 11:18:27 AM

Dependency object hierarchy

Dependency object hierarchy

satya - 7/18/2018, 11:20:32 AM

Dependency object hierarchy


org.gradle.api.artifacts.ExternalDependency
  isForce, setForce, version

org.gradle.api.artifacts.ModuleDependency
 addArtifact, artifact, artifact, attributes, 
 exclude, getArtifacts, getAttributes, 
 getExcludeRules, getTargetConfiguration, isTransitive, 
 setTargetConfiguration, setTransitive

org.gradle.api.artifacts.Dependency
 because, contentEquals, getGroup, 
 getName, getReason, getVersion

org.gradle.api.artifacts.ModuleVersionSelector
 getGroup, getModule, getName, 
 getVersion, getVersionConstraint, matchesStrictly

satya - 7/18/2018, 11:24:03 AM

Type of dependencies are documented in DependencyHandler API

Type of dependencies are documented in DependencyHandler API

satya - 7/18/2018, 11:25:41 AM

Type of dependencies


External library
Other projects
Files
Other configurations
Gradle dependencies
Client module dependencies

satya - 7/18/2018, 11:32:14 AM

Here is how to work with files in Gradle

Here is how to work with files in Gradle

satya - 7/18/2018, 11:47:06 AM

Here is a chapter of a book on dependencies

Here is a chapter of a book on dependencies

satya - 7/18/2018, 12:13:31 PM

is classpath a gradle dependency configuration name?

is classpath a gradle dependency configuration name?

Search for: is classpath a gradle dependency configuration name?

satya - 7/18/2018, 12:15:57 PM

Here is more on this

Here is more on this

satya - 7/18/2018, 12:24:06 PM

Here is a - slightly - better explanation of "classpath" as a configuration

Here is a - slightly - better explanation of "classpath" as a configuration

satya - 7/18/2018, 3:13:37 PM

Dependency terminology

Dependency terminology