Skip to content

Commit 139cf55

Browse files
authored
Merge pull request #53 from 1c-syntax/feature/updates
Обновления
2 parents cdf0a14 + 5b528f9 commit 139cf55

File tree

9 files changed

+128
-79
lines changed

9 files changed

+128
-79
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
java_version: ['11', '17', '20']
11+
java_version: ['17', '20']
1212
os: [ubuntu-latest, windows-latest, macOS-latest]
1313
steps:
1414
- uses: actions/checkout@v4
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish to Sonatype
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
branches:
8+
- develop
9+
workflow_dispatch:
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up JDK
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: 17
20+
distribution: 'liberica'
21+
- name: Publish to Sonatype
22+
run: ./gradlew publishMavenPublicationToSonatypeRepository -PsimplifyVersion
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
26+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
27+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }}
28+
ORG_GRADLE_PROJECT_signingInMemoryPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
29+
- name: Close repository
30+
if: github.event_name == 'release'
31+
run: ./gradlew closeAndReleaseRepository
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
35+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
36+
ORG_GRADLE_PROJECT_nexusUsername: ${{ secrets.SONATYPE_USERNAME }}
37+
ORG_GRADLE_PROJECT_nexusPassword: ${{ secrets.SONATYPE_PASSWORD }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Set up JDK
1515
uses: actions/setup-java@v4
1616
with:
17-
java-version: 11
17+
java-version: 17
1818
distribution: 'adopt'
1919
- name: Build with Gradle
2020
run: ./gradlew build

build.gradle.kts

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
1+
import me.qoomon.gitversioning.commons.GitRefType
12
import java.util.*
23

34
plugins {
45
`java-library`
56
`maven-publish`
67
jacoco
8+
id("org.sonarqube") version "4.4.1.3373"
79
id("org.cadixdev.licenser") version "0.6.1"
8-
id("com.github.gradle-git-version-calculator") version "1.1.0"
10+
id("me.qoomon.git-versioning") version "6.4.3"
911
id("io.freefair.lombok") version "8.4"
1012
id("io.freefair.javadoc-links") version "8.4"
1113
id("io.freefair.javadoc-utf-8") version "8.4"
12-
id("org.sonarqube") version "4.4.1.3373"
14+
id("io.freefair.maven-central.validate-poms") version "8.4"
15+
id("com.github.ben-manes.versions") version "0.50.0"
16+
id("ru.vyarus.pom") version "2.2.2"
17+
id("io.codearte.nexus-staging") version "0.30.0"
1318
}
1419

1520
group = "io.github.1c-syntax"
16-
version = gitVersionCalculator.calculateVersion("v")
21+
gitVersioning.apply {
22+
refs {
23+
considerTagsOnBranches = true
24+
tag("v(?<tagVersion>[0-9].*)") {
25+
version = "\${ref.tagVersion}\${dirty}"
26+
}
27+
branch(".+") {
28+
version = "\${ref}-\${commit.short}\${dirty}"
29+
}
30+
}
31+
32+
rev {
33+
version = "\${commit.short}\${dirty}"
34+
}
35+
}
36+
val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType.TAG
1737

1838
repositories {
1939
mavenLocal()
@@ -23,24 +43,24 @@ repositories {
2343

2444
dependencies {
2545
// логирование
26-
implementation("org.slf4j", "slf4j-api", "1.7.30")
46+
implementation("org.slf4j", "slf4j-api", "2.0.11")
2747

2848
// прочее
29-
implementation("commons-io", "commons-io", "2.8.0")
30-
api("io.github.1c-syntax", "bsl-common-library", "0.4.0")
49+
implementation("commons-io", "commons-io", "2.15.1")
50+
api("io.github.1c-syntax", "bsl-common-library", "0.5.0")
3151

3252
// тестирование
33-
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.7.0")
34-
testImplementation("org.junit.jupiter", "junit-jupiter-engine", "5.7.0")
35-
testImplementation("org.assertj", "assertj-core", "3.18.1")
53+
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.10.1")
54+
testImplementation("org.junit.jupiter", "junit-jupiter-engine", "5.10.1")
55+
testImplementation("org.assertj", "assertj-core", "3.25.0")
3656
// логирование
3757
// https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
38-
testImplementation("org.slf4j", "slf4j-log4j12", "1.7.30")
58+
testImplementation("org.slf4j", "slf4j-log4j12", "2.0.11")
3959
}
4060

4161
java {
42-
sourceCompatibility = JavaVersion.VERSION_11
43-
targetCompatibility = JavaVersion.VERSION_11
62+
sourceCompatibility = JavaVersion.VERSION_17
63+
targetCompatibility = JavaVersion.VERSION_17
4464
withSourcesJar()
4565
withJavadocJar()
4666
}
@@ -103,9 +123,29 @@ license {
103123
}
104124

105125
publishing {
126+
repositories {
127+
maven {
128+
name = "sonatype"
129+
url = if (isSnapshot)
130+
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
131+
else
132+
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
133+
134+
val sonatypeUsername: String? by project
135+
val sonatypePassword: String? by project
136+
137+
credentials {
138+
username = sonatypeUsername // ORG_GRADLE_PROJECT_sonatypeUsername
139+
password = sonatypePassword // ORG_GRADLE_PROJECT_sonatypePassword
140+
}
141+
}
142+
}
106143
publications {
107144
create<MavenPublication>("maven") {
108145
from(components["java"])
146+
if (isSnapshot && project.hasProperty("simplifyVersion")) {
147+
version = findProperty("git.ref.slug") as String + "-SNAPSHOT"
148+
}
109149
pom {
110150
description.set("Support configuration read library for Language 1C (BSL)")
111151
url.set("https://github.com/1c-syntax/supportconf")
@@ -155,3 +195,8 @@ tasks.withType<Javadoc> {
155195
(options as StandardJavadocDocletOptions)
156196
.addStringOption("Xdoclint:none", "-quiet")
157197
}
198+
199+
nexusStaging {
200+
serverUrl = "https://s01.oss.sonatype.org/service/local/"
201+
stagingProfileId = "15bd88b4d17915" // ./gradlew getStagingProfile
202+
}

gradle/wrapper/gradle-wrapper.jar

346 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
8788

8889
# Use the maximum available, or set MAX_FD != -1 to use that value.
8990
MAX_FD=maximum
@@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
146147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
148149
MAX_FD=$( ulimit -H -n ) ||
149150
warn "Could not query maximum file descriptor limit"
150151
esac
151152
case $MAX_FD in #(
152153
'' | soft) :;; #(
153154
*)
154155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
156157
ulimit -n "$MAX_FD" ||
157158
warn "Could not set maximum file descriptor limit to $MAX_FD"
158159
esac
@@ -201,11 +202,11 @@ fi
201202
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
202203
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
203204

204-
# Collect all arguments for the java command;
205-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
206-
# shell script including quotes and variable substitutions, so put them in
207-
# double quotes to make sure that they get re-expanded; and
208-
# * put everything else in single quotes, so that it's not re-expanded.
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
209210

210211
set -- \
211212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

src/main/java/com/github/_1c_syntax/bsl/supconf/SupportConfiguration.java

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,15 @@
2121
*/
2222
package com.github._1c_syntax.bsl.supconf;
2323

24-
import lombok.Value;
25-
2624
/**
2725
* Описание конфигурации поставщика
26+
*
27+
* @param name Название
28+
* @param provider Поставщик
29+
* @param version Версия
2830
*/
29-
@Value
30-
public class SupportConfiguration implements Comparable<SupportConfiguration> {
31-
/**
32-
* Название
33-
*/
34-
String name;
35-
36-
/**
37-
* Поставщик
38-
*/
39-
String provider;
40-
41-
/**
42-
* Версия
43-
*/
44-
String version;
45-
31+
public record SupportConfiguration(String name, String provider,
32+
String version) implements Comparable<SupportConfiguration> {
4633
public SupportConfiguration(String name, String provider, String version) {
4734
this.name = stripQuotes(name);
4835
this.provider = stripQuotes(provider);
@@ -51,7 +38,7 @@ public SupportConfiguration(String name, String provider, String version) {
5138

5239
@Override
5340
public int compareTo(SupportConfiguration o) {
54-
if(this.name.compareTo(o.name) != 0) {
41+
if (this.name.compareTo(o.name) != 0) {
5542
return this.name.compareTo(o.name);
5643
} else if (this.provider.compareTo(o.provider) != 0) {
5744
return this.provider.compareTo(o.provider);
@@ -61,16 +48,16 @@ public int compareTo(SupportConfiguration o) {
6148
}
6249

6350
private static String stripQuotes(String value) {
64-
if(value == null || value.length() < 2) {
51+
if (value == null || value.length() < 2) {
6552
return value;
6653
}
6754

6855
var result = value;
69-
if(value.charAt(0) == '\"') {
56+
if (value.charAt(0) == '\"') {
7057
result = value.substring(1);
7158
}
7259

73-
if(result.charAt(result.length() - 1) == '\"') {
60+
if (result.charAt(result.length() - 1) == '\"') {
7461
result = result.substring(0, result.length() - 1);
7562
}
7663
return result;

src/main/resources/log4j.xml

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
11
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
2-
<!--
3-
This file is a part of Support Configuration.
4-
5-
Copyright (c) 2019 - 2022
6-
Tymko Oleg <olegtymko@yandex.ru>, Maximov Valery <maximovvalery@gmail.com> and contributors
7-
8-
SPDX-License-Identifier: LGPL-3.0-or-later
9-
10-
Support Configuration is free software; you can redistribute it and/or
11-
modify it under the terms of the GNU Lesser General Public
12-
License as published by the Free Software Foundation; either
13-
version 3.0 of the License, or (at your option) any later version.
14-
15-
Support Configuration is distributed in the hope that it will be useful,
16-
but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18-
Lesser General Public License for more details.
19-
20-
You should have received a copy of the GNU Lesser General Public
21-
License along with Support Configuration.
22-
-->
232
<log4j:configuration debug="false">
24-
<!--Console appender -->
25-
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
26-
<layout class="org.apache.log4j.PatternLayout">
27-
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %p %m%n"/>
28-
</layout>
29-
</appender>
30-
31-
<root>
32-
<level value="DEBUG"/>
33-
<appender-ref ref="stdout"/>
34-
</root>
35-
</log4j:configuration>
3+
<!--Console appender -->
4+
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
5+
<layout class="org.apache.log4j.PatternLayout">
6+
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %p %m%n"/>
7+
</layout>
8+
</appender>
9+
10+
<root>
11+
<level value="DEBUG"/>
12+
<appender-ref ref="stdout"/>
13+
</root>
14+
</log4j:configuration>

0 commit comments

Comments
 (0)