필요 조건 목록
Nant를 공부하면서 제작한거라, 부족한 점이 많지만, 혹시 저 처럼 고생하시는 분에게 도움이 될까 해서 공개합니다.
조언이나 잘 못 된 점이 있으면 적어 주세요.
- subversion 서버의 최신 데이터 받는다.
- 빌드 버전을 빌드한 날짜와 빌드 넘버를 표시한다.
- 하위 경로에 있는 sln파일을 찾아서 빌드 한다.
Nant를 공부하면서 제작한거라, 부족한 점이 많지만, 혹시 저 처럼 고생하시는 분에게 도움이 될까 해서 공개합니다.
조언이나 잘 못 된 점이 있으면 적어 주세요.
<?xml version="1.0"?> <project name="TaklPlay" default="build"> <property name="configuration" value="release"/> <property name="date.now" value="${ datetime::now() }"/> <property name="month.now" value="${ datetime::get-month( date.now )}"/> <property name="month.now" value="0${ month.now }" if="${ int::parse( month.now ) < 10 }"/> <property name="day.now" value="${ datetime::get-day( date.now )}"/> <property name="day.now" value="0${ day.now }" if="${ int::parse( day.now ) < 10 }"/> <property name="timestamp" value="${month.now}${day.now}"/> <!--clean --> <target name="clean" description="remove all generated files"> <delete verbose="true"> <fileset> <include name="**/bin/**" /> <include name="**/Release/**" /> <include name="**/*.suo" /> <include name="**/*.user" /> </fileset> </delete> </target> <!-- 버전 정보 만들기 --> <target name="replaceVersion" description="replce file version"> <foreach item="File" property="filename"> <in> <items > <include name="**/*.rc" /> </items> </in> <do> <echo message="resource : ${filename}" /> <loadfile file="${filename}" property="fileContent" verbose="false" /> <regex pattern="(?'major'\d+)*,(?'minor'\d+)*,(?'buildDate'\d+)*,(?'buildNumber'\d+)" input="${fileContent}" /> <property name="newBuildNumber" value="${int::parse(buildNumber)+1}" /> <echo message="old version : ${major},${minor},${buildDate},${buildNumber}"/> <echo message="build version : ${major},${minor},${timestamp},${newBuildNumber}"/> <copy file="${filename}" tofile="${filename}.tmp" verbose="true" overwrite="true"> <filterchain> <replacestring from="${major},${minor},${buildDate},${buildNumber}" to="${major},${minor},${timestamp},${newBuildNumber}" ignorecase="true" /> <replacestring from="${major}, ${minor}, ${buildDate}, ${buildNumber}" to="${major}, ${minor}, ${timestamp}, ${newBuildNumber}" ignorecase="true" /> </filterchain> </copy> <delete file="${filename}" /> <move file="${filename}.tmp" tofile="${filename}" /> </do> </foreach> </target> <!-- build --> <target name="build" description="compiles the source code"> <exec program="svn.exe" commandline="up"> </exec> <foreach item="File" property="filename"> <in> <items > <include name="**/*.sln" /> </items> </in> <do> <exec program="C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com" commandline="/rebuild ${configuration} ${filename}"> </exec> </do> </foreach> </target> <!-- rebuild --> <target name="rebuild" depends="clean, build" /> <!-- all 전체 작업. --> <target name="all" depends="clean, replaceVersion, build"> <!-- rc파일을 commit해 준다. --> <foreach item="File" property="filename"> <in> <items > <include name="**/*.rc" /> </items> </in> <do> <exec program="svn.exe" commandline="commit ${filename} -m Project_Auto_Build." /> </do> </foreach> </target> </project>
댓글