이 질문의 version.code
부분을 해결, 그러나 여기에서 나는 우리의 프로젝트에 달성하고있어 방법은 없습니다 : 나는 우리 약에 포함 할 정보를 수집하는 C#을 도구를 만들었습니다
페이지. 이 도구는 도구 및 명령 행 args를 지정할 수있는 프로젝트 빌더 목록 (Properties->Builders)
의 첫 번째 단계에서 호출됩니다. 우리의 경우에 빌더 정보는 다음과 같습니다
위치 : C:\Projects\Mobile\Tools\AndroidBuildVersioner\AndroidBuildVersioner\bin\Release\AndroidBuildVersioner.exe
인수 : -f C:\Projects\Mobile\Android\ProjectName\res\values\build_version.xml
도구는 다음 억지로 lib 디렉토리와를 사용하여 내 경우에는 헤드 프로젝트의 개정 및 관련 libs와 검사 이 정보를 tp 쓸 수있는 파일 build_version.xml
에 씁니다. 이 파일은 자동 생성 된 파일이므로 작업 영역에 쓰기 가능 상태로 유지됩니다. 출력은 정보가 프로젝트 활동에 대해 쉽게 사용할 수 있도록 문자열 자원 세트입니다. 필자는 또한 처음에 매니페스트에 대해서도 글을 쓰고 있었지만, 빌드 도구가 손으로 수정해야하는 파일을 수정할 때 충돌을 일으키기 쉽습니다. 도움이된다면 여기
은 몇 가지 예입니다 :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="build_revision">9</string>
<string name="build_date">7/25/2011 9:48:13 AM</string>
<string name="build_machine">JMARTIN-PC</string>
<string name="build_user">jmartin</string>
</resources>
AndroidBuildVersioner.exe이
build_version.xml -이 간단한 블록은 단지 지역의 빌드 번호를 증가시키고 다시 일부 추가 ENV 정보를 기록 strings xml 파일에 저장합니다.
private static void updateBuildFileInfo(String file)
{
String fileContents = ReadFile(file);
String buildRevision = "0";
String newFileContents = @"<?xml version=""1.0"" encoding=""utf-8""?>"
+ Environment.NewLine + "<resources>" + Environment.NewLine ;
//find the build version in the contents of the file so it can be incremented
Match m = Regex.Match(fileContents, @"<string name=""build_revision"">(.*)</string>");
if (m.Success)
buildRevision = m.Groups[1].Value;
int intBuildRevision = 0;
try
{
intBuildRevision = Convert.ToInt32(buildRevision);
}
catch (FormatException e)
{
Console.WriteLine("Input string is not a sequence of digits.");
}
catch (OverflowException e)
{
Console.WriteLine("The number cannot fit in an Int32.");
}
finally
{
++intBuildRevision;
newFileContents += '\t' + @"<string name=""build_revision"">" + intBuildRevision + "</string>" + Environment.NewLine;
newFileContents += '\t' + @"<string name=""build_date"">" + DateTime.Now.ToString() + "</string>" + Environment.NewLine;
newFileContents += '\t' + @"<string name=""build_machine"">" + Environment.MachineName + "</string>" + Environment.NewLine;
newFileContents += '\t' + @"<string name=""build_user"">" + Environment.UserName + "</string>" + Environment.NewLine;
newFileContents += "</resources>";
}
writeOutput(file, newFileContents);
}
그렇습니다.'jni/Application.mk' (대부분의 응용 프로그램은 C++입니다)에서 호출한다는 것을 제외하고는 실제로 끝난 것과 비슷합니다. 매니페스트의 경우 개미 기반 빌더가 실제로 버전을 대체 할 수 있습니다.코드를 만들었지 만, 어쨌든 임시 복사본을 만들고 거기에 여러가지 것들을 대신 넣었습니다. 왜냐하면'version.code'와 커스텀 리소스들보다 더 많은 변화가 필요했기 때문입니다. –