Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Normalize task names generated by unity plugin #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class PaketUnityIntegrationSpec extends IntegrationSpec {
"project.tasks.getByName(#taskName%%)" | false

unityProjectName = "Test.Project"
taskName = PaketUnityPlugin.INSTALL_TASK_NAME + unityProjectName
taskName = PaketUnityPlugin.generateProjectTaskName(unityProjectName)
dependencyName = "Wooga.TestDependency"
configurationString = baseConfigurationString.replace("#taskName%%", "'${taskName}'")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ import wooga.gradle.paket.unity.tasks.PaketUnityInstall
* Example:
* <pre>
* {@code
* plugins {
* id 'net.wooga.paket-unity' version '0.10.1'
* }
* }
* plugins {* id 'net.wooga.paket-unity' version '0.10.1'
*}*}
* </pre>
*/
class PaketUnityPlugin implements Plugin<Project> {
Expand All @@ -47,6 +45,8 @@ class PaketUnityPlugin implements Plugin<Project> {
static final String EXTENSION_NAME = 'paketUnity'
static final String INSTALL_TASK_NAME = "paketUnityInstall"

static final String taskNameSeparator = "_"

@Override
void apply(Project project) {
this.project = project
Expand Down Expand Up @@ -78,7 +78,7 @@ class PaketUnityPlugin implements Plugin<Project> {
}

extension.paketReferencesFiles.each { referenceFile ->
def task = project.tasks.create(INSTALL_TASK_NAME + referenceFile.parentFile.name, PaketUnityInstall)
def task = project.tasks.create(generateProjectTaskName(referenceFile.parentFile.name), PaketUnityInstall)
task.with {
group = GROUP
description = "Installs dependencies for Unity3d project ${referenceFile.parentFile.name} "
Expand Down Expand Up @@ -110,4 +110,9 @@ class PaketUnityPlugin implements Plugin<Project> {
[paketInstall, paketRestore].each configClosure
}
}

static String generateProjectTaskName(name) {
return (INSTALL_TASK_NAME + name)
.replaceAll(/\./, taskNameSeparator)
}
}