Gradle

Groovy언어 사용

  • looks like natural language 
  • java와 통합 가능
  • Closure: 코드블록 혹은 메서드 포인터처럼 사용
  • delegate = invoker
  • this = this class
  • owner = outer area



DSL?

  • Domain Specific Language
  • 도메인이란 안드로이드나 자바 등



그래들 래퍼

  • gradlew 는 맥이나 리눅스용
  • gradlew.bat는 윈도우용

래퍼를 사용하는 이유?
모든사람이 같은 버전의 그래들을 사용하는것을 보장


그래들 명령어 모음

  • gradle dependencies
    • 디펜던시로 추가된 라이브러리를 보여줌
  • gradle --daemon
    • 해당 프로젝트(폴더)의 그래들대몬을 미리 실행시켜서 빌드속도를 높임
  • gradle --stop
    • 데몬 끔
  • gradle -q taskName
    • 해당 Task를 실행시킴
  • gradle tasks
    • 실행가능한 gradle 목록을 보여줌




Gradle
-빌드툴
-라이브러리 쉽게 추가(dependency 추가)
-컴파일
-패키징

다른 빌드툴 종류
-APACHE ANT
-IVY
-Maven

빌드속도비교
그래들이 훨씬 빠름

리포지토리도 다음과같이 선택할 수 있음
repositories {
    mavenCentral()
}



repositories {
    maven ("https://repository-achartengine.forge.cloudbees.com/snapshot/")
    jcenter {
        url "http://jcenter.bintray.com/"
    }
}
시스템 프로퍼티 불러오는방법

def homePath = System.properties['user.home']


dependsOn 거는 방법(cleanOther을 실행하면 clean compile이 선행해서 실행됨)
task cleanOther {
    doLast {
        println "I want to clean up before running!"
    }
}

cleanOther.dependsOn clean, compile

task compile {
    doLast {
        println 'Executing the compile task'
    }
}

task other(dependsOn: 'compile') {
    doLast {
        println "I'm not a default task!"
    }
}


Groovy프로젝트 생성방법
gradle -q init --type groovy-library






















댓글

이 블로그의 인기 게시물

XPath와 Appium과 Python