Skip to content

Commit 07d009d

Browse files
committed
Finish 0.13.0
2 parents 62afe74 + cefc693 commit 07d009d

File tree

599 files changed

+25821
-40342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

599 files changed

+25821
-40342
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ updates:
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "daily"
12+
groups:
13+
freefair:
14+
patterns:
15+
- "io.freefair.*"
1216
- package-ecosystem: "github-actions"
1317
directory: "/"
1418
schedule:

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: ./gradlew --no-daemon javadoc
3131

3232
- name: Set up Python
33-
uses: actions/setup-python@v5.0.0
33+
uses: actions/setup-python@v5.1.0
3434
with:
3535
python-version: '3.10'
3636
architecture: 'x64'

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ build/
1212
/.idea/sonar*
1313

1414
/.idea/misc.xml
15+
Gradle_*.xml
16+
/.idea/material_theme_project_new.xml
17+
*.hprof
18+
*.hprof.idom

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.MD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=1c-syntax_mdclasses&metric=coverage)](https://sonarcloud.io/dashboard?id=1c-syntax_mdclasses)
1010

1111
[![Download](https://img.shields.io/github/release/1c-syntax/mdclasses.svg?label=download&style=flat)](https://github.com/1c-syntax/mdclasses/releases/latest)
12-
[![JitPack](https://jitpack.io/v/1c-syntax/mdclasses.svg)](https://jitpack.io/#1c-syntax/mdclasses)
1312
[![GitHub Releases](https://img.shields.io/github/downloads/1c-syntax/mdclasses/latest/total?style=flat-square)](https://github.com/1c-syntax/mdclasses/releases)
1413

1514
## Сайт проекта (документация)

build.gradle.kts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ plugins {
88
signing
99
id("org.cadixdev.licenser") version "0.6.1"
1010
id("me.qoomon.git-versioning") version "6.4.3"
11-
id("com.gorylenko.gradle-git-properties") version "2.4.1"
12-
id("io.freefair.lombok") version "8.4"
13-
id("io.freefair.javadoc-links") version "8.4"
14-
id("io.freefair.javadoc-utf-8") version "8.4"
15-
id("io.freefair.maven-central.validate-poms") version "8.4"
16-
id("ru.vyarus.pom") version "2.2.2"
17-
id("org.sonarqube") version "4.4.1.3373"
11+
id("com.gorylenko.gradle-git-properties") version "2.4.2"
12+
id("io.freefair.lombok") version "8.6"
13+
id("io.freefair.javadoc-links") version "8.6"
14+
id("io.freefair.javadoc-utf-8") version "8.6"
15+
id("io.freefair.maven-central.validate-poms") version "8.6"
16+
id("ru.vyarus.pom") version "3.0.0"
17+
id("org.sonarqube") version "5.0.0.4638"
1818
id("io.codearte.nexus-staging") version "0.30.0"
1919
}
2020

@@ -51,13 +51,13 @@ dependencies {
5151
implementation("com.thoughtworks.xstream", "xstream", "1.4.20")
5252

5353
// логирование
54-
implementation("org.slf4j", "slf4j-api", "1.7.30")
54+
implementation("org.slf4j", "slf4j-api", "2.1.0-alpha1")
5555

5656
// прочее
5757
implementation("commons-io", "commons-io", "2.8.0")
58-
implementation("com.github.1c-syntax", "utils", "0.5.1")
59-
implementation("io.github.1c-syntax", "bsl-common-library", "0.5.0")
60-
implementation("io.github.1c-syntax", "supportconf", "0.12.1") {
58+
implementation("io.github.1c-syntax", "utils", "0.6.1")
59+
implementation("io.github.1c-syntax", "bsl-common-library", "0.6.0")
60+
implementation("io.github.1c-syntax", "supportconf", "0.14.0") {
6161
exclude("io.github.1c-syntax", "bsl-common-library")
6262
}
6363

@@ -75,7 +75,7 @@ dependencies {
7575

7676
// логирование
7777
// https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
78-
testImplementation("org.slf4j", "slf4j-log4j12", "1.7.30")
78+
testImplementation("org.slf4j", "slf4j-log4j12", "2.1.0-alpha1")
7979
}
8080

8181
java {

jitpack.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/main/java/com/github/_1c_syntax/bsl/mdclasses/CF.java

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is a part of MDClasses.
33
*
4-
* Copyright (c) 2019 - 2023
4+
* Copyright (c) 2019 - 2024
55
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
66
*
77
* SPDX-License-Identifier: LGPL-3.0-or-later
@@ -21,12 +21,10 @@
2121
*/
2222
package com.github._1c_syntax.bsl.mdclasses;
2323

24-
import com.github._1c_syntax.bsl.mdo.CommonModule;
2524
import com.github._1c_syntax.bsl.mdo.MD;
2625
import com.github._1c_syntax.bsl.mdo.Module;
2726
import com.github._1c_syntax.bsl.mdo.ModuleOwner;
2827
import com.github._1c_syntax.bsl.mdo.Subsystem;
29-
import com.github._1c_syntax.bsl.mdo.children.ObjectModule;
3028
import com.github._1c_syntax.bsl.mdo.support.ApplicationRunMode;
3129
import com.github._1c_syntax.bsl.mdo.support.ScriptVariant;
3230
import com.github._1c_syntax.bsl.mdo.support.UsePurposes;
@@ -38,7 +36,7 @@
3836
import java.util.Collections;
3937
import java.util.List;
4038
import java.util.Map;
41-
import java.util.stream.Collectors;
39+
import java.util.Optional;
4240

4341
public interface CF extends MDClass, ConfigurationTree {
4442

@@ -85,24 +83,12 @@ public interface CF extends MDClass, ConfigurationTree {
8583
/**
8684
* Возвращает соответствие пути к модулю его типу
8785
*/
88-
default Map<URI, ModuleType> getModulesByType() {
89-
return getAllModules().stream().collect(Collectors.toMap(Module::getUri, Module::getModuleType));
90-
}
86+
Map<URI, ModuleType> getModulesByType();
9187

9288
/**
93-
* Возвращает соответствие типов модулей их путям к файлам сгруппированные по представлению ссылки объекта-владельца
89+
* Возвращает соответствие пути к модулю к нему самому
9490
*/
95-
default Map<String, Map<ModuleType, URI>> modulesByMDORef() {
96-
return getPlainChildren().stream()
97-
.filter(ModuleOwner.class::isInstance)
98-
.map(ModuleOwner.class::cast)
99-
.collect(Collectors.toMap(
100-
(MD md) -> md.getMdoReference().getMdoRef(),
101-
md -> md.getModules().stream()
102-
.collect(Collectors.toMap(Module::getModuleType, Module::getUri))
103-
)
104-
);
105-
}
91+
Map<URI, Module> getModulesByURI();
10692

10793
/**
10894
* Возвращает соответствие типов модулей их путям к файлам для дочернего объекта
@@ -126,15 +112,7 @@ default Map<ModuleType, URI> mdoModuleTypes(String mdoRef) {
126112
/**
127113
* Возвращает соответствие пути файла модуля ссылке его владельца
128114
*/
129-
default Map<URI, MdoReference> modulesByObject() {
130-
return getAllModules().stream().collect(Collectors.toMap(Module::getUri, (Module module) -> {
131-
if (module instanceof ObjectModule objectModule) {
132-
return objectModule.getOwner();
133-
} else {
134-
return ((CommonModule) module).getMdoReference();
135-
}
136-
}));
137-
}
115+
Map<URI, MD> getModulesByObject();
138116

139117
/**
140118
* Возвращает список подсистем, в состав которых входит объект метаданных
@@ -165,4 +143,19 @@ default List<Subsystem> includedSubsystems(MdoReference mdoReference, boolean ad
165143
.flatMap(subsystem -> subsystem.included(mdoReference, addParentSubsystem).stream())
166144
.toList();
167145
}
146+
147+
@Override
148+
default ModuleType getModuleTypeByURI(URI uri) {
149+
return getModulesByType().getOrDefault(uri, ModuleType.UNKNOWN);
150+
}
151+
152+
@Override
153+
default Optional<Module> getModuleByUri(URI uri) {
154+
return Optional.ofNullable(getModulesByURI().get(uri));
155+
}
156+
157+
@Override
158+
default Optional<MD> findChild(URI uri) {
159+
return Optional.ofNullable(getModulesByObject().get(uri));
160+
}
168161
}

src/main/java/com/github/_1c_syntax/bsl/mdclasses/Configuration.java

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This file is a part of MDClasses.
33
*
4-
* Copyright (c) 2019 - 2023
4+
* Copyright (c) 2019 - 2024
55
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
66
*
77
* SPDX-License-Identifier: LGPL-3.0-or-later
@@ -77,10 +77,13 @@
7777
import com.github._1c_syntax.bsl.mdo.support.ScriptVariant;
7878
import com.github._1c_syntax.bsl.mdo.support.UseMode;
7979
import com.github._1c_syntax.bsl.mdo.support.UsePurposes;
80+
import com.github._1c_syntax.bsl.mdo.utils.LazyLoader;
8081
import com.github._1c_syntax.bsl.support.CompatibilityMode;
8182
import com.github._1c_syntax.bsl.support.SupportVariant;
8283
import com.github._1c_syntax.bsl.types.ConfigurationSource;
8384
import com.github._1c_syntax.bsl.types.MdoReference;
85+
import com.github._1c_syntax.bsl.types.ModuleType;
86+
import com.github._1c_syntax.utils.Lazy;
8487
import lombok.Builder;
8588
import lombok.Builder.Default;
8689
import lombok.EqualsAndHashCode;
@@ -89,8 +92,10 @@
8992
import lombok.ToString;
9093
import lombok.Value;
9194

95+
import java.net.URI;
9296
import java.util.Collections;
9397
import java.util.List;
98+
import java.util.Map;
9499

95100
/**
96101
* Корневой класс конфигурации 1с
@@ -139,6 +144,7 @@ public class Configuration implements CF {
139144
ApplicationRunMode defaultRunMode = ApplicationRunMode.AUTO;
140145
@Default
141146
List<Module> modules = Collections.emptyList();
147+
Lazy<List<Module>> allModules = new Lazy<>(this::computeAllModules);
142148
@Default
143149
String vendor = "";
144150
@Default
@@ -243,6 +249,11 @@ public class Configuration implements CF {
243249

244250
@Singular
245251
List<MD> children;
252+
Lazy<List<MD>> plainChildren = new Lazy<>(this::computePlainChildren);
253+
254+
Lazy<Map<URI, ModuleType>> modulesByType = new Lazy<>(this::computeModulesByType);
255+
Lazy<Map<URI, Module>> modulesByURI = new Lazy<>(this::computeModulesByURI);
256+
Lazy<Map<URI, MD>> modulesByObject = new Lazy<>(this::computeModulesByObject);
246257

247258
/*
248259
* Свое
@@ -306,6 +317,51 @@ public class Configuration implements CF {
306317
@Default
307318
MultiLanguageString briefInformation = MultiLanguageString.EMPTY;
308319

320+
@Override
321+
public List<Module> getAllModules() {
322+
return allModules.getOrCompute();
323+
}
324+
325+
@Override
326+
public List<MD> getPlainChildren() {
327+
return plainChildren.getOrCompute();
328+
}
329+
330+
@Override
331+
public Map<URI, ModuleType> getModulesByType() {
332+
return modulesByType.getOrCompute();
333+
}
334+
335+
@Override
336+
public Map<URI, MD> getModulesByObject() {
337+
return modulesByObject.getOrCompute();
338+
}
339+
340+
@Override
341+
public Map<URI, Module> getModulesByURI() {
342+
return modulesByURI.getOrCompute();
343+
}
344+
345+
private List<MD> computePlainChildren() {
346+
return LazyLoader.computePlainChildren(this);
347+
}
348+
349+
private Map<URI, ModuleType> computeModulesByType() {
350+
return LazyLoader.computeModulesByType(this);
351+
}
352+
353+
private Map<URI, MD> computeModulesByObject() {
354+
return LazyLoader.computeModulesByObject(this);
355+
}
356+
357+
private List<Module> computeAllModules() {
358+
return LazyLoader.computeAllModules(this);
359+
}
360+
361+
private Map<URI, Module> computeModulesByURI() {
362+
return LazyLoader.computeModulesByURI(this);
363+
}
364+
309365
private static Configuration createEmptyConfiguration() {
310366
var emptyString = "empty";
311367

0 commit comments

Comments
 (0)