mirror of https://github.com/apache/lucene.git
LUCENE-9471: clean up task and global temporary junk files (workaround). (#1767)
This commit is contained in:
parent
2f37f40171
commit
581e836569
|
@ -153,3 +153,4 @@ apply from: file('gradle/documentation/markdown.gradle')
|
||||||
apply from: file('gradle/documentation/render-javadoc.gradle')
|
apply from: file('gradle/documentation/render-javadoc.gradle')
|
||||||
|
|
||||||
apply from: file('gradle/hacks/findbugs.gradle')
|
apply from: file('gradle/hacks/findbugs.gradle')
|
||||||
|
apply from: file('gradle/hacks/gradle.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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// See LUCENE-9471. We redirect temporary location for gradle
|
||||||
|
// so that it doesn't pollute user's tmp. Wipe it during a clean though.
|
||||||
|
|
||||||
|
configure(rootProject) {
|
||||||
|
task cleanGradleTmp(type: Delete) {
|
||||||
|
delete fileTree(".gradle/tmp").matching {
|
||||||
|
include "gradle-worker-classpath*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
clean.dependsOn cleanGradleTmp
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we clean up after running tests.
|
||||||
|
allprojects {
|
||||||
|
plugins.withType(JavaPlugin) {
|
||||||
|
def temps = []
|
||||||
|
|
||||||
|
task cleanTaskTmp() {
|
||||||
|
doLast {
|
||||||
|
temps.each { temp ->
|
||||||
|
project.delete fileTree(temp).matching {
|
||||||
|
include "jar_extract*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(Test) {
|
||||||
|
finalizedBy rootProject.cleanGradleTmp, cleanTaskTmp
|
||||||
|
temps += temporaryDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -102,12 +102,21 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# LUCENE-9471: workaround for gradle leaving junk temp. files behind.
|
||||||
|
GRADLE_TEMPDIR=$APP_HOME/.gradle/tmp
|
||||||
|
mkdir -p $GRADLE_TEMPDIR
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
GRADLE_TEMPDIR=`cygpath --path --mixed "$GRADLE_TEMPDIR"`
|
||||||
|
fi
|
||||||
|
DEFAULT_JVM_OPTS="$DEFAULT_JVM_OPTS \"-Djava.io.tmpdir=$GRADLE_TEMPDIR\""
|
||||||
|
|
||||||
# LUCENE-9266: verify and download the gradle wrapper jar if we don't have one.
|
# LUCENE-9266: verify and download the gradle wrapper jar if we don't have one.
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
fi
|
fi
|
||||||
GRADLE_WRAPPER_JAR=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
GRADLE_WRAPPER_JAR=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
if ! $JAVACMD --source 11 $APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java $GRADLE_WRAPPER_JAR ; then
|
if ! $JAVACMD --source 11 $APP_HOME/buildSrc/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java $GRADLE_WRAPPER_JAR ; then
|
||||||
|
echo "\nSomething went wrong. Make sure you're using Java 11 or later."
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,11 @@ set APP_HOME=%DIRNAME%
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem LUCENE-9471: workaround for gradle leaving junk temp. files behind.
|
||||||
|
SET GRADLE_TEMPDIR=%DIRNAME%\.gradle\tmp
|
||||||
|
IF NOT EXIST "%GRADLE_TEMPDIR%" MKDIR %GRADLE_TEMPDIR%
|
||||||
|
SET DEFAULT_JVM_OPTS=%DEFAULT_JVM_OPTS% -Djava.io.tmpdir=%GRADLE_TEMPDIR%
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue