2015-02-06 4 views
1

Gradle의 uploadArchive이 다른 구성에서 이슈를 업로드하는 이유가 궁금합니다. 나의 이해는 당신이 설정을 선언 할 때 당신을 위해 업로드 작업을 얻을 것이고 그것이 불릴 때 그것은 그것의 설정에 할당 된 이슈를 업로드 할 것이라는 점이다. 제가 보는 행동이 아니다uploadArchives가 다른 구성의 이슈를 업로드하는 이유는 무엇입니까?

:

apply plugin: 'base' 

configurations { 
    foo 
} 

task fooIt(type: Zip) { 
    from 'blah.txt' 
    baseName 'foo' 
} 

task barIt(type: Zip) { 
    from 'blah.txt' 
    baseName 'bar' 
} 

artifacts { 
    foo fooIt 
} 

repositories { 
    flatDir { 
    name 'local' 
    dirs 'repo' 
    } 
} 

uploadArchives { 
    repositories { 
    add project.repositories.local 
    } 
} 

uploadFoo { 
    repositories { 
    add project.repositories.local 
    } 
} 

이 예는 archives 구성에 할당 된 유물이없는하지만 난 gradle uploadArchives를 호출 할 때 그것은 foo의 유물을 업로드합니다. 이 중

$ gradle -i uploadArchives 
All projects evaluated. 
Selected primary task 'uploadArchives' from project : 
Tasks to be executed: [task ':fooIt', task ':uploadArchives'] 
:fooIt (Thread[Daemon Thread 17,5,main]) started. 
:fooIt 
Skipping task ':fooIt' as it is up-to-date (took 0.008 secs). 
:fooIt UP-TO-DATE 
:fooIt (Thread[Daemon Thread 17,5,main]) completed. Took 0.017 secs. 
:uploadArchives (Thread[Daemon Thread 17,5,main]) started. 
:uploadArchives 
Executing task ':uploadArchives' (up-to-date check took 0.0 secs) due to: 
    Task has not declared any outputs. 
Publishing configuration: configuration ':archives' 
Publishing to Repository 'local' 
Published :gradle:unspecified:foo.zip to file:/private/tmp/gradle/repo/foo-unspecified.zip 
Published :gradle:unspecified:ivy.xml to file:/private/tmp/gradle/repo/ivy-unspecified.xml 
:uploadArchives (Thread[Daemon Thread 17,5,main]) completed. Took 0.017 secs. 

BUILD SUCCESSFUL 

두 질문 :

  1. fooIt 실행지고?
  2. foo 님의 가공물을 uploadArchives 님이 업로드하는 이유가 무엇인가요?

감사

$ gradle --version 
------------------------------------------------------------ 
Gradle 2.1 
------------------------------------------------------------ 

Build time: 2014-09-08 10:40:39 UTC 
Build number: none 
Revision:  e6cf70745ac11fa943e19294d19a2c527a669a53 

Groovy:  2.3.6 
Ant:   Apache Ant(TM) version 1.9.3 compiled on December 23 2013 
JVM:   1.7.0_45 (Oracle Corporation 24.45-b08) 
OS:   Mac OS X 10.10.2 x86_64 

답변

3

archives 구성은 모든 구성에서 모든 이슈를 포함합니다. 원하는 경우 혼자도 archives 구성에 직접 아티팩트를 추가 할 수 있다는 사실에 기인합니다. 그렇다면 uploadArchives 작업은 항상 선언 된 모든 이슈를 업로드합니다. 이슈의 하위 집합을 업로드하려면 upload<<ConfigurationName>> 태스크를 호출해야합니다.