From 5f0b51d3364fb7e0454a30f52e24b1a5f9383f66 Mon Sep 17 00:00:00 2001 From: Alexander Shestakov Date: Mon, 18 Jun 2018 15:45:29 +0200 Subject: [PATCH] Add lifecycle publish task, update tests for it --- .../gradle/build/UnityBuildPluginIntegrationSpec.groovy | 6 ++++++ .../wooga/gradle/build/unity/UnityBuildPlugin.groovy | 8 +++++++- .../groovy/wooga/gradle/build/UnityBuildPluginSpec.groovy | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/integrationTest/groovy/wooga/gradle/build/UnityBuildPluginIntegrationSpec.groovy b/src/integrationTest/groovy/wooga/gradle/build/UnityBuildPluginIntegrationSpec.groovy index 21f37447..75e76525 100644 --- a/src/integrationTest/groovy/wooga/gradle/build/UnityBuildPluginIntegrationSpec.groovy +++ b/src/integrationTest/groovy/wooga/gradle/build/UnityBuildPluginIntegrationSpec.groovy @@ -226,11 +226,17 @@ class UnityBuildPluginIntegrationSpec extends UnityIntegrationSpec { "check" | "platform" | "environment" | 'iOS' | 'IOSCi' "check" | "platform" | "properties" | 'iOS' | 'IOSCi' "check" | "platform" | "extension" | 'iOS' | 'IOSCi' + "publish" | "platform" | "environment" | 'iOS' | 'IOSCi' + "publish" | "platform" | "properties" | 'iOS' | 'IOSCi' + "publish" | "platform" | "extension" | 'iOS' | 'IOSCi' "assemble" | "environment" | "environment" | 'staging' | 'AndroidStaging' "assemble" | "environment" | "properties" | 'staging' | 'AndroidStaging' "assemble" | "environment" | "extension" | 'staging' | 'AndroidStaging' "check" | "environment" | "environment" | 'staging' | 'AndroidStaging' "check" | "environment" | "properties" | 'staging' | 'AndroidStaging' "check" | "environment" | "extension" | 'staging' | 'AndroidStaging' + "publish" | "environment" | "extension" | 'staging' | 'AndroidStaging' + "publish" | "environment" | "extension" | 'staging' | 'AndroidStaging' + "publish" | "environment" | "extension" | 'staging' | 'AndroidStaging' } } diff --git a/src/main/groovy/wooga/gradle/build/unity/UnityBuildPlugin.groovy b/src/main/groovy/wooga/gradle/build/unity/UnityBuildPlugin.groovy index 025af057..4bab8ebc 100644 --- a/src/main/groovy/wooga/gradle/build/unity/UnityBuildPlugin.groovy +++ b/src/main/groovy/wooga/gradle/build/unity/UnityBuildPlugin.groovy @@ -21,6 +21,7 @@ import org.gradle.api.Action import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.plugins.BasePlugin +import org.gradle.api.publish.plugins.PublishingPlugin import org.gradle.language.base.plugins.LifecycleBasePlugin import wooga.gradle.unity.UnityPlugin import wooga.gradle.build.unity.internal.DefaultUnityBuildPluginExtension @@ -40,7 +41,10 @@ class UnityBuildPlugin implements Plugin { def extension = project.extensions.create(UnityBuildPluginExtension, EXTENSION_NAME, DefaultUnityBuildPluginExtension, project) def exportLifecycleTask = project.tasks.create(EXPORT_ALL_TASK_NAME) - def baseLifecycleTaskNames = [LifecycleBasePlugin.ASSEMBLE_TASK_NAME, LifecycleBasePlugin.CHECK_TASK_NAME, LifecycleBasePlugin.BUILD_TASK_NAME] + def baseLifecycleTaskNames = [LifecycleBasePlugin.ASSEMBLE_TASK_NAME, + LifecycleBasePlugin.CHECK_TASK_NAME, + LifecycleBasePlugin.BUILD_TASK_NAME, + PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME] project.tasks.withType(UnityBuildPlayerTask, new Action() { @Override @@ -53,6 +57,8 @@ class UnityBuildPlugin implements Plugin { } }) + project.tasks.maybeCreate(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME) + project.afterEvaluate { extension.platforms.each { String platform -> def platformLifecycleTask = project.tasks.create("export${platform.capitalize()}") diff --git a/src/test/groovy/wooga/gradle/build/UnityBuildPluginSpec.groovy b/src/test/groovy/wooga/gradle/build/UnityBuildPluginSpec.groovy index dc9f45b1..79a318b3 100644 --- a/src/test/groovy/wooga/gradle/build/UnityBuildPluginSpec.groovy +++ b/src/test/groovy/wooga/gradle/build/UnityBuildPluginSpec.groovy @@ -75,6 +75,14 @@ class UnityBuildPluginSpec extends ProjectSpec { "exportIOS" | DefaultTask "exportAndroid" | DefaultTask "exportWebGL" | DefaultTask + "publish" | DefaultTask + "publishAndroidCi" | DefaultTask + "assemble" | DefaultTask + "assembleAndroidCi" | DefaultTask + "build" | DefaultTask + "buildAndroidCi" | DefaultTask + "check" | DefaultTask + "checkAndroidCi" | DefaultTask } @Unroll