mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
removed traces of experiment with jarring module outputs
This commit is contained in:
-68
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 com.intellij.compiler.impl.jarr;
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.make.BuildParticipant;
|
||||
import com.intellij.openapi.compiler.make.BuildParticipantProvider;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.CompilerModuleExtension;
|
||||
import com.intellij.openapi.roots.CompilerProjectExtension;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.elements.ArtifactRootElement;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementFactory;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactImpl;
|
||||
import com.intellij.packaging.impl.artifacts.PlainArtifactType;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class JarBuildParticipantProvider extends BuildParticipantProvider {
|
||||
|
||||
@Override
|
||||
public Collection<? extends BuildParticipant> getParticipants(final Module module) {
|
||||
|
||||
if (!Registry.is("jar.build")) return Collections.emptySet();
|
||||
|
||||
return Collections.singleton(new BuildParticipant() {
|
||||
@Override
|
||||
public Artifact createArtifact(CompileContext context) {
|
||||
|
||||
PackagingElementFactory factory = PackagingElementFactory.getInstance();
|
||||
ArtifactRootElement<?> root = factory.createArtifactRootElement();
|
||||
|
||||
CompositePackagingElement<?> classesJar = factory.createArchive(module.getName() + ".jar");
|
||||
classesJar.addOrFindChild(factory.createModuleOutput(module));
|
||||
String s = CompilerModuleExtension.getInstance(module).getCompilerOutputPathForTests().getPath();
|
||||
classesJar.addOrFindChild(factory.createDirectoryCopyWithParentDirectories(s, ""));
|
||||
root.addOrFindChild(classesJar);
|
||||
|
||||
Project project = module.getProject();
|
||||
VirtualFile output = CompilerProjectExtension.getInstance(project).getCompilerOutput();
|
||||
String path = output == null ? null : output.getPath() + "/jars";
|
||||
return path == null ? null : new ArtifactImpl(module.getName(), PlainArtifactType.getInstance(), false, root, path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,7 +33,6 @@ import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.util.Chunk;
|
||||
import com.intellij.util.JarClasspathHelper;
|
||||
import com.intellij.util.PathsList;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -215,8 +214,6 @@ public class ModuleChunk extends Chunk<Module> {
|
||||
for (final Module module : modules) {
|
||||
Collections.addAll(cpFiles, orderEnumerator(module, exportedOnly, new AfterJdkOrderEntryCondition()).getClassesRoots());
|
||||
}
|
||||
cpFiles = JarClasspathHelper.patchFiles(cpFiles, myContext.getProject());
|
||||
|
||||
return cpFiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 com.intellij.execution.impl;
|
||||
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.execution.configurations.RunProfile;
|
||||
import com.intellij.execution.runners.JavaProgramPatcher;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.JarClasspathHelper;
|
||||
import com.intellij.util.PathsList;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class JarProgramPatcher extends JavaProgramPatcher {
|
||||
|
||||
@Override
|
||||
public void patchJavaParameters(Executor executor, RunProfile configuration, JavaParameters javaParameters) {
|
||||
|
||||
if (!(configuration instanceof RunConfiguration) || !Registry.is("jar.build")) return;
|
||||
|
||||
String path = JarClasspathHelper.getJarsPath(((RunConfiguration)configuration).getProject());
|
||||
if (path == null) return;
|
||||
|
||||
PathsList classPath = javaParameters.getClassPath();
|
||||
List<String> pathList = classPath.getPathList();
|
||||
for (String s: pathList) {
|
||||
String name = new File(s).getName();
|
||||
VirtualFile jarFile = JarClasspathHelper.getJarFile(path, name);
|
||||
if (jarFile != null) {
|
||||
classPath.remove(s);
|
||||
classPath.add(jarFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 com.intellij.util;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.CompilerProjectExtension;
|
||||
import com.intellij.openapi.roots.OrderEnumerator;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.OrderedSet;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class JarClasspathHelper {
|
||||
|
||||
public static OrderedSet<VirtualFile> patchFiles(OrderedSet<VirtualFile> files, Project project) {
|
||||
if (!Registry.is("jar.build")) {
|
||||
return files;
|
||||
}
|
||||
String path = getJarsPath(project);
|
||||
final OrderedSet<VirtualFile> result = new OrderedSet<VirtualFile>(TObjectHashingStrategy.CANONICAL);
|
||||
final Collection<VirtualFile> modulesOutputs =
|
||||
new HashSet<VirtualFile>(Arrays.asList(OrderEnumerator.orderEntries(project).withoutLibraries().withoutSdk().getClassesRoots()));
|
||||
for (VirtualFile file : files) {
|
||||
VirtualFile jar = getJarFile(path, file.getName());
|
||||
if (modulesOutputs.contains(file) && jar != null) {
|
||||
result.add(jar);
|
||||
}
|
||||
else {
|
||||
result.add(file);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile getJarFile(String path, String moduleName) {
|
||||
VirtualFile jar = LocalFileSystem.getInstance().refreshAndFindFileByPath(path + "/" + moduleName + ".jar");
|
||||
System.out.println(jar);
|
||||
return jar;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getJarsPath(Project project) {
|
||||
CompilerProjectExtension extension = CompilerProjectExtension.getInstance(project);
|
||||
if (extension == null) {
|
||||
return null;
|
||||
}
|
||||
VirtualFile output = extension.getCompilerOutput();
|
||||
if (output == null) {
|
||||
return null;
|
||||
}
|
||||
return output.getPath() + "/jars";
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,6 @@ psi.deferIconLoading=true
|
||||
find.search.in.project.files=false
|
||||
|
||||
structureView.coalesceTime=500
|
||||
jar.build=false
|
||||
|
||||
keymap.show.alias.actions=false
|
||||
frameworks.download.libraries.server.url=http://pluginsrepo-test:8080
|
||||
|
||||
@@ -215,9 +215,6 @@
|
||||
<projectService serviceInterface="com.intellij.openapi.roots.ui.configuration.dependencyAnalysis.AnalyzeDependenciesSettings"
|
||||
serviceImplementation="com.intellij.openapi.roots.ui.configuration.dependencyAnalysis.AnalyzeDependenciesSettings"/>
|
||||
|
||||
<compiler.buildParticipantProvider implementation="com.intellij.compiler.impl.jarr.JarBuildParticipantProvider"/>
|
||||
<java.programPatcher implementation="com.intellij.execution.impl.JarProgramPatcher"/>
|
||||
|
||||
<daemon.highlightInfoFilter implementation="com.intellij.debugger.engine.evaluation.DebuggerHighlightFilter"/>
|
||||
<daemon.highlightInfoFilter implementation="com.intellij.codeInsight.daemon.impl.HighlightInfoFilterImpl"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user