mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -172,7 +172,7 @@ libraryLicense(name: "Apache Sanselan", libraryName: "Sanselan", version: "0.98"
|
||||
libraryLicense(name: "Automaton", libraryName: "automaton.jar", version: "1.11", license: "BSD", url: "http://www.brics.dk/automaton/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php")
|
||||
libraryLicense(name: "DTDParser", version: "1.13", license: "LGPL", url: "http://sourceforge.net/projects/dtdparser/", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1")
|
||||
libraryLicense(name: "Ganymed", version: "bundled with SVNKit", libraryName: "svnkit.jar", license: "BSD", url: "http://www.ganymed.ethz.ch/ssh2/", licenseUrl: "http://www.ganymed.ethz.ch/ssh2/LICENSE.txt")
|
||||
libraryLicense(name: "sqljet", version: "bundled with SVNKit", libraryName: "sqljet.jar", license: "GPLv2", url: "http://sqljet.com", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1")
|
||||
libraryLicense(name: "sqljet", version: "bundled with SVNKit", libraryName: "sqljet_fix.jar", license: "GPLv2", url: "http://sqljet.com", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1")
|
||||
libraryLicense(name: "svnkit-javahl", version: "bundled with SVNKit", libraryName: "svnkit-javahl.jar", license: "link (commercial license)", url: "http://www.svnkit.com/", licenseUrl: "http://svnkit.com/license.html")
|
||||
libraryLicense(name: "javahl", version: "1.7.2", libraryName: "javahl.jar", license: "Apache", url: "http://subversion.apache.org", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
|
||||
libraryLicense(name: "Apache Commons HTTPClient", libraryName: "httpclient-4.1.1.jar", version:"4.1.1", license: "Apache 2.0",
|
||||
|
||||
@@ -334,19 +334,36 @@ public abstract class DebuggerUtils {
|
||||
return getSuperType(subType, superType) != null;
|
||||
}
|
||||
|
||||
public static PsiClass findClass(String className, Project project, final GlobalSearchScope scope) {
|
||||
@Nullable
|
||||
public static PsiClass findClass(final String className, Project project, final GlobalSearchScope scope) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
final PsiManager psiManager = PsiManager.getInstance(project);
|
||||
final JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(psiManager.getProject());
|
||||
if (getArrayClass(className) != null) {
|
||||
return JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory().getArrayClass(LanguageLevelProjectExtension.getInstance(psiManager.getProject()).getLanguageLevel());
|
||||
return javaPsiFacade.getElementFactory().getArrayClass(LanguageLevelProjectExtension.getInstance(psiManager.getProject()).getLanguageLevel());
|
||||
}
|
||||
if(project.isDefault()) {
|
||||
return null;
|
||||
}
|
||||
final String _className = className.replace('$', '.');
|
||||
final PsiClass aClass = JavaPsiFacade.getInstance(psiManager.getProject()).findClass(_className, scope);
|
||||
if (aClass == null && scope != GlobalSearchScope.allScope(project)) {
|
||||
return JavaPsiFacade.getInstance(psiManager.getProject()).findClass(_className, GlobalSearchScope.allScope(project));
|
||||
PsiClass aClass = javaPsiFacade.findClass(_className, scope);
|
||||
if (aClass == null) {
|
||||
if (!_className.equals(className)) {
|
||||
// try original name if it differs from the normalized name
|
||||
aClass = javaPsiFacade.findClass(className, scope);
|
||||
}
|
||||
}
|
||||
if (aClass == null) {
|
||||
final GlobalSearchScope globalScope = GlobalSearchScope.allScope(project);
|
||||
if (!globalScope.equals(scope)) {
|
||||
aClass = javaPsiFacade.findClass(_className, globalScope);
|
||||
if (aClass == null) {
|
||||
if (!_className.equals(className)) {
|
||||
// try original name with global scope if the original differs from the normalized name
|
||||
aClass = javaPsiFacade.findClass(className, globalScope);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return aClass;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ import com.intellij.ui.popup.PopupUpdateProcessor;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usages.*;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.diff.Diff;
|
||||
import com.intellij.util.diff.FilesTooBigForDiffException;
|
||||
@@ -195,7 +196,7 @@ public abstract class ChooseByNameBase {
|
||||
}
|
||||
|
||||
public boolean isSearchInAnyPlace() {
|
||||
return mySearchInAnyPlace;
|
||||
return PlatformUtils.isCidr() || mySearchInAnyPlace;
|
||||
}
|
||||
|
||||
public void setSearchInAnyPlace(boolean searchInAnyPlace) {
|
||||
|
||||
+24
-6
@@ -19,6 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -32,10 +33,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class DefaultChooseByNameItemProvider implements ChooseByNameItemProvider {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.gotoByName.ChooseByNameIdea");
|
||||
@@ -53,21 +51,41 @@ public class DefaultChooseByNameItemProvider implements ChooseByNameItemProvider
|
||||
Processor<Object> consumer) {
|
||||
String namePattern = getNamePattern(base, pattern);
|
||||
String qualifierPattern = getQualifierPattern(base, pattern);
|
||||
String modifiedNamePattern = null;
|
||||
|
||||
if (base.isSearchInAnyPlace() && !namePattern.trim().isEmpty()) {
|
||||
namePattern = "*" + namePattern + "*";
|
||||
modifiedNamePattern = "*" + namePattern + "*";
|
||||
}
|
||||
|
||||
boolean empty = namePattern.isEmpty() || namePattern.equals("@"); // TODO[yole]: remove implicit dependency
|
||||
if (empty && !base.canShowListForEmptyPattern()) return;
|
||||
|
||||
List<String> namesList = new ArrayList<String>();
|
||||
getNamesByPattern(base, base.getNames(everywhere), cancelled, namesList, namePattern);
|
||||
String[] names = base.getNames(everywhere);
|
||||
getNamesByPattern(base, names, cancelled, namesList, namePattern);
|
||||
if (cancelled.compute()) {
|
||||
throw new ProcessCanceledException();
|
||||
}
|
||||
sortNamesList(namePattern, namesList);
|
||||
|
||||
if (modifiedNamePattern != null) {
|
||||
final Set<String> matched = new HashSet<String>(namesList);
|
||||
List<String> additionalNamesList = new ArrayList<String>();
|
||||
namePattern = modifiedNamePattern;
|
||||
getNamesByPattern(base, names, cancelled, additionalNamesList, namePattern);
|
||||
additionalNamesList = ContainerUtil.filter(additionalNamesList, new Condition<String>() {
|
||||
@Override
|
||||
public boolean value(String name) {
|
||||
return !matched.contains(name);
|
||||
}
|
||||
});
|
||||
sortNamesList(namePattern, additionalNamesList);
|
||||
namesList.addAll(additionalNamesList);
|
||||
}
|
||||
|
||||
if (cancelled.compute()) {
|
||||
throw new ProcessCanceledException();
|
||||
}
|
||||
|
||||
List<Object> sameNameElements = new SmartList<Object>();
|
||||
|
||||
|
||||
@@ -40,43 +40,46 @@ public abstract class IndentationParser implements PsiParser {
|
||||
// EOL
|
||||
if (type == myEolTokenType) {
|
||||
// Handle variant with several EOLs
|
||||
if (startLineMarker == null){
|
||||
if (startLineMarker == null) {
|
||||
startLineMarker = builder.mark();
|
||||
}
|
||||
eolSeen = true;
|
||||
} else
|
||||
|
||||
// Indent
|
||||
{
|
||||
if (type == myIndentTokenType){
|
||||
}
|
||||
else {
|
||||
if (type == myIndentTokenType) {
|
||||
//noinspection ConstantConditions
|
||||
currentIndent = builder.getTokenText().length();
|
||||
} else
|
||||
|
||||
if (eolSeen) {
|
||||
if (startLineMarker != null){
|
||||
startLineMarker.rollbackTo();
|
||||
startLineMarker = null;
|
||||
}
|
||||
else {
|
||||
if (!eolSeen && !stack.isEmpty() && currentIndent > 0 && currentIndent < stack.peek().first) {
|
||||
// sometimes we do not have EOL between indents
|
||||
eolSeen = true;
|
||||
}
|
||||
// Close indentation blocks
|
||||
while (!stack.isEmpty() && currentIndent < stack.peek().first){
|
||||
stack.pop().second.done(myBlockElementType);
|
||||
}
|
||||
|
||||
if (!stack.isEmpty()) {
|
||||
final Pair<Integer, PsiBuilder.Marker> pair = stack.peek();
|
||||
if (currentIndent == pair.first) {
|
||||
if (eolSeen) {
|
||||
if (startLineMarker != null) {
|
||||
startLineMarker.rollbackTo();
|
||||
startLineMarker = null;
|
||||
}
|
||||
// Close indentation blocks
|
||||
while (!stack.isEmpty() && currentIndent < stack.peek().first){
|
||||
stack.pop().second.done(myBlockElementType);
|
||||
passEOLsAndIndents(builder);
|
||||
stack.push(Pair.create(currentIndent, builder.mark()));
|
||||
}
|
||||
if (currentIndent > pair.first) {
|
||||
passEOLsAndIndents(builder);
|
||||
stack.push(Pair.create(currentIndent, builder.mark()));
|
||||
|
||||
if (!stack.isEmpty()) {
|
||||
final Pair<Integer, PsiBuilder.Marker> pair = stack.peek();
|
||||
if (currentIndent == pair.first) {
|
||||
stack.pop().second.done(myBlockElementType);
|
||||
passEOLsAndIndents(builder);
|
||||
stack.push(Pair.create(currentIndent, builder.mark()));
|
||||
}
|
||||
if (currentIndent > pair.first) {
|
||||
passEOLsAndIndents(builder);
|
||||
stack.push(Pair.create(currentIndent, builder.mark()));
|
||||
}
|
||||
}
|
||||
eolSeen = false;
|
||||
currentIndent = 0;
|
||||
}
|
||||
eolSeen = false;
|
||||
currentIndent = 0;
|
||||
}
|
||||
}
|
||||
advanceLexer(builder);
|
||||
|
||||
+12
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package com.intellij.profile.codeInspection.ui;
|
||||
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.codeInspection.ex.Descriptor;
|
||||
import com.intellij.codeInspection.ex.ScopeToolState;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
@@ -108,4 +109,15 @@ public class InspectionConfigTreeNode extends CheckedTreeNode {
|
||||
public void dropCache() {
|
||||
myProperSetting.drop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (userObject instanceof Descriptor) {
|
||||
final String displayNameByKey = HighlightDisplayKey.getDisplayNameByKey(((Descriptor)userObject).getKey());
|
||||
if (displayNameByKey != null) {
|
||||
return displayNameByKey;
|
||||
}
|
||||
}
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
+17
-1
@@ -71,6 +71,8 @@ import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.refactoring.util.CommonRefactoringUtil;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
import com.intellij.util.Query;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import com.intellij.util.ui.PositionTracker;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -220,8 +222,22 @@ public abstract class InplaceRefactoring {
|
||||
return new MyLookupExpression(getInitialName(), myNameSuggestions, myElementToRename, shouldSelectAll(), myAdvertisementText);
|
||||
}
|
||||
|
||||
protected boolean acceptReference(PsiReference reference) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Collection<PsiReference> collectRefs(SearchScope referencesSearchScope) {
|
||||
return ReferencesSearch.search(myElementToRename, referencesSearchScope, false).findAll();
|
||||
final Query<PsiReference> search = ReferencesSearch.search(myElementToRename, referencesSearchScope, false);
|
||||
|
||||
final CommonProcessors.CollectProcessor<PsiReference> processor = new CommonProcessors.CollectProcessor<PsiReference>() {
|
||||
@Override
|
||||
protected boolean accept(PsiReference reference) {
|
||||
return acceptReference(reference);
|
||||
}
|
||||
};
|
||||
|
||||
search.forEach(processor);
|
||||
return processor.getResults();
|
||||
}
|
||||
|
||||
protected boolean buildTemplateAndStart(final Collection<PsiReference> refs,
|
||||
|
||||
@@ -129,10 +129,8 @@ public class SafeDeleteHandler implements RefactoringActionHandler {
|
||||
|
||||
};
|
||||
|
||||
if (elementsToDelete.length > 0) {
|
||||
SafeDeleteDialog dialog = new SafeDeleteDialog(project, elementsToDelete, callback);
|
||||
dialog.show();
|
||||
}
|
||||
SafeDeleteDialog dialog = new SafeDeleteDialog(project, elementsToDelete, callback);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ public class AndroidApkBuilder {
|
||||
}
|
||||
final String zipAlignPath = sdkPath + File.separator + AndroidCommonUtils.toolPath(SdkConstants.FN_ZIPALIGN);
|
||||
boolean withAlignment = new File(zipAlignPath).exists();
|
||||
String unalignedApk = finalApk + UNALIGNED_SUFFIX;
|
||||
String unalignedApk = AndroidCommonUtils.addSuffixToFileName(finalApk, UNALIGNED_SUFFIX);
|
||||
|
||||
Map<AndroidCompilerMessageKind, List<String>> map2 = filterUsingKeystoreMessages(
|
||||
finalPackage(dexPath, sourceRoots, externalJars, nativeLibsFolders, withAlignment ? unalignedApk : finalApk, resPackagePath,
|
||||
|
||||
@@ -516,4 +516,15 @@ public class AndroidCommonUtils {
|
||||
}
|
||||
return result.toArray(new File[result.size()]);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String addSuffixToFileName(@NotNull String path, @NotNull String suffix) {
|
||||
final int dot = path.lastIndexOf('.');
|
||||
if (dot < 0) {
|
||||
return path + suffix;
|
||||
}
|
||||
final String a = path.substring(0, dot);
|
||||
final String b = path.substring(dot);
|
||||
return a + suffix + b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,11 +110,9 @@ public class AndroidDexBuilder extends ProjectLevelBuilder {
|
||||
}
|
||||
|
||||
final ProjectPaths projectPaths = context.getProjectPaths();
|
||||
final File dexOutputDir = AndroidJpsUtil.getOutputDirectoryForPackagedFiles(projectPaths, module);
|
||||
|
||||
File dexOutputDir = AndroidJpsUtil.getDirectoryForIntermediateArtifacts(context, module);
|
||||
dexOutputDir = AndroidJpsUtil.createDirIfNotExist(dexOutputDir, context, BUILDER_NAME);
|
||||
if (dexOutputDir == null) {
|
||||
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, AndroidJpsBundle
|
||||
.message("android.jps.errors.output.dir.not.specified", module.getName())));
|
||||
success = false;
|
||||
continue;
|
||||
}
|
||||
@@ -125,7 +123,7 @@ public class AndroidDexBuilder extends ProjectLevelBuilder {
|
||||
.message("android.jps.warnings.dex.no.compiled.files", module.getName())));
|
||||
continue;
|
||||
}
|
||||
final Set<String> externalLibraries = AndroidJpsUtil.getExternalLibraries(projectPaths, module, platform);
|
||||
final Set<String> externalLibraries = AndroidJpsUtil.getExternalLibraries(context, module, platform);
|
||||
|
||||
boolean includeSystemProguardCfg = false;
|
||||
String proguardCfgPath = context.getBuilderParameter(AndroidCommonUtils.PROGUARD_CFG_PATH_OPTION);
|
||||
@@ -175,7 +173,7 @@ public class AndroidDexBuilder extends ProjectLevelBuilder {
|
||||
fileSet.addAll(externalLibraries);
|
||||
jars.addAll(externalLibraries);
|
||||
|
||||
AndroidJpsUtil.processClasspath(projectPaths, module, new AndroidDependencyProcessor() {
|
||||
AndroidJpsUtil.processClasspath(context, module, new AndroidDependencyProcessor() {
|
||||
@Override
|
||||
public void processExternalLibrary(@NotNull File file) {
|
||||
fileSet.add(file.getPath());
|
||||
@@ -372,7 +370,6 @@ public class AndroidDexBuilder extends ProjectLevelBuilder {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ProjectPaths paths = context.getProjectPaths();
|
||||
final Set<String> classFilesDirs = new HashSet<String>();
|
||||
final Set<String> libClassFilesDirs = new HashSet<String>();
|
||||
final Set<String> outputDirs = new HashSet<String>();
|
||||
@@ -380,7 +377,7 @@ public class AndroidDexBuilder extends ProjectLevelBuilder {
|
||||
AndroidJpsUtil.addSubdirectories(classesDir, classFilesDirs);
|
||||
outputDirs.add(classesDir.getPath());
|
||||
|
||||
AndroidJpsUtil.processClasspath(paths, module, new AndroidDependencyProcessor() {
|
||||
AndroidJpsUtil.processClasspath(context, module, new AndroidDependencyProcessor() {
|
||||
|
||||
@Override
|
||||
public void processAndroidLibraryOutputDirectory(@NotNull File dir) {
|
||||
|
||||
@@ -37,7 +37,8 @@ class AndroidJpsUtil {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.android.AndroidJpsUtil");
|
||||
|
||||
@NonNls public static final String ANDROID_STORAGE_DIR = "android";
|
||||
@NonNls private static final String RESOURCE_CACHE_STORAGE = "res-cache";
|
||||
@NonNls private static final String RESOURCE_CACHE_STORAGE = "res_cache";
|
||||
@NonNls private static final String INTERMEDIATE_ARTIFACTS_STORAGE = "intermediate_artifacts";
|
||||
|
||||
public static final Condition<File> CLASSES_AND_JARS_FILTER = new Condition<File>() {
|
||||
@Override
|
||||
@@ -142,10 +143,23 @@ class AndroidJpsUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File getDirectoryForIntermediateArtifacts(@NotNull CompileContext context,
|
||||
@NotNull Module module) {
|
||||
final File androidStorage = new File(context.getDataManager().getDataStorageRoot(), ANDROID_STORAGE_DIR);
|
||||
return new File(new File(androidStorage, INTERMEDIATE_ARTIFACTS_STORAGE), module.getName());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static File getOutputDirectoryForPackagedFiles(@NotNull ProjectPaths paths, @NotNull Module module) {
|
||||
// todo: return build directory for mavenized modules to place .dex and .apk files into target dir (not target/classes)
|
||||
return paths.getModuleOutputDir(module, false);
|
||||
public static File createDirIfNotExist(@NotNull File dir, @NotNull CompileContext context, @NotNull String compilerName) {
|
||||
if (!dir.exists()) {
|
||||
if (!dir.mkdirs()) {
|
||||
context.processMessage(new CompilerMessage(compilerName, BuildMessage.Kind.ERROR,
|
||||
AndroidJpsBundle.message("android.jps.cannot.create.directory", dir.getPath())));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
public static void addSubdirectories(@NotNull File baseDir, @NotNull Collection<String> result) {
|
||||
@@ -162,7 +176,9 @@ class AndroidJpsUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<String> getExternalLibraries(@NotNull ProjectPaths paths, @NotNull Module module, @NotNull AndroidPlatform platform) {
|
||||
public static Set<String> getExternalLibraries(@NotNull CompileContext context,
|
||||
@NotNull Module module,
|
||||
@NotNull AndroidPlatform platform) {
|
||||
final Set<String> result = new HashSet<String>();
|
||||
final AndroidDependencyProcessor processor = new AndroidDependencyProcessor() {
|
||||
@Override
|
||||
@@ -175,7 +191,7 @@ class AndroidJpsUtil {
|
||||
return type == AndroidDependencyType.EXTERNAL_LIBRARY;
|
||||
}
|
||||
};
|
||||
processClasspath(paths, module, processor);
|
||||
processClasspath(context, module, processor);
|
||||
addAnnotationsJarIfNecessary(platform, result);
|
||||
return result;
|
||||
}
|
||||
@@ -191,18 +207,21 @@ class AndroidJpsUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void processClasspath(@NotNull ProjectPaths paths, @NotNull Module module, @NotNull AndroidDependencyProcessor processor) {
|
||||
processClasspath(paths, module, processor, new HashSet<String>(), false);
|
||||
public static void processClasspath(@NotNull CompileContext context,
|
||||
@NotNull Module module,
|
||||
@NotNull AndroidDependencyProcessor processor) {
|
||||
processClasspath(context, module, processor, new HashSet<String>(), false);
|
||||
}
|
||||
|
||||
private static void processClasspath(@NotNull ProjectPaths paths,
|
||||
@NotNull final Module module,
|
||||
@NotNull final AndroidDependencyProcessor processor,
|
||||
@NotNull final Set<String> visitedModules,
|
||||
final boolean exportedLibrariesOnly) {
|
||||
private static void processClasspath(@NotNull CompileContext context,
|
||||
@NotNull final Module module,
|
||||
@NotNull final AndroidDependencyProcessor processor,
|
||||
@NotNull final Set<String> visitedModules,
|
||||
final boolean exportedLibrariesOnly) {
|
||||
if (!visitedModules.add(module.getName())) {
|
||||
return;
|
||||
}
|
||||
final ProjectPaths paths = context.getProjectPaths();
|
||||
|
||||
if (processor.isToProcess(AndroidDependencyType.EXTERNAL_LIBRARY)) {
|
||||
for (ClasspathItem item : module.getClasspath(ClasspathKind.PRODUCTION_RUNTIME, exportedLibrariesOnly)) {
|
||||
@@ -232,25 +251,29 @@ class AndroidJpsUtil {
|
||||
final boolean depLibrary = depFacet != null && depFacet.isLibrary();
|
||||
final File depClassDir = paths.getModuleOutputDir(depModule, false);
|
||||
|
||||
if (depClassDir != null) {
|
||||
if (depLibrary) {
|
||||
if (processor.isToProcess(AndroidDependencyType.ANDROID_LIBRARY_PACKAGE)) {
|
||||
final File packagedClassesJar = new File(depClassDir, AndroidCommonUtils.CLASSES_JAR_FILE_NAME);
|
||||
if (depLibrary) {
|
||||
if (processor.isToProcess(AndroidDependencyType.ANDROID_LIBRARY_PACKAGE)) {
|
||||
final File intArtifactsDir = getDirectoryForIntermediateArtifacts(context, depModule);
|
||||
final File packagedClassesJar = new File(intArtifactsDir, AndroidCommonUtils.CLASSES_JAR_FILE_NAME);
|
||||
|
||||
if (packagedClassesJar.isFile()) {
|
||||
processor.processAndroidLibraryPackage(packagedClassesJar);
|
||||
}
|
||||
if (packagedClassesJar.isFile()) {
|
||||
processor.processAndroidLibraryPackage(packagedClassesJar);
|
||||
}
|
||||
if (processor.isToProcess(AndroidDependencyType.ANDROID_LIBRARY_OUTPUT_DIRECTORY)) {
|
||||
}
|
||||
if (processor.isToProcess(AndroidDependencyType.ANDROID_LIBRARY_OUTPUT_DIRECTORY)) {
|
||||
if (depClassDir != null && depClassDir.isDirectory()) {
|
||||
processor.processAndroidLibraryOutputDirectory(depClassDir);
|
||||
}
|
||||
}
|
||||
else if (processor.isToProcess(AndroidDependencyType.JAVA_MODULE_OUTPUT_DIR) && depFacet == null && depClassDir.isDirectory()) {
|
||||
// do not support android-app->android-app compile dependencies
|
||||
processor.processJavaModuleOutputDirectory(depClassDir);
|
||||
}
|
||||
}
|
||||
processClasspath(paths, depModule, processor, visitedModules, !depLibrary || exportedLibrariesOnly);
|
||||
else if (processor.isToProcess(AndroidDependencyType.JAVA_MODULE_OUTPUT_DIR) &&
|
||||
depFacet == null &&
|
||||
depClassDir != null &&
|
||||
depClassDir.isDirectory()) {
|
||||
// do not support android-app->android-app compile dependencies
|
||||
processor.processJavaModuleOutputDirectory(depClassDir);
|
||||
}
|
||||
processClasspath(context, depModule, processor, visitedModules, !depLibrary || exportedLibrariesOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-8
@@ -11,8 +11,6 @@ import org.jetbrains.jps.incremental.BuilderCategory;
|
||||
import org.jetbrains.jps.incremental.CompileContext;
|
||||
import org.jetbrains.jps.incremental.ModuleLevelBuilder;
|
||||
import org.jetbrains.jps.incremental.ProjectBuildException;
|
||||
import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
import org.jetbrains.jps.incremental.messages.CompilerMessage;
|
||||
import org.jetbrains.jps.incremental.messages.ProgressMessage;
|
||||
|
||||
import java.io.File;
|
||||
@@ -54,11 +52,9 @@ public class AndroidLibraryPackagingBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
|
||||
final ProjectPaths projectPaths = context.getProjectPaths();
|
||||
final File outputDirectoryForPackagedFiles = AndroidJpsUtil.getOutputDirectoryForPackagedFiles(projectPaths, module);
|
||||
|
||||
if (outputDirectoryForPackagedFiles == null) {
|
||||
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, AndroidJpsBundle
|
||||
.message("android.jps.errors.output.dir.not.specified", module.getName())));
|
||||
File outputDir = AndroidJpsUtil.getDirectoryForIntermediateArtifacts(context, module);
|
||||
outputDir = AndroidJpsUtil.createDirIfNotExist(outputDir, context, BUILDER_NAME);
|
||||
if (outputDir == null) {
|
||||
success = false;
|
||||
continue;
|
||||
}
|
||||
@@ -80,7 +76,7 @@ public class AndroidLibraryPackagingBuilder extends ModuleLevelBuilder {
|
||||
|
||||
if (subdirs.size() > 0) {
|
||||
context.processMessage(new ProgressMessage(AndroidJpsBundle.message("android.jps.progress.library.packaging", module.getName())));
|
||||
final File outputJarFile = new File(outputDirectoryForPackagedFiles, AndroidCommonUtils.CLASSES_JAR_FILE_NAME);
|
||||
final File outputJarFile = new File(outputDir, AndroidCommonUtils.CLASSES_JAR_FILE_NAME);
|
||||
doneSomething = true;
|
||||
try {
|
||||
AndroidCommonUtils.packClassFilesIntoJar(ArrayUtil.EMPTY_STRING_ARRAY, ArrayUtil.toStringArray(subdirs), outputJarFile);
|
||||
|
||||
+15
-10
@@ -333,8 +333,10 @@ public class AndroidPackagingBuilder extends ProjectLevelBuilder {
|
||||
final String[] sourceRoots = AndroidJpsUtil.toPaths(AndroidJpsUtil.getSourceRootsForModuleAndDependencies(module));
|
||||
final ProjectPaths paths = context.getProjectPaths();
|
||||
|
||||
final File outputDir = AndroidJpsUtil.getOutputDirectoryForPackagedFiles(paths, module);
|
||||
if (outputDir == null) {
|
||||
final File intArtifactsDir = AndroidJpsUtil.getDirectoryForIntermediateArtifacts(context, module);
|
||||
|
||||
final File moduleOutputDir = paths.getModuleOutputDir(module, false);
|
||||
if (moduleOutputDir == null) {
|
||||
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, AndroidJpsBundle
|
||||
.message("android.jps.errors.output.dir.not.specified", module.getName())));
|
||||
return false;
|
||||
@@ -345,13 +347,13 @@ public class AndroidPackagingBuilder extends ProjectLevelBuilder {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Set<String> externalJarsSet = AndroidJpsUtil.getExternalLibraries(paths, module, platform);
|
||||
final File resPackage = getPackagedResourcesFile(module, outputDir);
|
||||
final Set<String> externalJarsSet = AndroidJpsUtil.getExternalLibraries(context, module, platform);
|
||||
final File resPackage = getPackagedResourcesFile(module, intArtifactsDir);
|
||||
|
||||
final File classesDexFile = new File(outputDir.getPath(), AndroidCommonUtils.CLASSES_FILE_NAME);
|
||||
final File classesDexFile = new File(intArtifactsDir.getPath(), AndroidCommonUtils.CLASSES_FILE_NAME);
|
||||
|
||||
final String sdkPath = platform.getSdk().getSdkPath();
|
||||
final String outputPath = AndroidJpsUtil.getApkPath(facet, outputDir);
|
||||
final String outputPath = AndroidJpsUtil.getApkPath(facet, moduleOutputDir);
|
||||
if (outputPath == null) {
|
||||
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, AndroidJpsBundle
|
||||
.message("android.jps.errors.cannot.compute.output.apk", module.getName())));
|
||||
@@ -361,7 +363,11 @@ public class AndroidPackagingBuilder extends ProjectLevelBuilder {
|
||||
final String[] nativeLibDirs = collectNativeLibsFolders(facet);
|
||||
|
||||
final String resPackagePath = release ? resPackage.getPath() + RELEASE_SUFFIX : resPackage.getPath();
|
||||
final String outputApkPath = release ? outputPath + UNSIGNED_SUFFIX : outputPath;
|
||||
|
||||
final String outputApkPath = release
|
||||
? AndroidCommonUtils.addSuffixToFileName(outputPath, UNSIGNED_SUFFIX)
|
||||
: outputPath;
|
||||
|
||||
final String classesDexFilePath = classesDexFile.getPath();
|
||||
final String[] externalJars = ArrayUtil.toStringArray(externalJarsSet);
|
||||
|
||||
@@ -474,10 +480,9 @@ public class AndroidPackagingBuilder extends ProjectLevelBuilder {
|
||||
final ArrayList<String> assetsDirPaths = new ArrayList<String>();
|
||||
collectAssetDirs(facet, assetsDirPaths);
|
||||
|
||||
final File outputDir = AndroidJpsUtil.getOutputDirectoryForPackagedFiles(context.getProjectPaths(), module);
|
||||
File outputDir = AndroidJpsUtil.getDirectoryForIntermediateArtifacts(context, module);
|
||||
outputDir = AndroidJpsUtil.createDirIfNotExist(outputDir, context, BUILDER_NAME);
|
||||
if (outputDir == null) {
|
||||
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, AndroidJpsBundle
|
||||
.message("android.jps.errors.output.dir.not.specified", module.getName())));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+25
@@ -91,6 +91,12 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
checkAndroidDependencies(moduleDataMap, context);
|
||||
|
||||
if (context.isProjectRebuild()) {
|
||||
if (!clearAndroidStorages(context, chunk.getModules())) {
|
||||
return ExitCode.ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
final Map<File, Module> idlFilesToCompile = new HashMap<File, Module>();
|
||||
final Map<File, Module> rsFilesToCompile = new HashMap<File, Module>();
|
||||
|
||||
@@ -169,6 +175,18 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
return success ? ExitCode.OK : ExitCode.ABORT;
|
||||
}
|
||||
|
||||
private static boolean clearAndroidStorages(@NotNull CompileContext context, @NotNull Collection<Module> modules) {
|
||||
for (Module module : modules) {
|
||||
final File dir = AndroidJpsUtil.getDirectoryForIntermediateArtifacts(context, module);
|
||||
if (dir.exists() && !FileUtil.delete(dir)) {
|
||||
context.processMessage(
|
||||
new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, AndroidJpsBundle.message("android.jps.cannot.delete", dir.getPath())));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean checkVersions(@NotNull Map<Module, MyModuleData> dataMap, @NotNull CompileContext context) {
|
||||
for (Map.Entry<Module, MyModuleData> entry : dataMap.entrySet()) {
|
||||
final Module module = entry.getKey();
|
||||
@@ -581,6 +599,13 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
success = false;
|
||||
continue;
|
||||
}
|
||||
final File parent = aptOutputDirectory.getParentFile();
|
||||
if (parent != null && !parent.exists() && !parent.mkdirs()) {
|
||||
context.processMessage(new CompilerMessage(ANDROID_APT_COMPILER, BuildMessage.Kind.ERROR, AndroidJpsBundle.message(
|
||||
"android.jps.cannot.create.directory", parent.getPath())));
|
||||
success = false;
|
||||
continue;
|
||||
}
|
||||
if (!FileUtil.moveDirWithContent(tmpOutputDir, aptOutputDirectory)) {
|
||||
context.processMessage(new CompilerMessage(ANDROID_APT_COMPILER, BuildMessage.Kind.ERROR, AndroidJpsBundle
|
||||
.message("android.jps.errors.cannot.move.content", tmpOutputDir.getPath(), aptOutputDirectory.getPath())));
|
||||
|
||||
@@ -117,6 +117,11 @@ public class AndroidAptCompiler implements SourceGeneratingCompiler {
|
||||
context.addMessage(CompilerMessageCategory.ERROR, "Cannot delete directory " + genRootPath, null, -1, -1);
|
||||
continue;
|
||||
}
|
||||
final File parent = genRootDir.getParentFile();
|
||||
if (parent != null && !parent.exists() && !parent.mkdirs()) {
|
||||
context.addMessage(CompilerMessageCategory.ERROR, "Cannot create directory " + parent.getPath(), null, -1, -1);
|
||||
continue;
|
||||
}
|
||||
if (!FileUtil.moveDirWithContent(tmpOutputDir, genRootDir)) {
|
||||
final String message = "Cannot move content from " + tmpOutputDir.getPath() + " to " + genRootPath;
|
||||
context.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
|
||||
|
||||
@@ -235,7 +235,7 @@ public class AndroidPackagingCompiler implements PackagingCompiler {
|
||||
: item.getResPackagePath();
|
||||
|
||||
final String finalPath = unsigned
|
||||
? item.getFinalPath() + UNSIGNED_SUFFIX
|
||||
? AndroidCommonUtils.addSuffixToFileName(item.getFinalPath(), UNSIGNED_SUFFIX)
|
||||
: item.getFinalPath();
|
||||
|
||||
final String[] sourceRoots = AndroidCompileUtil.toOsPaths(item.getSourceRoots());
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ public class UnusedDefInspection extends GroovyLocalInspectionBase {
|
||||
}
|
||||
}
|
||||
else if (element instanceof GrVariable) {
|
||||
toHighlight = ((GrVariable)element).getInitializerGroovy();
|
||||
toHighlight = ((GrVariable)element).getNameIdentifierGroovy();
|
||||
}
|
||||
if (toHighlight == null) toHighlight = element;
|
||||
return toHighlight;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
def m = [a: 1, b: 2]
|
||||
def m1 = <warning descr="Assignment is not used">[a: 1, b: 2]</warning>
|
||||
def <warning descr="Assignment is not used">m1</warning> = [a: 1, b: 2]
|
||||
def val = 'a'
|
||||
|
||||
switch (val) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
def m = [a: 1, b: 2]
|
||||
def m1 = <warning descr="Assignment is not used">[a: 1, b: 2]</warning>
|
||||
def <warning descr="Assignment is not used">m1</warning> = [a: 1, b: 2]
|
||||
def val = 'a'
|
||||
|
||||
switch (val) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
def testV(def variable) {
|
||||
def v = "s"
|
||||
def m="10"
|
||||
def x=<warning descr="Assignment is not used">"10"</warning>
|
||||
def <warning descr="Assignment is not used">x</warning>="10"
|
||||
try {
|
||||
switch (variable) {
|
||||
case 1:
|
||||
|
||||
@@ -13,4 +13,4 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
Class clazz = <warning descr="Assignment is not used">null</warning>
|
||||
Class <warning descr="Assignment is not used">clazz</warning> = null
|
||||
@@ -15,6 +15,6 @@
|
||||
*/
|
||||
def x = new Date()
|
||||
def y = new Date()
|
||||
def z = <warning descr="Assignment is not used">new Date()</warning>
|
||||
def <warning descr="Assignment is not used">z</warning> = new Date()
|
||||
assert false : "should have thrown exception, but returned $x"
|
||||
assert false : "should have thrown exception, but returned ${y}"
|
||||
@@ -19,7 +19,7 @@ class TroubleCase {
|
||||
private Foo<Baz> fooBaz;
|
||||
|
||||
private void troubleMethod(boolean b) {
|
||||
def icDao = <warning descr="Assignment is not used">(b?fooBaz:fooBar)</warning>;
|
||||
def <warning descr="Assignment is not used">icDao</warning> = (b?fooBaz:fooBar);
|
||||
|
||||
for(Object x: new ArrayList()) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.lang.properties.xml;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
* Date: 5/25/12
|
||||
*/
|
||||
public abstract class SoftLazyValue<T> {
|
||||
|
||||
private SoftReference<T> myReference;
|
||||
|
||||
public T getValue() {
|
||||
T t;
|
||||
if (myReference == null || (t = myReference.get()) == null) {
|
||||
t = compute();
|
||||
myReference = new SoftReference<T>(t);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected abstract T compute();
|
||||
}
|
||||
@@ -33,8 +33,25 @@ public class XmlPropertiesFile implements PropertiesFile {
|
||||
|
||||
private static final Key<CachedValue<PropertiesFile>> KEY = Key.create("xml properties file");
|
||||
private final XmlFile myFile;
|
||||
private final List<IProperty> myProperties = new ArrayList<IProperty>();
|
||||
private final MultiMap<String, IProperty> myPropertiesMap = new MultiMap<String, IProperty>();
|
||||
private final SoftLazyValue<MultiMap<String, IProperty>> myPropertiesMap = new SoftLazyValue<MultiMap<String, IProperty>>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected MultiMap<String, IProperty> compute() {
|
||||
XmlTag rootTag = myFile.getRootTag();
|
||||
if (rootTag == null) {
|
||||
return MultiMap.emptyInstance();
|
||||
}
|
||||
|
||||
XmlTag[] entries = rootTag.findSubTags("entry");
|
||||
MultiMap<String, IProperty> map = new MultiMap<String, IProperty>();
|
||||
|
||||
for (XmlTag entry : entries) {
|
||||
XmlProperty property = new XmlProperty(entry, XmlPropertiesFile.this);
|
||||
map.putValue(property.getKey(), property);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
public static PropertiesFile getPropertiesFile(final PsiFile file) {
|
||||
@@ -55,15 +72,6 @@ public class XmlPropertiesFile implements PropertiesFile {
|
||||
|
||||
private XmlPropertiesFile(XmlFile file) {
|
||||
myFile = file;
|
||||
XmlTag rootTag = file.getRootTag();
|
||||
if (rootTag != null) {
|
||||
XmlTag[] entries = rootTag.findSubTags("entry");
|
||||
for (XmlTag entry : entries) {
|
||||
XmlProperty property = new XmlProperty(entry, this);
|
||||
myProperties.add(property);
|
||||
myPropertiesMap.putValue(property.getKey(), property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -75,19 +83,19 @@ public class XmlPropertiesFile implements PropertiesFile {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<IProperty> getProperties() {
|
||||
return myProperties;
|
||||
return new ArrayList<IProperty>(myPropertiesMap.getValue().values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProperty findPropertyByKey(@NotNull @NonNls String key) {
|
||||
Collection<IProperty> properties = myPropertiesMap.get(key);
|
||||
Collection<IProperty> properties = myPropertiesMap.getValue().get(key);
|
||||
return properties.isEmpty() ? null : properties.iterator().next();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<IProperty> findPropertiesByKey(@NotNull @NonNls String key) {
|
||||
return new ArrayList<IProperty>(myPropertiesMap.get(key));
|
||||
return new ArrayList<IProperty>(myPropertiesMap.getValue().get(key));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/sqljet.jar!/" />
|
||||
<root url="jar://$MODULE_DIR$/lib/sqljet_fix.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
||||
Reference in New Issue
Block a user