Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Выделен программный интерфейс для подключения сторонних реализаций клиента отладки #142

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
*/
package com.clouds42.CommandLineOptions;

import com._1c.g5.v8.dt.debug.model.base.data.DebugTargetType;

import com.github._1c_syntax.coverage41C.DebugTargetType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option;

import java.lang.invoke.MethodHandles;
import java.lang.module.ModuleDescriptor;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -93,22 +93,9 @@ public void setAutoconnectTargets(List<DebugTargetType> autoconnectTargets) {

public List<DebugTargetType> getAutoconnectTargets() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yukon39, как часто используется getAutoconnectTargets из опций? Может константу сделать с таргетами?

if (autoconnectTargets == null || autoconnectTargets.isEmpty()) {
autoconnectTargets = new LinkedList<DebugTargetType>();
autoconnectTargets.addAll(DebugTargetType.VALUES);
autoconnectTargets.remove(DebugTargetType.UNKNOWN);

autoconnectTargets = new LinkedList<>();
autoconnectTargets.addAll(DebugTargetType.getAutoconnectTargets());
}
return autoconnectTargets;
}

public List<DebugTargetType> getFilteredAutoconnectTargets(ModuleDescriptor.Version ApiVersion) {
List<DebugTargetType> debugTypes = getAutoconnectTargets();

if (ModuleDescriptor.Version.parse("8.3.16").compareTo(ApiVersion) > 0) {
debugTypes.remove(DebugTargetType.MOBILE_MANAGED_CLIENT);
logger.info("[{}] was removed", DebugTargetType.MOBILE_MANAGED_CLIENT);
}
return debugTypes;
}

}
14 changes: 5 additions & 9 deletions src/main/java/com/clouds42/Commands/CoverServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.clouds42.CommandLineOptions.OutputOptions;
import com.clouds42.PipeMessages;
import com.clouds42.Utils;
import com.github._1c_syntax.coverage41C.CoverageCollector;
import org.scalasbt.ipcsocket.UnixDomainServerSocket;
import org.scalasbt.ipcsocket.Win32NamedPipeServerSocket;
import org.slf4j.Logger;
Expand Down Expand Up @@ -106,15 +107,14 @@ private Boolean listenSocket(Socket clientSocket) {
logger.info("Get command: {}", line);
switch (line) {
case PipeMessages.DUMP_COMMAND:
Utils.dumpCoverageFile(getCoverageData(), getMetadataOptions(), getOutputOptions());
dumpCoverageData();
out.println(PipeMessages.OK_RESULT);
return true;
case PipeMessages.STATS_COMMAND:
out.println(PipeMessages.OK_RESULT);
return true;
case PipeMessages.CLEAN_COMMAND:
getCoverageData().forEach((uri, bigDecimalIntegerMap) ->
bigDecimalIntegerMap.replaceAll((k, v) -> 0));
cleanCoverageData();
out.println(PipeMessages.OK_RESULT);
return true;
case PipeMessages.CHECK_COMMAND:
Expand Down Expand Up @@ -142,11 +142,7 @@ private Boolean listenSocket(Socket clientSocket) {

protected abstract void gracefulShutdown(PrintWriter out) throws IOException;

protected abstract MetadataOptions getMetadataOptions();

protected abstract Map<URI, Map<BigDecimal, Integer>> getCoverageData();

protected abstract OutputOptions getOutputOptions();

protected abstract void dumpCoverageData();

protected abstract void cleanCoverageData();
}
Loading