Skip to content

Commit

Permalink
#497 | Don't scan CCv2 js-storefront and datahub sub-folders duri…
Browse files Browse the repository at this point in the history
…ng project import/refresh
  • Loading branch information
mlytvyn authored Jul 1, 2023
1 parent 7dad2f9 commit b187901
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## [2023.2.3]

### Features
- Don't scan CCv2 `js-storefront` and `datahub` sub-folders during project import/refresh [#497](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/497)

### `ImpEx` enhancements
- Improved substitution of the `$config-xxx` properties [#496](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/496)

Expand Down
20 changes: 19 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
#
# This file is part of "SAP Commerce Developers Toolset" plugin for Intellij IDEA.
# Copyright (C) 2023 EPAM Systems <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradle.version = 8.1.1

Expand Down Expand Up @@ -26,7 +44,7 @@ intellij.jvm.args=-ea -Xms512m -Xmx3G -XX:MaxMetaspaceSize=400m
intellij.update.since.until.build=true

intellij.plugin.name=SAP-Commerce-Developers-Toolset
intellij.plugin.version=2023.2.2
intellij.plugin.version=2023.2.3
intellij.plugin.since.build=232.7754.73
intellij.plugin.until.build=232.*

Expand Down
2 changes: 2 additions & 0 deletions src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ object HybrisConstants {
@JvmField
val EXCLUDE_GIT_DIRECTORY = FileUtilRt.toSystemDependentName("/.git")
@JvmField
val EXCLUDE_GITHUB_DIRECTORY = FileUtilRt.toSystemDependentName("/.github")
@JvmField
val EXCLUDE_GRADLE_DIRECTORY = FileUtilRt.toSystemDependentName("/.gradle")
@JvmField
val EXCLUDE_TEMP_DIRECTORY = FileUtilRt.toSystemDependentName("/temp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.intellij.idea.plugin.hybris.project.settings.jaxb.localextensions.ScanType;
import com.intellij.idea.plugin.hybris.project.tasks.TaskProgressProcessor;
import com.intellij.idea.plugin.hybris.project.utils.FileUtils;
import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettings;
import com.intellij.idea.plugin.hybris.settings.HybrisApplicationSettingsComponent;
import com.intellij.idea.plugin.hybris.settings.HybrisProjectSettingsComponent;
import com.intellij.openapi.application.ApplicationManager;
Expand Down Expand Up @@ -379,7 +378,7 @@ protected void scanDirectoryForHybrisModules(

this.foundModules.clear();

final HybrisApplicationSettings settings = HybrisApplicationSettingsComponent.getInstance().getState();
final var settings = HybrisApplicationSettingsComponent.getInstance().getState();

final Map<DIRECTORY_TYPE, Set<File>> moduleRootMap = newModuleRootMap();
LOG.info("Scanning for modules");
Expand All @@ -395,21 +394,20 @@ protected void scanDirectoryForHybrisModules(
LOG.info("Scanning for hybris modules out of the project");
this.findModuleRoots(moduleRootMap, false, hybrisDistributionDirectory, progressListenerProcessor);
}
final Set<File> moduleRootDirectories = processDirectoriesByTypePriority(
final var moduleRootDirectories = processDirectoriesByTypePriority(
moduleRootMap,
isScanThroughExternalModule(),
progressListenerProcessor
);

final List<ModuleDescriptor> moduleDescriptors = new ArrayList<>();
final List<File> pathsFailedToImport = new ArrayList<>();
final var moduleDescriptors = new ArrayList<ModuleDescriptor>();
final var pathsFailedToImport = new ArrayList<File>();

addRootModule(rootDirectory, moduleDescriptors, pathsFailedToImport, settings.getGroupModules());

for (File moduleRootDirectory : moduleRootDirectories) {
for (final var moduleRootDirectory : moduleRootDirectories) {
try {
final ModuleDescriptor moduleDescriptor = ModuleDescriptorFactory.INSTANCE
.createDescriptor(moduleRootDirectory, this);
final var moduleDescriptor = ModuleDescriptorFactory.INSTANCE.createDescriptor(moduleRootDirectory, this);
moduleDescriptors.add(moduleDescriptor);

if (moduleDescriptor instanceof final YModuleDescriptor yModuleDescriptor) {
Expand Down Expand Up @@ -640,6 +638,11 @@ private void findModuleRoots(
if (hybrisProjectService.isCCv2Module(rootProjectDirectory)) {
LOG.info("Detected CCv2 module " + rootProjectDirectory.getAbsolutePath());
moduleRootMap.get(NON_HYBRIS).add(rootProjectDirectory);
final var name = rootProjectDirectory.getName();
if (name.endsWith(HybrisConstants.CCV2_JS_STOREFRONT_NAME) || name.endsWith(HybrisConstants.CCV2_DATAHUB_NAME)) {
// faster import: no need to process sub-folders of the CCv2 js-storefront and datahub directories
return;
}
}
}

Expand Down Expand Up @@ -688,6 +691,7 @@ private boolean isDirectoryExcluded(final Path file) {
path.endsWith(HybrisConstants.EXCLUDE_GRADLE_DIRECTORY) ||
path.endsWith(HybrisConstants.EXCLUDE_ECLIPSEBIN_DIRECTORY) ||
path.endsWith(HybrisConstants.EXCLUDE_GIT_DIRECTORY) ||
path.endsWith(HybrisConstants.EXCLUDE_GITHUB_DIRECTORY) ||
path.endsWith(HybrisConstants.EXCLUDE_IDEA_DIRECTORY) ||
path.endsWith(HybrisConstants.EXCLUDE_MACOSX_DIRECTORY) ||
path.endsWith(HybrisConstants.EXCLUDE_IDEA_MODULE_FILES_DIRECTORY) ||
Expand Down Expand Up @@ -1111,5 +1115,9 @@ public String toString() {
'}';
}

protected enum DIRECTORY_TYPE {HYBRIS, NON_HYBRIS}
protected enum DIRECTORY_TYPE {
HYBRIS,
NON_HYBRIS,
CCV2,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public void refresh(final HybrisProjectSettings settings) throws ConfigurationEx

this.getContext().cleanup();

final HybrisProjectDescriptor hybrisProjectDescriptor = this.getContext().getHybrisProjectDescriptor();
final var hybrisProjectDescriptor = this.getContext().getHybrisProjectDescriptor();

hybrisProjectDescriptor.setSourceCodeFile(FileUtils.toFile(settings.getSourceCodeFile(), true));
hybrisProjectDescriptor.setExternalExtensionsDirectory(FileUtils.toFile(settings.getExternalExtensionsDirectory(), true));
Expand All @@ -592,12 +592,12 @@ public void refresh(final HybrisProjectSettings settings) throws ConfigurationEx
hybrisProjectDescriptor.setImportCustomAntBuildFiles(settings.getImportCustomAntBuildFiles());
hybrisProjectDescriptor.setScanThroughExternalModule(settings.getScanThroughExternalModule());

final HybrisApplicationSettings appSettings = HybrisApplicationSettingsComponent.getInstance().getState();
final var appSettings = HybrisApplicationSettingsComponent.getInstance().getState();
hybrisProjectDescriptor.setWithMavenSources(appSettings.getWithMavenSources());
hybrisProjectDescriptor.setWithMavenJavadocs(appSettings.getWithMavenJavadocs());
hybrisProjectDescriptor.setWithStandardProvidedSources(appSettings.getWithStandardProvidedSources());

final String ideModulesFilesDirectory = settings.getIdeModulesFilesDirectory();
final var ideModulesFilesDirectory = settings.getIdeModulesFilesDirectory();
if (ideModulesFilesDirectory != null) {
hybrisProjectDescriptor.setModulesFilesDirectory(
new File(ideModulesFilesDirectory)
Expand All @@ -611,7 +611,7 @@ public void refresh(final HybrisProjectSettings settings) throws ConfigurationEx
);
}

final String hybrisDirectory = settings.getHybrisDirectory();
final var hybrisDirectory = settings.getHybrisDirectory();
if (hybrisDirectory != null) {
hybrisProjectDescriptor.setHybrisDistributionDirectory(
FileUtils.toFile(
Expand Down

0 comments on commit b187901

Please sign in to comment.