Git Product home page Git Product logo

teamcity-unity3d-build-runner-plugin's Introduction

Teamcity Unity3d Build Runner plugin

Overview

Teamcity is a continuous integration server. Unity3d is a powerful 3d game creation editor and engine. If you want to easily build Unity3d players as part of a Teamcity installation, you can invoke them from a Shell runner, but editing parameters and viewing log files is a bit of a pest.

This plugin makes life a bit easier and provides a nice cross-platform way of building Unity3d projects on the Mac or Windows platforms. (Note that the Unity3d build usually does not output any build progress to standard output but instead outputs to a log file, whose location is platform-specific)

Update now supports multiple versions of Unity installed on the same build agent!

Using

Installation

Prebuilt version

Updated A new prebuilt version against Teamcity 9.1 that requires Java 1.8 is here: unityRunner.zip, 6MB This should work with older Teamcity as long as Java 1.8 is being used.

Old version You can download an older prebuilt version against Teamcity 8.0.3 here: prebuilt unity runner.zip, 1.5MB It may work with other versions of Teamcity (unless there are breaking API changes).

Compilation

When building the plugin, you need to have downloaded the Teamcity distribution you want to build against, so that the compilation process can grab the necessary libs. It's also useful so that you can test that it will load the plugin correctly.

When running Teamcity locally, any plugins need to be installed by putting them in the TEAMCITY_DATA_PATH/plugins folder.

You can find the TEAMCITY_DATA_PATH is set under Administration > Server Configuration > GlobalSetting ( according to this documentation: http://confluence.jetbrains.com/display/TCD4/TeamCity+Data+Directory )

On Nix and OSX this defaults to /home//.BuildServer.

On Windows is by default:%PROGRAMDATA%\JetBrains\TeamCity ( Windows 8, Teamcity Version 8.0.4 )

Before compiling, it's important to update the build.properties file with the paths the Teamcity distribution and to the TEAMCITY_DATA_PATH folder. When the process is complete, ant should automatically copy the unityRunner.zip file to the Datapath folder. For example:

path.variable.teamcitydistribution=C:\\TeamCity
teamcity.data.path=c:\\Teamcity

Ant CLI

To compile with ant directly, just run ant dist from the root folder of the repo.

IntelliJ

Compile with IntelliJ IDEA -- the Community Edition (free) version will work!

Open up the unity_runner.ipr file, then open the Ant Build window and add build.xml (if not automatically detected).

Double click on 'dist' target to do a full build, which should produce dist/unityRunner.zip

Installing in Teamcity

Copy the unityRunner.zip file to the TEAMCITY_DATA_PATH/plugins/ folder in your Teamcity installation, then restart Teamcity.

Usage

'Unity' will be available as a Build Step. It will automatically detect if Unity appears to be installed on an Agent, by looking in the default install location for each platform (Program Files or Applications).

Options

Many of these relate to Unity3d command line arguments

  • Unity version - specify the full version of Unity to use e.g. 5.1.2f4 or leave blank to use the latest version
  • Unity executable - overrides the default path of Unity executable
  • Batch Mode - should be left enabled usually, enables the Unity -batchmode
  • No graphics - on Windows only, do not initialize a graphics device during a build to avoid errors when running without a good GPU. Equivalent to -nographics command line option
  • Project path - specifies the path (relative to Working directory) of Unity project to open
  • Build Player - choose which Unity Player to build, currently supported are Web, Windows or OSX (but it would be easy to add others if required). Equivalent to passing -buildWebPlayer -buildWindowsPlayer or -buildOSXPlayer on command line
  • Execute method - specify a method for Unity to execute, to allow you to customise your build process. Equivalent to -executeMethod on the command line
  • Build path - specify the output build path for the Player
  • Clear output before - ensures output folder exists and is empty, before invoking Unity
  • Clean output after - removes any .svn and .meta files found in the output directory, as these are usually not wanted
  • Quit - specify if unity should quit after a build. Usually should be left enabled, equivalent to the -quit command line option

Features

  • Automatically locates the Unity3d log file and sends it to Teamcity whilst the build is in progress, giving feedback during the build and preventing spurious 'build is hanging' warnings from Teamcity.
  • Automatically detects if Unity3d is installed on an Agent, so prevents attempts to run if Unity3d is not installed.
  • Processes log file to detect and flag up warnings and errors to Teamcity, making log files easier to read
  • Detects compilation, asset refresh and Player statistics blocks in the log file

Multiple versions of Unity on a single agent

Simply install Unity and then rename its installation folder, so you then have /Applications or \Program Files with folders like "Unity 1.2.3", "Unity 4.5.5" and so on. As long as the folder name starts with Unity it will be scanned by the plugin.

You can then specify the version in your Unity build step, and the plugin will automatically add the correct Agent Requirement so that only Agents with that version installed will be available to your build.

If you leave the version blank, the latest installed version of Unity will be used.

Contributing

Please do! Simply fork the github project as usual.

In particular in the future you may want to

  • add support for more log messages
  • build different Players
  • invoke test suites

teamcity-unity3d-build-runner-plugin's People

Contributors

jonnyfunfun avatar mcterrydrever avatar rumblesan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teamcity-unity3d-build-runner-plugin's Issues

Build Agent: Windows 10 mistaken as Mac, Unity not found

Hello,

We installed a build agent on a Win10 box and connected it to a TC9.1 server. It reports requirements being unmet, with the message "Exception getting finding unity versions". Looking at the source, we think it is misidentifying the system as a Mac box and using /Applications as the path to look for unity. As a test we copied the Unity folder from Program Files to c:\Applications and the runner successfully found it and was happy, which seems to indicate that it is in fact doing a search and is able to find Unity, but is looking in the wrong place.

Configurable windowsUnityPath

Hello--

The windowsUnityPath is currently hardcoded to the 32bit "Program Files (x86)" path, however on the new 5.0+ Unity, there is a possibility this will be installed in the 64bit "Program Files" folder instead.

It would be nice if this could be overridden and/or detected instead.

Cheers~

incompatible runner or incompatible agent

My greeting.
Trying to bring unity3d-runner to work on Teamcity9.
After successfully install of plugin and adding Unity build step, i've started to fight with a problem - there is no compatible agents to build project.

On the Agent Requirements page there is two messages.

TC_agent
Incompatible runner: Unity
Unmet requirements: unity.latest exists

I thought in two ways -

  1. Unity plugin doesn't see my Unity package. (btw it was installed in default folder)
  2. I have incompatible Java version on the agent. (at this moment i've upgrated to JDK 1.8.0_45 on teamcity server and 1.8_60 on agent ... doesn't help).

That's why i can't understand, what does plugin wants from me =).
There is still error messages in teamcity_agent log :

java.lang.UnsupportedClassVersionError: unityRunner/agent/AgentListener : Unsupported major.minor version 52.0

and no compatible agents.

Thank you in advance.

Can't build.

Trying to build this using both ant and IntelliJ gives me the same error (see below). For some reason it can't find XMLPropertyListConfiguration.

commons-configuration-1.10.jar is in lib and shows up in IntelliJ (I can even decompile it and find XMLPropertyListConfiguration inside).

I'm trying to build on Windows if that matters.

I have set the paths in the build.properties file as per instructions, is there anything else I need to do?

[javac] C:\Projects\Teamcity-unity3d-build-runner-plugin-master\agent\src\unityRunner\agent\UnityRunnerBuildServiceFactory.java:25: error: package org.apache.commons.configuration.plist does not exist
[javac] import org.apache.commons.configuration.plist.XMLPropertyListConfiguration;
[javac] ^
[javac] C:\Projects\Teamcity-unity3d-build-runner-plugin-master\agent\src\unityRunner\agent\UnityRunnerBuildServiceFactory.java:181: error: cannot find symbol
[javac] XMLPropertyListConfiguration config = new XMLPropertyListConfiguration(configFilePath.toFile());
[javac] ^
[javac] symbol: class XMLPropertyListConfiguration
[javac] C:\Projects\Teamcity-unity3d-build-runner-plugin-master\agent\src\unityRunner\agent\UnityRunnerBuildServiceFactory.java:181: error: cannot find symbol
[javac] XMLPropertyListConfiguration config = new XMLPropertyListConfiguration(configFilePath.toFile());
[javac] ^
[javac] symbol: class XMLPropertyListConfiguration

Updates?

Is anyone updating this any further? There are a few features I would like to suggest, if so.

New Prebuilt Runner Zip?

Hello - I've attempted to build the latest Unity Runner via IDEA under Windows, but for some reason the runner type doesn't show up when creating new build configurations. I didn't have any errors in the build, and the plugin shows up in the TeamCity configured plugins list....

Anyway, I was hoping you could create a new prebuilt runner ZIP file for me? The one currently linked on the project home page is from 2013.

Many thanks!
Mike.

Incompatible Agents

I am using TeamCity version 9.1.1 (build 37059)

So I've gone through a lot of hoop jumping updating a TeamCity installation I inherited from an old co-worker, and not understanding that TEAM_CITY_DATA_PATH was not where I thought it was...but after a few hours I did eventually install this plugin correctly and removed the old one...

I even had to uninstall a buildAgent that was stuck in an endless loop of failed updates. Reinstalling it fixed that.

Now I have my final hurdle, and sadly will go to sleep with unresolved conflict, because I am absolutely stumped.

When I try to run a build, I am met with the following error and reason:

Incompatible runner:
Unity

Unmet requirements:
unity.latest exists

I even shutdown the Agent, deleted its plugin folder, and restarted it (thus forcing an update to the Agent). I was paranoid it was somehow still getting the old Unity plugin. I understand it pulls the data from the TEAM_CITY_DATA_PATH and installs some plugins into its own local directory.

However, this still happens. I have no idea if it is anything I can fix. I have also tried specifying the Unity version I have installed, but that also does not work.

If it helps, I have Unity 5.1.3p1 installed. I'm not sure if it is required that I have a non-patch release installed with the way unity.latest currently works. Explicitly typing in 5.1.3p1 also did nothing.

EDIT: I just noticed that, for some reason, Unity does not appear as one of the supported Build Runners in my Agent's Build Runners tab. I am unsure how this is possible, because it is being added to the plugins folder, I can see it there.

EDIT 2: I was just looking through my teamcity-agent.log file, and came across this error.

[2015-09-04 01:02:18,552]  ERROR -    jetbrains.buildServer.AGENT - Exception getting finding unity versions :\Applications 

However, it is an error you would expect, running on a Windows installation. The rest of the log claims that unityRunner is indeed running, so I am unsure if this has anything to do with the problem. I imagine not, or else it wouldn't work for anybody on Windows.

Ant Build Error

I can't compile using Ant build although "Build>Rebuild Project" from Intellij Idea shows no error

here's the compile message
Created dir: V:\Teamcity-unity3d-build-runner-plugin\out\production\unityrunner-agent
javac
V:\Teamcity-unity3d-build-runner-plugin\unityrunner.xml:260: Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1180)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:935)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.Main.start(Main.java:198)
at org.apache.tools.ant.Main.main(Main.java:286)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)
V:\Teamcity-unity3d-build-runner-plugin\unityrunner.xml (260:46)'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 21 source files to V:\Teamcity-unity3d-build-runner-plugin\out\production\unityrunner-agent
V:\Teamcity-unity3d-build-runner-plugin\agent\src\unityRunner\agent\UnityRunnerBuildServiceFactory.java:25: error: package org.apache.commons.configuration.plist does not exist
V:\Teamcity-unity3d-build-runner-plugin\agent\src\unityRunner\agent\UnityRunnerBuildServiceFactory.java (181:21)error: cannot find symbol class XMLPropertyListConfiguration
V:\Teamcity-unity3d-build-runner-plugin\agent\src\unityRunner\agent\UnityRunnerBuildServiceFactory.java (181:63)error: cannot find symbol class XMLPropertyListConfiguration
3 errors
V:\Teamcity-unity3d-build-runner-plugin\unityrunner.xml:260: Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1180)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:935)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.Main.start(Main.java:198)
at org.apache.tools.ant.Main.main(Main.java:286)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)
V:\Teamcity-unity3d-build-runner-plugin\unityrunner.xml:260: Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1180)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:935)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.Main.start(Main.java:198)
at org.apache.tools.ant.Main.main(Main.java:286)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)

'Unity' does not show up as a Build Step

'Unity' does not show up as a Build Step. I didn't have any errors in the build, and the plugin shows up in the TeamCity configured plugins list.

This is related to issue 15:
#15

Built with ant 1.9.4 on Windows 8.1 64-bit

IntelliJ compiler errors

Hi!

As I try to compile using IntelliJ I get this errors.
Any idea of how to fix it?
I want to change some stuff for my needs on the plugin and may contribute!

compiler2

Thanks

IDEA massage: Can not to run Ant

Hi,
Tried to install this plugin but then I click on dist to make unityRunner.zip this message poped up: JDK (1.6) needed to run this ANT target is not configured. Please update your settings in the Project | Libraries menu.

Please, help me with it.

Won't find unity install on windows

The plugin fails to find my install of unity on a windows build agent. By the looks of things it has something to do with me running 32-bit java on 64-bit windows with 64-bit unity.

Will investigate further.

Build Path issues in Windows

Hello--
First off, great plugin! Well done.
I have been noticing some issues with setting the Build Path in Windows:
(I have the clearBefore and cleanAfter flags both checked.)

1.) Setting the path with *.exe at the end: (e.g. c:\repo\builds\game.exe) - the first time this runs, it works correctly. Creates the game.exe, folder tree is also correct. The second time it runs, however, it errors:

[Step 1/1] Removing output directory: c:\repo\builds\game.exe
[Step 1/1] java.lang.IllegalArgumentException: c:\repo\builds\game.exe is not a directory

2.) Setting the path without the *.exe at the end (e.g. c:\repos\builds), builds the data directories but upon moving the default exe created errors with:

[Step 1/1] Error building Player: IOException: Failed to Move File / Directory from 'Temp/StagingArea/player_win.exe' to 'c:/repo/builds/'.

The Build Log does not contain Asset Size information

Hello,

I am using your plugin to run automated Unity Builds and it works great. Good job there ! The only thing that I am missing is the fact that in the build log I don't see the information below :

Textures 113.2 mb 19.9%
Meshes 66.8 mb 11.7%
Animations 5.8 mb 1.0%
Sounds 27.3 mb 4.8%
Shaders 5.3 mb 0.9%
Other Assets 7.4 mb 1.3%
Levels 329.1 mb 57.8%
Scripts 4.2 mb 0.7%
Included DLLs 6.4 mb 1.1%
File headers 3.7 mb 0.6%
Complete size 569.0 mb 100.0%

And all the assets sorted by uncompressed size

Do you have any clue why that is not present in my logs ? Do I have to set up the runner in a specific way ?

http://i.imgur.com/WYCBBHR.png

That's how my runner is configured :)

Good job with the plugin , really appreciate the work you have done.

PS : I did check the Log file after the build has finished and that information is there.

Support multiple versions of unity installed on a single build agent

As we have multiple teams using Unity3d and sharing the build machines, we should allow multiple versions installed at the same time.
Unity has an installer BUT you can rename/move the folder after install.
So we could require all Unity versions to be installed in /Applications/UnityVersions/...
We can then auto detect the actual version from the info.plist file
To specify which version, we can use Agent Requirements and/or a new version parameter on the Unity Runner. This would select a MAJOR and MINOR version number.
The Build Runner can add any number of version parameters as Agent Parameters in the format unity.version.MAJOR.MINOR e.g. unity.version.4.3=4.3.2f4
unity.version.5.1=5.1.0beta4

(MC story TOOL-606)

Android builds?

Can this plugin be used for automating building of Android *.apk files?

Build Extra parameters are enclosed with quote marks

Maybe I'm not understanding why this is, but it seems to me that it's unnecessary to wrap the input from the "Build extra" configuration field in quotes.

e.g. Build extra: -myParam 1 -anotherParam 2

results in the following command with parameters:

Starting: "C:\Program Files (x86)\Unity\Editor\unity.exe" -batchmode -quit -projectPath <...> -executeMethod <...> -cleanedLogFile <...> "-myParam 1 -anotherParam 2"

Wouldn't it be more logical to have the parameters added without those quote marks? In that way we can just search the System.Environment.GetCommandLineArgs directly without an intermediate step in between to split the quoted parameter. This also prevents us from calling any parameters ourselves that haven't been exposed through the configuration, like -buildTarget (even though that can be done through a script via -executeMethod).

Next generation of Unity plugin

From TeamCity team we want to say thanks for all contributors of this plugin. All of you made significant contribution in TeamCity ecosystem.

Since the active development of it is looks suspended and some of our users need support of features from latest Unity releases we've started development of the JetBrains driven Unity plugin:
https://plugins.jetbrains.com/plugin/11453-unity-support

Feel free to try it and contribute in the project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.