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

Обновления #53

Merged
merged 1 commit into from
Jan 13, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java_version: ['11', '17', '20']
java_version: ['17', '20']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/publish-to-sonatype.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish to Sonatype

on:
release:
types: [published]
push:
branches:
- develop
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'liberica'
- name: Publish to Sonatype
run: ./gradlew publishMavenPublicationToSonatypeRepository -PsimplifyVersion
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
- name: Close repository
if: github.event_name == 'release'
run: ./gradlew closeAndReleaseRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_nexusUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_nexusPassword: ${{ secrets.SONATYPE_PASSWORD }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: 'adopt'
- name: Build with Gradle
run: ./gradlew build
Expand Down
69 changes: 57 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
import me.qoomon.gitversioning.commons.GitRefType
import java.util.*

plugins {
`java-library`
`maven-publish`
jacoco
id("org.sonarqube") version "4.4.1.3373"
id("org.cadixdev.licenser") version "0.6.1"
id("com.github.gradle-git-version-calculator") version "1.1.0"
id("me.qoomon.git-versioning") version "6.4.3"
id("io.freefair.lombok") version "8.4"
id("io.freefair.javadoc-links") version "8.4"
id("io.freefair.javadoc-utf-8") version "8.4"
id("org.sonarqube") version "4.4.1.3373"
id("io.freefair.maven-central.validate-poms") version "8.4"
id("com.github.ben-manes.versions") version "0.50.0"
id("ru.vyarus.pom") version "2.2.2"
id("io.codearte.nexus-staging") version "0.30.0"
}

group = "io.github.1c-syntax"
version = gitVersionCalculator.calculateVersion("v")
gitVersioning.apply {
refs {
considerTagsOnBranches = true
tag("v(?<tagVersion>[0-9].*)") {
version = "\${ref.tagVersion}\${dirty}"
}
branch(".+") {
version = "\${ref}-\${commit.short}\${dirty}"
}
}

rev {
version = "\${commit.short}\${dirty}"
}
}
val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType.TAG

repositories {
mavenLocal()
Expand All @@ -23,24 +43,24 @@ repositories {

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

// прочее
implementation("commons-io", "commons-io", "2.8.0")
api("io.github.1c-syntax", "bsl-common-library", "0.4.0")
implementation("commons-io", "commons-io", "2.15.1")
api("io.github.1c-syntax", "bsl-common-library", "0.5.0")

// тестирование
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.7.0")
testImplementation("org.junit.jupiter", "junit-jupiter-engine", "5.7.0")
testImplementation("org.assertj", "assertj-core", "3.18.1")
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.10.1")
testImplementation("org.junit.jupiter", "junit-jupiter-engine", "5.10.1")
testImplementation("org.assertj", "assertj-core", "3.25.0")
// логирование
// https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
testImplementation("org.slf4j", "slf4j-log4j12", "1.7.30")
testImplementation("org.slf4j", "slf4j-log4j12", "2.0.11")
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
Expand Down Expand Up @@ -103,9 +123,29 @@ license {
}

publishing {
repositories {
maven {
name = "sonatype"
url = if (isSnapshot)
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
else
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")

val sonatypeUsername: String? by project
val sonatypePassword: String? by project

credentials {
username = sonatypeUsername // ORG_GRADLE_PROJECT_sonatypeUsername
password = sonatypePassword // ORG_GRADLE_PROJECT_sonatypePassword
}
}
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
if (isSnapshot && project.hasProperty("simplifyVersion")) {
version = findProperty("git.ref.slug") as String + "-SNAPSHOT"
}
pom {
description.set("Support configuration read library for Language 1C (BSL)")
url.set("https://github.com/1c-syntax/supportconf")
Expand Down Expand Up @@ -155,3 +195,8 @@ tasks.withType<Javadoc> {
(options as StandardJavadocDocletOptions)
.addStringOption("Xdoclint:none", "-quiet")
}

nexusStaging {
serverUrl = "https://s01.oss.sonatype.org/service/local/"
stagingProfileId = "15bd88b4d17915" // ./gradlew getStagingProfile
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 9 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

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

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,15 @@
*/
package com.github._1c_syntax.bsl.supconf;

import lombok.Value;

/**
* Описание конфигурации поставщика
*
* @param name Название
* @param provider Поставщик
* @param version Версия
*/
@Value
public class SupportConfiguration implements Comparable<SupportConfiguration> {
/**
* Название
*/
String name;

/**
* Поставщик
*/
String provider;

/**
* Версия
*/
String version;

public record SupportConfiguration(String name, String provider,
String version) implements Comparable<SupportConfiguration> {
public SupportConfiguration(String name, String provider, String version) {
this.name = stripQuotes(name);
this.provider = stripQuotes(provider);
Expand All @@ -51,7 +38,7 @@ public SupportConfiguration(String name, String provider, String version) {

@Override
public int compareTo(SupportConfiguration o) {
if(this.name.compareTo(o.name) != 0) {
if (this.name.compareTo(o.name) != 0) {
return this.name.compareTo(o.name);
} else if (this.provider.compareTo(o.provider) != 0) {
return this.provider.compareTo(o.provider);
Expand All @@ -61,16 +48,16 @@ public int compareTo(SupportConfiguration o) {
}

private static String stripQuotes(String value) {
if(value == null || value.length() < 2) {
if (value == null || value.length() < 2) {
return value;
}

var result = value;
if(value.charAt(0) == '\"') {
if (value.charAt(0) == '\"') {
result = value.substring(1);
}

if(result.charAt(result.length() - 1) == '\"') {
if (result.charAt(result.length() - 1) == '\"') {
result = result.substring(0, result.length() - 1);
}
return result;
Expand Down
45 changes: 12 additions & 33 deletions src/main/resources/log4j.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<!--
This file is a part of Support Configuration.

Copyright (c) 2019 - 2022
Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors

SPDX-License-Identifier: LGPL-3.0-or-later

Support Configuration is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.

Support Configuration is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with Support Configuration.
-->
<log4j:configuration debug="false">
<!--Console appender -->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %p %m%n"/>
</layout>
</appender>

<root>
<level value="DEBUG"/>
<appender-ref ref="stdout"/>
</root>
</log4j:configuration>
<!--Console appender -->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %p %m%n"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="stdout"/>
</root>
</log4j:configuration>