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

Переработка инструмента #3

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f75aec2
Удалил velocity
alkoleft Apr 29, 2023
ff6880e
Встроенное описание ссылок на непубликуемые методы
alkoleft Apr 29, 2023
ae5957e
Правки выявленных проблем
alkoleft Apr 30, 2023
dfa7add
Доработки оформления
alkoleft May 1, 2023
ad84b78
Исправлено формирование описания параметров
alkoleft Sep 5, 2023
0f3baf4
Исправлено формирование описаний свойств
alkoleft Sep 5, 2023
db198ab
#ORAIS-183
alkoleft Oct 6, 2023
dc5dcc6
Fixture
alkoleft Oct 10, 2023
903bc5f
Доработки под структуру подсистем
alkoleft Oct 10, 2023
af9cc5c
Refactoring
alkoleft Oct 10, 2023
12964f8
Возможность объединения с ручными доками
alkoleft Oct 10, 2023
579d988
Оптимизация вывода
alkoleft Oct 10, 2023
9740230
Reformat code
alkoleft Oct 10, 2023
1b8ddf4
Работа со структурой
alkoleft Oct 12, 2023
bd92d1d
Рефакторинг
alkoleft Oct 17, 2023
b83df1e
Refactoring
alkoleft Oct 17, 2023
9347f1d
Render template optomize
alkoleft Oct 17, 2023
6ba3c04
migrate to new mdclasses and bsl-parser
alkoleft Oct 18, 2023
f39f34c
remove spring - lightweight jar
alkoleft Oct 18, 2023
0103451
configure dependencies
alkoleft Oct 19, 2023
d2fefce
Исправление ошибок вывода и получения дочерних элементов подсистем
alkoleft Oct 19, 2023
4da8a8a
Правка шаблона, работа со ссылками
alkoleft Oct 19, 2023
d2f007a
Фикс недочетов
alkoleft Oct 19, 2023
d1934e4
add gradle wrapper
alkoleft Oct 20, 2023
5235141
Fix log errors
alkoleft Oct 20, 2023
af53353
add support SUB_DIRECTORY layout for md2conf
alkoleft Oct 20, 2023
40d7761
Optimize
alkoleft Oct 22, 2023
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
1 change: 0 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

The MIT License (MIT)

Copyright (c) 2023 alkoleft
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# bsldoc

## Запуск

### Параметры запуска

`bsldoc --format=<Docusaurus, Markdown> --only-subsystems=<root subsystems list> --regions=<regions filter> source destination`

* `--format` - Формат
* `--only-subsystems` - Список подсистем, по которым строится документация
* `--regions` - Фильтр регионов, для которых строится документация
* `source` - Каталог исходников
* `destination` - Каталог выгрузки документации
53 changes: 12 additions & 41 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ repositories {
mavenLocal()
mavenCentral()
maven(url = "https://jitpack.io")
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

java {
Expand All @@ -28,31 +29,28 @@ java.sourceSets["main"].java {
}

dependencies {
// spring
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-websocket")
implementation("info.picocli:picocli-spring-boot-starter:4.7.1")
implementation("info.picocli", "picocli", "4.7.5")

implementation("com.github.1c-syntax", "bsl-language-server", "0.20.0")

implementation("com.github.1c-syntax", "mdclasses", "0.10.3")
implementation("io.github.1c-syntax", "bsl-common-library", "f6714e4e")
implementation("io.github.1c-syntax", "supportconf", "0.1.1") {
exclude("io.github.1c-syntax", "bsl-common-library")
}
implementation("com.github.1c-syntax", "bsl-parser", "167aaad827322e09ccde4658a71152dad234de4b") {
implementation("com.github.1c-syntax", "mdclasses", "develop-SNAPSHOT")
implementation("com.github.1c-syntax", "utils", "0.5.1")
implementation("io.github.1c-syntax", "bsl-common-library", "0.5.0")
implementation("io.github.1c-syntax", "supportconf", "0.12.1")
implementation("com.github.1c-syntax", "bsl-parser", "develop-SNAPSHOT") {
exclude("com.tunnelvisionlabs", "antlr4-annotations")
exclude("commons-beanutils", "commons-beanutils")
exclude("com.ibm.icu", "*")
exclude("org.antlr", "ST4")
exclude("org.abego.treelayout", "org.abego.treelayout.core")
exclude("org.antlr", "antlr-runtime")
exclude("org.glassfish", "javax.json")
}

implementation("commons-io", "commons-io", "2.14.0")
implementation("ch.qos.logback:logback-core:1.2.11")
runtimeOnly("ch.qos.logback:logback-classic:1.2.11")

// template engine
implementation("com.github.jknack:handlebars:4.3.1")
implementation("org.apache.velocity:velocity-engine-core:2.3")
implementation("org.apache.velocity:velocity-tools:2.0")

testImplementation("org.junit.jupiter:junit-jupiter:$JUINT_VERSION")
testImplementation("org.junit.jupiter:junit-jupiter-api:$JUINT_VERSION")
Expand All @@ -74,41 +72,14 @@ tasks.withType<JavaCompile> {
}

tasks.jar {
// manifest {
// attributes["Main-Class"] = "ru.alkoleft.bsl.doc.Main"
// }
enabled = true
archiveClassifier.set("")
}

tasks.bootJar {
// manifest {
// attributes["Main-Class"] = "ru.alkoleft.bsl.doc.Main"
// }
archiveClassifier.set("exec")
}

tasks {
val fatJar = register<Jar>("fatJar") {
dependsOn.addAll(listOf("compileJava", "processResources")) // We need this for Gradle optimization to work
archiveClassifier.set("standalone") // Naming the jar
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { attributes(mapOf("Main-Class" to application.mainClass)) } // Provided we set it up in the application plugin configuration
val sourcesMain = sourceSets.main.get()
val contents = configurations.runtimeClasspath.get()
.map { if (it.isDirectory) it else zipTree(it) } +
sourcesMain.output
from(contents)
}
build {
dependsOn(fatJar) // Trigger fat jar creation during build
}

group = "build"
}



publishing {
repositories {
maven {
Expand Down
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
78 changes: 78 additions & 0 deletions src/main/java/ru/alkoleft/bsl/doc/AutodocManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package ru.alkoleft.bsl.doc;

import lombok.Builder;
import lombok.SneakyThrows;
import org.apache.commons.io.file.PathUtils;
import ru.alkoleft.bsl.doc.bsl.BslContext;
import ru.alkoleft.bsl.doc.bsl.Filter;
import ru.alkoleft.bsl.doc.content.processor.TitleProcessor;
import ru.alkoleft.bsl.doc.manual.ManualContent;
import ru.alkoleft.bsl.doc.model.ContentModel;
import ru.alkoleft.bsl.doc.options.ManualMergeStrategy;
import ru.alkoleft.bsl.doc.options.OutputOptions;
import ru.alkoleft.bsl.doc.render.BaseRender;
import ru.alkoleft.bsl.doc.render.StructureRender;
import ru.alkoleft.bsl.doc.render.handlebars.RenderContext;
import ru.alkoleft.bsl.doc.render.output.OutputStrategy;
import ru.alkoleft.bsl.doc.structure.StructureBuilder;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;

public class AutodocManager {

private final OutputOptions outputOptions;
private final Path destination;
private final ManualMergeStrategy manualMergeStrategy;
private final ManualContent manualContent;
private final BslContext bslContext;

@Builder
public AutodocManager(Filter filter, OutputOptions outputOptions, Path sources, Path destination, Path manualDocumentation, ManualMergeStrategy manualMergeStrategy) {
this.destination = destination;
this.outputOptions = outputOptions;
this.manualMergeStrategy = manualMergeStrategy;
manualContent = new ManualContent(manualDocumentation, destination);
bslContext = new BslContext(sources, filter);

TitleProcessor.Factory.create(outputOptions.getOutputFormat());
}

public void loadData() {
manualContent.buildModel(outputOptions.getOutputFormat());
}

public void generateDocumentation() {
manualContent.copy();

var structure = StructureBuilder.builder(outputOptions).build(bslContext);
StructureBuilder.print(structure);

var processor = OutputStrategy.create(manualMergeStrategy);
var contentModel = Objects.requireNonNullElseGet(manualContent.getContentModel(), ContentModel::new);
processor.init(outputOptions.getOutputFormat(), manualContent, contentModel);
var render = new StructureRender(outputOptions, processor, contentModel);

BaseRender.setContext(RenderContext.Factory.create(outputOptions));
render.render(structure, destination);
}

@SneakyThrows
public void clearOutput() {
if (Files.exists(destination)) {
Files.walk(destination)
.filter(it -> it != destination)
.forEach(this::deletePath);
}
}

private void deletePath(Path path) {
try {
PathUtils.delete(path);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Loading