Skip to content

Commit

Permalink
Merge pull request #22 from proDOOMman/develop
Browse files Browse the repository at this point in the history
v2.0
  • Loading branch information
proDOOMman authored May 7, 2020
2 parents 11364b0 + 1f7278f commit b97e5a5
Show file tree
Hide file tree
Showing 202 changed files with 12,529 additions and 1,050 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ gradle-app.setting
/bin/
/choco/*.nupkg
.scannerwork
.metadata
59 changes: 14 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,26 @@
Сценарий использования:

0) Устанавливаем EDT (для работы программы нужны как минимум его библиотеки ```com._1c.g5.v8.dt.debug.core_*.jar```, ```com._1c.g5.v8.dt.debug.model_*.jar```). Если держать EDT на данной машине затруднительно, из можно скопировать в любую папку, установить параметр окружения EDT_LOCATION в данную папку и удалить EDT.
1) Скачиваем последнюю версию со страницы https://github.com/proDOOMman/Coverage41C/releases или устанавливаем через ```choco install Coverage41C```
1) Скачиваем последнюю версию со страницы https://github.com/proDOOMman/Coverage41C/releases
2) Включаем http-отладку на сервере 1С-Предприятия потём добавления к флагу -debug флага -http (или добавляем флаги ```/debug -http -attach /debuggerURL «адрес отладчика»``` в строку запуска файловой базы, см. https://its.1c.ru/db/v837doc#bookmark:adm:TI000000495)
3) Проверяем что dbgs.exe (https://its.1c.ru/db/edtdoc/content/197/hdoc/_top/dbgs) запустился и работает. Для этого в браузере открываем его, адрес по умолчанию http://127.0.0.1:1550/. В случае успеха выдолжны увидеть сообщение "... it works!".
4) Выгружаем исходники конфигурации или расширения в файлы.
5) Запускаем анализ покрытия командой ```Coverage41C -i <ИмяИнформационнойБазыВКластере> -P <ПутьКПроекту> -s <ПутьКИсходникамОтносительноКорняПроекта> -o <ИмяВыходногоФайлаПокрытия> -e <ИмяРасширения>```. Для файловой базы нужно указать адрес отладчика и предопределённое имя информационной базы ```-i DefAlias -u http://127.0.0.1:<Порт>```.
6) (Опционально, полезно для конвейера) Проверяем статус программы командой ```Coverage41C -i <ИмяИнформационнойБазыВКластере> -a check```.
5) Запускаем анализ покрытия командой ```Coverage41C start -i <ИмяИнформационнойБазыВКластере> -P <ПутьКПроекту> -s <ПутьКИсходникамОтносительноКорняПроекта> -o <ИмяВыходногоФайлаПокрытия> -e <ИмяРасширения>```. Для файловой базы нужно указать адрес отладчика и предопределённое имя информационной базы ```-i DefAlias -u http://127.0.0.1:<Порт>```.
6) (Опционально, полезно для конвейера) Проверяем статус программы командой ```Coverage41C check -i <ИмяИнформационнойБазыВКластере>```.
7) Выполняем тесты
8) Останавливаем программу нажатием Ctrl+C в окне терминала или командой ```Coverage41C -a stop -i <ИмяИнформационнойБазыВКластере> -u http://127.0.0.1:<Порт>```. Также возможна запись файла покрытия без остановки замеров командой ```-a dump```.
8) Останавливаем программу нажатием Ctrl+C в окне терминала или командой ```Coverage41C stop -i <ИмяИнформационнойБазыВКластере> -u http://127.0.0.1:<Порт>```. Также возможна запись файла покрытия без остановки замеров командой ```dump```.
9) Полученный файл в формате genericCoverage.xml загружаем в SonarQube.

```cmd
Usage: Coverage41C [-hV] [-p] [--verbose] [-a=<commandAction>]
[-c=<inputRawXmlFile>] [-e=<extensionName>]
-i=<infobaseAlias> [-o=<outputFile>] [-P=<projectDirName>]
[-p:env=<passwordEnv>] [-r=<removeSupport>]
[-s=<srcDirName>] [-t=<pingTimeout>] [-u=<debugServerUrl>]
[-u:file=<debugServerUrlFileName>]
[-x=<externalDataProcessorUrl>] [-n=<debugAreaNames>]...
Usage: Coverage41C [-hV] [COMMAND]
Make measures from 1C:Enterprise and save them to genericCoverage.xml file
-a, --action=<commandAction>
Action: start, stop, dump, clean, check, convert.
Default - start
-i, --infobase=<infobaseAlias>
InfoBase name. For file infobase use 'DefAlias' name
-e, --extensionName=<extensionName>
Extension name
-x, --externalDataProcessor=<externalDataProcessorUrl>
External data processor (or external report) url
-s, --srcDir=<srcDirName>
Directory with sources exported to xml
-P, --projectDir=<projectDirName>
Directory with project
-o, --out=<outputFile> Output file name
-c, --convertFile=<inputRawXmlFile>
Input file name with RAW xml coverage data
-u, --debugger=<debugServerUrl>
Debugger url. Default - http://127.0.0.1:1550/
-u:file, --debugger:file=<debugServerUrlFileName>
Debugger url file name
-p, --password Dbgs password
-p:env, --password:env=<passwordEnv>
Password environment variable name
-n, --areanames=<debugAreaNames>
Debug area names (not for general use!)
-t, --timeout=<pingTimeout>
Ping timeout. Default - 1000
-r, --removeSupport=<removeSupport>
Remove support values: NOT_EDITABLE,
EDITABLE_SUPPORT_ENABLED, NOT_SUPPORTED, NONE.
Default - NONE
--verbose If you need more logs. Default - false
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
start Start measure and save coverage data to file
stop Stop main application and save coverage to file
check Check is main application ready
clean Clear coverage data in main application
dump Save coverage data to file
convert Convert results from internal uuid-based format
```
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group 'com.clouds42'
version '1.3-SNAPSHOT'
version '2.0-SNAPSHOT'

sourceCompatibility = 11

Expand Down
2 changes: 1 addition & 1 deletion choco/coverage41c.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- version should MATCH as closely as possible with the underlying software -->
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
<version>1.2</version>
<version>2.0</version>
<packageSourceUrl>https://github.com/proDOOMman/Coverage41C</packageSourceUrl>
<owners>proDOOMman</owners>
<!-- ============================== -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.clouds42.CommandLineOptions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.nio.file.Files;
import java.nio.file.Path;

@Command
public class ConnectionOptions {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Option(names = {"-i", "--infobase"}, description = "InfoBase name. File infobase uses 'DefAlias' name." +
" Default - ${DEFAULT-VALUE}", defaultValue = "DefAlias")
private String infobaseAlias;

@Option(names = {"-u", "--debugger"}, description = "Debugger url. Default - ${DEFAULT-VALUE}", defaultValue = "http://127.0.0.1:1550/")
private String debugServerUrl;

@Option(names = {"-u:file", "--debugger:file"}, description = "Debugger url file name", defaultValue = "")
private String debugServerUrlFileName;

public String getInfobaseAlias() {
return infobaseAlias;
}

public void setInfobaseAlias(String infobaseAlias) {
this.infobaseAlias = infobaseAlias;
}

public String getDebugServerUrl() {

if (!debugServerUrlFileName.isEmpty()) {
try {
debugServerUrl =
"http://" + Files.lines(Path.of(debugServerUrlFileName)).findFirst().get().trim();
debugServerUrlFileName = "";
} catch (IOException e) {
logger.info(e.getLocalizedMessage());
}
}

return debugServerUrl;
}

public void setDebugServerUrl(String debugServerUrl) {
this.debugServerUrl = debugServerUrl;
}

}
24 changes: 24 additions & 0 deletions src/main/java/com/clouds42/CommandLineOptions/ConvertOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.clouds42.CommandLineOptions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option;

import java.io.File;
import java.lang.invoke.MethodHandles;

public class ConvertOptions {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Option(names = {"-c", "--convertFile"}, description = "Input file name with RAW xml coverage data", required = true)
private File inputRawXmlFile;

public File getInputRawXmlFile() {
return inputRawXmlFile;
}

public void setInputRawXmlFile(File inputRawXmlFile) {
this.inputRawXmlFile = inputRawXmlFile;
}
}
62 changes: 62 additions & 0 deletions src/main/java/com/clouds42/CommandLineOptions/DebuggerOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.clouds42.CommandLineOptions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option;

import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;

public class DebuggerOptions {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Option(names = {"-p", "--password"}, description = "Dbgs password", interactive = true)
private String password;

@Option(names = {"-p:env", "--password:env"}, description = "Password environment variable name", defaultValue = "")
private String passwordEnv;

@Option(names = {"-n", "--areanames"}, description = "Debug area names (not for general use!)")
private List<String> debugAreaNames;

@Option(names = {"-t", "--timeout"}, description = "Ping timeout. Default - ${DEFAULT-VALUE}", defaultValue = "1000")
private Integer pingTimeout;

public String getPassword() {
if (password != null) {
if (password.trim().isEmpty()) {
if (!passwordEnv.isEmpty()) {
password = System.getenv(passwordEnv);
passwordEnv = "";
}
}
}
return password;
}

public void setPassword(String password) {
this.password = password;
}

public List<String> getDebugAreaNames() {
if (debugAreaNames == null) {
return new ArrayList<>();
} else {
return debugAreaNames;
}
}

public void setDebugAreaNames(List<String> debugAreaNames) {
this.debugAreaNames = debugAreaNames;
}

public Integer getPingTimeout() {
return pingTimeout;
}

public void setPingTimeout(Integer pingTimeout) {
this.pingTimeout = pingTimeout;
}
}
36 changes: 36 additions & 0 deletions src/main/java/com/clouds42/CommandLineOptions/FilterOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.clouds42.CommandLineOptions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option;

import java.lang.invoke.MethodHandles;

public class FilterOptions {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Option(names = {"-e", "--extensionName"}, description = "Extension name", defaultValue = "")
private String extensionName;

@Option(names = {"-x", "--externalDataProcessor"}, description = "External data processor (or external report) url",
defaultValue = "")
private String externalDataProcessorUrl;

public String getExtensionName() {
return extensionName;
}

public void setExtensionName(String extensionName) {
this.extensionName = extensionName;
}

public String getExternalDataProcessorUrl() {
return externalDataProcessorUrl;
}

public void setExternalDataProcessorUrl(String externalDataProcessorUrl) {
this.externalDataProcessorUrl = externalDataProcessorUrl;
}

}
23 changes: 23 additions & 0 deletions src/main/java/com/clouds42/CommandLineOptions/LoggingOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.clouds42.CommandLineOptions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option;

import java.lang.invoke.MethodHandles;

public class LoggingOptions {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Option(names = "--verbose", description = "If you need more logs. Default - ${DEFAULT-VALUE}", defaultValue = "false")
private Boolean verbose;

public Boolean isVerbose() {
return verbose.booleanValue();
}

public void setVerbose(Boolean verbose) {
this.verbose = verbose;
}
}
61 changes: 61 additions & 0 deletions src/main/java/com/clouds42/CommandLineOptions/MetadataOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.clouds42.CommandLineOptions;

import com.github._1c_syntax.mdclasses.metadata.additional.SupportVariant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option;

import java.lang.invoke.MethodHandles;

public class MetadataOptions {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Option(names = {"-s", "--srcDir"}, description = "Directory with sources exported to xml", defaultValue = "")
private String srcDirName;

@Option(names = {"-P", "--projectDir"}, description = "Directory with project", defaultValue = "")
private String projectDirName;

@Option(names = {"-r", "--removeSupport"}, description = "Remove support values: ${COMPLETION-CANDIDATES}. Default - ${DEFAULT-VALUE}", defaultValue = "NONE")
private SupportVariant removeSupport;

private void updatePaths() {
if (projectDirName.isEmpty() && !srcDirName.isEmpty()) {
// for backward compatibility
projectDirName = srcDirName;
srcDirName = "";
}
}

public String getSrcDirName() {
updatePaths();
return srcDirName;
}

public void setSrcDirName(String srcDirName) {
this.srcDirName = srcDirName;
}

public String getProjectDirName() {
updatePaths();
return projectDirName;
}

public void setProjectDirName(String projectDirName) {
this.projectDirName = projectDirName;
}

public SupportVariant getRemoveSupport() {
return removeSupport;
}

public void setRemoveSupport(SupportVariant removeSupport) {
this.removeSupport = removeSupport;
}

public boolean isRawMode() {
return getSrcDirName().isEmpty()
&& getProjectDirName().isEmpty();
}
}
25 changes: 25 additions & 0 deletions src/main/java/com/clouds42/CommandLineOptions/OutputOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.clouds42.CommandLineOptions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option;

import java.io.File;
import java.lang.invoke.MethodHandles;

public class OutputOptions {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@Option(names = {"-o", "--out"}, description = "Output file name")
private File outputFile;

public File getOutputFile() {
return outputFile;
}

public void setOutputFile(File outputFile) {
this.outputFile = outputFile;
}

}
Loading

0 comments on commit b97e5a5

Please sign in to comment.