This plugin provides tasks to run unity batchmode commands in gradle. It runs and reports unity unit-tests and is able to export .unitypackage
files.
build.gradle
plugins {
id 'net.wooga.unity' version '2.4.0'
}
Unity3D > 5.5
build.gradle
plugins {
id "net.wooga.unity" version "2.4.0"
}
unity {
authentication {
username = "username@company.com"
password = "password"
serial = "unityserial"
}
// projectPath = ""
// reportsDir = ""
// unityPath = ""
//autoActivateUnity = true
//autoReturnLicense = true
//assetsDir = "Assets"
//pluginsDir = "Assets/Plugins"
//defaultBuildTarget = "android"
}
exportUnityPackage {
inputFiles file('Assets')
}
task(performBuild, type:wooga.gradle.unity.tasks.Unity) {
args "-executeMethod", "MyEditorScript.PerformBuild"
// projectPath
// buildTarget
// logFile
// quit = true || quit true
// batchMode = true batchMode true
// noGraphics = false noGraphics false
}
task(performMultipleBuilds) {
doLast {
unity.batchMode {
unityPath = project.file("/Applications/Unity-5.5.3f1/Unity.app/Contents/MacOS/Unity")
args "-executeMethod", "MyEditorScript.PerformBuild"
}
unity.batchMode {
unityPath = project.file("/Applications/Unity-5.6.0f3/Unity.app/Contents/MacOS/Unity")
args "-executeMethod", "MyEditorScript.PerformBuild"
}
}
}
//hook up the tasks into the lifecycle
tasks.assemble.dependsOn performBuild
tasks.assemble.dependsOn performMultipleBuilds
tasks.returnUnityLicense.mustRunAfter performMultipleBuilds
Built with Oracle JDK7 Tested with Oracle JDK8
Gradle Version | Works |
---|---|
< 5.1 | |
5.1 | |
5.2 | |
5.3 | |
5.4 | |
5.5 | |
5.6 | |
5.6 | |
6.0 | |
6.1 | |
6.2 | |
6.3 | |
6.4 | |
6.5 | |
6.6 | |
6.6 | |
6.7 | |
6.8 | |
6.9 | |
7.0 |
Copyright 2017 Wooga GmbH
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.