Merge pull request #14451 from andrejserafim/run
Add gradle run command to replace run.bat and run.sh
This commit is contained in:
commit
7034feeceb
|
@ -44,7 +44,7 @@ In order to run Elasticsearch from source without building a package, you can
|
|||
run it using Maven:
|
||||
|
||||
-------------------------------------
|
||||
./run.sh
|
||||
gradle run
|
||||
-------------------------------------
|
||||
|
||||
=== Test case filtering.
|
||||
|
@ -455,5 +455,5 @@ mvn -Dtests.coverage verify jacoco:report
|
|||
|
||||
== Debugging from an IDE
|
||||
|
||||
If you want to run elasticsearch from your IDE, you should execute ./run.sh
|
||||
If you want to run elasticsearch from your IDE, you should execute gradle run
|
||||
It opens a remote debugging port that you can connect with your IDE.
|
||||
|
|
|
@ -199,3 +199,5 @@ task buildSrcEclipse(type: GradleBuild) {
|
|||
}
|
||||
tasks.eclipse.dependsOn(buildSrcEclipse)
|
||||
|
||||
task run(dependsOn: ':distribution:run')
|
||||
|
||||
|
|
|
@ -36,6 +36,9 @@ class ClusterConfiguration {
|
|||
@Input
|
||||
int transportPort = 9500
|
||||
|
||||
@Input
|
||||
boolean daemonize = true
|
||||
|
||||
@Input
|
||||
String jvmArgs = System.getProperty('tests.jvm.argline', '')
|
||||
|
||||
|
|
|
@ -248,17 +248,22 @@ class ClusterFormationTasks {
|
|||
// elasticsearch.bat is spawned as it has no daemon mode
|
||||
return project.tasks.create(name: name, type: DefaultTask, dependsOn: setup) << {
|
||||
// Fall back to Ant exec task as Gradle Exec task does not support spawning yet
|
||||
ant.exec(executable: 'cmd', spawn: true, dir: cwd) {
|
||||
ant.exec(executable: 'cmd', spawn: config.daemonize, dir: cwd) {
|
||||
esEnv.each { key, value -> env(key: key, value: value) }
|
||||
(['/C', 'call', esScript] + esProps).each { arg(value: it) }
|
||||
}
|
||||
esPostStartActions(ant, logger)
|
||||
}
|
||||
} else {
|
||||
List esExecutable = [esScript]
|
||||
if(config.daemonize) {
|
||||
esExecutable.add("-d")
|
||||
}
|
||||
|
||||
return project.tasks.create(name: name, type: Exec, dependsOn: setup) {
|
||||
workingDir cwd
|
||||
executable 'sh'
|
||||
args esScript, '-d' // daemonize!
|
||||
args esExecutable
|
||||
args esProps
|
||||
environment esEnv
|
||||
errorOutput = new ByteArrayOutputStream()
|
||||
|
@ -344,4 +349,4 @@ class ClusterFormationTasks {
|
|||
static File pidFile(File dir) {
|
||||
return new File(dir, 'es.pid')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package org.elasticsearch.gradle.test
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
class RunTask extends DefaultTask {
|
||||
ClusterConfiguration clusterConfig = new ClusterConfiguration(httpPort: 9200, transportPort: 9300, daemonize: false)
|
||||
|
||||
RunTask() {
|
||||
ClusterFormationTasks.setup(project, this, clusterConfig)
|
||||
}
|
||||
}
|
|
@ -136,4 +136,3 @@ if (isEclipse == false || project.path == "${projectsPrefix}:core-tests") {
|
|||
Task copyRestSpec = RestSpecHack.configureTask(project, true)
|
||||
integTest.dependsOn copyRestSpec
|
||||
}
|
||||
|
||||
|
|
|
@ -195,3 +195,5 @@ DependencyLicensesTask.configure(project) {
|
|||
mapping from: /lucene-.*/, to: 'lucene'
|
||||
mapping from: /jackson-.*/, to: 'jackson'
|
||||
}
|
||||
|
||||
task run(type:org.elasticsearch.gradle.test.RunTask){}
|
5
run.bat
5
run.bat
|
@ -1,5 +0,0 @@
|
|||
::
|
||||
:: build zip package, but ensuring its from the current source
|
||||
:: turn off tests and other validation to speed it up
|
||||
:: TODO: can be sped up more, if shading is moved out of core/
|
||||
CALL mvn -am -pl dev-tools,distribution/zip package -DskipTests -Drun -Pdev
|
Loading…
Reference in New Issue