From 0e182501ec805595d1d2539f6815018d4e9790b1 Mon Sep 17 00:00:00 2001 From: bohdan-harniuk Date: Mon, 30 Aug 2021 14:04:53 +0300 Subject: [PATCH 1/4] Code cleanup before release v4.0.0 --- CHANGELOG.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 971848c2b..8af49add2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0). ## 4.0.0 +### Added + +- Added XML file header include code template in [#615](https://github.com/magento/magento2-phpstorm-plugin/pull/615) +- Added autofocus on a first field for all existent dialogs in [#599](https://github.com/magento/magento2-phpstorm-plugin/pull/599) +- Added Web API generation for the Magento Entity Creator in [#597](https://github.com/magento/magento2-phpstorm-plugin/pull/597) and [#607](https://github.com/magento/magento2-phpstorm-plugin/pull/607) +- Added DI XML plugin type attribute inspections in [#588](https://github.com/magento/magento2-phpstorm-plugin/pull/588) +- Added Web API interface for service (PHP class) generation in [#586](https://github.com/magento/magento2-phpstorm-plugin/pull/586) +- Added DI XML type tag attributes inspections that related to the PHP/Magento types in [#582](https://github.com/magento/magento2-phpstorm-plugin/pull/582) +- Added DI XML preference tag attributes inspections in [#578](https://github.com/magento/magento2-phpstorm-plugin/pull/578) +- Added Web API XML service tag attributes inspections in [#577](https://github.com/magento/magento2-phpstorm-plugin/pull/577) +- Added an error handler to help user with a new bug issue creation on the GitHub side in [#552](https://github.com/magento/magento2-phpstorm-plugin/pull/552) and [#593](https://github.com/magento/magento2-phpstorm-plugin/pull/593) +- Added Web API declaration generation in [#548](https://github.com/magento/magento2-phpstorm-plugin/pull/548) and [#595](https://github.com/magento/magento2-phpstorm-plugin/pull/595) +- Added JS and CSS support for Copy Magento Path action in [#536](https://github.com/magento/magento2-phpstorm-plugin/pull/536) + +### Changed + +- Changed the content of the generated plugin class in [#612](https://github.com/magento/magento2-phpstorm-plugin/pull/612) +- Changed using of hardcoded entity id value into the constant in all files generated by the Entity Creator in [#606](https://github.com/magento/magento2-phpstorm-plugin/pull/606) +- Changed dialog fields validation logic for validation only visible fields on the dialog in [#573](https://github.com/magento/magento2-phpstorm-plugin/pull/573) + +### Fixed + +- Fixed a casting exception in the XML index in [#617](https://github.com/magento/magento2-phpstorm-plugin/pull/617) +- Fixed a bug with plugin generation for complex non-primitive types in [#609](https://github.com/magento/magento2-phpstorm-plugin/pull/609) +- Fixed a bug with the namespace generation in a generated controller in [#571](https://github.com/magento/magento2-phpstorm-plugin/pull/571) +- Fixed a bug with directory validation for the generation dialogues in [#565](https://github.com/magento/magento2-phpstorm-plugin/pull/565) +- Fixed wrong entity data mapper file template position in [#549](https://github.com/magento/magento2-phpstorm-plugin/pull/549) +- Fixed incorrect data saving into table model within editing a table in [#544](https://github.com/magento/magento2-phpstorm-plugin/pull/544) +- Fixed an error when plugin or observer name is not set in [#533](https://github.com/magento/magento2-phpstorm-plugin/pull/533) +- Fixed incorrect duplication warning for disabled plugin in di.xml in [#529](https://github.com/magento/magento2-phpstorm-plugin/pull/529) + ## 3.2.2 ### Fixed From a62459bfacbb10530c5dca0667a1558877cf3eb3 Mon Sep 17 00:00:00 2001 From: bohdan-harniuk Date: Tue, 31 Aug 2021 17:45:15 +0300 Subject: [PATCH 2/4] Upgrade min intellij version to the v.2021.2.1 (org.jetbrains.intellij:1.1.4) --- CHANGELOG.md | 1 - build.gradle | 28 +++++++++---------- .../php/WebApiLinemarkerRegistrarTest.java | 8 +++--- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af49add2..a36472376 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0). ### Added - Added XML file header include code template in [#615](https://github.com/magento/magento2-phpstorm-plugin/pull/615) -- Added autofocus on a first field for all existent dialogs in [#599](https://github.com/magento/magento2-phpstorm-plugin/pull/599) - Added Web API generation for the Magento Entity Creator in [#597](https://github.com/magento/magento2-phpstorm-plugin/pull/597) and [#607](https://github.com/magento/magento2-phpstorm-plugin/pull/607) - Added DI XML plugin type attribute inspections in [#588](https://github.com/magento/magento2-phpstorm-plugin/pull/588) - Added Web API interface for service (PHP class) generation in [#586](https://github.com/magento/magento2-phpstorm-plugin/pull/586) diff --git a/build.gradle b/build.gradle index a75bd1e56..2e5189f46 100644 --- a/build.gradle +++ b/build.gradle @@ -4,10 +4,10 @@ */ plugins { - id 'org.jetbrains.intellij' version '0.7.2' + id 'org.jetbrains.intellij' version '1.1.4' id 'checkstyle' id 'pmd' - id 'org.jetbrains.changelog' version '0.6.2' + id 'org.jetbrains.changelog' version '1.2.1' } repositories { @@ -23,17 +23,17 @@ apply plugin: 'idea' apply plugin: 'groovy' apply plugin: 'org.jetbrains.changelog' -def phpPluginVersion = System.getProperty("phpPluginVersion", "211.6693.111") -def ideaVersion = System.getProperty("ideaVersion", "2021.1") +def phpPluginVersion = System.getProperty("phpPluginVersion", "212.5080.71") +def ideaVersion = System.getProperty("ideaVersion", "2021.2.1") def javaVersion = 11 sourceCompatibility = javaVersion targetCompatibility = javaVersion intellij { - version ideaVersion - type 'IU' - pluginName 'com.magento.idea.magento2plugin' + version = ideaVersion + type = 'IU' + pluginName = 'com.magento.idea.magento2plugin' plugins = [ "com.jetbrains.php:$phpPluginVersion", 'yaml', @@ -41,17 +41,17 @@ intellij { 'properties', 'CSS', 'JavaScriptLanguage', - 'com.intellij.lang.jsgraphql:2.9.1', + 'com.intellij.lang.jsgraphql:3.0.0', 'platform-images', 'copyright' ] - updateSinceUntilBuild false - sameSinceUntilBuild false - downloadSources !Boolean.valueOf(System.getenv('CI')) - sandboxDirectory "${project.rootDir}/.idea-sandbox" + updateSinceUntilBuild = false + sameSinceUntilBuild = false + downloadSources = !Boolean.valueOf(System.getenv('CI')) + sandboxDir = "${project.rootDir}/.idea-sandbox" patchPluginXml { - changeNotes({ changelog.getLatest().toHTML() }) + changeNotes = provider { changelog.getLatest().toHTML() } } } @@ -85,7 +85,7 @@ apply from: "${project.rootDir}/gradle-tasks/staticChecks.gradle" changelog { version = "${project.version}" path = "${project.projectDir}/CHANGELOG.md" - header = { "[${project.version}] - ${getDate()}" } + header = provider { "[${project.version}] - ${getDate()}" } headerParserRegex = ~/(\d+\.)?(\d+\.)?(\*|\d+)/ itemPrefix = "-" keepUnreleasedSection = true diff --git a/tests/com/magento/idea/magento2plugin/linemarker/php/WebApiLinemarkerRegistrarTest.java b/tests/com/magento/idea/magento2plugin/linemarker/php/WebApiLinemarkerRegistrarTest.java index 8b1c20b3f..59ff4d8e8 100644 --- a/tests/com/magento/idea/magento2plugin/linemarker/php/WebApiLinemarkerRegistrarTest.java +++ b/tests/com/magento/idea/magento2plugin/linemarker/php/WebApiLinemarkerRegistrarTest.java @@ -5,7 +5,7 @@ package com.magento.idea.magento2plugin.linemarker.php; -import com.intellij.openapi.application.impl.ApplicationInfoImpl; +import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.magento.idea.magento2plugin.MagentoIcons; import com.magento.idea.magento2plugin.linemarker.LinemarkerFixtureTestCase; @@ -32,8 +32,8 @@ public void testWebApiServiceShouldHaveLinemarker() { // work around for issue caused by // com.magento.idea.magento2plugin.linemarker.xml.LineMarkerXmlTagDecorator // in com.intellij.psi.impl.smartPointers.SmartPsiElementPointerImpl.createElementInfo - final boolean isInStressTestCurrent = ApplicationInfoImpl.isInStressTest(); - ApplicationInfoImpl.setInStressTest(true); + final boolean isInStressTestCurrent = ApplicationManagerEx.isInStressTest(); + ApplicationManagerEx.setInStressTest(true); myFixture.configureByFile(this.getFixturePath("TestService.php", "php")); @@ -54,7 +54,7 @@ public void testWebApiServiceShouldHaveLinemarker() { ); //restore default value - ApplicationInfoImpl.setInStressTest(isInStressTestCurrent); + ApplicationManagerEx.setInStressTest(isInStressTestCurrent); } /** From 74aa694db5f274a405676d8600d37318b6329f8c Mon Sep 17 00:00:00 2001 From: bohdan-harniuk Date: Wed, 1 Sep 2021 14:43:44 +0300 Subject: [PATCH 3/4] Adjusted default code style settings for the unit tests scope --- ...faultCodeStyleSettingsAdjustmentsUtil.java | 38 +++++++++++++++++++ .../generatePluginClassFile/TestPlugin.php | 2 - .../generator/BaseGeneratorTestCase.java | 3 ++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/com/magento/idea/magento2plugin/actions/generation/generator/util/DefaultCodeStyleSettingsAdjustmentsUtil.java diff --git a/src/com/magento/idea/magento2plugin/actions/generation/generator/util/DefaultCodeStyleSettingsAdjustmentsUtil.java b/src/com/magento/idea/magento2plugin/actions/generation/generator/util/DefaultCodeStyleSettingsAdjustmentsUtil.java new file mode 100644 index 000000000..dc9298bf1 --- /dev/null +++ b/src/com/magento/idea/magento2plugin/actions/generation/generator/util/DefaultCodeStyleSettingsAdjustmentsUtil.java @@ -0,0 +1,38 @@ +/* + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +package com.magento.idea.magento2plugin.actions.generation.generator.util; + +import com.intellij.openapi.project.Project; +import com.intellij.psi.codeStyle.CodeStyleSettings; +import com.intellij.psi.codeStyle.CodeStyleSettingsManager; +import com.intellij.psi.codeStyle.CommonCodeStyleSettings; +import org.jetbrains.annotations.NotNull; + +public final class DefaultCodeStyleSettingsAdjustmentsUtil { + + private DefaultCodeStyleSettingsAdjustmentsUtil() { + } + + /** + * Adjust default code style settings for project. + * + * @param project Project + */ + public static void execute(final @NotNull Project project) { + final CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager + .getInstance(project) + .getTemporarySettings(); + + if (codeStyleSettings == null) { + return; + } + final CommonCodeStyleSettings commonPhpSettings = codeStyleSettings + .getCommonSettings("PHP"); + // This value has changed to TRUE by default in the latest releases. + // This is necessary to return the value by default to the previous one. + commonPhpSettings.ALIGN_MULTILINE_PARAMETERS = false; + } +} diff --git a/testData/actions/generation/generator/PluginClassGenerator/generatePluginClassFile/TestPlugin.php b/testData/actions/generation/generator/PluginClassGenerator/generatePluginClassFile/TestPlugin.php index d51c758a9..6494bbd3d 100644 --- a/testData/actions/generation/generator/PluginClassGenerator/generatePluginClassFile/TestPlugin.php +++ b/testData/actions/generation/generator/PluginClassGenerator/generatePluginClassFile/TestPlugin.php @@ -1,9 +1,7 @@ Date: Wed, 1 Sep 2021 17:08:34 +0300 Subject: [PATCH 4/4] Removed unnecessary change from the changed list --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a36472376..ee9563e06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0). - Changed the content of the generated plugin class in [#612](https://github.com/magento/magento2-phpstorm-plugin/pull/612) - Changed using of hardcoded entity id value into the constant in all files generated by the Entity Creator in [#606](https://github.com/magento/magento2-phpstorm-plugin/pull/606) -- Changed dialog fields validation logic for validation only visible fields on the dialog in [#573](https://github.com/magento/magento2-phpstorm-plugin/pull/573) ### Fixed