You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2019/05/15 15:29:32 UTC
[lucene-solr] branch jira/SOLR-13452_gradle updated: SOLR-13452: Do
some general cleanup and pull test and implementationTran config into their
own files as well to simplify the main build.gradle.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch jira/SOLR-13452_gradle
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/jira/SOLR-13452_gradle by this push:
new 9471e3e SOLR-13452: Do some general cleanup and pull test and implementationTran config into their own files as well to simplify the main build.gradle.
9471e3e is described below
commit 9471e3edf7eaafb94d91207c4e71e33b3ded2fcc
Author: markrmiller <ma...@apache.org>
AuthorDate: Wed May 15 10:29:13 2019 -0500
SOLR-13452: Do some general cleanup and pull test and implementationTran config into their own files as well to simplify the main build.gradle.
---
build.gradle | 145 ++++++------------------------
buildSrc/common/configure-impltran.gradle | 51 +++++++++++
buildSrc/common/configure-test.gradle | 55 ++++++++++++
buildSrc/{ => ide}/eclipse.gradle | 0
buildSrc/ide/idea.gradle | 20 +++++
solr/test-framework/build.gradle | 5 ++
6 files changed, 157 insertions(+), 119 deletions(-)
diff --git a/build.gradle b/build.gradle
index f073b66..dd3ccdf 100644
--- a/build.gradle
+++ b/build.gradle
@@ -39,8 +39,8 @@ allprojects {
}
task('regenerate') {
- doLast {
- println "regenerate"
+ doFirst {
+ println "--> regenerate"
}
}
@@ -56,52 +56,16 @@ configure(subprojects) { pj ->
plugins.withType(JavaPlugin) {
- test {
-
- systemProperty 'java.security.egd', 'file:/dev/./urandom'
-
- filter {
- includeTestsMatching "*.Test*"
- includeTestsMatching "*.*Test"
- }
-
- // Use UTF-8, don't rely on local platform encoding.
- compileJava.options.encoding = "UTF-8"
- compileTestJava.options.encoding = "UTF-8"
-
- maxHeapSize = "512m"
- // Enable assertions
- jvmArgs += "-ea"
- // Enable assertions in system classes
- jvmArgs += "-esa"
-
- systemProperty 'tests.multiplier', '1'
- systemProperty 'tests.codec', 'random'
- systemProperty 'tests.postingsformat', 'random'
- systemProperty 'tests.docvaluesformat', 'random'
- systemProperty 'tests.locale', 'random'
- systemProperty 'tests.timezone', 'random'
- systemProperty 'tests.directory', 'random'
- systemProperty 'tests.linedocsfile', 'europarl.lines.txt.gz'
- systemProperty 'tests.loggingfile', './lucene/tools/junit4/logging.properties'
- systemProperty 'tests.nightly', 'false'
- systemProperty 'tests.weekly', 'false'
- systemProperty 'tests.monster', 'false'
- systemProperty 'tests.slow', 'false'
- systemProperty 'tests.cleanthreads.sysprop', 'perMethod'
- systemProperty 'tests.verbose', 'false'
- systemProperty 'tests.filterstacks', 'true'
- systemProperty 'tests.asserts', 'true'
- systemProperty 'tempDir', '.out/tests-temp'
- systemProperty 'java.io.tmpdir', '.out/tests-temp'
- }
-
// forbidden apis ...need to exclude hadoop and ...
// pj.plugins.apply(BuildPlugin)
sourceCompatibility = "11"
targetCompatibility = "11"
+ // Use UTF-8, don't rely on local platform encoding.
+ compileJava.options.encoding = "UTF-8"
+ compileTestJava.options.encoding = "UTF-8"
+
sourceSets {
main.java.srcDirs = ['src/java']
main.resources.srcDirs = ['src/resources']
@@ -109,54 +73,13 @@ configure(subprojects) { pj ->
test.resources.srcDirs = ['src/test-files']
}
- dependencies {
- // move to solr testframework
- testRuntimeOnly 'org.apache.logging.log4j:log4j-api'
- testRuntimeOnly 'org.apache.logging.log4j:log4j-core'
- testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
- testRuntimeOnly 'com.lmax:disruptor'
- }
-
-
- // we create new *Tran configurations that are transitive
- // and can be used between modules
- configurations {
-
- implementationTran
- testImplementationTran
-
- implementationTran2
- testImplementationTran2
-
- implementationTran.transitive = true
- testImplementationTran.transitive = true
-
- implementationTran2.transitive = false
- testImplementationTran2.transitive = false
-
- testImplementationTran2.extendsFrom testImplementationTran
- implementationTran2.extendsFrom implementationTran
-
- testImplementation.extendsFrom testImplementationTran2
- implementation.extendsFrom implementationTran2
- }
-
- // make everything else not transitive
- configure(configurations.all.findAll { c -> c.getName() != "implementationTran" && c.getName() != "testImplementationTran" }) {
- transitive = false
- }
+ // configure tests
+ project.apply from: new File(buildSrcDir, "buildSrc/common/configure-test.gradle")
+
+ // we create new implementationTran and testImplementationTran configurations that are
+ // transitive and can be used between modules
+ project.apply from: new File(buildSrcDir, "buildSrc/common/configure-impltran.gradle")
- project.sourceSets.test.setCompileClasspath( project.sourceSets.test.getCompileClasspath().plus(project.configurations.testImplementationTran).plus(project.configurations.implementationTran))
- project.sourceSets.test.setRuntimeClasspath( project.sourceSets.test.getRuntimeClasspath().plus(project.configurations.testImplementationTran).plus(project.configurations.implementationTran))
-
- project.sourceSets.main.setCompileClasspath( project.sourceSets.main.getCompileClasspath().plus(project.configurations.implementationTran))
- project.sourceSets.main.setRuntimeClasspath( project.sourceSets.main.getRuntimeClasspath().plus(project.configurations.implementationTran))
-
-
- configurations.all {
- // TODO: does not belong here
- exclude group: 'org.slf4j', module: 'slf4j-log4j12'
- }
// Custom javac options
tasks.withType(JavaCompile) {
@@ -179,6 +102,16 @@ configure(subprojects) { pj ->
classifier 'sources'
from sourceSets.main.allJava
}
+
+ // configure maven
+ publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ from components.java
+ artifact tasks.sourceJar
+ }
+ }
+ }
}
tasks.withType(Test) {
@@ -199,18 +132,6 @@ configure(subprojects) { pj ->
failFast = true
}
}
-
- plugins.withType(JavaPlugin) {
- // configure maven
- publishing {
- publications {
- mavenJava(MavenPublication) {
- from components.java
- artifact tasks.sourceJar
- }
- }
- }
- }
}
tasks.create('checkWorkingCopy', CheckWorkingCopy, true)
@@ -219,27 +140,13 @@ task checkSourcePatterns(type: org.apache.lucene.gradle.CheckSourcePatterns) {
baseDir = rootProject.projectDir
}
-// setup eclipse
+// setup eclipse and idea
allprojects {
plugins.withType(JavaPlugin) {
- project.apply from: new File(buildSrcDir, "buildSrc/eclipse.gradle")
+ project.apply from: new File(buildSrcDir, "buildSrc/ide/eclipse.gradle")
+ project.apply from: new File(buildSrcDir, "buildSrc/ide/idea.gradle")
}
}
-// turn off idea cycle checking - how to do for eclipse?
-idea.project.ipr {
- // Edit the output *.ipr file before it's written out
- withXml { root ->
- root.asNode().depthFirst().iterator().forEachRemaining { n ->
- if (n.name().equals("annotationProcessing")) {
- n.attributes().remove("enabled")
- n.attributes().remove("useClasspath")
- }
- if (n.name().equals("profile") && n.parent().name().equals("annotationProcessing")) {
- n.attributes().put("enabled", "false")
- }
- }
- }
-
-}
+
diff --git a/buildSrc/common/configure-impltran.gradle b/buildSrc/common/configure-impltran.gradle
new file mode 100644
index 0000000..675bc99
--- /dev/null
+++ b/buildSrc/common/configure-impltran.gradle
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+// we create new *Tran configurations that are transitive
+// and can be used between modules
+
+ configurations {
+
+ implementationTran
+ testImplementationTran
+
+ implementationTran2
+ testImplementationTran2
+
+ implementationTran.transitive = true
+ testImplementationTran.transitive = true
+
+ implementationTran2.transitive = false
+ testImplementationTran2.transitive = false
+
+ testImplementationTran2.extendsFrom testImplementationTran
+ implementationTran2.extendsFrom implementationTran
+
+ testImplementation.extendsFrom testImplementationTran2
+ implementation.extendsFrom implementationTran2
+}
+
+// make everything else not transitive
+configure(configurations.all.findAll { c -> c.getName() != "implementationTran" && c.getName() != "testImplementationTran" }) {
+ transitive = false
+}
+
+project.sourceSets.test.setCompileClasspath( project.sourceSets.test.getCompileClasspath().plus(project.configurations.testImplementationTran).plus(project.configurations.implementationTran))
+project.sourceSets.test.setRuntimeClasspath( project.sourceSets.test.getRuntimeClasspath().plus(project.configurations.testImplementationTran).plus(project.configurations.implementationTran))
+
+project.sourceSets.main.setCompileClasspath( project.sourceSets.main.getCompileClasspath().plus(project.configurations.implementationTran))
+project.sourceSets.main.setRuntimeClasspath( project.sourceSets.main.getRuntimeClasspath().plus(project.configurations.implementationTran))
diff --git a/buildSrc/common/configure-test.gradle b/buildSrc/common/configure-test.gradle
new file mode 100644
index 0000000..cca458b
--- /dev/null
+++ b/buildSrc/common/configure-test.gradle
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+// we create new *Tran configurations that are transitive
+// and can be used between modules
+
+test {
+ systemProperty 'java.security.egd', 'file:/dev/./urandom'
+
+ filter {
+ includeTestsMatching "*.Test*"
+ includeTestsMatching "*.*Test"
+ }
+
+ maxHeapSize = "512m"
+ // Enable assertions
+ jvmArgs += "-ea"
+ // Enable assertions in system classes
+ jvmArgs += "-esa"
+
+ systemProperty 'tests.multiplier', '1'
+ systemProperty 'tests.codec', 'random'
+ systemProperty 'tests.postingsformat', 'random'
+ systemProperty 'tests.docvaluesformat', 'random'
+ systemProperty 'tests.locale', 'random'
+ systemProperty 'tests.timezone', 'random'
+ systemProperty 'tests.directory', 'random'
+ systemProperty 'tests.linedocsfile', 'europarl.lines.txt.gz'
+ systemProperty 'tests.loggingfile', './lucene/tools/junit4/logging.properties'
+ systemProperty 'tests.nightly', 'false'
+ systemProperty 'tests.weekly', 'false'
+ systemProperty 'tests.monster', 'false'
+ systemProperty 'tests.slow', 'false'
+ systemProperty 'tests.cleanthreads.sysprop', 'perMethod'
+ systemProperty 'tests.verbose', 'false'
+ systemProperty 'tests.filterstacks', 'true'
+ systemProperty 'tests.asserts', 'true'
+ systemProperty 'tempDir', '.out/tests-temp'
+ systemProperty 'java.io.tmpdir', '.out/tests-temp'
+}
+
diff --git a/buildSrc/eclipse.gradle b/buildSrc/ide/eclipse.gradle
similarity index 100%
rename from buildSrc/eclipse.gradle
rename to buildSrc/ide/eclipse.gradle
diff --git a/buildSrc/ide/idea.gradle b/buildSrc/ide/idea.gradle
new file mode 100644
index 0000000..9da3ca8
--- /dev/null
+++ b/buildSrc/ide/idea.gradle
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+idea {
+
+}
diff --git a/solr/test-framework/build.gradle b/solr/test-framework/build.gradle
index 1ae06b1..8ea764c 100644
--- a/solr/test-framework/build.gradle
+++ b/solr/test-framework/build.gradle
@@ -57,5 +57,10 @@ dependencies {
testImplementation 'commons-fileupload:commons-fileupload'
testImplementation 'org.apache.commons:commons-lang3'
+
+ testRuntimeOnly 'org.apache.logging.log4j:log4j-api'
+ testRuntimeOnly 'org.apache.logging.log4j:log4j-core'
+ testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
+ testRuntimeOnly 'com.lmax:disruptor'
}
\ No newline at end of file