https://docs.gradle.org/current/userguide/dependency_management_terminology.html

 

Dependency Management Terminology

A file or directory produced by a build, such as a JAR, a ZIP distribution, or a native executable. Artifacts are typically designed to be used or consumed by users or other projects, or deployed to hosting systems. In such cases, the artifact is a single

docs.gradle.org

 

https://docs.gradle.org/current/userguide/core_dependency_management.html

 

Dependency Management

Software projects rarely work in isolation. Projects often rely on reusable functionality from libraries. Some projects organize unrelated functionality into separate parts of a modular system. Dependency management is an automated technique for declaring,

docs.gradle.org

 

https://docs.gradle.org/current/userguide/declaring_repositories.html

 

Declaring repositories

When searching for a module in a repository, Gradle, by default, checks for supported metadata file formats in that repository. In a Maven repository, Gradle looks for a .pom file, in an ivy repository it looks for an ivy.xml file and in a flat directory r

docs.gradle.org

 

https://docs.gradle.org/current/userguide/declaring_dependencies.html

 

Declaring dependencies

Configurations are intended to be used for a single role: declaring dependencies, performing resolution, or defining consumable variants. In the past, some configurations did not define which role they were intended to be used for. A deprecation warning is

docs.gradle.org

 

https://docs.gradle.org/current/userguide/library_vs_application.html

 

Understanding the difference between libraries and applications

Whenever, as a developer, you decide to include a dependency, you must understand that there are consequences for your consumers. For example, if you add a dependency to your project, it becomes a transitive dependency of your consumers, and therefore may

docs.gradle.org

https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html

 

View and Debug Dependencies

A project may request two different versions of the same dependency either directly or transitively. Gradle applies version conflict resolution to ensure that only one version of the dependency exists in the dependency graph. The following example introduc

docs.gradle.org

https://docs.gradle.org/current/userguide/dependency_resolution.html

 

Understanding dependency resolution

Gradle contains a highly sophisticated dependency caching mechanism, which seeks to minimise the number of remote requests made in dependency resolution, while striving to guarantee that the results of dependency resolution are correct and reproducible. Th

docs.gradle.org

https://docs.gradle.org/current/userguide/dependency_verification.html

 

Verifying dependencies

The local keyring files (.gpg or .keys) can be used to avoid reaching out to key servers whenever a key is required to verify an artifact. However, it may be that the local keyring doesn’t contain a key, in which case Gradle would use the key servers to

docs.gradle.org

 

'Android > Gadle' 카테고리의 다른 글

Project 객체의 속성  (0) 2024.03.13
Gradle User Manual  (0) 2024.03.13
Android Gradle plugin API reference  (0) 2024.03.13
그레이들 테스크 실행  (0) 2024.03.13
그레이들 Gradle  (0) 2024.03.13

version

프로젝트나 결과물의 버전(설정이 없을 시 unspecified)

 

description

프로젝트의 설명

 

name

프로젝트의 이름

 

state

프로젝트 빌드 상태(프로젝트 빌드 상태의 종류: NOT EXECUTED, EXECUTING, EXECUTED, FAILED)

 

status

프로젝트 결과물의 상태(프로젝트 결과물 상태의 종류: NOT EXECUTED, EXECUTING, EXECUTED, FAILED)

 

path

프로젝트 경로(경로 구분자':')

 

projectDir

프로젝트 기준 디렉터리

 

group

프로젝트가 속한 그룹(특별한 경우만 지정, 루트 프로젝트는 공백문자, 하위 프로젝트는 루트 프로젝트나 부모 프로젝트로 지정)

 

buildDir

프로젝트 빌드 디렉터리(모든 결과물이 생성되는 디렉터리, 기본값 proejctDir/build)

 

plugins

Project 객체에 적용된 플러그인의 컨테이너

 

project

기준 프로젝트 참조

 

rootProject

루트 프로젝트 참조

 

parent

기준 프로젝트의 상위 프로젝트 참조

 

childProjects

기준 프로젝트의 하위 프로젝트 참조(Map 형식으로 저장)

 

allprojects

기준 프로젝트에 포함된 모든 프로젝트 참조(Set 형식으로 저장)

 

subprojects

기준 프로젝트 이하의 모든 프로젝트 참조(Set 형식으로 저장)

 

'Android > Gadle' 카테고리의 다른 글

Gradle Dependency 문서들  (0) 2024.03.13
Gradle User Manual  (0) 2024.03.13
Android Gradle plugin API reference  (0) 2024.03.13
그레이들 테스크 실행  (0) 2024.03.13
그레이들 Gradle  (0) 2024.03.13

https://docs.gradle.org/current/userguide/userguide.html?_gl=1*1xozz9k*_ga*MTkwMDIyODc3Ny4xNzEwMjUwMzQ0*_ga_7W7NC6YNPT*MTcxMDMwNzk2OS4yLjAuMTcxMDMwNzk3Ni41My4wLjA.

 

Gradle User Manual

Gradle Build Tool is a fast, dependable, and adaptable open-source build automation tool with an elegant and extensible declarative build language. In this User Manual, Gradle Build Tool is abbreviated Gradle.

docs.gradle.org

 

'Android > Gadle' 카테고리의 다른 글

Gradle Dependency 문서들  (0) 2024.03.13
Project 객체의 속성  (0) 2024.03.13
Android Gradle plugin API reference  (0) 2024.03.13
그레이들 테스크 실행  (0) 2024.03.13
그레이들 Gradle  (0) 2024.03.13

https://developer.android.com/reference/tools/gradle-api

 

Android Gradle plugin API reference  |  Android Developers

Android Gradle plugin API reference

developer.android.com

 

'Android > Gadle' 카테고리의 다른 글

Project 객체의 속성  (0) 2024.03.13
Gradle User Manual  (0) 2024.03.13
그레이들 테스크 실행  (0) 2024.03.13
그레이들 Gradle  (0) 2024.03.13
Gradle  (0) 2024.03.12

그레이들 래퍼 gradle wrapper는 그레이들을 실행할 때 사용자가 사전에 그레이들을 설치할 필요가 없게 하는 것이다.

 

유닉스에서는 gradlew, 윈도우에서는 gradlew.bat 스크립트며 프로젝트 루트 디렉터리에 위치한다.

 

w는 wrapper를 의미.

 

래퍼는 gradle-wrapper.jar와 gradle-wrapper.properties 파일로 이루어져있다. gradle/wrapper 디렉터리에서 찾을 수 있다.

 

 


Gradle-wrapper.properties

 

distuributionUrl 속성은 래퍼의 다운로드 버전이 8.4 임을 의미한다.

처음 실행한 후에 zipStoreBase아래 zipStorePath 디렉터리에 저장되고, 그 이후엔 저장된 캐시를 사용한다. 

래퍼를 실행하는 방법은 명령창에서 ./gradlew를 실행하면 된다. 윈도우에선 gradlew.bat 를 실행한다.

 

 

'Android > Gadle' 카테고리의 다른 글

Project 객체의 속성  (0) 2024.03.13
Gradle User Manual  (0) 2024.03.13
Android Gradle plugin API reference  (0) 2024.03.13
그레이들 Gradle  (0) 2024.03.13
Gradle  (0) 2024.03.12

Gradle 구조에 관한 내용.

 


전체 Gradle Scripts

 

 

 


Settings.gradle

 

안드로이드 프로젝트는 멀티 프로젝트 구조, settings.gradle 파일에 포함하는 하위 프로젝트(모듈)가 담겨져 있다.

settings.gradle

settings.gradle 파일에 기본으로 생성되는 값으로, include 문장은 app 모듈을 포함한다.

 

안드로이드 라이브러리 프로젝트를 추가한다면  settings.gradle에 추가해야한다.

 


프로젝트 Build.gradle

최상위 build.gradle파일(프로젝트 build.gradle)

 프로젝트 build.gradle 파일의 buildscript 블록은 안드로이드 플러그인을 어디서 다운로드할지 지정한다.

프로젝트 build.gradle 파일의 buildscript 블록은 안드로이드 플러그인 버전을 지정한다.

 


App 모듈 Build.gradle

app모듈의 build.gradle

apply 문장은 안드로이드 플러그인 지정. 

 

모듈 build.gradle 파일의 android  블록은 프로젝트의 세부 내용을 정의한다.

 

android블록의 compileSdk 항목은 컴파일 SDK 버전

android블록의 defaultConfig 블록에 몇가지 속성을 지정할 수 있다.

 

applicationId

애플리케이션의 패키지 이름을 정의. 구글 플레이 스토어에서 유일한 이름으로 구별되어야 하고, 한번 마켓에 올라가면 이 값은 변경되어서는 안됨. 값을 변경하게 되면 전혀 다른 애플리케이션이 되어 기존 사용자가 동일한 이름으로 최선 버전을 검색할 수 없음. gradle로 넘어가기 전에는 AndroidManifest.xml 파일의 package 속셍에 정의했지만, 이제 두 값은 서로 달라도 된다. 우선 순위는 AndroidId가 더 높다.

 

minSdk

지원하는 최소 SDK 버전. SDK가 이 값보다 낮은 기기에서는 해당 애플리케이션을 검색할 수 없다. gradle로 넘어가기 전에는 AndroidManifest.xml 파일에 uses-sdk 태그 속성으로 정의 했지만, 이러한 방식은 이제 지원하지 않으며 gradle 의 빌드 속성값으로 대체 되어 있다.

 

targetSdk

애플리케이션에서 의도하는 목적 SDK 버전. Android Studio에서는 이 값이 Android 최신 버전보다 낮으면 경고를 표시하며, 원하는 버전을 지정하면 된다.

 

versionCode

애플리케이션의 버전을 나타내는 정수 값. 업그레이드의 기준으로 사용한다.

 

VersionName

사용자에게 배포되는 애플리케이션 버전을 나타내는 문자열. 보통 <Major>.<Minor>.<Version> 형식이다.

 

ComplieOptions 블록은 이 애플리케이션이 JDK 1.8을 사용하고 있음을 알려준다.

 

 

Android Studio의 Project Structure 에서 실행하면 다음과 같이 속성값이 보인다.

모듈 build.gradle의 dependencies 블록에 라이브러리의 그룹, 이름, 버전을 지정해서 안드로이드 애플리케이션에 외부 라이브러리를 추가할 수 있다.

 

외부 라이브러리 명시할 때 configuration도 함께 입력.

compile, runtime, testCompile 등이 있다.

 

메이븐 저장소에 있는 라이브러리 그룹, 이름, 버전을 명시할 때 사용하는 문법

configuration명 '[그룹]:[이름]:[버전]'

예시

testCompile 'junit:junit:4.12'

 

메이븐 저장소가 아니라 로컬 파일 시스템에 있는 파일을 참조하려면 file이나 fileTree 문법을 사용한다

dependencies {

compile files('libs/a.jar', 'libs/b.jar')

compile fileTree(dir: 'libs', include: '*.jar')

}

 

 

저장소 설정

모듈 build.gradle에 있는 repositories 블록에 외부 라이브버리 의존성을 확인하는 저장소를 설정할 수 있다.

 

'Android > Gadle' 카테고리의 다른 글

Project 객체의 속성  (0) 2024.03.13
Gradle User Manual  (0) 2024.03.13
Android Gradle plugin API reference  (0) 2024.03.13
그레이들 테스크 실행  (0) 2024.03.13
Gradle  (0) 2024.03.12

https://gradle.org/

 

Gradle Build Tool

Accelerate developer productivity. Gradle helps teams build, automate and deliver better software, faster.

gradle.org

 

'Android > Gadle' 카테고리의 다른 글

Project 객체의 속성  (0) 2024.03.13
Gradle User Manual  (0) 2024.03.13
Android Gradle plugin API reference  (0) 2024.03.13
그레이들 테스크 실행  (0) 2024.03.13
그레이들 Gradle  (0) 2024.03.13

+ Recent posts