mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
groovy-all-*.jar cannot contain 'src' and 'doc'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -60,7 +60,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.arithme
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
import org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfiguration;
|
||||
import org.jetbrains.plugins.groovy.runner.GroovyScriptRunner;
|
||||
import org.jetbrains.plugins.groovy.util.GroovyUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
@@ -219,7 +218,7 @@ public class GradleScriptType extends GroovyScriptType {
|
||||
|
||||
params.setMainClass(findMainClass(gradleHome, script, project));
|
||||
|
||||
final File[] groovyJars = GroovyUtils.getFilesInDirectoryByPattern(gradleHome.getPath() + "/lib/", GroovyConfigUtils.GROOVY_ALL_JAR_PATTERN);
|
||||
final File[] groovyJars = GroovyConfigUtils.getGroovyAllJars(gradleHome.getPath() + "/lib/");
|
||||
if (groovyJars.length > 0) {
|
||||
params.getClassPath().add(groovyJars[0].getAbsolutePath());
|
||||
} else if (module != null) {
|
||||
|
||||
+16
-3
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.util;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -365,9 +380,7 @@ public class GradleInstallationManager {
|
||||
final JarFileSystem jarFileSystem = JarFileSystem.getInstance();
|
||||
List<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
for (File file : libraries) {
|
||||
if (ANY_GRADLE_JAR_FILE_PATTERN.matcher(file.getName()).matches()
|
||||
|| GroovyConfigUtils.GROOVY_ALL_JAR_PATTERN.matcher(file.getName()).matches())
|
||||
{
|
||||
if (ANY_GRADLE_JAR_FILE_PATTERN.matcher(file.getName()).matches() || GroovyConfigUtils.matchesGroovyAll(file.getName())) {
|
||||
final VirtualFile virtualFile = localFileSystem.refreshAndFindFileByIoFile(file);
|
||||
if (virtualFile != null) {
|
||||
ContainerUtil.addIfNotNull(result, jarFileSystem.getJarRootForLocalFile(virtualFile));
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.jetbrains.plugins.groovy.GroovyBundle;
|
||||
import org.jetbrains.plugins.groovy.util.GroovyUtils;
|
||||
import org.jetbrains.plugins.groovy.util.LibrariesUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -45,7 +46,7 @@ import java.util.regex.Pattern;
|
||||
* @author ilyas
|
||||
*/
|
||||
public abstract class GroovyConfigUtils extends AbstractConfigUtils {
|
||||
@NonNls public static final Pattern GROOVY_ALL_JAR_PATTERN = Pattern.compile("groovy-all-(\\d.*)\\.jar");
|
||||
@NonNls private static final Pattern GROOVY_ALL_JAR_PATTERN = Pattern.compile("groovy-all-(\\d.*)\\.jar");
|
||||
|
||||
private static GroovyConfigUtils myGroovyConfigUtils;
|
||||
@NonNls public static final String GROOVY_JAR_PATTERN_NOVERSION = "groovy\\.jar";
|
||||
@@ -69,6 +70,15 @@ public abstract class GroovyConfigUtils extends AbstractConfigUtils {
|
||||
return myGroovyConfigUtils;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File[] getGroovyAllJars(@NotNull String path) {
|
||||
return GroovyUtils.getFilesInDirectoryByPattern(path, GROOVY_ALL_JAR_PATTERN);
|
||||
}
|
||||
|
||||
public static boolean matchesGroovyAll(@NotNull String name) {
|
||||
return GROOVY_ALL_JAR_PATTERN.matcher(name).matches() && !name.contains("src") && !name.contains("doc");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getSDKVersion(@NotNull final String path) {
|
||||
String groovyJarVersion = getSDKJarVersion(path + "/lib", GROOVY_JAR_PATTERN, MANIFEST_PATH);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -126,7 +126,7 @@ public class GantRunner extends GroovyScriptRunner {
|
||||
}
|
||||
|
||||
private static void addGroovyAndAntJars(JavaParameters params, Module module, String gantHome) {
|
||||
final File[] groovyJars = GroovyUtils.getFilesInDirectoryByPattern(gantHome + "/lib/", GroovyConfigUtils.GROOVY_ALL_JAR_PATTERN);
|
||||
final File[] groovyJars = GroovyConfigUtils.getGroovyAllJars(gantHome + "/lib/");
|
||||
if (groovyJars.length > 0) {
|
||||
params.getClassPath().add(groovyJars[0].getAbsolutePath());
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -104,7 +104,7 @@ public abstract class GroovyScriptRunner {
|
||||
final VirtualFile[] files = OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots();
|
||||
for (VirtualFile root : files) {
|
||||
if (root.getName().matches(GroovyConfigUtils.GROOVY_JAR_PATTERN)
|
||||
|| GroovyConfigUtils.GROOVY_ALL_JAR_PATTERN.matcher(root.getName()).matches())
|
||||
|| GroovyConfigUtils.matchesGroovyAll(root.getName()))
|
||||
{
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -88,7 +88,7 @@ public abstract class GroovyUtils {
|
||||
public static File getBundledGroovyJar() {
|
||||
String root = new File(PathUtil.getJarPathForClass(GroovyUtils.class)).isDirectory() ?
|
||||
PluginPathManager.getPluginHomePath("groovy") + "/../../lib/" : PathManager.getHomePath() + "/lib/";
|
||||
final File[] groovyJars = getFilesInDirectoryByPattern(root, GroovyConfigUtils.GROOVY_ALL_JAR_PATTERN);
|
||||
final File[] groovyJars = GroovyConfigUtils.getGroovyAllJars(root);
|
||||
assert groovyJars.length == 1;
|
||||
return groovyJars[0];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 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.
|
||||
@@ -164,7 +164,7 @@ public class LibrariesUtil {
|
||||
private static String getEmbeddableGroovyJar(VirtualFile[] classRoots) {
|
||||
for (VirtualFile file : classRoots) {
|
||||
final String name = file.getName();
|
||||
if (GroovyConfigUtils.GROOVY_ALL_JAR_PATTERN.matcher(name).matches()) {
|
||||
if (GroovyConfigUtils.matchesGroovyAll(name)) {
|
||||
String jarPath = file.getPresentableUrl();
|
||||
File realFile = new File(jarPath);
|
||||
if (realFile.exists()) {
|
||||
|
||||
Reference in New Issue
Block a user