Open theskipster opened 9 years ago
Good timing as I am doing some updates right now. So please do let me know what features you were thinking of. Would also be interested to know what TeamCity version / Java version you are using. We're just about to make the move to TC9.1 with Java 8.
Let me check with the team to see what we are looking for.
I know the first item is to have the log file stream to TeamCity instead of waiting for it to finish, then we can see the progress.
I will see what else we do on our end that would be cool if it was included in the runner.
As a start, here is the metarunner we have at the moment.
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="Unity - Compile">
<description>Compile a Unity application</description>
<settings>
<parameters>
<param name="Unity_Version" value="/Applications/Unity453" spec="select label_1='4.3.3' data_1='/Applications/Unity433' label_2='4.5.2' data_2='/Applications/Unity452' label_3='4.5.3' data_3='/Applications/Unity453' label_4='4.6.0' data_4='/Applications/Unity460' label_5='4.6.2' data_5='/Applications/Unity462' label_6='4.6.3' data_6='/Applications/Unity463' label_7='4.6.4' data_7='/Applications/Unity464' label_8='4.6.5f1' data_8='/Applications/Unity465f1' label_9='5.0.0' data_9='/Applications/Unity500' label_10='5.0.1' data_10='/Applications/Unity501' label_11='5.1.1f1' data_11='/Applications/Unity511f1' display='normal' label='Unity Version'" />
<param name="Unity_CustomBuildPath" value="Assets/Build" spec="text description='Path (relative to the Unity projects root folder) to the JSON formatted build files' validationMode='not_empty' label='Build Path' display='normal'" />
<param name="Unity_CustomScenePath" value="Assets/%
My_ProjectName%/Scenes" spec="text description='Path (relative to the Unity project root folder) to the Scenes directory.' validationMode='not_empty' label='Scene Path' display='normal'" />
<param name="Unity_OutputDir" value="%teamcity.build.checkoutDir%/Package/Unity/%My_ProjectName%/" spec="text description='Location of the output. Ensure a backslash (/) is added at the end of this variable. The platform will be added to the end of the path. {%teamcity.build.checkoutDir%/%env.TEAMCITY_PROJECT_NAME%/Output/}' validationMode='not_empty' label='Output Directory' display='normal'" />
<param name="Unity_Platform" value="Android" spec="select label_1='Desktop (32bit)' data_1='Desktop_32' data_5='Android' data_6='iOS' display='normal' label='Platform' data_3='Desktop_64' label_3='Desktop (64bit)' label_7='Web' data_7='Web' label_9='Windows (32-bit)' data_9='Windows' label_11='MAC OS X' data_11='Mac'" />
<param name="Unity_ProjectPath" value="/srv/Subversion/%teamcity.project.id%/" spec="text description='Base directory of the project on the build agent.' validationMode='not_empty' label='Base Project Path' display='normal'" />
<param name="Unity_BuildConfiguration" value="Debug" spec="text description='The build configuration to be built.' validationMode='not_empty' label='Build Configuration' display='normal'" />
<param name="Unity_ProductVersion" value="%build.number%" spec="text description='The version (without build number) of the application.' validationMode='not_empty' label='Application Version' display='normal'" />
<param name="Unity_ProductRevision" value="%build.counter%" spec="text description='The build number (without version) of the application.' validationMode='not_empty' label='Application Build Number' display='normal'" />
</parameters>
<build-runners>
<runner name="Update Unity symbolic link to point to proper version." type="simpleRunner">
<parameters>
<param name="script.content"><![CDATA[#!/bin/bash
echo updating the Applictions/Unity symbolic link to point to %Unity_Version%
rm /Applications/Unity
ln -s %Unity_Version% /Applications/Unity
rc=$?
if [ $rc -ne 0 ]; then
echo "Step Failed ... Exiting"
exit $rc
fi]]></param>
<param name="teamcity.step.mode" value="default" />
<param name="use.custom.script" value="true" />
</parameters>
</runner>
<runner name="Unity3D build runner" type="unityRunner">
<parameters>
<param name="argument.batch_mode" value="true" />
<param name="argument.build_extra" value="-outputdir %Unity_OutputDir%%Unity_BuildConfiguration%/%Unity_Platform% -configuration %Unity_BuildConfiguration%_%Unity_Platform% -customscenepath %Unity_CustomScenePath% -buildpath %Unity_CustomBuildPath% -bundleVersion %Unity_ProductVersion% -bundleVersionCode %Unity_ProductRevision%" />
<param name="argument.build_path" value="%Unity_OutputDir%%Unity_BuildConfiguration%/%Unity_Platform%" />
<param name="argument.clean_output_after" value="true" />
<param name="argument.clear_output_before" value="true" />
<param name="argument.execute_method" value="BuildSystem.BuildFromCommandLine" />
<param name="argument.no_graphics" value="true" />
<param name="argument.project_path" value="%Unity_ProjectPath%" />
<param name="argument.quit" value="true" />
<param name="teamcity.step.mode" value="default" />
</parameters>
</runner>
</build-runners>
</settings>
</meta-runner>
We did at one point have the file streaming but there seemed to be bugs in the apache tailer. I can bump the version and see if it works better, probably add that as a configurable option so people can opt in/out.
Also, that's a neat workaround to use symbolic links to set up different unity versions - ha!
Yes. Made it much more generic for us, and Unity was smart to not have any external dependencies. So far, it has worked with v4 and v5. I think we have 6 or 7 versions (and subversion) of Unity on one build agent.
Hi. Another thing that we do is autodetect the version of Unity that is being used. Here is the script:
echo "cd %teamcity.build.checkoutDir%"
cd %teamcity.build.checkoutDir%
FileToParse="%teamcity.build.workingDir%/ProjectSettings/ProjectVersion.txt"
ParseString="m_EditorVersion"
# Check for the existence of a "ProjectSettings\ProjectVersion.txt". If it doesn't exist then fail otherwise parse it for the Unity Version
if [ ! -f "$FileToParse" ]
then
echo "An attempt to auto-detect the Unity version has failed. File $FileToParse does not exist. Exiting!"
exit 1
else
# Parse the file for "m_EditorVersion"
echo "Attempting to find string $ParseString in file $FileToParse"
echo
TokenUnityVersion=`grep $ParseString $FileToParse | awk -F "$ParseString: " '{print $2}'`
echo "Token: $TokenUnityVersion"
if [ -z "$TokenUnityVersion" ]
then
echo "Cannot find $ParseString in file $FileToParse. Exiting!"
exit 1
else
FinalUnityVersion=$TokenUnityVersion
fi
fi
# Strip out the period so that 5.1.1f1 becomes 511f1
FinalUnityVersion=`echo "${FinalUnityVersion//.}"`
FinalUnityVersion="Unity$FinalUnityVersion"
echo "Checking to see if Unity version $FinalUnityVersion exists"
if [ ! -d "/Applications/$FinalUnityVersion" ]
then
echo "Unable to find $FinalUnityVersion installed under '/Applications'. Exiting!"
exit 1
fi
# If there is a symbolic link called /Applications/Unity then remove it
if [[ -L "/Applications/Unity" && -d "/Applications/Unity" ]]
then
echo "Removing symbolic link /Applications/Unity"
echo "rm /Applications/Unity"
rm /Applications/Unity
fi
# Create the symbolic link
echo ln -s "/Applications/$FinalUnityVersion /Applications/Unity"
ln -s "/Applications/$FinalUnityVersion" "/Applications/Unity"
rc=$?
if [ $rc -ne 0 ]
then
echo "Failed to create symbolic link ... Exiting"
exit $rc
fi
Hi Mark,
Are there any more updates to this? I have a few other things I would love to add to this.
I don't believe there are - I've now left Mind Candy and am no longer maintaining it, unfortunately.
But it might be worth raising issues if there are things to add, as others may be looking at it.
Many thanks,
Mark
On Wed, 27 Jul 2016 at 16:52 Jarret Peterson notifications@github.com wrote:
Hi Mark,
Are there any more updates to this? I have a few other things I would love to add to this.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mindcandy/Teamcity-unity3d-build-runner-plugin/issues/17#issuecomment-235630165, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6OXJrQN8Bbglj-XOzRM78Z3LhJIWnsks5qZ36pgaJpZM4FcNAJ .
Is anyone updating this any further? There are a few features I would like to suggest, if so.