use PathMacroUtil.DIRECTORY_STORE_NAME const

This commit is contained in:
Vladimir Krivosheev
2018-04-25 17:24:00 +02:00
parent 4b35917fa6
commit 601baec28c
5 changed files with 13 additions and 21 deletions
@@ -1,6 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.jps.idea;
import groovy.lang.Script;
import org.jetbrains.jps.model.serialization.PathMacroUtil;
import java.io.File;
import java.io.IOException;
@@ -16,7 +18,7 @@ public class IdeaProjectLoader {
File home = new File(new URI(uri).getSchemeSpecificPart());
while (home != null) {
if (home.isDirectory() && new File(home, ".idea").exists()) {
if (home.isDirectory() && new File(home, PathMacroUtil.DIRECTORY_STORE_NAME).exists()) {
return home.getCanonicalPath();
}
@@ -14,6 +14,7 @@ import com.intellij.openapi.components.ExtensionAreas;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.*;
import com.intellij.openapi.extensions.impl.PicoPluginExtensionInitializationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.StreamUtil;
@@ -86,7 +87,7 @@ public class PluginManagerCore {
private static class Holder {
private static final BuildNumber ourBuildNumber = calcBuildNumber();
private static final boolean ourIsRunningFromSources = new File(PathManager.getHomePath(), ".idea").isDirectory();
private static final boolean ourIsRunningFromSources = new File(PathManager.getHomePath(), Project.DIRECTORY_STORE_FOLDER).isDirectory();
private static BuildNumber calcBuildNumber() {
BuildNumber ourBuildNumber = BuildNumber.fromString(System.getProperty("idea.plugins.compatible.build"));
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.formatting.commandLine;
import com.intellij.ide.impl.ProjectUtil;
@@ -37,6 +23,7 @@ import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
import com.intellij.util.PlatformUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.serialization.PathMacroUtil;
import java.io.File;
import java.io.IOException;
@@ -82,7 +69,7 @@ public class FileSetFormatter extends FileSetProcessor {
private File createProjectDir() throws IOException {
File tempDir = FileUtil.createTempDirectory(PROJECT_DIR_PREFIX, myProjectUID + PROJECT_DIR_SUFFIX);
File projectDir = new File(tempDir.getPath() + File.separator + ".idea");
File projectDir = new File(tempDir.getPath() + File.separator + PathMacroUtil.DIRECTORY_STORE_NAME);
if (projectDir.mkdirs()) {
return projectDir;
}
@@ -11,6 +11,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.serialization.PathMacroUtil;
import java.io.File;
import java.io.IOException;
@@ -36,12 +37,12 @@ public class VcsRootDetectorTest extends VcsRootBaseTest {
public void testProjectWithMockRootUnderIt() throws IOException {
cd(projectRoot);
mkdir("src");
mkdir(".idea");
mkdir(PathMacroUtil.DIRECTORY_STORE_NAME);
doTest(new VcsRootConfiguration().vcsRoots("community"), projectRoot, "community");
}
public void testProjectWithAllSubdirsUnderMockRootShouldStillBeNotFullyControlled() throws IOException {
String[] dirNames = {".idea", "src", "community"};
String[] dirNames = {PathMacroUtil.DIRECTORY_STORE_NAME, "src", "community"};
doTest(new VcsRootConfiguration().vcsRoots(dirNames), projectRoot, dirNames);
}
@@ -28,6 +28,7 @@ import org.jetbrains.idea.devkit.dom.Extension
import org.jetbrains.idea.devkit.dom.ExtensionPoint
import org.jetbrains.idea.devkit.dom.impl.PluginPsiClassConverter
import org.jetbrains.idea.devkit.util.PsiUtil
import org.jetbrains.jps.model.serialization.PathMacroUtil
fun checkProperModule(extensionPoint: ExtensionPoint, holder: DomElementAnnotationHolder) {
if (checkProperXmlFileForClass(extensionPoint, holder, extensionPoint.`interface`.value)) {
@@ -132,7 +133,7 @@ fun isIdeaPlatformModule(module: Module?): Boolean {
if (parent.name == "plugins") {
return false
}
if (parent.findChild(".idea") != null) {
if (parent.findChild(PathMacroUtil.DIRECTORY_STORE_NAME) != null) {
return true
}
parent = parent.parent