통상적으로 Flex SDK의 compc로 만든 swc는 Flash CS3에서 가져다 쓸
수가 없다. 그러나 갈수록 개발도 다양화되고 복잡화해지면서 framework이라던가 library들을 가져다 써야하는
경우가 생기기 마련이다.
이래저래 웹을 뒤지다 보니 역시나 나와 같은
고민을 한 사람이 있다.
http://timwalling.com/2007/10/22/compiling-flash-cs3-compatible-swcs-with-flex/
주 요점은
1)
manifest.xml을 생성
2) Flex SDK 3의 경우 컴파일 시 -compute-digest=false를 추가
위 링크는 Flex Builder 자체에서 하는 법을 기술하였는데 아쉽게도 자동화
빌드 때문에 build.xml을 써야하는 상황이었는데 Flex Tasks for Ant에서 다양한 옵션을
지원하지 않기에 다음과 같은 방법을 써야만 했다.
이번 프로젝트에서 사용한
방법이다. 통상적으로 ${compc.exe}는 선언되어 있다고 가정한다.
<exec executable="${compc.exe}" failonerror="true">
<arg
line="-output=dist/${project.output}" />
<arg line="-source-path src/base" />
<arg line="-source-path src/ext" />
<arg line="-include-classes ${include-classes}" />
<arg line="${library-path}" />
<arg line="${external-library-path}" />
<arg line="-namespace http://namespace resources/manifest.xml" />
<arg line="-compute-digest=false" />
</exec>
http://namespace는 자신의 것을 이용하도록 한다. 전반적인 의도는 Flex Tasks for
Ant의 <compc />에서는 지원을 제대로 안하는 컴파일러 옵션들이 있기 때문에 <exec
/>를 이용하여 직접 호출하는 방식이다.
여기서 ${include-classes}, ${library-path}, ${external-library-path}는 <pathconvert
/>라는 기능을 이용하여 생성하였다. 내가 사용했던 각 <pathconvert />들은 다음과 같다.
<pathconvert property="include-classes" pathsep=" " dirsep=".">
<path>
<fileset dir="src/base" includes="**/*.as" />
<fileset dir="src/ext" includes="**/*.as"
/>
</path>
<map from="${basedir}/src/base/" to="" />
<map from="${basedir}/src/ext/" to="" />
<chainedmapper>
<globmapper from="*.as" to="*" />
</chainedmapper>
</pathconvert>
<pathconvert property="library-path" pathsep="
">
<path>
<fileset dir="lib" includes="**/*.swc" />
</path>
<mapper>
<globmapper
from="*" to="-library-path "*"" />
</mapper>
</pathconvert>
<pathconvert property="external-library-path" pathsep=" ">
<path>
<fileset dir="${flex.sdk.home}/frameworks/libs" includes="**/*.swc" />
</path>
<mapper>
<globmapper from="*"
to="-external-library-path "*"" />
</mapper>
</pathconvert>
다만 Flash CS3에서는 mx.* 관련
패키지들을 이용할 수 없으므로 사용하는 class 선별을 잘 하여야 한다. 통상적으로
flash.* 패키지를 위주로 이용한다면 별다른 문제는 없다.
Flex SDK 4에서는
playerglobal.swc가 2가지 버전으로 존재하기 때문에 살짝 문제점이 있긴 하지만 아직 정식
릴리즈 안했기에 일단 이걸로 사용하고 있다.




