shorten paths in additional command line args for javac (IDEA-97712)

This commit is contained in:
nik
2013-07-24 13:54:42 +04:00
parent a7be42377d
commit bb88c6135e
3 changed files with 44 additions and 1 deletions
@@ -0,0 +1,38 @@
/*
* 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 com.intellij.compiler.impl.javaCompiler.javac;
import com.intellij.openapi.application.PathMacroFilter;
import org.jdom.Attribute;
import org.jdom.Element;
/**
* @author nik
*/
public class JavacConfigurationMacroFilter extends PathMacroFilter {
@Override
public boolean recursePathMacros(Attribute attribute) {
if (attribute.getName().equals("value")) {
Element parent = attribute.getParent();
if (parent != null && "option".equals(parent.getName()) && "ADDITIONAL_OPTIONS_STRING".equals(parent.getAttributeValue("name"))) {
Element grandParent = parent.getParentElement();
return grandParent != null && grandParent.getName().equals("component")
&& grandParent.getAttributeValue("name").equals("JavacSettings");
}
}
return false;
}
}
@@ -15,12 +15,15 @@
*/
package com.intellij.openapi.components.impl;
import com.intellij.application.options.PathMacrosCollector;
import com.intellij.application.options.PathMacrosImpl;
import com.intellij.application.options.ReplacePathToMacroMap;
import com.intellij.openapi.application.PathMacros;
import com.intellij.openapi.components.CompositePathMacroFilter;
import com.intellij.openapi.components.ExpandMacroToPathMap;
import com.intellij.openapi.components.PathMacroManager;
import com.intellij.openapi.components.TrackingPathMacroSubstitutor;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
@@ -37,6 +40,7 @@ import org.jetbrains.jps.model.serialization.PathMacroUtil;
import java.util.*;
public class BasePathMacroManager extends PathMacroManager {
private static CompositePathMacroFilter ourFilter = new CompositePathMacroFilter(Extensions.getExtensions(PathMacrosCollector.MACRO_FILTER_EXTENSION_POINT_NAME));
private PathMacrosImpl myPathMacros;
public BasePathMacroManager(@Nullable PathMacros pathMacros) {
@@ -183,7 +187,7 @@ public class BasePathMacroManager extends PathMacroManager {
@Override
public void collapsePaths(final Element element) {
getReplacePathMap().substitute(element, SystemInfo.isFileSystemCaseSensitive);
getReplacePathMap().substitute(element, SystemInfo.isFileSystemCaseSensitive, false, ourFilter);
}
public int hashCode() {
@@ -223,6 +223,7 @@
serviceImplementation="com.intellij.compiler.impl.rmiCompiler.RmicConfiguration"/>
<projectService serviceInterface="com.intellij.compiler.impl.javaCompiler.jikes.JikesConfiguration"
serviceImplementation="com.intellij.compiler.impl.javaCompiler.jikes.JikesConfiguration"/>
<pathMacroFilter implementation="com.intellij.compiler.impl.javaCompiler.javac.JavacConfigurationMacroFilter"/>
<applicationService serviceInterface="com.intellij.openapi.wm.impl.FrameTitleBuilder"
serviceImplementation="com.intellij.openapi.wm.IdeaFrameTitleBuilder"/>