mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-19 13:06:53 +01:00
Add missing scm-integration-test-plugin to scm-it
This commit is contained in:
committed by
René Pfeuffer
parent
cb138a0fc7
commit
dddc36a0ef
@@ -37,11 +37,15 @@ class IntegrationTestPlugin implements Plugin<Project> {
|
||||
it.extension = extension
|
||||
}
|
||||
|
||||
project.tasks.register('prepare-home', PrepareHomeTask) {
|
||||
it.extension = extension
|
||||
}
|
||||
|
||||
project.tasks.register("startScmServer", RunTask) {
|
||||
it.extension = extension
|
||||
it.waitForCompletion = false
|
||||
it.frontend = false
|
||||
dependsOn 'write-server-config'
|
||||
dependsOn 'write-server-config', 'prepare-home'
|
||||
}
|
||||
|
||||
project.tasks.register("stopScmServer", StopScmServer) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.cloudogu.scm
|
||||
|
||||
|
||||
import com.google.common.io.Files
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.tasks.Nested
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
class PrepareHomeTask extends DefaultTask {
|
||||
|
||||
@Nested
|
||||
ScmServerExtension extension
|
||||
|
||||
@OutputDirectory
|
||||
File getPluginFolder() {
|
||||
return new File(extension.getHome(), "plugins")
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void prepareHome() {
|
||||
File pluginFolder = getPluginFolder()
|
||||
if (!pluginFolder.exists() && !pluginFolder.mkdirs()) {
|
||||
throw new GradleException("failed to create plugin folder at ${pluginFolder}")
|
||||
}
|
||||
|
||||
Configuration configuration = extension.getPlugins()
|
||||
if (configuration != null) {
|
||||
List<File> plugins = configuration.resolvedConfiguration
|
||||
.resolvedArtifacts
|
||||
.collect { artifact ->
|
||||
if (artifact.extension == 'smp') {
|
||||
return artifact.file
|
||||
}
|
||||
}.findAll { file ->
|
||||
file != null && file.exists()
|
||||
}
|
||||
plugins.forEach { source ->
|
||||
File target = new File(pluginFolder, source.getName())
|
||||
Files.copy(source, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,9 +44,12 @@ class RunPlugin implements Plugin<Project> {
|
||||
project.tasks.register('write-server-config', WriteServerConfigTask) {
|
||||
it.extension = extension
|
||||
}
|
||||
project.tasks.register('prepare-home', PrepareHomeTask) {
|
||||
it.extension = extension
|
||||
}
|
||||
project.tasks.register("run", RunTask) {
|
||||
it.extension = extension
|
||||
dependsOn 'write-server-config', 'yarnSetup'
|
||||
dependsOn 'write-server-config', 'prepare-home', 'yarnSetup'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ class ScmServerExtension implements Serializable {
|
||||
private boolean liveReload = true
|
||||
private File warFile
|
||||
private File loggingConfiguration
|
||||
private Configuration plugins
|
||||
|
||||
ScmServerExtension(Project project) {
|
||||
this.project = project
|
||||
@@ -113,4 +114,14 @@ class ScmServerExtension implements Serializable {
|
||||
void setLoggingConfiguration(File loggingConfiguration) {
|
||||
this.loggingConfiguration = loggingConfiguration
|
||||
}
|
||||
|
||||
@Optional
|
||||
@Classpath
|
||||
Configuration getPlugins() {
|
||||
return plugins
|
||||
}
|
||||
|
||||
void setPlugins(Configuration plugins) {
|
||||
this.plugins = plugins
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'org.scm-manager.java'
|
||||
id 'org.scm-manager.core-plugins'
|
||||
id 'org.scm-manager.integration-tests'
|
||||
}
|
||||
|
||||
configurations {
|
||||
itWebApp
|
||||
itPlugin
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -50,12 +52,14 @@ dependencies {
|
||||
testImplementation 'org.glassfish:javax.json:1.1.4'
|
||||
|
||||
itWebApp project(path: ':scm-webapp', configuration: 'webapp')
|
||||
itPlugin project(path: ':scm-plugins:scm-integration-test-plugin', configuration: 'smp')
|
||||
}
|
||||
|
||||
scmServer {
|
||||
configuration 'itWebApp'
|
||||
openBrowser = false
|
||||
liveReload = false
|
||||
plugins = configurations.itPlugin
|
||||
}
|
||||
|
||||
test {
|
||||
@@ -67,9 +71,7 @@ task integrationTest(type: Test) {
|
||||
include '**/*ITCase.class'
|
||||
exclude '**/*Test.class'
|
||||
|
||||
dependsOn 'test'
|
||||
doFirst {
|
||||
tasks.getByName('startScmServer').exec()
|
||||
}
|
||||
dependsOn 'test', 'startScmServer'
|
||||
mustRunAfter 'startScmServer'
|
||||
finalizedBy 'stopScmServer'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user