2013-01-31 3 views
0

이 질문에 대한 답을 찾을 수 없었습니다. 사용자가 볼 수 있듯이 리버스 엔지니어링을 시도하는 build.xml이 어떻게 작동하는지 이해하는 것은 중요하지 않습니다. 그럼에도 불구하고 나는 그 질문이 타당하다고 생각한다.개미 작업

<condition property="tests.complete"> 
    <isset property="no.tests" /> 
</condition> 
<condition property="tests.complete"> 
    <and> 
     <uptodate> 
      ... 
     </uptodate> 
     <uptodate> 
      ... 
     </uptodate> 
     <uptodate> 
      ... 
     </uptodate> 
     <not> 
      <available ... /> 
     </not> 
     <not> 
      <isset ... /> 
     </not> 
    </and> 
</condition> 

내가 속성 no.tests가 설정되어있는 경우이 코드 세그먼트가 발생하기 전에 이해 않는 한 다음 속성 tests.complete 것 : 나는 다음과 같은 코드 세그먼트가이 build.xml 파일에서

첫 번째 조건에서 true로 설정되고 두 번째 조건 태스크에서 어떤 일이 발생하더라도 코드 조각을 남겨 둘 때이 속성은 true로 유지됩니다. 제 질문은, 테스트 tests.complete 속성이 첫 번째 조건에 의해 설정된다는 가정하에 두 번째 조건 테스트 집합이 평가됩니까?

답변

0

깨끗한 (정의되지 않은) 속성 만 설정할 수 있습니다. 속성이 이미 설정된 경우 아무 것도 수행되지 않습니다.

따라서 두 번째 조건 집합은 평가되지 않습니다.

<target name="run"> 
    <property name="whatever" value="true"/> 
    <condition property="tests.complete" else="false"> 
     <isset property="no.tests" /> <!-- no.tests isn't defined --> 
    </condition> 
    <echo message="${tests.complete}"/> <!-- prints false --> 

    <condition property="tests.complete" else="false"> 
     <isset property="whatever" /> <!-- the property whatever is defined --> 
    </condition> 
    <echo message="${tests.complete}"/> <!-- prints false as well! --> 
</target> 
:

<target name="run"> 
    <property name="no.tests" value="true"/> 
    <condition property="tests.complete"> 
     <isset property="no.tests" /> 
    </condition> 
    <echo message="${tests.complete}"/> <!-- prints true --> 

    <condition property="tests.complete" else="false"> 
     <isset property="whatever" /> <!-- property whatever is not set --> 
    </condition> 
    <echo message="${tests.complete}"/> <!-- prints true as well! --> 
</target> 

당신은 너무 반대를 사용하여 테스트 할 수 있습니다 : 당신은이 코드를 사용하여 테스트 할 수 있습니다