diff --git a/third_party/CHANGELOG.md b/third_party/CHANGELOG.md index 008c1db16..72395297d 100644 --- a/third_party/CHANGELOG.md +++ b/third_party/CHANGELOG.md @@ -1,3 +1,9 @@ +## 501.0.0 + +### Removed + +- Dropped support for Dart SDK versions older than 2.12. + ## 500.0.0 ### Added diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/DartFileListener.java b/third_party/src/main/java/com/jetbrains/lang/dart/DartFileListener.java index 288ac2a3b..cc6dd4f4a 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/DartFileListener.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/DartFileListener.java @@ -39,7 +39,7 @@ import com.jetbrains.lang.dart.sdk.DartPackagesLibraryType; import com.jetbrains.lang.dart.sdk.DartSdk; import com.jetbrains.lang.dart.sdk.DartSdkLibUtil; -import com.jetbrains.lang.dart.util.DotPackagesFileUtil; +import com.jetbrains.lang.dart.util.PackageConfigFileUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -69,10 +69,8 @@ public final class DartFileListener implements AsyncFileListener { if (event instanceof VFilePropertyChangeEvent) { if (((VFilePropertyChangeEvent)event).isRename()) { - if (DotPackagesFileUtil.PACKAGE_CONFIG_JSON.equals(((VFilePropertyChangeEvent)event).getOldValue()) || - DotPackagesFileUtil.PACKAGE_CONFIG_JSON.equals(((VFilePropertyChangeEvent)event).getNewValue()) || - DotPackagesFileUtil.DOT_PACKAGES.equals(((VFilePropertyChangeEvent)event).getOldValue()) || - DotPackagesFileUtil.DOT_PACKAGES.equals(((VFilePropertyChangeEvent)event).getNewValue())) { + if (PackageConfigFileUtil.PACKAGE_CONFIG_JSON.equals(((VFilePropertyChangeEvent)event).getOldValue()) || + PackageConfigFileUtil.PACKAGE_CONFIG_JSON.equals(((VFilePropertyChangeEvent)event).getNewValue())) { packagesFileEvents.add(event); } @@ -83,8 +81,7 @@ public final class DartFileListener implements AsyncFileListener { } } else { - if (DotPackagesFileUtil.PACKAGE_CONFIG_JSON.equals(PathUtil.getFileName(event.getPath())) || - DotPackagesFileUtil.DOT_PACKAGES.equals(PathUtil.getFileName(event.getPath()))) { + if (PackageConfigFileUtil.PACKAGE_CONFIG_JSON.equals(PathUtil.getFileName(event.getPath()))) { packagesFileEvents.add(event); } @@ -138,15 +135,9 @@ public static void scheduleDartPackageRootsUpdate(final @NotNull Project project if (module == null || !DartSdkLibUtil.isDartSdkEnabled(module)) continue; Map packagesMap = null; - VirtualFile packagesFile = DotPackagesFileUtil.findPackageConfigJsonFile(pubspecFile.getParent()); + VirtualFile packagesFile = PackageConfigFileUtil.findPackageConfigJsonFile(pubspecFile.getParent()); if (packagesFile != null) { - packagesMap = DotPackagesFileUtil.getPackagesMapFromPackageConfigJsonFile(packagesFile); - } - else { - packagesFile = DotPackagesFileUtil.findDotPackagesFile(pubspecFile.getParent()); - if (packagesFile != null) { - packagesMap = DotPackagesFileUtil.getPackagesMap(packagesFile); - } + packagesMap = PackageConfigFileUtil.getPackagesMapFromPackageConfigJsonFile(packagesFile); } if (packagesMap != null) { @@ -359,7 +350,7 @@ public void afterVfsChange() { if (file == null) continue; VirtualFile dartRoot = file.getParent(); - if (dartRoot != null && file.getName().equals(DotPackagesFileUtil.PACKAGE_CONFIG_JSON)) { + if (dartRoot != null && file.getName().equals(PackageConfigFileUtil.PACKAGE_CONFIG_JSON)) { dartRoot = dartRoot.getParent(); } VirtualFile pubspec = dartRoot == null ? null : dartRoot.findChild(PUBSPEC_YAML); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/analyzer/DartAnalysisServerService.java b/third_party/src/main/java/com/jetbrains/lang/dart/analyzer/DartAnalysisServerService.java index b235161d6..8574abce9 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/analyzer/DartAnalysisServerService.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/analyzer/DartAnalysisServerService.java @@ -81,19 +81,9 @@ import java.util.concurrent.TimeUnit; public final class DartAnalysisServerService implements Disposable { - public static final String MIN_SDK_VERSION = "1.12"; - private static final String MIN_MOVE_FILE_SDK_VERSION = "2.3.2"; + public static final String MIN_SDK_VERSION = "2.12"; private static final String COMPLETION_2_SERVER_VERSION = "1.33"; - // Webdev works going back to 2.6.0, future minimum version listed in the pubspec.yaml, link below, won't mean that 2.6.0 aren't - // supported. - // https://github.com/dart-lang/webdev/blob/master/webdev/pubspec.yaml#L11 - public static final String MIN_WEBDEV_SDK_VERSION = "2.6.0"; - - // As of the Dart SDK version 2.8.0, the file .dart_tool/package_config.json is preferred over the .packages file. - // https://github.com/dart-lang/sdk/issues/48272 - public static final String MIN_PACKAGE_CONFIG_JSON_SDK_VERSION = "2.8.0"; - // The dart cli command provides a language server command, `dart language-server`, which // should be used going forward instead of `dart .../analysis_server.dart.snapshot`. public static final String MIN_DART_LANG_SERVER_SDK_VERSION = "2.16.0"; @@ -488,18 +478,6 @@ public static boolean isDartSdkVersionSufficient(final @NotNull DartSdk sdk) { return StringUtil.compareVersionNumbers(sdk.getVersion(), MIN_SDK_VERSION) >= 0; } - public static boolean isDartSdkVersionSufficientForMoveFileRefactoring(final @NotNull DartSdk sdk) { - return StringUtil.compareVersionNumbers(sdk.getVersion(), MIN_MOVE_FILE_SDK_VERSION) >= 0; - } - - public static boolean isDartSdkVersionSufficientForWebdev(final @NotNull DartSdk sdk) { - return StringUtil.compareVersionNumbers(sdk.getVersion(), MIN_WEBDEV_SDK_VERSION) >= 0; - } - - public static boolean isDartSdkVersionSufficientForPackageConfigJson(final @NotNull DartSdk sdk) { - return StringUtil.compareVersionNumbers(sdk.getVersion(), MIN_PACKAGE_CONFIG_JSON_SDK_VERSION) >= 0; - } - public static boolean isDartSdkVersionSufficientForDartLangServer(final @NotNull DartSdk sdk) { return StringUtil.compareVersionNumbers(sdk.getVersion(), MIN_DART_LANG_SERVER_SDK_VERSION) >= 0; } @@ -1239,10 +1217,6 @@ public boolean edit_isPostfixCompletionApplicable(VirtualFile file, int _offset, return null; } - if (StringUtil.compareVersionNumbers(mySdkVersion, "1.25") < 0) { - return PostfixTemplateDescriptor.EMPTY_ARRAY; - } - final Ref resultRef = Ref.create(); final CountDownLatch latch = new CountDownLatch(1); server.edit_listPostfixCompletionTemplates(new ListPostfixCompletionTemplatesConsumer() { @@ -1730,7 +1704,7 @@ public void onError(final RequestError error) { final int _selectionOffset, final int _selectionLength) { final AnalysisServer server = myServer; - if (server == null || StringUtil.compareVersionNumbers(mySdkVersion, "1.25") < 0) { + if (server == null) { return null; } @@ -1769,7 +1743,7 @@ public void onError(final RequestError error) { final @NotNull List importedElements, final int _offset) { final AnalysisServer server = myServer; - if (server == null || StringUtil.compareVersionNumbers(mySdkVersion, "1.25") < 0) { + if (server == null) { return null; } @@ -1934,12 +1908,8 @@ private void analysis_setSubscriptions() { subscriptions.put(AnalysisService.NAVIGATION, myVisibleFileUris); subscriptions.put(AnalysisService.OVERRIDES, myVisibleFileUris); subscriptions.put(AnalysisService.OUTLINE, myVisibleFileUris); - if (StringUtil.compareVersionNumbers(mySdkVersion, "1.13") >= 0) { - subscriptions.put(AnalysisService.IMPLEMENTED, myVisibleFileUris); - } - if (StringUtil.compareVersionNumbers(mySdkVersion, "1.25.0") >= 0) { - subscriptions.put(AnalysisService.CLOSING_LABELS, myVisibleFileUris); - } + subscriptions.put(AnalysisService.IMPLEMENTED, myVisibleFileUris); + subscriptions.put(AnalysisService.CLOSING_LABELS, myVisibleFileUris); if (LOG.isDebugEnabled()) { LOG.debug("analysis_setSubscriptions, subscriptions:\n" + subscriptions); @@ -2187,15 +2157,7 @@ else if (!useDartLangServerCall && !dasSnapshotFile.canRead()) { vmArgsRaw = ""; } - @NonNls String serverArgsRaw; - if (useDartLangServerCall) { - serverArgsRaw = "--protocol=analyzer"; - } - else { - // Note that as of Dart 2.12.0 the '--useAnalysisHighlight2' flag is ignored (and is the - // default highlighting mode). We still want to pass it in for earlier SDKs. - serverArgsRaw = "--useAnalysisHighlight2"; - } + String serverArgsRaw = useDartLangServerCall ? "--protocol=analyzer" : ""; try { serverArgsRaw += " " + Registry.stringValue("dart.server.additional.arguments"); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartEditorNotificationsProvider.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartEditorNotificationsProvider.java index 7bd7f9d46..859d90fb3 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartEditorNotificationsProvider.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartEditorNotificationsProvider.java @@ -14,7 +14,6 @@ import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.NlsContexts; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; @@ -53,7 +52,7 @@ public final class DartEditorNotificationsProvider implements EditorNotification final DartSdk sdk = DartSdk.getDartSdk(project); if (sdk != null && DartSdkLibUtil.isDartSdkEnabled(module)) { - return fileEditor -> new PubActionsPanel(fileEditor, sdk); + return fileEditor -> new PubActionsPanel(fileEditor); } } @@ -116,14 +115,11 @@ public final class DartEditorNotificationsProvider implements EditorNotification } private static final class PubActionsPanel extends EditorNotificationPanel { - private PubActionsPanel(@NotNull FileEditor fileEditor, @NotNull DartSdk sdk) { + private PubActionsPanel(@NotNull FileEditor fileEditor) { super(fileEditor, null, EditorColors.GUTTER_BACKGROUND, Status.Info); createActionLabel(DartBundle.message("pub.get"), "Dart.pub.get"); createActionLabel(DartBundle.message("pub.upgrade"), "Dart.pub.upgrade"); - - if (StringUtil.compareVersionNumbers(sdk.getVersion(), DartPubOutdatedAction.MIN_SDK_VERSION) >= 0) { - createActionLabel(DartBundle.message("pub.outdated"), "Dart.pub.outdated"); - } + createActionLabel(DartBundle.message("pub.outdated"), "Dart.pub.outdated"); myLinksPanel.add(new JSeparator(SwingConstants.VERTICAL)); createActionLabel(DartBundle.message("webdev.build"), "Dart.build"); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubActionBase.kt b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubActionBase.kt index f36d23e9f..6503c7581 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubActionBase.kt +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubActionBase.kt @@ -36,7 +36,6 @@ import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.Key import com.intellij.openapi.util.NlsContexts import com.intellij.openapi.util.io.FileUtil -import com.intellij.openapi.util.text.StringUtil import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.wm.ToolWindowId @@ -77,7 +76,7 @@ abstract class DartPubActionBase : AnAction(), DumbAware { e.presentation.isEnabled = visible && !isInProgress } - protected abstract fun getTitle(project: Project, pubspecYamlFile: VirtualFile): String + protected abstract fun getTitle(pubspecYamlFile: VirtualFile): String protected abstract fun calculatePubParameters(project: Project, pubspecYamlFile: VirtualFile): Array? @@ -92,7 +91,7 @@ abstract class DartPubActionBase : AnAction(), DumbAware { if (sdk == null && allowModalDialogs) { val answer = Messages.showDialog(module.project, DartBundle.message("dart.sdk.is.not.configured"), - getTitle(module.project, pubspecYamlFile), + getTitle(pubspecYamlFile), arrayOf(DartBundle.message("setup.dart.sdk"), CommonBundle.getCancelButtonText()), Messages.OK, Messages.getErrorIcon()) @@ -104,14 +103,13 @@ abstract class DartPubActionBase : AnAction(), DumbAware { if (sdk == null) return - val useDartPub = StringUtil.compareVersionNumbers(sdk.version, DART_PUB_MIN_SDK_VERSION) >= 0 - val exeFile = if (useDartPub) File(DartSdkUtil.getDartExePath(sdk)) else File(DartSdkUtil.getPubPath(sdk)) + val exeFile = File(DartSdkUtil.getDartExePath(sdk)) if (!exeFile.isFile) { if (allowModalDialogs) { val answer = Messages.showDialog(module.project, DartBundle.message("dart.sdk.bad.dartpub.path", exeFile.path), - getTitle(module.project, pubspecYamlFile), + getTitle(pubspecYamlFile), arrayOf(DartBundle.message("setup.dart.sdk"), CommonBundle.getCancelButtonText()), Messages.OK, Messages.getErrorIcon()) @@ -135,7 +133,7 @@ abstract class DartPubActionBase : AnAction(), DumbAware { setupPubExePath(command, sdk) command.addParameters(*pubParameters) - doPerformPubAction(module, pubspecYamlFile, command, getTitle(module.project, pubspecYamlFile)) + doPerformPubAction(module, pubspecYamlFile, command, getTitle(pubspecYamlFile)) } } @@ -185,25 +183,12 @@ abstract class DartPubActionBase : AnAction(), DumbAware { private const val GROUP_DISPLAY_ID: @NonNls String = "Dart Pub Tool" private val PUB_TOOL_WINDOW_CONTENT_INFO_KEY = Key.create("PUB_TOOL_WINDOW_CONTENT_INFO_KEY") - private const val DART_PUB_MIN_SDK_VERSION = "2.10" - private const val DART_RUN_TEST_MIN_SDK_VERSION = "2.11" - private val ourInProgress = AtomicBoolean(false) - @JvmStatic - fun isUseDartRunTestInsteadOfPubRunTest(dartSdk: DartSdk): Boolean = - StringUtil.compareVersionNumbers(dartSdk.version, DART_RUN_TEST_MIN_SDK_VERSION) >= 0 - @JvmStatic fun setupPubExePath(commandLine: GeneralCommandLine, dartSdk: DartSdk) { - val useDartPub = StringUtil.compareVersionNumbers(dartSdk.version, DART_PUB_MIN_SDK_VERSION) >= 0 - if (useDartPub) { - commandLine.withExePath(FileUtil.toSystemDependentName(DartSdkUtil.getDartExePath(dartSdk))) - commandLine.addParameter("pub") - } - else { - commandLine.withExePath(FileUtil.toSystemDependentName(DartSdkUtil.getPubPath(dartSdk))) - } + commandLine.withExePath(FileUtil.toSystemDependentName(DartSdkUtil.getDartExePath(dartSdk))) + commandLine.addParameter("pub") } @JvmStatic diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildAction.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildAction.java index 55dd43de7..a89e1fe03 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildAction.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildAction.java @@ -17,23 +17,16 @@ public class DartPubBuildAction extends DartPubActionBase { @Override public void update(@NotNull AnActionEvent e) { super.update(e); - final Project project = e.getProject(); - if (project != null && DartWebdev.INSTANCE.useWebdev(DartSdk.getDartSdk(project))) { - e.getPresentation().setText(DartBundle.message("action.text.webdev.build")); - e.getPresentation().setDescription(DartBundle.message("action.description.run.webdev.build")); - } - else { - e.getPresentation().setText(DartBundle.message("action.text.pub.build")); - e.getPresentation().setDescription(DartBundle.message("action.description.run.pub.build")); - } + + e.getPresentation().setText(DartBundle.message("action.text.webdev.build")); + e.getPresentation().setDescription(DartBundle.message("action.description.run.webdev.build")); } @Override - protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull Project project, final @NotNull VirtualFile pubspecYamlFile) { + protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull VirtualFile pubspecYamlFile) { final String projectName = PubspecYamlUtil.getDartProjectName(pubspecYamlFile); final String prefix = projectName == null ? "" : ("[" + projectName + "] "); - return prefix + DartBundle - .message(DartWebdev.INSTANCE.useWebdev(DartSdk.getDartSdk(project)) ? "dart.webdev.build.title" : "dart.pub.build.title"); + return prefix + DartBundle.message("dart.webdev.build.title"); } @Override @@ -47,12 +40,8 @@ public void update(@NotNull AnActionEvent e) { final DartSdk sdk = DartSdk.getDartSdk(project); if (sdk == null) return null; // can't happen, already checked - if (DartWebdev.INSTANCE.useWebdev(sdk)) { - if (!DartWebdev.INSTANCE.ensureWebdevActivated(project)) return null; - - return new String[]{"global", "run", "webdev", "build", "--output=" + dialog.getInputFolder() + ":" + dialog.getOutputFolder()}; - } + if (!DartWebdev.INSTANCE.ensureWebdevActivated(project)) return null; - return new String[]{"build", "--mode=" + dialog.getPubBuildMode(), "--output=" + dialog.getOutputFolder()}; + return new String[]{"global", "run", "webdev", "build", "--output=" + dialog.getInputFolder() + ":" + dialog.getOutputFolder()}; } } diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildDialog.form b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildDialog.form index 69cf7ee48..9b551f78f 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildDialog.form +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildDialog.form @@ -1,21 +1,21 @@
- + - + - + - + @@ -24,79 +24,19 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildDialog.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildDialog.java index 50f1a0c5f..5e9b692b8 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildDialog.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubBuildDialog.java @@ -11,66 +11,35 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.wm.IdeFocusManager; -import com.intellij.ui.components.JBRadioButton; import com.jetbrains.lang.dart.DartBundle; -import com.jetbrains.lang.dart.pubServer.DartWebdev; -import com.jetbrains.lang.dart.sdk.DartSdk; import com.jetbrains.lang.dart.util.PathUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import java.awt.event.ActionListener; public class DartPubBuildDialog extends DialogWrapper { - private static final String DART_PUB_BUILD_MODE_KEY = "DART_PUB_BUILD_MODE"; - private static final String DART_PUB_CUSTOM_BUILD_MODE_KEY = "DART_PUB_CUSTOM_BUILD_MODE"; - - private static final String RELEASE_MODE = "release"; - private static final String DEBUG_MODE = "debug"; - private static final String OTHER_MODE = "other"; - private static final String DEFAULT_MODE = RELEASE_MODE; - private static final String DART_BUILD_INPUT_KEY = "DART_BUILD_INPUT_KEY"; private static final String DEFAULT_INPUT_FOLDER = "web"; private static final String DART_BUILD_OUTPUT_KEY = "DART_PUB_BUILD_OUTPUT_KEY"; // _PUB_ - for compatibility private static final String DEFAULT_OUTPUT_FOLDER = "build"; private JPanel myMainPanel; - private JPanel myBuildModePanel; - private JBRadioButton myReleaseRadioButton; - private JBRadioButton myDebugRadioButton; - private JBRadioButton myOtherRadioButton; - private JTextField myOtherModeTextField; - private JPanel myInputFolderPanel; private JTextField myInputFolderTextField; private TextFieldWithBrowseButton myOutputFolderField; private final @NotNull Project myProject; - private final boolean myUseWebdev; public DartPubBuildDialog(final @NotNull Project project, final @NotNull VirtualFile packageDir) { super(project); myProject = project; - myUseWebdev = DartWebdev.INSTANCE.useWebdev(DartSdk.getDartSdk(project)); - setTitle(DartBundle.message(myUseWebdev ? "dart.webdev.build.title" : "dart.pub.build.title")); + setTitle(DartBundle.message("dart.webdev.build.title")); setOKButtonText(DartBundle.message("button.text.build2")); - final ActionListener listener = e -> updateControls(); - myReleaseRadioButton.addActionListener(listener); - myDebugRadioButton.addActionListener(listener); - myOtherRadioButton.addActionListener(listener); - myOtherRadioButton.addActionListener(e -> { - if (myOtherRadioButton.isSelected()) { - IdeFocusManager.getInstance(myProject).requestFocus(myOtherModeTextField, true); - } - }); - var packagePathSlash = FileUtil.toSystemDependentName(packageDir.getPath() + "/"); myOutputFolderField.addBrowseFolderListener( myProject, @@ -103,34 +72,8 @@ public void setText(JTextField component, @NotNull String text) { private void reset() { final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject); - if (myUseWebdev) { - myBuildModePanel.setVisible(false); - myInputFolderTextField.setText(propertiesComponent.getValue(DART_BUILD_INPUT_KEY, DEFAULT_INPUT_FOLDER)); - } - else { - myInputFolderPanel.setVisible(false); - - final String mode = propertiesComponent.getValue(DART_PUB_BUILD_MODE_KEY, DEFAULT_MODE); - if (mode.equals(RELEASE_MODE)) { - myReleaseRadioButton.setSelected(true); - } - else if (mode.equals(DEBUG_MODE)) { - myDebugRadioButton.setSelected(true); - } - else { - myOtherRadioButton.setSelected(true); - } - - myOtherModeTextField.setText(propertiesComponent.getValue(DART_PUB_CUSTOM_BUILD_MODE_KEY, "")); - } - + myInputFolderTextField.setText(propertiesComponent.getValue(DART_BUILD_INPUT_KEY, DEFAULT_INPUT_FOLDER)); myOutputFolderField.setText(propertiesComponent.getValue(DART_BUILD_OUTPUT_KEY, DEFAULT_OUTPUT_FOLDER)); - - updateControls(); - } - - private void updateControls() { - myOtherModeTextField.setEnabled(myOtherRadioButton.isSelected()); } @Override @@ -138,19 +81,9 @@ private void updateControls() { return myMainPanel; } - @Override - public @Nullable JComponent getPreferredFocusedComponent() { - if (myOtherRadioButton.isSelected()) return myOtherModeTextField; - return null; - } - @Override protected @Nullable ValidationInfo doValidate() { - if (!myUseWebdev && myOtherRadioButton.isSelected() && StringUtil.isEmptyOrSpaces(myOtherModeTextField.getText())) { - return new ValidationInfo(DartBundle.message("validation.info.build.mode.not.specified")); - } - - if (myUseWebdev && myInputFolderTextField.getText().trim().isEmpty()) { + if (myInputFolderTextField.getText().trim().isEmpty()) { return new ValidationInfo(DartBundle.message("validation.info.input.folder.not.specified")); } @@ -158,7 +91,7 @@ private void updateControls() { return new ValidationInfo(DartBundle.message("validation.info.output.folder.not.specified")); } - if (myUseWebdev && myInputFolderTextField.getText().trim().equals(myOutputFolderField.getText().trim())) { + if (myInputFolderTextField.getText().trim().equals(myOutputFolderField.getText().trim())) { return new ValidationInfo(DartBundle.message("validation.info.input.and.output.folders.must.be.different")); } @@ -174,31 +107,13 @@ protected void doOKAction() { private void saveDialogState() { final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject); - if (myUseWebdev) { - final String inputPath = StringUtil.nullize(myInputFolderTextField.getText().trim()); - propertiesComponent.setValue(DART_BUILD_INPUT_KEY, inputPath, DEFAULT_INPUT_FOLDER); - } - else { - final String mode = myReleaseRadioButton.isSelected() ? RELEASE_MODE - : myDebugRadioButton.isSelected() ? DEBUG_MODE - : OTHER_MODE; - propertiesComponent.setValue(DART_PUB_BUILD_MODE_KEY, mode, DEFAULT_MODE); - - if (myOtherRadioButton.isSelected()) { - propertiesComponent.setValue(DART_PUB_CUSTOM_BUILD_MODE_KEY, myOtherModeTextField.getText().trim()); - } - } + final String inputPath = StringUtil.nullize(myInputFolderTextField.getText().trim()); + propertiesComponent.setValue(DART_BUILD_INPUT_KEY, inputPath, DEFAULT_INPUT_FOLDER); final String outputPath = StringUtil.nullize(myOutputFolderField.getText().trim()); propertiesComponent.setValue(DART_BUILD_OUTPUT_KEY, outputPath, DEFAULT_OUTPUT_FOLDER); } - public @NotNull String getPubBuildMode() { - if (myReleaseRadioButton.isSelected()) return RELEASE_MODE; - if (myDebugRadioButton.isSelected()) return DEBUG_MODE; - return myOtherModeTextField.getText().trim(); - } - public @NotNull String getInputFolder() { String path = myInputFolderTextField.getText().trim(); if (path.isEmpty()) path = DEFAULT_INPUT_FOLDER; diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubCacheRepairAction.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubCacheRepairAction.java index a4343ffe8..a838a10a7 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubCacheRepairAction.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubCacheRepairAction.java @@ -12,7 +12,7 @@ public class DartPubCacheRepairAction extends DartPubActionBase { @Override - protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull Project project, final @NotNull VirtualFile pubspecYamlFile) { + protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull VirtualFile pubspecYamlFile) { return DartBundle.message("dart.pub.cache.repair.title"); } diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubGetAction.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubGetAction.java index 0d61a38c1..19309d421 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubGetAction.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubGetAction.java @@ -11,7 +11,7 @@ public class DartPubGetAction extends DartPubActionBase { @Override - protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull Project project, final @NotNull VirtualFile pubspecYamlFile) { + protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull VirtualFile pubspecYamlFile) { final String projectName = PubspecYamlUtil.getDartProjectName(pubspecYamlFile); final String prefix = projectName == null ? "" : ("[" + projectName + "] "); return prefix + DartBundle.message("dart.pub.get.title"); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubOutdatedAction.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubOutdatedAction.java index 0645928b8..486ddcf0d 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubOutdatedAction.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubOutdatedAction.java @@ -4,7 +4,6 @@ import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.NlsContexts; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.jetbrains.lang.dart.DartBundle; import com.jetbrains.lang.dart.sdk.DartSdk; @@ -13,7 +12,6 @@ import org.jetbrains.annotations.Nullable; public class DartPubOutdatedAction extends DartPubActionBase { - public static final String MIN_SDK_VERSION = "2.8"; @Override public void update(@NotNull AnActionEvent e) { @@ -21,13 +19,13 @@ public void update(@NotNull AnActionEvent e) { final Project project = e.getProject(); DartSdk sdk = project != null ? DartSdk.getDartSdk(project) : null; - if (sdk == null || StringUtil.compareVersionNumbers(sdk.getVersion(), MIN_SDK_VERSION) < 0) { + if (sdk == null) { e.getPresentation().setEnabledAndVisible(false); } } @Override - protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull Project project, final @NotNull VirtualFile pubspecYamlFile) { + protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull VirtualFile pubspecYamlFile) { final String projectName = PubspecYamlUtil.getDartProjectName(pubspecYamlFile); final String prefix = projectName == null ? "" : ("[" + projectName + "] "); return prefix + DartBundle.message("dart.pub.outdated.title"); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubUpgradeAction.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubUpgradeAction.java index 3c9748f36..29fe570ad 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubUpgradeAction.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartPubUpgradeAction.java @@ -11,7 +11,7 @@ public class DartPubUpgradeAction extends DartPubActionBase { @Override - protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull Project project, final @NotNull VirtualFile pubspecYamlFile) { + protected @NotNull @NlsContexts.DialogTitle String getTitle(final @NotNull VirtualFile pubspecYamlFile) { final String projectName = PubspecYamlUtil.getDartProjectName(pubspecYamlFile); final String prefix = projectName == null ? "" : ("[" + projectName + "] "); return prefix + DartBundle.message("dart.pub.upgrade.title"); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/introduce/DartServerExtractLocalVariableHandler.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/introduce/DartServerExtractLocalVariableHandler.java index 3260568f7..ac8a9cb92 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/introduce/DartServerExtractLocalVariableHandler.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/introduce/DartServerExtractLocalVariableHandler.java @@ -46,7 +46,7 @@ public void invoke(@NotNull Project project, PsiElement @NotNull [] elements, Da @Override public void invoke(final @NotNull Project project, final Editor editor, PsiFile file, DataContext dataContext) { final DartSdk sdk = DartSdk.getDartSdk(project); - if (sdk == null || StringUtil.compareVersionNumbers(sdk.getVersion(), "1.14") < 0) { + if (sdk == null) { return; } diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/moveFile/DartServerMoveDartFileHandler.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/moveFile/DartServerMoveDartFileHandler.java index a0ee75500..f522dae52 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/moveFile/DartServerMoveDartFileHandler.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/moveFile/DartServerMoveDartFileHandler.java @@ -36,8 +36,7 @@ public boolean canProcessElement(PsiFile psiFile) { return false; } final Project project = psiFile.getProject(); - final DartSdk dartSdk = DartSdk.getDartSdk(project); - if (dartSdk == null || !DartAnalysisServerService.isDartSdkVersionSufficientForMoveFileRefactoring(dartSdk)) { + if (DartSdk.getDartSdk(project) == null) { return false; } return DartAnalysisServerService.getInstance(project).isInIncludedRoots(psiFile.getVirtualFile()); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/DartCommandLineRunnerParameters.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/DartCommandLineRunnerParameters.java index 12d5b5066..88f3c4a2c 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/DartCommandLineRunnerParameters.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/DartCommandLineRunnerParameters.java @@ -25,7 +25,7 @@ public class DartCommandLineRunnerParameters implements Cloneable { private @Nullable @NlsSafe String myFilePath = null; private @Nullable @NlsSafe String myVMOptions = null; - private boolean myCheckedModeOrEnableAsserts = true; + private boolean myAssertsEnabled = true; private @Nullable @NlsSafe String myArguments = null; private @Nullable @NlsSafe String myWorkingDirectory = null; private @NotNull Map myEnvs = new LinkedHashMap<>(); @@ -67,19 +67,16 @@ public void setVMOptions(final @Nullable @NlsSafe String vmOptions) { myVMOptions = vmOptions; } - /** - * For Dart 2 it means 'enable asserts' flag; for Dart 1 - 'checked mode' flag - */ @OptionTag("checkedMode") // compatibility - public boolean isCheckedModeOrEnableAsserts() { - return myCheckedModeOrEnableAsserts; + public boolean areAssertsEnabled() { + return myAssertsEnabled; } /** * For Dart 2 it means 'enable asserts' flag; for Dart 1 - 'checked mode' flag */ - public void setCheckedModeOrEnableAsserts(final boolean checkedModeOrEnableAsserts) { - myCheckedModeOrEnableAsserts = checkedModeOrEnableAsserts; + public void setAssertsEnabled(final boolean assertsEnabled) { + myAssertsEnabled = assertsEnabled; } public @Nullable @NlsSafe String getArguments() { diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/DartCommandLineRunningState.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/DartCommandLineRunningState.java index 1f3fbff1b..b0e32e639 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/DartCommandLineRunningState.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/DartCommandLineRunningState.java @@ -197,13 +197,8 @@ else if (vmOption.startsWith("--observe:")) { } } - if (myRunnerParameters.isCheckedModeOrEnableAsserts()) { - if (StringUtil.compareVersionNumbers(sdk.getVersion(), "2") < 0) { - addVmOption(sdk, commandLine, "--checked"); - } - else { - addVmOption(sdk, commandLine, "--enable-asserts"); - } + if (myRunnerParameters.areAssertsEnabled()) { + addVmOption(sdk, commandLine, "--enable-asserts"); } if (DefaultDebugExecutor.EXECUTOR_ID.equals(getEnvironment().getExecutor().getId())) { diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/ui/DartCommandLineConfigurationEditorForm.form b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/ui/DartCommandLineConfigurationEditorForm.form index 30e134f3d..838ffd062 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/ui/DartCommandLineConfigurationEditorForm.form +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/ui/DartCommandLineConfigurationEditorForm.form @@ -85,7 +85,7 @@ - + diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/ui/DartCommandLineConfigurationEditorForm.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/ui/DartCommandLineConfigurationEditorForm.java index f88b1444f..aea55d05e 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/ui/DartCommandLineConfigurationEditorForm.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/ui/DartCommandLineConfigurationEditorForm.java @@ -20,7 +20,6 @@ import com.jetbrains.lang.dart.DartFileType; import com.jetbrains.lang.dart.ide.runner.server.DartCommandLineRunConfiguration; import com.jetbrains.lang.dart.ide.runner.server.DartCommandLineRunnerParameters; -import com.jetbrains.lang.dart.sdk.DartSdk; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -30,7 +29,7 @@ public class DartCommandLineConfigurationEditorForm extends SettingsEditor DartConfigurable.openDartSettings(project)); } - final String dartSdkVersion = dartSdk.getVersion(); - if (!dartSdkVersion.isEmpty() && - !DartAnalysisServerService.isDartSdkVersionSufficientForWebdev(dartSdk)) { - throw new RuntimeConfigurationError( - DartBundle.message("old.dart.sdk.for.webdev", DartAnalysisServerService.MIN_WEBDEV_SDK_VERSION, dartSdkVersion)); - } // check html file getHtmlFile(); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/test/DartTestRunningState.java b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/test/DartTestRunningState.java index c48a287e1..2b681dfb2 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/test/DartTestRunningState.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/test/DartTestRunningState.java @@ -7,7 +7,6 @@ import com.intellij.execution.Executor; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.configurations.RuntimeConfigurationError; -import com.intellij.execution.executors.DefaultRunExecutor; import com.intellij.execution.filters.UrlFilter; import com.intellij.execution.process.ProcessHandler; import com.intellij.execution.runners.ExecutionEnvironment; @@ -30,7 +29,6 @@ import com.intellij.openapi.util.text.Strings; import com.intellij.openapi.vfs.VirtualFile; import com.jetbrains.lang.dart.DartBundle; -import com.jetbrains.lang.dart.ide.actions.DartPubActionBase; import com.jetbrains.lang.dart.ide.runner.DartConsoleFilter; import com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter; import com.jetbrains.lang.dart.ide.runner.base.DartRunConfiguration; @@ -47,7 +45,6 @@ public class DartTestRunningState extends DartCommandLineRunningState { private static final String RUN_COMMAND = "run"; private static final String TEST_PACKAGE_SPEC = "test"; private static final String EXPANDED_REPORTER_OPTION = "-r json"; - public static final String DART_VM_OPTIONS_ENV_VAR = "DART_VM_OPTIONS"; public DartTestRunningState(final @NotNull ExecutionEnvironment environment) throws ExecutionException { super(environment); @@ -150,7 +147,7 @@ private static ConsoleView createConsole(@NotNull ExecutionEnvironment env) { } params.setArguments(builder.toString()); - params.setCheckedModeOrEnableAsserts(false); + params.setAssertsEnabled(false); // working directory is not configurable in UI because there's only one valid value that we calculate ourselves params.setWorkingDirectory(params.computeProcessWorkingDirectory(project)); @@ -159,13 +156,7 @@ private static ConsoleView createConsole(@NotNull ExecutionEnvironment env) { @Override protected void setupExePath(@NotNull GeneralCommandLine commandLine, @NotNull DartSdk sdk) { - boolean useDartTest = DartPubActionBase.isUseDartRunTestInsteadOfPubRunTest(sdk); - if (useDartTest) { - commandLine.setExePath(FileUtil.toSystemDependentName(DartSdkUtil.getDartExePath(sdk))); - } - else { - commandLine.setExePath(FileUtil.toSystemDependentName(DartSdkUtil.getPubPath(sdk))); - } + commandLine.setExePath(FileUtil.toSystemDependentName(DartSdkUtil.getDartExePath(sdk))); } @Override @@ -175,31 +166,7 @@ protected void appendParamsAfterVmOptionsBeforeArgs(@NotNull GeneralCommandLine @Override protected void addVmOption(@NotNull DartSdk sdk, @NotNull GeneralCommandLine commandLine, @NotNull String option) { - boolean useDartTest = DartPubActionBase.isUseDartRunTestInsteadOfPubRunTest(sdk); - if (useDartTest) { - super.addVmOption(sdk, commandLine, option); - return; - } - - // SDK 2.9 and older - final String arguments = StringUtil.notNullize(myRunnerParameters.getArguments()); - if (DefaultRunExecutor.EXECUTOR_ID.equals(getEnvironment().getExecutor().getId()) && - option.startsWith("--enable-vm-service:") && - (arguments.startsWith("-p ") || arguments.contains(" -p "))) { - // When we start browser-targeted tests then there are 2 dart processes spawned: parent (pub) and child (tests). - // If we add --enable-vm-service option to the DART_VM_OPTIONS env var then it will apply for both processes and will obviously - // fail for the child process (because the port will be already occupied by the parent one). - // Setting --enable-vm-service option for the parent process doesn't make much sense, so we skip it. - return; - } - - String options = commandLine.getEnvironment().get(DART_VM_OPTIONS_ENV_VAR); - if (StringUtil.isEmpty(options)) { - commandLine.getEnvironment().put(DART_VM_OPTIONS_ENV_VAR, option); - } - else { - commandLine.getEnvironment().put(DART_VM_OPTIONS_ENV_VAR, options + " " + option); - } + super.addVmOption(sdk, commandLine, option); } DartTestRunnerParameters getParameters() { diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/DartGeneratorPeer.java b/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/DartGeneratorPeer.java index 89b96fb5b..52c420f4e 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/DartGeneratorPeer.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/DartGeneratorPeer.java @@ -55,9 +55,7 @@ public class DartGeneratorPeer implements ProjectGeneratorPeer myDartCreateTemplates;// not-null means that it's been already calculated - private List myStagehandTemplates;// not-null means that it's been already calculated public DartGeneratorPeer() { // set initial values before initDartSdkControls() because listeners should not be triggered on initialization @@ -117,42 +115,23 @@ private void onSdkPathChanged() { return; } - boolean useDartCreate = Stagehand.isUseDartCreate(sdkPath); - if (useDartCreate) { - if (myDartCreateCalcStarted) { - if (myDartCreateTemplates != null) { - showTemplates(myDartCreateTemplates); - } - else { - // Calculation in progress, just wait. - myLoadingTemplatesPanel.setVisible(true); - myLoadedTemplatesPanel.setVisible(false); - } + if (myDartCreateCalcStarted) { + if (myDartCreateTemplates != null) { + showTemplates(myDartCreateTemplates); } else { - myDartCreateCalcStarted = true; - startLoadingTemplates(useDartCreate); + // Calculation in progress, just wait. + myLoadingTemplatesPanel.setVisible(true); + myLoadedTemplatesPanel.setVisible(false); } } else { - if (myStagehandCalcStarted) { - if (myStagehandTemplates != null) { - showTemplates(myStagehandTemplates); - } - else { - // Calculation in progress, just wait. - myLoadingTemplatesPanel.setVisible(true); - myLoadedTemplatesPanel.setVisible(false); - } - } - else { - myStagehandCalcStarted = true; - startLoadingTemplates(useDartCreate); - } + myDartCreateCalcStarted = true; + startLoadingTemplates(); } } - private void startLoadingTemplates(boolean useDartCreate) { + private void startLoadingTemplates() { myLoadingTemplatesPanel.setVisible(true); myLoadingTemplatesPanel.setPreferredSize(myLoadedTemplatesPanel.getPreferredSize()); @@ -170,12 +149,7 @@ private void startLoadingTemplates(boolean useDartCreate) { myLoadingTemplatesPanel.remove(asyncProcessIcon); Disposer.dispose(asyncProcessIcon); - if (useDartCreate) { - myDartCreateTemplates = templates; - } - else { - myStagehandTemplates = templates; - } + myDartCreateTemplates = templates; // it's better to call onSdkPathChanged() but not showTemplates() directly as sdk path could have been changed during this long calculation onSdkPathChanged(); diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/DartProjectTemplate.java b/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/DartProjectTemplate.java index 260eb8818..e8be4be29 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/DartProjectTemplate.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/DartProjectTemplate.java @@ -30,7 +30,6 @@ public abstract class DartProjectTemplate { private static final Stagehand STAGEHAND = new Stagehand(); - private static List ourStagehandTemplateCache; private static List ourDartCreateTemplateCache; private static final Logger LOG = Logger.getInstance(DartProjectTemplate.class.getName()); @@ -80,36 +79,17 @@ public static void loadTemplatesAsync(@NotNull String sdkRoot, @NotNull Consumer } private static @NotNull List getStagehandTemplates(@NotNull String sdkRoot) { - boolean useDartCreate = Stagehand.isUseDartCreate(sdkRoot); - - if (useDartCreate) { - if (ourDartCreateTemplateCache != null) { - return ourDartCreateTemplateCache; - } - } - else { - if (ourStagehandTemplateCache != null) { - return ourStagehandTemplateCache; - } + if (ourDartCreateTemplateCache != null) { + return ourDartCreateTemplateCache; } - STAGEHAND.install(sdkRoot); final List templates = STAGEHAND.getAvailableTemplates(sdkRoot); - if (useDartCreate) { - ourDartCreateTemplateCache = new ArrayList<>(); - for (StagehandDescriptor template : templates) { - ourDartCreateTemplateCache.add(new StagehandTemplate(STAGEHAND, template)); - } - return ourDartCreateTemplateCache; - } - else { - ourStagehandTemplateCache = new ArrayList<>(); - for (StagehandDescriptor template : templates) { - ourStagehandTemplateCache.add(new StagehandTemplate(STAGEHAND, template)); - } - return ourStagehandTemplateCache; + ourDartCreateTemplateCache = new ArrayList<>(); + for (StagehandDescriptor template : templates) { + ourDartCreateTemplateCache.add(new StagehandTemplate(STAGEHAND, template)); } + return ourDartCreateTemplateCache; } static void createWebRunConfiguration(final @NotNull Module module, final @NotNull VirtualFile htmlFile) { diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/Stagehand.java b/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/Stagehand.java index dff3b2074..18554c664 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/Stagehand.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/projectWizard/Stagehand.java @@ -9,8 +9,6 @@ import com.intellij.openapi.util.NlsSafe; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.SystemProperties; -import com.jetbrains.lang.dart.ide.actions.DartPubActionBase; import com.jetbrains.lang.dart.sdk.DartSdkUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -22,15 +20,10 @@ import java.util.ArrayList; import java.util.List; +// TODO: Rename this and related classes away from "stagehand", +// as templates are now retrieved and bootstrapped with `dart create`. public class Stagehand { - private static final String DART_CREATE_MIN_SDK_VERSION = "2.10"; - - static boolean isUseDartCreate(@NotNull String sdkHomePath) { - String version = DartSdkUtil.getSdkVersion(sdkHomePath); - return version != null && StringUtil.compareVersionNumbers(version, DART_CREATE_MIN_SDK_VERSION) >= 0; - } - public static class StagehandDescriptor { public final @NotNull @NonNls String myId; public final @NotNull @NlsSafe String myLabel; @@ -70,30 +63,11 @@ private static ProcessOutput runDartCreate(@NotNull String sdkRoot, return new CapturingProcessHandler(command).runProcess(timeoutInSeconds * 1000, false); } - private static ProcessOutput runPubGlobal(@NotNull String sdkRoot, - @Nullable String workingDirectory, - int timeoutInSeconds, - @NotNull String pubEnvVarSuffix, - String... pubParameters) throws ExecutionException { - final GeneralCommandLine command = new GeneralCommandLine() - .withExePath(DartSdkUtil.getPubPath(sdkRoot)) - .withWorkDirectory(workingDirectory) - .withEnvironment(DartPubActionBase.PUB_ENV_VAR_NAME, DartPubActionBase.getPubEnvValue() + ".stagehand" + pubEnvVarSuffix); - - command.addParameter("global"); - command.addParameters(pubParameters); - - return new CapturingProcessHandler(command).runProcess(timeoutInSeconds * 1000, false); - } - public void generateInto(final @NotNull String sdkRoot, final @NotNull VirtualFile projectDirectory, final @NotNull String templateId) throws ExecutionException { - ProcessOutput output = isUseDartCreate(sdkRoot) - ? runDartCreate(sdkRoot, projectDirectory.getParent().getPath(), 30, "--force", "--no-pub", "--template", - templateId, projectDirectory.getName()) - : runPubGlobal(sdkRoot, projectDirectory.getPath(), 30, "", "run", "stagehand", "--author", - SystemProperties.getUserName(), templateId); + ProcessOutput output = runDartCreate(sdkRoot, projectDirectory.getParent().getPath(), 30, "--force", "--no-pub", "--template", + templateId, projectDirectory.getName()); if (output.getExitCode() != 0) { throw new ExecutionException(output.getStderr()); @@ -102,9 +76,7 @@ public void generateInto(final @NotNull String sdkRoot, public List getAvailableTemplates(final @NotNull String sdkRoot) { try { - ProcessOutput output = isUseDartCreate(sdkRoot) - ? runDartCreate(sdkRoot, null, 10, "--list-templates") - : runPubGlobal(sdkRoot, null, 10, "", "run", "stagehand", "--machine"); + ProcessOutput output = runDartCreate(sdkRoot, null, 10, "--list-templates"); int exitCode = output.getExitCode(); @@ -126,11 +98,6 @@ public List getAvailableTemplates(final @NotNull String sdk obj.optString("entrypoint"))); } - if (!isUseDartCreate(sdkRoot)) { - // Sort the stagehand templates lexically by name. - result.sort((one, two) -> one.myLabel.compareToIgnoreCase(two.myLabel)); - } - return result; } catch (ExecutionException | JSONException e) { @@ -139,15 +106,4 @@ public List getAvailableTemplates(final @NotNull String sdk return EMPTY; } - - public void install(final @NotNull String sdkRoot) { - if (isUseDartCreate(sdkRoot)) return; - - try { - runPubGlobal(sdkRoot, null, 60, ".activate", "activate", "stagehand"); - } - catch (ExecutionException e) { - LOG.info(e); - } - } } diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/psi/DartPackageAwareFileReference.java b/third_party/src/main/java/com/jetbrains/lang/dart/psi/DartPackageAwareFileReference.java index 329443f10..39d490587 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/psi/DartPackageAwareFileReference.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/psi/DartPackageAwareFileReference.java @@ -9,11 +9,10 @@ import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; -import com.jetbrains.lang.dart.analyzer.DartAnalysisServerService; import com.jetbrains.lang.dart.sdk.DartSdk; import com.jetbrains.lang.dart.util.DartResolveUtil; import com.jetbrains.lang.dart.util.DartUrlResolver; -import com.jetbrains.lang.dart.util.DotPackagesFileUtil; +import com.jetbrains.lang.dart.util.PackageConfigFileUtil; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -49,12 +48,7 @@ class DartPackageAwareFileReference extends FileReference { DartSdk sdk = DartSdk.getDartSdk(project); VirtualFile packagesFile; if (sdk != null && pubspecYamlFile != null) { - if (DartAnalysisServerService.isDartSdkVersionSufficientForPackageConfigJson(sdk)) { - packagesFile = DotPackagesFileUtil.getPackageConfigJsonFile(project, pubspecYamlFile); - } - else { - packagesFile = pubspecYamlFile.getParent().findChild(DotPackagesFileUtil.DOT_PACKAGES); - } + packagesFile = PackageConfigFileUtil.getPackageConfigJsonFile(project, pubspecYamlFile); } else { packagesFile = null; diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/psi/impl/DartFileReference.java b/third_party/src/main/java/com/jetbrains/lang/dart/psi/impl/DartFileReference.java index 1135d35f2..cce9d73f3 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/psi/impl/DartFileReference.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/psi/impl/DartFileReference.java @@ -1,9 +1,7 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.jetbrains.lang.dart.psi.impl; -import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.impl.source.resolve.ResolveCache; @@ -17,9 +15,7 @@ import com.jetbrains.lang.dart.psi.DartImportStatement; import com.jetbrains.lang.dart.psi.DartUriElement; import com.jetbrains.lang.dart.resolve.DartResolver; -import com.jetbrains.lang.dart.sdk.DartSdk; import com.jetbrains.lang.dart.util.DartResolveUtil; -import com.jetbrains.lang.dart.util.DartUrlResolver; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -80,26 +76,6 @@ public PsiElement handleElementRename(final @NotNull String newFileName) throws @Override public PsiElement bindToElement(final @NotNull PsiElement element) throws IncorrectOperationException { - if (element instanceof PsiFile) { - final VirtualFile contextFile = DartResolveUtil.getRealVirtualFile(myUriElement.getContainingFile()); - final VirtualFile targetFile = DartResolveUtil.getRealVirtualFile(((PsiFile)element)); - final Project project = myUriElement.getProject(); - final DartSdk dartSdk = DartSdk.getDartSdk(project); - if (dartSdk != null && !DartAnalysisServerService.isDartSdkVersionSufficientForMoveFileRefactoring(dartSdk)) { - if (contextFile != null && targetFile != null) { - final String newUri = DartUrlResolver.getInstance(myUriElement.getProject(), contextFile).getDartUrlForFile(targetFile); - if (newUri.startsWith(DartUrlResolver.PACKAGE_PREFIX)) { - return updateUri(newUri); - } - else if (newUri.startsWith(DartUrlResolver.FILE_PREFIX)) { - final String relativePath = FileUtil.getRelativePath(contextFile.getParent().getPath(), targetFile.getPath(), '/'); - if (relativePath != null) { - return updateUri(relativePath); - } - } - } - } - } return myUriElement; } diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/DartWebdev.kt b/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/DartWebdev.kt index 8af583d5b..ce549cea2 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/DartWebdev.kt +++ b/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/DartWebdev.kt @@ -8,7 +8,6 @@ import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.progress.ProgressManager import com.intellij.openapi.project.Project import com.intellij.openapi.util.NlsSafe -import com.intellij.openapi.util.text.StringUtil import com.intellij.util.concurrency.ThreadingAssertions import com.jetbrains.lang.dart.DartBundle import com.jetbrains.lang.dart.ide.actions.DartPubActionBase @@ -20,12 +19,6 @@ private val LOG = logger() object DartWebdev { var activated: Boolean = false - fun useWebdev(sdk: DartSdk?): Boolean { - if (sdk == null) return false - val sdkVersion = sdk.version - return StringUtil.compareVersionNumbers(sdkVersion, "2") >= 0 - } - /** * @return `false` only if explicitly cancelled by user */ diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/PubServerPathHandler.kt b/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/PubServerPathHandler.kt index f377d8932..f36922c42 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/PubServerPathHandler.kt +++ b/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/PubServerPathHandler.kt @@ -31,11 +31,6 @@ private class PubServerPathHandler : WebServerPathHandler { authHeaders: HttpHeaders, isCustomHost: Boolean, ): Boolean { - val sdk = DartSdk.getDartSdk(project) - if (sdk == null || StringUtil.compareVersionNumbers(sdk.version, "1.6") < 0) { - return false - } - val servedDirAndPathForPubServer = getServedDirAndPathForPubServer(project, path) ?: return false PubServerManager.getInstance(project).send(context.channel(), request, authHeaders, servedDirAndPathForPubServer.first, servedDirAndPathForPubServer.second) diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/PubServerService.java b/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/PubServerService.java index 6b9b4886a..0d42dab6f 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/PubServerService.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/pubServer/PubServerService.java @@ -185,27 +185,18 @@ public void sendToPubServer(final @NotNull Channel clientChannel, final DartSdk dartSdk = DartSdk.getDartSdk(project); if (dartSdk == null) return null; - if (DartWebdev.INSTANCE.useWebdev(DartSdk.getDartSdk(getProject()))) { - if (!DartWebdev.INSTANCE.getActivated()) { - ApplicationManager.getApplication() - .invokeAndWait(() -> DartWebdev.INSTANCE.ensureWebdevActivated(getProject()), ModalityState.any()); - } + if (!DartWebdev.INSTANCE.getActivated()) { + ApplicationManager.getApplication() + .invokeAndWait(() -> DartWebdev.INSTANCE.ensureWebdevActivated(getProject()), ModalityState.any()); } final GeneralCommandLine commandLine = new GeneralCommandLine().withWorkDirectory(firstServedDir.getParent().getPath()); DartPubActionBase.setupPubExePath(commandLine, dartSdk); commandLine.withEnvironment(DartPubActionBase.PUB_ENV_VAR_NAME, DartPubActionBase.getPubEnvValue()); - if (DartWebdev.INSTANCE.useWebdev(dartSdk)) { - commandLine.addParameters("global", "run", "webdev", "serve"); - commandLine.addParameter(firstServedDir.getName() + ":" + port); - commandLine.withEnvironment(DartPubActionBase.PUB_ENV_VAR_NAME, DartPubActionBase.getPubEnvValue() + ".webdev"); - } - else { - commandLine.addParameter("serve"); - commandLine.addParameter(firstServedDir.getName()); - commandLine.addParameter("--port=" + port); - } + commandLine.addParameters("global", "run", "webdev", "serve"); + commandLine.addParameter(firstServedDir.getName() + ":" + port); + commandLine.withEnvironment(DartPubActionBase.PUB_ENV_VAR_NAME, DartPubActionBase.getPubEnvValue() + ".webdev"); final OSProcessHandler processHandler = new OSProcessHandler(commandLine); processHandler.addProcessListener(new PubServeOutputListener(project, myServerReadyLock)); @@ -218,15 +209,13 @@ protected void connectToProcess(final @NotNull AsyncPromise pr final int port, final @NotNull OSProcessHandler processHandler, final @NotNull Consumer errorOutputConsumer) { - if (DartWebdev.INSTANCE.useWebdev(DartSdk.getDartSdk(getProject()))) { - synchronized (myServerReadyLock) { - try { - // wait for the Webdev server to start before redirecting, so that Chrome doesn't show error. - //noinspection WaitNotInLoop - myServerReadyLock.wait(15000); - } - catch (InterruptedException e) {/**/} + synchronized (myServerReadyLock) { + try { + // wait for the Webdev server to start before redirecting, so that Chrome doesn't show error. + //noinspection WaitNotInLoop + myServerReadyLock.wait(15000); } + catch (InterruptedException e) {/**/} } if (processHandler.isProcessTerminated()) { diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/sdk/DartSdkUtil.java b/third_party/src/main/java/com/jetbrains/lang/dart/sdk/DartSdkUtil.java index 88ae8cac7..53c2ea9b2 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/sdk/DartSdkUtil.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/sdk/DartSdkUtil.java @@ -200,12 +200,4 @@ public static void updateKnownSdkPaths(final @NotNull Project project, final @No public static @NotNull String getDartExePath(@NotNull String sdkRoot) { return sdkRoot + (SystemInfo.isWindows ? "/bin/dart.exe" : "/bin/dart"); } - - public static @NotNull String getPubPath(@NotNull DartSdk sdk) { - return getPubPath(sdk.getHomePath()); - } - - public static @NotNull String getPubPath(@NotNull String sdkRoot) { - return sdkRoot + (SystemInfo.isWindows ? "/bin/pub.bat" : "/bin/pub"); - } } diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/util/DartUrlResolverImpl.java b/third_party/src/main/java/com/jetbrains/lang/dart/util/DartUrlResolverImpl.java index 41fee54a9..feb070095 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/util/DartUrlResolverImpl.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/util/DartUrlResolverImpl.java @@ -17,7 +17,6 @@ import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.PairConsumer; -import com.jetbrains.lang.dart.analyzer.DartAnalysisServerService; import com.jetbrains.lang.dart.ide.index.DartLibraryIndex; import com.jetbrains.lang.dart.sdk.DartPackagesLibraryProperties; import com.jetbrains.lang.dart.sdk.DartPackagesLibraryType; @@ -195,15 +194,8 @@ private void initLivePackageNameToDirMap() { final VirtualFile baseDir = myPubspecYamlFile == null ? null : myPubspecYamlFile.getParent(); if (myPubspecYamlFile == null || baseDir == null) return; - Map packagesMap; - if (myDartSdk == null || DartAnalysisServerService.isDartSdkVersionSufficientForPackageConfigJson(myDartSdk)) { - VirtualFile packagesFile = DotPackagesFileUtil.getPackageConfigJsonFile(myProject, myPubspecYamlFile); - packagesMap = packagesFile != null ? DotPackagesFileUtil.getPackagesMapFromPackageConfigJsonFile(packagesFile) : null; - } - else { - VirtualFile packagesFile = baseDir.findChild(DotPackagesFileUtil.DOT_PACKAGES); - packagesMap = packagesFile != null ? DotPackagesFileUtil.getPackagesMap(packagesFile) : null; - } + final VirtualFile packagesFile = PackageConfigFileUtil.getPackageConfigJsonFile(myProject, myPubspecYamlFile); + final Map packagesMap = packagesFile != null ? PackageConfigFileUtil.getPackagesMapFromPackageConfigJsonFile(packagesFile) : null; if (packagesMap != null) { for (Map.Entry entry : packagesMap.entrySet()) { diff --git a/third_party/src/main/java/com/jetbrains/lang/dart/util/DotPackagesFileUtil.java b/third_party/src/main/java/com/jetbrains/lang/dart/util/PackageConfigFileUtil.java similarity index 71% rename from third_party/src/main/java/com/jetbrains/lang/dart/util/DotPackagesFileUtil.java rename to third_party/src/main/java/com/jetbrains/lang/dart/util/PackageConfigFileUtil.java index da3a9060d..1e9c8068b 100644 --- a/third_party/src/main/java/com/jetbrains/lang/dart/util/DotPackagesFileUtil.java +++ b/third_party/src/main/java/com/jetbrains/lang/dart/util/PackageConfigFileUtil.java @@ -15,20 +15,16 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.OSAgnosticPathUtil; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.io.URLUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.HashMap; -import java.util.List; import java.util.Map; -public final class DotPackagesFileUtil { - - public static final String DOT_PACKAGES = ".packages"; +public final class PackageConfigFileUtil { public static final String DART_TOOL_DIR = ".dart_tool"; public static final String PACKAGE_CONFIG_JSON = "package_config.json"; @@ -85,17 +81,6 @@ public final class DotPackagesFileUtil { return null; } - public static @Nullable VirtualFile findDotPackagesFile(@Nullable VirtualFile dir) { - while (dir != null) { - final VirtualFile file = dir.findChild(DOT_PACKAGES); - if (file != null && !file.isDirectory()) { - return file; - } - dir = dir.getParent(); - } - return null; - } - public static @Nullable Map getPackagesMapFromPackageConfigJsonFile(final @NotNull VirtualFile packageConfigJsonFile) { Pair> data = packageConfigJsonFile.getUserData(MOD_STAMP_TO_PACKAGES_MAP); @@ -142,8 +127,11 @@ public final class DotPackagesFileUtil { * ``` */ private static @Nullable Map loadPackagesMapFromJson(@NotNull VirtualFile packageConfigJsonFile) { - String fileContentsStr = FileUtil.loadFileOrNull(packageConfigJsonFile.getPath()); - if (fileContentsStr == null) { + final String fileContentsStr; + try { + fileContentsStr = StringUtil.convertLineSeparators(VfsUtilCore.loadText(packageConfigJsonFile)); + } + catch (Exception e) { return null; } @@ -152,7 +140,7 @@ public final class DotPackagesFileUtil { jsonElement = JsonParser.parseString(fileContentsStr); } catch (Exception e) { - Logger.getInstance(DotPackagesFileUtil.class).info(e); + Logger.getInstance(PackageConfigFileUtil.class).info(e); return null; } @@ -184,62 +172,6 @@ public final class DotPackagesFileUtil { return null; } - public static @Nullable Map getPackagesMap(final @NotNull VirtualFile dotPackagesFile) { - Pair> data = dotPackagesFile.getUserData(MOD_STAMP_TO_PACKAGES_MAP); - - final Long currentTimestamp = dotPackagesFile.getModificationCount(); - final Long cachedTimestamp = Pair.getFirst(data); - - if (cachedTimestamp == null || !cachedTimestamp.equals(currentTimestamp)) { - data = null; - dotPackagesFile.putUserData(MOD_STAMP_TO_PACKAGES_MAP, null); - final Map packagesMap = loadPackagesMap(dotPackagesFile); - - if (packagesMap != null) { - data = Pair.create(currentTimestamp, packagesMap); - dotPackagesFile.putUserData(MOD_STAMP_TO_PACKAGES_MAP, data); - } - } - - return Pair.getSecond(data); - } - - private static @Nullable Map loadPackagesMap(@NotNull VirtualFile dotPackagesFile) { - try { - final List lines; - if (ApplicationManager.getApplication().isUnitTestMode()) { - lines = StringUtil.split(new String(dotPackagesFile.contentsToByteArray(), StandardCharsets.UTF_8), "\n"); - } - else { - lines = FileUtil.loadLines(dotPackagesFile.getPath(), "UTF-8"); - } - - final Map result = new HashMap<>(); - - for (String line : lines) { - if (line.trim().isEmpty() || line.startsWith("#")) continue; - - final int colonIndex = line.indexOf(':'); - if (colonIndex > 0 && colonIndex < line.length() - 1) { - final String packageName = line.substring(0, colonIndex).trim(); - final String encodedUri = line.substring(colonIndex + 1).trim(); - // need to protect '+' chars because URLDecoder.decode replaces '+' with space - final String encodedUriWithoutPluses = StringUtil.replace(encodedUri, "+", "%2B"); - final String uri = URLUtil.decode(encodedUriWithoutPluses); - final String packageUri = getAbsolutePackageRootPath(dotPackagesFile.getParent(), uri); - if (!packageName.isEmpty() && packageUri != null) { - result.put(packageName, packageUri); - } - } - } - - return result; - } - catch (IOException e) { - return null; - } - } - private static @Nullable String getAbsolutePackageRootPath(@NotNull VirtualFile baseDir, @NotNull String uri) { if (uri.startsWith("file:/")) { final String pathAfterSlashes = StringUtil.trimEnd(StringUtil.trimLeading(StringUtil.trimStart(uri, "file:/"), '/'), "/"); diff --git a/third_party/src/main/resources/messages/DartBundle.properties b/third_party/src/main/resources/messages/DartBundle.properties index 0c1fe1212..b6fe6a6fd 100644 --- a/third_party/src/main/resources/messages/DartBundle.properties +++ b/third_party/src/main/resources/messages/DartBundle.properties @@ -109,7 +109,6 @@ runner.web.app.configuration.name=Dart Web App command.line.run.config.label.dart.file=Dart &file: command.line.run.config.label.vm.options=&VM options: command.line.run.config.checkbox.enable.asserts=E&nable asserts -command.line.run.config.checkbox.checked.mode=Checked mode command.line.run.config.label.program.arguments=Program a&rguments: command.line.run.config.label.working.directory=&Working directory: @@ -125,7 +124,6 @@ webdev.debug.configuration.description=Start Dart web application using the webd web.run.config.label.html.file=HTML &file: web.run.config.label.webdev.port=Webdev &port: choose.html.main.file=Choose HTML File -old.dart.sdk.for.webdev=Dart SDK {0}+ is required for debugging a Dart web app using webdev, current version: {1} dart.project.description=Create project for use with the Dart programming language project.template.not.selected=Project template is not selected @@ -144,7 +142,6 @@ working.dir.0=Working dir: {0} dart.pub.get.title=Pub Get dart.pub.upgrade.title=Pub Upgrade dart.pub.outdated.title=Pub Outdated -dart.pub.build.title=Pub Build dart.webdev.build.title=Webdev Build dart.pub.cache.repair.title=Pub Repair Cache dart.pub.cache.repair.message=The pub cache repair command performs a clean reinstall
of all hosted and git packages in the system cache.

Start cache repair? @@ -348,8 +345,6 @@ action.Dart.stop.dart.webdev.server.description=Stop Dart Webdev Server action.DartCopyDtdUriAction.text=Dart: Copy DTD URI to Clipboard action.DartCopyDtdUriAction.description=Copy Dart Tooling Daemon URI to clipboard -action.description.run.pub.build=Run 'pub build' -action.text.pub.build=Pub Build\u2026 action.text.webdev.build=Webdev Build\u2026 action.description.run.webdev.build=Run 'webdev build' border.breaking.policy=Breaking Policy @@ -397,7 +392,6 @@ filetype.dart.description=Dart validation.info.input.and.output.folders.must.be.different=Input and output folders must be different validation.info.output.folder.not.specified=Output folder not specified validation.info.input.folder.not.specified=Input folder not specified -validation.info.build.mode.not.specified=Build mode not specified button.browse.dialog.title.output.folder=Output Folder button.text.build2=Build action.title.dart.rename.refactoring=Dart Rename Refactoring @@ -448,10 +442,6 @@ radio.inline.all.references.remove.method=Inline all references and remove the m radio.inline.this.reference.leave.method=Inline this reference and leave the method label.method.0=Method {0} -dart.build.dialog.label.build.mode=Build mode: -dart.build.dialog.radio.button.release=&Release -dart.build.dialog.radio.button.debug=&Debug -dart.build.dialog.radio.button.other=&Other: dart.build.dialog.label.input.folder=&Input folder: dart.build.dialog.label.output.folder=O&utput folder: diff --git a/third_party/src/test/java/com/jetbrains/lang/dart/workflow/DartWorkflowTest.java b/third_party/src/test/java/com/jetbrains/lang/dart/workflow/DartWorkflowTest.java index 2098b82c7..39a2498e5 100644 --- a/third_party/src/test/java/com/jetbrains/lang/dart/workflow/DartWorkflowTest.java +++ b/third_party/src/test/java/com/jetbrains/lang/dart/workflow/DartWorkflowTest.java @@ -140,15 +140,34 @@ public void testDartUrlResolver() { name: NestedProject dependencies: RootProject: - path: ../""").getVirtualFile(); + path: ../ + SomePackage: any""").getVirtualFile(); myFixture.addFileToProject("example/lib/src/nestedlib.dart", ""); myFixture.addFileToProject("example/packages/NestedProject/nestedlib.dart", ""); myFixture.addFileToProject("example/packages/RootProject/rootlib.dart", ""); myFixture.addFileToProject("pub/global/cache/SomePackage/lib/somepack.dart", ""); - myFixture.saveText(myFixture.addFileToProject("example/.packages", "").getVirtualFile(), - "RootProject:../lib/\n" + - "NestedProject:lib/\n" + - "SomePackage:" + rootUrl + "/pub/global/cache/SomePackage/lib/"); + myFixture.saveText(myFixture.addFileToProject("example/.dart_tool/package_config.json", "").getVirtualFile(), + String.format(""" + { + "configVersion": 2, + "packages": [ + { + "name": "SomePackage", + "rootUri": "%s", + "packageUri": "lib/" + }, + { + "name": "RootProject", + "rootUri": "../../", + "packageUri": "lib/" + }, + { + "name": "NestedProject", + "rootUri": "../", + "packageUri": "lib/" + } + ] + }""", rootUrl + "/pub/global/cache/SomePackage")); DartUrlResolver resolver = DartUrlResolver.getInstance(getProject(), nestedPubspec); VirtualFile file;