diff --git a/.idea/aws.xml b/.idea/aws.xml new file mode 100644 index 000000000..d6edbd7b1 --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index e4eed6d91..f76035daa 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml new file mode 100644 index 000000000..d68d95837 --- /dev/null +++ b/.idea/dbnavigator.xml @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/emacs.xml b/.idea/emacs.xml new file mode 100644 index 000000000..a1e816fc0 --- /dev/null +++ b/.idea/emacs.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/icon.png b/.idea/icon.png old mode 100755 new mode 100644 diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 000000000..29936c2f4 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/jpa-buddy.xml b/.idea/jpa-buddy.xml new file mode 100644 index 000000000..966d5f56a --- /dev/null +++ b/.idea/jpa-buddy.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/markdown.xml b/.idea/markdown.xml new file mode 100644 index 000000000..8c1e5f3ed --- /dev/null +++ b/.idea/markdown.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 9272e3224..99ce4c7c4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml1 b/.idea/misc.xml1 new file mode 100644 index 000000000..6c477170a --- /dev/null +++ b/.idea/misc.xml1 @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml index 0637f91e3..e96534fb2 100644 --- a/.idea/uiDesigner.xml +++ b/.idea/uiDesigner.xml @@ -119,9 +119,6 @@ - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index c80f2198b..35eb1ddfb 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,7 +1,6 @@ - + - - + \ No newline at end of file diff --git a/build.gradle b/build.gradle index d3dc1f4dd..110994f7f 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,10 @@ dependencies { version = "${version}.$buildNumber" allprojects { - repositories { mavenCentral() } + repositories { + mavenLocal() + mavenCentral() + } apply plugin: 'java' sourceCompatibility = javaVersion targetCompatibility = javaTargetVersion @@ -31,6 +34,7 @@ allprojects { apply plugin: 'org.jetbrains.intellij' intellij { version = ideaVersion + type.set("IC") plugins = ['copyright', 'java'] downloadSources = Boolean.valueOf(sources) sameSinceUntilBuild = Boolean.valueOf(isEAP) @@ -67,6 +71,7 @@ allprojects { } repositories { + mavenLocal() jcenter() flatDir { dirs 'libs' diff --git a/gradle.properties b/gradle.properties index 34048313e..1a329e569 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ version = 0.11 ideaVersion = 2023.2 javaVersion = 17 javaTargetVersion = 17 -buildNumber = SNAPSHOT +buildNumber = X sources = true isEAP = false localIdePath = diff --git a/jps-plugin/build.gradle b/jps-plugin/build.gradle index 379382033..52299d1b5 100644 --- a/jps-plugin/build.gradle +++ b/jps-plugin/build.gradle @@ -1 +1,10 @@ -jar.archiveFileName = "jps-plugin.jar" \ No newline at end of file +jar.archiveName = "jps-plugin.jar" + +repositories { + mavenLocal() + mavenCentral() +} + +dependencies { + implementation group: 'com.github.metadave', name: 'etp', version: '0.7' +} diff --git a/jps-plugin/src/org/intellij/erlang/jps/builder/AppFileConverter.java b/jps-plugin/src/org/intellij/erlang/jps/builder/AppFileConverter.java new file mode 100755 index 000000000..8360f4f91 --- /dev/null +++ b/jps-plugin/src/org/intellij/erlang/jps/builder/AppFileConverter.java @@ -0,0 +1,76 @@ +package org.intellij.erlang.jps.builder; + +import java.io.*; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import com.intellij.openapi.util.io.FileUtil; +import com.metadave.etp.ETP; +import com.metadave.etp.rep.*; +import org.jetbrains.jps.incremental.CompileContext; +import org.jetbrains.jps.incremental.messages.BuildMessage; +import org.jetbrains.jps.incremental.messages.CompilerMessage; + +/** + * Takes original xxx.app.src file decodes it using ETP library, and adds modules and registred sections + * if they are not already present. + */ +public class AppFileConverter { + private File appConfigSrc; + private ETPTuple appConfigterms; + private CompileContext context; + public AppFileConverter(CompileContext context, File appConfigSrc, File outputDir) { + this.context=context; + this.appConfigSrc=appConfigSrc; + try { + appConfigterms = (ETPTuple)ETP.parse(new FileInputStream(appConfigSrc)); + if(!"application".equals(((ETPAtom)(appConfigterms.getValue(0))).getValue())) + throw new ParseException("Unexpected file format - missing application",0); + List> list=((ETPList)(appConfigterms.getValue(2))).getValue(); + HashSet s = new HashSet<>(); + for(ETPTerm etpTerm : list) { + String name = ((ETPAtom)(((ETPTuple)etpTerm).getValue(0))).getValue(); + s.add(name); + } + if(!s.contains("registered")) { + list.add(new ETPTuple(new ETPAtom("registered"),new ETPList(new ArrayList>()))); + } + if(!s.contains("modules")) { + String[] names = outputDir.list(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.endsWith("beam"); + } + }); + ArrayList> modules = new ArrayList>(); + for(int i=0;i parseTransforms = extension != null ? extension.getParseTransforms() : Collections.emptyList(); + List flags = extension != null ? extension.getExtraFlags() : Collections.emptyList(); if (parseTransforms.isEmpty()) return; for (String ptModule : parseTransforms) { commandLine.addParameter("+{parse_transform, " + ptModule + "}"); } + for (String ptModule : flags) { + commandLine.addParameter(ptModule); + } } private static void addCodePath(@NotNull GeneralCommandLine commandLine, diff --git a/jps-plugin/src/org/intellij/erlang/jps/builder/ErlangCompilerError.java b/jps-plugin/src/org/intellij/erlang/jps/builder/ErlangCompilerError.java index 4165a4006..230a73d9e 100644 --- a/jps-plugin/src/org/intellij/erlang/jps/builder/ErlangCompilerError.java +++ b/jps-plugin/src/org/intellij/erlang/jps/builder/ErlangCompilerError.java @@ -1,96 +1,97 @@ -/* - * Copyright 2012-2014 Sergey Ignatov - * - * 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. - */ - -package org.intellij.erlang.jps.builder; - -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jps.incremental.messages.BuildMessage; - -import java.io.File; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class ErlangCompilerError { - static final Pattern COMPILER_MESSAGE_PATTERN = Pattern.compile("^((?:[a-zA-Z]:)?.+?):(?:(\\d+):)?(\\s*Warning:)?\\s*(.+)$"); - static final int PATH_MATCH_INDEX = 1; - static final int LINE_MATCH_INDEX = 2; - static final int WARNING_MATCH_INDEX = 3; - static final int DETAILS_MATCH_INDEX = 4; - - private final String myErrorMessage; - private final String myUrl; - private final int myLine; - private final BuildMessage.Kind myKind; - - private ErlangCompilerError(@NotNull String errorMessage, - @NotNull String url, - int line, - @NotNull BuildMessage.Kind category) { - this.myErrorMessage = errorMessage; - this.myUrl = url; - this.myLine = line; - this.myKind = category; - } - - @NotNull - public String getErrorMessage() { - return myErrorMessage; - } - - @NotNull - public String getUrl() { - return myUrl; - } - - public int getLine() { - return myLine; - } - - @NotNull - public BuildMessage.Kind getKind() { - return myKind; - } - - @Nullable - public static ErlangCompilerError create(@NotNull String rootPath, @NotNull String erlcMessage) { - Matcher matcher = COMPILER_MESSAGE_PATTERN.matcher(StringUtil.trimTrailing(erlcMessage)); - if (!matcher.matches()) return null; - - String relativeFilePath = FileUtil.toSystemIndependentName(matcher.group(PATH_MATCH_INDEX)); - File path = StringUtil.isEmpty(rootPath) ? new File(relativeFilePath) : new File(FileUtil.toSystemIndependentName(rootPath), relativeFilePath); - if (!path.exists()) return null; - - String line = matcher.group(LINE_MATCH_INDEX); - String warning = matcher.group(WARNING_MATCH_INDEX); - String details = matcher.group(DETAILS_MATCH_INDEX); - return createCompilerError(path.getPath(), line, warning, details); - } - - @NotNull - private static ErlangCompilerError createCompilerError(@NotNull String filePath, - @Nullable String line, - @Nullable String warning, - @NotNull String details) { - int lineNumber = StringUtil.parseInt(line, -1); - BuildMessage.Kind category = warning != null ? BuildMessage.Kind.WARNING : BuildMessage.Kind.ERROR; - // VfsUtilCore.pathToUrl(filePath) - String fileUrl = "file://" + FileUtil.toSystemIndependentName(filePath); - return new ErlangCompilerError(details, fileUrl, lineNumber, category); - } -} +/* + * Copyright 2012-2014 Sergey Ignatov + * + * 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. + */ + +package org.intellij.erlang.jps.builder; + +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.text.StringUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jps.incremental.messages.BuildMessage; + +import java.io.File; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class ErlangCompilerError { + + static final Pattern COMPILER_MESSAGE_PATTERN = Pattern.compile("^((?:[a-zA-Z]:)?.+?):(?:(\\d+)(?::\\d+)?:)?(\\s*Warning:)?\\s*(.+)$"); + static final int PATH_MATCH_INDEX = 1; + static final int LINE_MATCH_INDEX = 2; + static final int WARNING_MATCH_INDEX = 3; + static final int DETAILS_MATCH_INDEX = 4; + + private final String myErrorMessage; + private final String myUrl; + private final int myLine; + private final BuildMessage.Kind myKind; + + private ErlangCompilerError(@NotNull String errorMessage, + @NotNull String url, + int line, + @NotNull BuildMessage.Kind category) { + this.myErrorMessage = errorMessage; + this.myUrl = url; + this.myLine = line; + this.myKind = category; + } + + @NotNull + public String getErrorMessage() { + return myErrorMessage; + } + + @NotNull + public String getUrl() { + return myUrl; + } + + public int getLine() { + return myLine; + } + + @NotNull + public BuildMessage.Kind getKind() { + return myKind; + } + + @Nullable + public static ErlangCompilerError create(@NotNull String rootPath, @NotNull String erlcMessage) { + Matcher matcher = COMPILER_MESSAGE_PATTERN.matcher(StringUtil.trimTrailing(erlcMessage)); + if (!matcher.matches()) return null; + + String relativeFilePath = FileUtil.toSystemIndependentName(matcher.group(PATH_MATCH_INDEX)); + File path = StringUtil.isEmpty(rootPath) ? new File(relativeFilePath) : new File(FileUtil.toSystemIndependentName(rootPath), relativeFilePath); + if (!path.exists()) return null; + + String line = matcher.group(LINE_MATCH_INDEX); + String warning = matcher.group(WARNING_MATCH_INDEX); + String details = matcher.group(DETAILS_MATCH_INDEX); + return createCompilerError(path.getPath(), line, warning, details); + } + + @NotNull + private static ErlangCompilerError createCompilerError(@NotNull String filePath, + @Nullable String line, + @Nullable String warning, + @NotNull String details) { + int lineNumber = StringUtil.parseInt(line, -1); + BuildMessage.Kind category = warning != null ? BuildMessage.Kind.WARNING : BuildMessage.Kind.ERROR; + // VfsUtilCore.pathToUrl(filePath) + String fileUrl = "file://" + FileUtil.toSystemIndependentName(filePath); + return new ErlangCompilerError(details, fileUrl, lineNumber, category); + } +} diff --git a/jps-plugin/src/org/intellij/erlang/jps/builder/ErlangCompilerProcessAdapter.java b/jps-plugin/src/org/intellij/erlang/jps/builder/ErlangCompilerProcessAdapter.java index bc7da70b0..36059e4f8 100644 --- a/jps-plugin/src/org/intellij/erlang/jps/builder/ErlangCompilerProcessAdapter.java +++ b/jps-plugin/src/org/intellij/erlang/jps/builder/ErlangCompilerProcessAdapter.java @@ -32,7 +32,11 @@ public ErlangCompilerProcessAdapter(@NotNull CompileContext context, @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { - showMessage(createCompilerMessage(myBuilderName, myCompileTargetRootPath, event.getText())); + ErlangCompilerError error = ErlangCompilerError.create(myCompileTargetRootPath, event.getText()); + if(error!=null) { + showMessage(new CompilerMessage(myBuilderName, error.getKind(), error.getErrorMessage(), extractPath(error.getUrl()), -1L, -1L, -1L, error.getLine(), -1L)); + } + showMessage(new CompilerMessage(myBuilderName,BuildMessage.Kind.INFO,event.getText(),null,-1L,-1L,-1L,-1L,-1L)); } @NotNull @@ -47,7 +51,8 @@ public static CompilerMessage createCompilerMessage(@NotNull String builderName, ErlangCompilerError error = ErlangCompilerError.create(compileTargetRootPath, text); if (error != null) { kind = error.getKind(); - messageText = error.getErrorMessage(); + // + // messageText = error.getErrorMessage(); sourcePath = extractPath(error.getUrl()); line = error.getLine(); diff --git a/jps-plugin/src/org/intellij/erlang/jps/model/ErlangModuleExtensionProperties.java b/jps-plugin/src/org/intellij/erlang/jps/model/ErlangModuleExtensionProperties.java index 1dd0b67c3..7e3b70369 100644 --- a/jps-plugin/src/org/intellij/erlang/jps/model/ErlangModuleExtensionProperties.java +++ b/jps-plugin/src/org/intellij/erlang/jps/model/ErlangModuleExtensionProperties.java @@ -29,10 +29,17 @@ public class ErlangModuleExtensionProperties { //should not contain duplicate elements public List myParseTransforms = new ArrayList<>(); + @Tag("extraFlags") + @XCollection(elementName="flags") + //should not contain duplicate elements + public List myExtraFlags = new ArrayList<>(); + public ErlangModuleExtensionProperties() { } public ErlangModuleExtensionProperties(@NotNull ErlangModuleExtensionProperties props) { myParseTransforms = new ArrayList<>(props.myParseTransforms); + myExtraFlags = new ArrayList<>(props.myExtraFlags); + } } diff --git a/jps-plugin/src/org/intellij/erlang/jps/model/JpsErlangModuleExtension.java b/jps-plugin/src/org/intellij/erlang/jps/model/JpsErlangModuleExtension.java index 953f8128c..cb3eb60be 100644 --- a/jps-plugin/src/org/intellij/erlang/jps/model/JpsErlangModuleExtension.java +++ b/jps-plugin/src/org/intellij/erlang/jps/model/JpsErlangModuleExtension.java @@ -58,6 +58,10 @@ public List getParseTransforms() { return Collections.unmodifiableList(myProperties.myParseTransforms); } + public List getExtraFlags() { + return Collections.unmodifiableList(myProperties.myExtraFlags); + } + @Nullable public static JpsErlangModuleExtension getExtension(@Nullable JpsModule module) { return module != null ? module.getContainer().getChild(ROLE) : null; diff --git a/jps-plugin/tests/org/intellij/erlang/jps/ErlangBuilderTest.java b/jps-plugin/tests/org/intellij/erlang/jps/ErlangBuilderTest.java index f8b8895c4..a0aefcc83 100644 --- a/jps-plugin/tests/org/intellij/erlang/jps/ErlangBuilderTest.java +++ b/jps-plugin/tests/org/intellij/erlang/jps/ErlangBuilderTest.java @@ -77,4 +77,6 @@ protected void addModule(@NotNull String moduleName, @NotNull JpsSdk sdk) { addModule(moduleName, srcPaths, outputPath, testOutputPath, sdk, JpsErlangModuleType.INSTANCE); } + + } diff --git a/jps-plugin/tests/org/intellij/erlang/jps/builder/ErlangCompilerErrorTest.java b/jps-plugin/tests/org/intellij/erlang/jps/builder/ErlangCompilerErrorTest.java index 574bcdbd6..5da5cf40c 100644 --- a/jps-plugin/tests/org/intellij/erlang/jps/builder/ErlangCompilerErrorTest.java +++ b/jps-plugin/tests/org/intellij/erlang/jps/builder/ErlangCompilerErrorTest.java @@ -47,6 +47,16 @@ public void testMatchesMessageFromErlcOnMac() { ); } + public void testMatchesMessageFromErlc24OnLinux() { + doRegexMatchTest( + "/srv/work/docker-dev/MSVE_dev_env/project/mpro/src/mpro_rest_proxy.erl:476:1: Warning: function merge_pdus/1 is unused\\n'", + "/srv/work/docker-dev/MSVE_dev_env/project/mpro/src/mpro_rest_proxy.erl", + "476:1", + " Warning:", + "function merge_pdus/1 is unused\\n'" + ); + } + private static void doRegexMatchTest( @NotNull String erlcMessage, @Nullable String path, @@ -56,9 +66,14 @@ private static void doRegexMatchTest( ) { Matcher matcher = COMPILER_MESSAGE_PATTERN.matcher(erlcMessage); assertTrue(matcher.matches()); - assertEquals(path, matcher.group(PATH_MATCH_INDEX)); - assertEquals(line, matcher.group(LINE_MATCH_INDEX)); - assertEquals(warning, matcher.group(WARNING_MATCH_INDEX)); - assertEquals(details, matcher.group(DETAILS_MATCH_INDEX)); + String pathT=matcher.group(PATH_MATCH_INDEX); + String lineT=matcher.group(LINE_MATCH_INDEX); + String warnT=matcher.group(WARNING_MATCH_INDEX); + String detaT=matcher.group(DETAILS_MATCH_INDEX); + + assertEquals(path, pathT); + assertEquals(line, lineT); + assertEquals(warning,warnT ); + assertEquals(details, detaT); } } diff --git a/resources/META-INF/java-deps.xml b/resources/META-INF/java-deps.xml index 2440a5d75..b5407af7f 100644 --- a/resources/META-INF/java-deps.xml +++ b/resources/META-INF/java-deps.xml @@ -17,7 +17,7 @@ - + diff --git a/resources/debugger/beams/debugnode.beam b/resources/debugger/beams/debugnode.beam index fa68cc1f8..7a3bf2ee2 100644 Binary files a/resources/debugger/beams/debugnode.beam and b/resources/debugger/beams/debugnode.beam differ diff --git a/resources/debugger/beams/remote_debugger.beam b/resources/debugger/beams/remote_debugger.beam index 9404bfabc..1b4fe30b8 100644 Binary files a/resources/debugger/beams/remote_debugger.beam and b/resources/debugger/beams/remote_debugger.beam differ diff --git a/resources/debugger/beams/remote_debugger_listener.beam b/resources/debugger/beams/remote_debugger_listener.beam index e31874b0b..59fac05a9 100644 Binary files a/resources/debugger/beams/remote_debugger_listener.beam and b/resources/debugger/beams/remote_debugger_listener.beam differ diff --git a/resources/debugger/beams/remote_debugger_notifier.beam b/resources/debugger/beams/remote_debugger_notifier.beam index 9d6c13d02..0bd74fc19 100644 Binary files a/resources/debugger/beams/remote_debugger_notifier.beam and b/resources/debugger/beams/remote_debugger_notifier.beam differ diff --git a/src/org/intellij/erlang/debugger/remote/ErlangRemoteDebugRunConfigurationType.java b/src/org/intellij/erlang/debugger/remote/ErlangRemoteDebugRunConfigurationType.java index 0e03567e0..bcf5d1b98 100644 --- a/src/org/intellij/erlang/debugger/remote/ErlangRemoteDebugRunConfigurationType.java +++ b/src/org/intellij/erlang/debugger/remote/ErlangRemoteDebugRunConfigurationType.java @@ -38,6 +38,12 @@ private ErlangRemoteDebugRunConfigurationType() { public RunConfiguration createTemplateConfiguration(@NotNull Project project) { return new ErlangRemoteDebugRunConfiguration(project, "Erlang remote node"); } + + @NotNull + @Override + public String getId() { + return "Erlang Remote Node"; + } }); } diff --git a/src/org/intellij/erlang/debugger/xdebug/ErlangXDebugProcess.java b/src/org/intellij/erlang/debugger/xdebug/ErlangXDebugProcess.java index a66f91509..c6e3f6a83 100644 --- a/src/org/intellij/erlang/debugger/xdebug/ErlangXDebugProcess.java +++ b/src/org/intellij/erlang/debugger/xdebug/ErlangXDebugProcess.java @@ -394,7 +394,8 @@ private static void setUpErlangDebuggerCodePath(GeneralCommandLine commandLine) } private static void copyBeamTo(String beamName, File directory) throws IOException { - try (var inputStream = ResourceUtil.getResourceAsStream(ClassLoader.getSystemClassLoader(), "/debugger/beams", beamName)) { + // ClassLoader cl=ErlangXDebugProcess.class.getClassLoader(); + try (var inputStream = ErlangXDebugProcess.class.getResourceAsStream("/debugger/beams/"+beamName)) { if (inputStream == null) { throw new IOException("Failed to locate debugger module: " + beamName); } diff --git a/src/org/intellij/erlang/eunit/ErlangUnitRunConfigurationType.java b/src/org/intellij/erlang/eunit/ErlangUnitRunConfigurationType.java index 8cf58df0d..b1338fb76 100644 --- a/src/org/intellij/erlang/eunit/ErlangUnitRunConfigurationType.java +++ b/src/org/intellij/erlang/eunit/ErlangUnitRunConfigurationType.java @@ -35,6 +35,7 @@ private ErlangUnitRunConfigurationType() { addFactory(new ErlangUnitConfigurationFactory(this)); } + public static ErlangUnitRunConfigurationType getInstance() { return CONFIGURATION_TYPE_EP.findExtensionOrFail(ErlangUnitRunConfigurationType.class); } diff --git a/src/org/intellij/erlang/facet/ErlangFacetConfiguration.java b/src/org/intellij/erlang/facet/ErlangFacetConfiguration.java index f2cb28446..1028dc1e5 100644 --- a/src/org/intellij/erlang/facet/ErlangFacetConfiguration.java +++ b/src/org/intellij/erlang/facet/ErlangFacetConfiguration.java @@ -55,12 +55,26 @@ public List getParseTransforms() { return Collections.unmodifiableList(myState.myParseTransforms); } + public void setParseTransformsFrom(Iterable parseTransforms) { myState.myParseTransforms = new ArrayList<>(ContainerUtil.newLinkedHashSet(parseTransforms)); } + public void addParseTransforms(Collection newParseTransforms) { if (newParseTransforms.isEmpty()) return; setParseTransformsFrom(ContainerUtil.concat(myState.myParseTransforms, newParseTransforms)); } + + + public List getExtraFlags() { + return Collections.unmodifiableList(myState.myExtraFlags); + } + public void setExtraFlagsFrom(Iterable extraFlags) { + myState.myExtraFlags = new ArrayList<>(ContainerUtil.newLinkedHashSet(extraFlags)); + } + public void addExtraFlags(Collection extraFlags) { + if (extraFlags.isEmpty()) return; + setParseTransformsFrom(ContainerUtil.concat(myState.myExtraFlags, extraFlags)); + } } diff --git a/src/org/intellij/erlang/facet/ui/ErlangFacetEditor.form b/src/org/intellij/erlang/facet/ui/ErlangFacetEditor.form index 66058dda9..3d231d0b4 100644 --- a/src/org/intellij/erlang/facet/ui/ErlangFacetEditor.form +++ b/src/org/intellij/erlang/facet/ui/ErlangFacetEditor.form @@ -8,7 +8,7 @@ - + @@ -33,6 +33,22 @@ + + + + + + + + + + + + + + + + diff --git a/src/org/intellij/erlang/facet/ui/ErlangFacetEditor.java b/src/org/intellij/erlang/facet/ui/ErlangFacetEditor.java index 2dfdf4a6d..3703dddfc 100644 --- a/src/org/intellij/erlang/facet/ui/ErlangFacetEditor.java +++ b/src/org/intellij/erlang/facet/ui/ErlangFacetEditor.java @@ -29,10 +29,14 @@ import javax.swing.*; import javax.swing.event.DocumentEvent; import java.util.List; +import java.util.ArrayList; +import java.util.StringTokenizer; public class ErlangFacetEditor extends FacetEditorTab { private JPanel myRootPanel; private JTextField myParseTransformsEditorField; + private JTextField myFlagsEditorField; + private final ErlangFacetConfiguration myConfiguration; private boolean myIsModified = false; @@ -45,6 +49,12 @@ protected void textChanged(DocumentEvent e) { myIsModified = true; } }); + myFlagsEditorField.getDocument().addDocumentListener(new DocumentAdapter() { + @Override + protected void textChanged(DocumentEvent e) { + myIsModified = true; + } + }); } @Nls @@ -68,6 +78,7 @@ public boolean isModified() { @Override public void reset() { myParseTransformsEditorField.setText(getConfigurationParseTransforms()); + myFlagsEditorField.setText(getConfigurationExtraFlags()); myIsModified = false; } @@ -78,6 +89,7 @@ public void disposeUIResources() { @Override public void apply() { myConfiguration.setParseTransformsFrom(getUiParseTransforms()); + myConfiguration.setExtraFlagsFrom(getUiExtraFlags()); myIsModified = false; } @@ -85,6 +97,35 @@ private String getConfigurationParseTransforms() { return StringUtil.join(myConfiguration.getParseTransforms(), ", "); } + private String getConfigurationExtraFlags() { + return StringUtil.join(myConfiguration.getExtraFlags(), " "); + } + + private List getUiExtraFlags() { + String extraFlagsString = myFlagsEditorField.getText(); + StringTokenizer st=new StringTokenizer(extraFlagsString," '"); + boolean quoted=false; + List result=new ArrayList(); + StringBuilder sb=new StringBuilder(); + while(st.hasMoreTokens()) + { + String token=st.nextToken(); + if(token.equals("'")) { + quoted = !quoted; + } + if(!quoted && token.equals(" ")) { + if(sb.length()>0) + result.add(sb.toString()); + sb = new StringBuilder(); + } else { + sb.append(token); + } + } + if(sb.length()>0) + result.add(sb.toString()); + return result; + } + private List getUiParseTransforms() { String parseTransformsString = myParseTransformsEditorField.getText(); List split = StringUtil.split(parseTransformsString, ",");