[groovy] don't use built-in groovy-starter.conf (IDEA-210733)

It adds tools.jar unnecessarily; and it doesn't make sense in environments without full Groovy SDK (e.g. Maven).
This commit is contained in:
Daniil Ovchinnikov
2019-04-16 13:38:04 +03:00
parent ed3ed7dec2
commit da0f985ef8
4 changed files with 16 additions and 49 deletions
@@ -1,23 +0,0 @@
##############################################################################
## ##
## Groovy Classloading Configuration ##
## ##
##############################################################################
##
## $Revision: 9225 $ $Date: 2007-11-15 21:17:45 +0100 (Do, 15 Nov 2007) $
##
## Note: do not add classes from java.lang here. No rt.jar and on some
## platforms no tools.jar
##
## See http://groovy.codehaus.org/api/org/codehaus/groovy/tools/LoaderConfiguration.html
## for the file format
# load required libraries
load !{groovy.home}/lib/*.jar
# load user specific libraries
load !{user.home}/.groovy/lib/*.jar
# tools.jar for ant tasks
load ${tools.jar}
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.gant;
import com.intellij.execution.CantRunException;
@@ -50,6 +50,7 @@ public class GantRunner extends GroovyScriptRunner {
}
}
@Nullable
private static String getGantConfPath(final String gantHome) {
String confPath = FileUtil.toSystemDependentName(gantHome + "/conf/gant-starter.conf");
if (new File(confPath).exists()) {
@@ -70,14 +71,15 @@ public class GantRunner extends GroovyScriptRunner {
setGroovyHome(params, gantHome);
final String confPath = getGantConfPath(gantHome);
params.getVMParametersList().add("-Dgroovy.starter.conf=" + confPath);
if (confPath != null) {
params.getVMParametersList().add("-Dgroovy.starter.conf=" + confPath);
params.getProgramParametersList().add("--conf");
params.getProgramParametersList().add(confPath);
}
params.getVMParametersList().addParametersString(configuration.getVMParameters());
params.setMainClass("org.codehaus.groovy.tools.GroovyStarter");
params.getProgramParametersList().add("--conf");
params.getProgramParametersList().add(confPath);
if (gantHome.contains("grails")) {
params.getClassPath().addAllFiles(GroovyUtils.getFilesInDirectoryByPattern(gantHome + "/lib", ".*\\.jar"));
}
@@ -102,14 +102,16 @@ public class DefaultGroovyScriptRunner extends GroovyScriptRunner {
}
final String confPath = getConfPath(groovyHomeDependentName);
params.getVMParametersList().add("-Dgroovy.starter.conf=" + confPath);
if (confPath != null) {
params.getVMParametersList().add("-Dgroovy.starter.conf=" + confPath);
params.getProgramParametersList().add("--conf");
params.getProgramParametersList().add(confPath);
}
HttpConfigurable.getInstance().getJvmProperties(false, null).forEach(p -> params.getVMParametersList().addProperty(p.first, p.second));
params.setMainClass("org.codehaus.groovy.tools.GroovyStarter");
params.getProgramParametersList().add("--conf");
params.getProgramParametersList().add(confPath);
params.getProgramParametersList().add("--main");
params.getProgramParametersList().add(mainClass);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed 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.
*/
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.runner;
import com.intellij.execution.CantRunException;
@@ -53,13 +39,13 @@ public abstract class GroovyScriptRunner {
return false;
}
@Nullable
protected static String getConfPath(final String groovyHomePath) {
String confpath = FileUtil.toSystemDependentName(groovyHomePath + "/conf/groovy-starter.conf");
if (new File(confpath).exists()) {
return confpath;
}
return getPathInConf("groovy-starter.conf");
return null;
}
public static String getPathInConf(String fileName) {