Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vassiliy.Kudryashov
2017-07-21 23:48:29 +03:00
15 changed files with 226 additions and 16 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -89,6 +89,10 @@ class IdeaCommunityProperties extends BaseIdeaProperties {
return new LinuxDistributionCustomizer() {
{
iconPngPath = "$projectHome/platform/icons/src/icon_CE_128.png"
//snapName = "intellij-idea-community"
//snapDescription =
// "The most intelligent Java IDE. Every aspect of IntelliJ IDEA is specifically designed to maximize developer productivity. " +
// "Together, powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience."
}
@Override
+6
View File
@@ -0,0 +1,6 @@
#-----------------------------------------------------------------------
# Snap-specific properties
#-----------------------------------------------------------------------
idea.skip.desktop.entry.step=true
ide.no.platform.update=Snap
+25
View File
@@ -0,0 +1,25 @@
# see platform/build-scripts/.../LinuxDistributionBuilder.groovy
name: $NAME$
version: '$VERSION$'
icon: $NAME$.png
summary: $SUMMARY$
description: $DESCRIPTION$
grade: stable
confinement: classic
architectures: [amd64]
apps:
$NAME$:
command: $SCRIPT$
parts:
common:
plugin: dump
source: dist.all
bins:
plugin: dump
source: dist.unix
jre:
plugin: dump
source: jre
@@ -25,6 +25,8 @@ import com.intellij.codeInsight.template.impl.JavaTemplateUtil;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@@ -60,7 +62,8 @@ public class TypeExpression extends Expression {
@Override
public String toString() {
return myItems.size() == 1 ? super.toString() : type.getPresentableText();
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
return myItems.size() == 1 || settings.isUseFqClassNames() ? super.toString() : type.getPresentableText();
}
};
}
@@ -124,7 +124,7 @@ public class RenameJavaMethodProcessor extends RenameJavaMemberProcessor {
qualifyOuterMemberReferences(outerHides);
qualifyStaticImportReferences(staticImportHides);
if (!method.isConstructor() && method.findDeepestSuperMethods().length == 0) {
if (!method.isConstructor() && method.isPhysical() && method.findDeepestSuperMethods().length == 0) {
PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, true, CommonClassNames.JAVA_LANG_OVERRIDE);
if (annotation != null && annotation.isPhysical()) {
annotation.delete();
@@ -0,0 +1,16 @@
import java.util.ArrayList;
import java.util.Comparator;
public final class Main {
public static void main(final String[] args) {
new ArrayList<Node>().sort(Comparator.comparingInt((N<caret>ode node) -> node.value).reversed());
}
static class Node {
private final int value;
Node(final int value) {
this.value = value;
}
}
}
@@ -26,6 +26,8 @@ import com.intellij.openapi.editor.actionSystem.EditorActionManager
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiMethod
import com.intellij.psi.PsiModifier
import com.intellij.psi.codeStyle.CodeStyleSettings
import com.intellij.psi.codeStyle.CodeStyleSettingsManager
import com.intellij.psi.util.PsiTreeUtil
/**
* @author ven
@@ -173,6 +175,53 @@ class A {
}
void "test use fully qualified names with conflicting imports"() {
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
def fqClassNames = settings.useFqClassNames
try {
settings.setUseFqClassNames(true)
configureFromFileText "a.java", """
import java.awt.List;
class A {
void m(java.util.List<String> list){
fo<caret>o(list);
}
}
"""
TemplateManagerImpl.setTemplateTesting(project, testRootDisposable)
doAction("Create method 'foo'")
def state = TemplateManagerImpl.getTemplateState(getEditor())
def document = getEditor().getDocument()
def offset = getEditor().getCaretModel().getOffset()
ApplicationManager.application.runWriteAction {
def method = PsiTreeUtil.getParentOfType(getFile().findElementAt(offset), PsiMethod.class)
method.getModifierList().setModifierProperty(PsiModifier.STATIC, false)
PsiDocumentManager.getInstance(getFile().project).commitDocument(document)
}
state.gotoEnd(false)
checkResultByText """
import java.awt.List;
class A {
void m(java.util.List<String> list){
foo(list);
}
private void foo(java.util.List<String> list) {
}
}
"""
}
finally {
settings.setUseFqClassNames(fqClassNames)
}
}
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage"
@@ -26,7 +26,7 @@ import java.util.List;
public class RedundantLambdaParameterTypeInspectionTest extends LightCodeInsightFixtureTestCase {
private RedundantLambdaParameterTypeInspection myInspection = new RedundantLambdaParameterTypeInspection();
private final String myIntentionName = "Remove redundant parameter types";
private static final String ourIntentionName = "Remove redundant parameter types";
@Override
protected String getBasePath() {
@@ -91,20 +91,24 @@ public class RedundantLambdaParameterTypeInspectionTest extends LightCodeInsight
assertIntentionNotAvailable();
}
public void _testInChain() { // disabled till the functionality is available
public void testInChain() { // disabled till the functionality is available
doTest();
}
public void testNotApplicableDueToChainedCall() throws Exception {
assertIntentionNotAvailable();
}
private void doTest() {
myFixture.configureByFiles(getTestName(false) + ".java");
final IntentionAction singleIntention = myFixture.findSingleIntention(myIntentionName);
final IntentionAction singleIntention = myFixture.findSingleIntention(ourIntentionName);
myFixture.launchAction(singleIntention);
myFixture.checkResultByFile(getTestName(false) + ".java", getTestName(false) + "_after.java", true);
}
private void assertIntentionNotAvailable() {
myFixture.configureByFiles(getTestName(false) + ".java");
final List<IntentionAction> intentionActions = myFixture.filterAvailableIntentions(myIntentionName);
assertEmpty(myIntentionName + " is not expected", intentionActions);
final List<IntentionAction> intentionActions = myFixture.filterAvailableIntentions(ourIntentionName);
assertEmpty(ourIntentionName + " is not expected", intentionActions);
}
}
@@ -68,6 +68,12 @@ class BuildOptions {
public static final String BUILD_DMG_WITHOUT_BUNDLED_JRE = "intellij.build.dmg.without.bundled.jre"
boolean buildDmgWithoutBundledJre = SystemProperties.getBooleanProperty(BUILD_DMG_WITHOUT_BUNDLED_JRE, SystemProperties.getBooleanProperty("artifact.mac.no.jdk", false))
/**
* Pass 'true' to this system property to produce .snap packages.
* A build configuration should have "docker.version >= 17" in requirements.
*/
boolean buildUnixSnaps = SystemProperties.getBooleanProperty("intellij.build.unix.snaps", false)
/**
* Path to a zip file containing 'production' and 'test' directories with compiled classes of the project modules inside.
*/
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -37,6 +37,12 @@ abstract class LinuxDistributionCustomizer {
*/
boolean buildTarGzWithoutBundledJre = true
/**
* If a .snap package should be produced
*/
String snapName = null
String snapDescription = null
/**
* Name of the root directory inside linux .tar.gz archive
*/
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -15,6 +15,7 @@
*/
package org.jetbrains.intellij.build.impl
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.intellij.build.BuildContext
import org.jetbrains.intellij.build.BuildOptions
import org.jetbrains.intellij.build.JvmArchitecture
@@ -71,6 +72,7 @@ class LinuxDistributionBuilder extends OsSpecificDistributionBuilder {
def jreDirectoryPath = buildContext.bundledJreManager.extractLinuxJre()
if (jreDirectoryPath != null) {
buildTarGz(jreDirectoryPath, osSpecificDistPath)
buildSnapPackage(jreDirectoryPath, osSpecificDistPath)
}
else {
buildContext.messages.info("Skipping building Linux distribution with bundled JRE because JRE archive is missing")
@@ -182,4 +184,86 @@ class LinuxDistributionBuilder extends OsSpecificDistributionBuilder {
buildContext.notifyArtifactBuilt(gzPath)
}
}
private void buildSnapPackage(String jreDirectoryPath, String unixDistPath) {
if (!buildContext.options.buildUnixSnaps || customizer.snapName == null) return
if (StringUtil.isEmpty(customizer.iconPngPath)) buildContext.messages.error("'iconPngPath' not set")
if (StringUtil.isEmpty(customizer.snapDescription)) buildContext.messages.error("'snapDescription' not set")
String snapDir = "${buildContext.paths.buildOutputRoot}/dist.snap"
buildContext.messages.block("Build Linux .snap package") {
buildContext.messages.progress("Preparing files")
def desktopTemplate = "${buildContext.paths.communityHome}/platform/platform-resources/src/entry.desktop"
def ce = buildContext.productProperties.productCode in ["IC", "PC"]
def productName = buildContext.applicationInfo.productName
if (ce && !productName.contains("Community Edition")) productName += " Community Edition" // IdeaApplicationInfo.xml//names@product
buildContext.ant.copy(file: desktopTemplate, tofile: "${snapDir}/snap/gui/${customizer.snapName}.desktop") {
filterset(begintoken: '$', endtoken: '$') {
filter(token: "NAME", value: productName)
filter(token: "ICON", value: "/bin/${buildContext.productProperties.baseFileName}.png")
filter(token: "SCRIPT", value: "/bin/${buildContext.productProperties.baseFileName}.sh")
filter(token: "WM_CLASS", value: "jetbrains-${buildContext.applicationInfo.shortProductName.toLowerCase()}${ce ? "-ce" : ""}")
}
}
buildContext.ant.copy(file: customizer.iconPngPath, tofile: "${snapDir}/${customizer.snapName}.png")
def snapcraftTemplate = "${buildContext.paths.communityHome}/build/snap/snapcraft-template.yaml"
def version = "${buildContext.applicationInfo.majorVersion}.${buildContext.applicationInfo.minorVersion}"
buildContext.ant.copy(file: snapcraftTemplate, tofile: "${snapDir}/snapcraft.yaml") {
filterset(begintoken: '$', endtoken: '$') {
filter(token: "NAME", value: customizer.snapName)
filter(token: "VERSION", value: version)
filter(token: "SUMMARY", value: productName)
filter(token: "DESCRIPTION", value: customizer.snapDescription)
filter(token: "SCRIPT", value: "bin/${buildContext.productProperties.baseFileName}.sh")
}
}
buildContext.ant.concat(destfile: "${unixDistPath}/bin/idea.properties", append: true) {
filelist(dir: "${buildContext.paths.communityHome}/build/snap", files: "idea-snap.properties")
}
buildContext.ant.delete(quiet: true) {
fileset(dir: "${unixDistPath}/bin") {
include(name: "fsnotifier")
include(name: "fsnotifier-arm")
include(name: "libyjpagent-linux.so")
}
}
buildContext.ant.chmod(perm: "755") {
fileset(dir: unixDistPath) {
include(name: "bin/*.sh")
include(name: "bin/*.py")
include(name: "bin/fsnotifier*")
customizer.extraExecutables.each { include(name: it) }
}
fileset(dir: jreDirectoryPath) {
include(name: "jre64/bin/*")
}
}
buildContext.messages.progress("Building package")
buildContext.ant.exec(executable: "docker", dir: snapDir, failonerror: true) {
arg(value: "run")
arg(value: "--volume=${snapDir}:/build")
arg(value: "--volume=${buildContext.paths.distAll}:/build/dist.all:ro")
arg(value: "--volume=${unixDistPath}:/build/dist.unix:ro")
arg(value: "--volume=${jreDirectoryPath}:/build/jre:ro")
arg(value: "--workdir=/build")
arg(value: "--env=SNAPCRAFT_SETUP_CORE=1")
arg(value: "snapcore/snapcraft")
arg(value: "snapcraft")
}
def snapArtifact = "${customizer.snapName}_${version}_amd64.snap"
buildContext.ant.move(file: "${snapDir}/${snapArtifact}", todir: buildContext.paths.artifacts)
buildContext.notifyArtifactBuilt("${buildContext.paths.artifacts}/" + snapArtifact)
}
}
}
@@ -66,6 +66,7 @@ import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
public class AppUIUtil {
private static final String VENDOR_PREFIX = "jetbrains-";
private static final boolean DEBUG_MODE = SystemProperties.getBooleanProperty("idea.debug.mode", false);
private static boolean ourMacDocIconSet = false;
public static void updateWindowIcon(@NotNull Window window) {
ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();
@@ -95,8 +96,9 @@ public class AppUIUtil {
if (!SystemInfo.isMac) {
window.setIconImages(images);
}
else if (DEBUG_MODE) {
else if (DEBUG_MODE && !ourMacDocIconSet) {
MacAppIcon.setDockIcon(ImageUtil.toBufferedImage(images.get(0)));
ourMacDocIconSet = true;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -78,7 +78,12 @@ class PyCharmCommunityProperties extends PyCharmPropertiesBase {
return new LinuxDistributionCustomizer() {
{
iconPngPath = "$projectHome/python/resources/PyCharmCore128.png"
//snapName = "pycharm-community"
//snapDescription =
// "Python IDE for professional developers. Save time while PyCharm takes care of the routine. "
// "Focus on bigger things and embrace the keyboard-centric approach to get the most of PyCharm’s many productivity features."
}
@Override
String getRootDirectoryName(ApplicationInfoProperties applicationInfo, String buildNumber) {
"pycharm-community-${applicationInfo.isEAP ? buildNumber : applicationInfo.fullVersion}"
+3 -3
View File
@@ -18,7 +18,7 @@ if teamcity_presence_env_var not in os.environ:
# anything sent to stdout/stderr goes to IDE directly, not after test is over like it is done by default.
# out and err are not in sync, so output may go to wrong test
JB_DISABLE_BUFFERING = "JB_DISABLE_BUFFERING" in os.environ
PROJECT_DIR = os.getcwd()
def _parse_parametrized(part):
"""
@@ -179,7 +179,7 @@ class NewTeamcityServiceMessages(_old_service_messages):
loc = possible_location.find("(")
if loc > 0:
possible_location = possible_location[:loc].strip()
properties["locationHint"] = "python<{0}>://{1}".format(os.getcwd(), possible_location)
properties["locationHint"] = "python<{0}>://{1}".format(PROJECT_DIR, possible_location)
except KeyError:
# If message does not have name, then it is not test
# Simply pass it
@@ -399,4 +399,4 @@ def jb_doc_args(framework_name, args):
Runner encouraged to report its arguments to user with aid of this function
"""
print("Launching {0} with arguments {1} in {2}\n".format(framework_name, " ".join(args), os.getcwd()))
print("Launching {0} with arguments {1} in {2}\n".format(framework_name, " ".join(args), PROJECT_DIR))
@@ -1,7 +1,7 @@
<component xmlns="http://jetbrains.org/intellij/schema/application-info"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jetbrains.org/intellij/schema/application-info http://jetbrains.org/intellij/schema/ApplicationInfo.xsd">
<version major="2017" minor="2" eap="true"/>
<version major="2017" minor="3" eap="true"/>
<company name="JetBrains s.r.o." url="https://www.jetbrains.com/?fromIDE"/>
<build number="__BUILD_NUMBER__" date="__BUILD_DATE__"/>
<logo url="/pycharm_core_logo.png" textcolor="000000" progressColor="08f5d6" progressX="114" progressY="278" progressHeight="3"/>