사실 저는 최근에이 문제를 해결할 방법을 찾아 냈습니다. 기본 아이디어는 내 ANT 파일이 모든 라이브러리 프로젝트를 찾아서 먼저 빌드 한 다음 nodeps
대상으로 나머지 프로젝트를 빌드한다는 것입니다. 이렇게하면 CoreLibrary이 지속적으로 다시 컴파일되는 상황을 효과적으로 방지 할 수 있습니다. 실제로 그래서 나는 nodeps 대상으로 라이브러리를 구축 할 수있는 라이브러리 의존성 순서를 발견 작업을 쓴 경우
<?xml version="1.0" encoding="UTF-8"?>
<project name="MasterBuild">
<!-- A property for the name of the file that contains 'android.library=true' (which is how we find library projects) -->
<property name="library.setting.file.name" value="project.properties" />
<filelist id="normal-projects" dir=".">
<!-- You want to add your own projects here -->
<file name="./MyProject/build.xml" />
<file name="./MyProject2/build.xml" />
<file name="./MyProject3/build.xml" />
</filelist>
<fileset id="all-libraries-properties" dir=".">
<include name="*/${library.setting.file.name}" />
<contains casesensitive="true" text="android.library=true" />
</fileset>
<pathconvert property="all-libraries" refid="all-libraries-properties">
<globmapper from="*${library.setting.file.name}" to="*build.xml" />
</pathconvert>
<target name="-set-debug-mode">
<property name="build.target" value="debug" />
<property name="install.target" value="installd" />
</target>
<target name="-set-release-mode">
<property name="build.target" value="release" />
<property name="install.target" value="installr" />
</target>
<target name="-build-dependencies" unless="built.dependencies">
<property name="built.dependencies" value="true" />
<subant buildpath="${all-libraries}" target="${build.target}" inheritall="false" />
</target>
<target name="-build-normal-projects" depends="-build-dependencies">
<subant inheritall="false">
<target name="nodeps" />
<target name="${build.target}" />
<resources refid="normal-projects" />
</subant>
</target>
<target name="-install-normal-projects">
<subant inheritall="false">
<target name="${install.target}" />
<resources refid="normal-projects" />
</subant>
</target>
<target name="debug" depends="-set-debug-mode, -build-normal-projects" description="Builds (only) a debug-key signed application" />
<target name="release" depends="-set-release-mode, -build-normal-projects" description="Builds (only) a release-key signed application" />
<target name="installd" depends="-set-debug-mode, -install-normal-projects" description="Installs (only) a debug-key signed application" />
<target name="installr" depends="-set-release-mode, -install-normal-projects" description="Installs (only) a release-key signed application" />
</project>
주이 솔루션을 향상시킬 수있다. 또한, "정상적인 프로젝트"를 자동으로 탐지하는 방법이있을 수 있지만 아직 필요하지 않습니다. 마지막으로, 나는 정상적인 ANT 파일에서 꽤 많은 것들을 풀어 여기에 가져 왔으므로 아무 것도 놓치지 않았다. 그러나 개념은 존재합니다.
지금 당장은 그렇게 생각하지 않습니다. 다음 주요 도구 릴리스는 라이브러리 프로젝트를 JAR로 배포하기위한 지원을 제공 할 수 있습니다. 이 경우 Ant 스크립트가 라이브러리 프로젝트를 빌드하고 다른 프로젝트가 직접 라이브러리 프로젝트가 아닌 JAR을 참조하도록 할 수 있습니다. 적어도 이론적으로는. – CommonsWare
감사합니다. 나는 도서관의 반복적 인 건물 건설이 어떻게 든 여기서 도움이 될 수있는 새로운 건물 건설 과정을 기대했다. 즉, Lib A와 Lib B가 Lib C를 참조하고 있다면 Lib C는 Lib A와 B를 참조하는 프로젝트를 빌드 할 때 한 번만 빌드됩니다. 내가 활용할 수있는 방법을 찾아 낼 수 있다면 좋겠다고 생각했습니다. 이 문제가 있습니다. –
@CommonsWare보고자하는 답변을 업데이트했습니다. 내가 할 수있는 한 잘 작동해야한다고 말할 수 있지만,'nodeps' 타겟이 SDK에 추가되었을 때 나는 확신하지 못한다. –