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

Milestone - å #209

Merged
merged 15 commits into from
Feb 24, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ jobs:
uses: actions/checkout@v3
# see: https://github.com/marketplace/actions/setup-java-jdk
- name: Setup Java JDK
uses: actions/setup-java@v3.9.0
uses: actions/setup-java@v3.10.0
with:
# The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file
java-version: '19'
# Java distribution. See the list of supported distributions in README file
distribution: 'corretto'
distribution: 'oracle'
# The package type (jdk, jre, jdk+fx, jre+fx)
#java-package: # optional, default is jdk
# The architecture of the package
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3.9.0
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'corretto'
distribution: 'temurin'
check-latest: true
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Gradle
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef
uses: gradle/gradle-build-action@6095a76664413da4c8c134ee32e8a8ae900f0f1f
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Gradle
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef
uses: gradle/gradle-build-action@6095a76664413da4c8c134ee32e8a8ae900f0f1f
with:
arguments: build

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef
uses: gradle/gradle-build-action@6095a76664413da4c8c134ee32e8a8ae900f0f1f
with:
arguments: publish
env:
Expand Down
30 changes: 15 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ buildscript {
}
}
dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
classpath "org.gradlex:extra-java-module-info:1.2.1"
}
}
Expand All @@ -21,8 +20,7 @@ plugins {
id 'com.lwohvye.java-conventions'
id 'org.springframework.boot' // 主要是定义了这个,定义了SpringBoot的Version相关,并提供了application, bootJar, bootBuildImage这些Task
// 在parent root执行Task,会同步执行sub project的Task,比如执行了bootJar,那会执行subPro的bootJar(若其中没有该Task会ignore)
id 'signing'
id 'io.codearte.nexus-staging' version '0.30.0'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}

ext.sharedManifest = manifest {
Expand All @@ -46,6 +44,8 @@ subprojects {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
options.addBooleanOption('-enable-preview', true)
options.addStringOption('-release', '19')
// Add support for custom tag
options.addStringOption('tag', 'date:a:Init Date:')
options.addStringOption('tag', 'author:a:Major Contributor:')
Expand Down Expand Up @@ -91,8 +91,8 @@ publishing {
url = 'https://github.com/WHY-lWoHvYe/valentine-p2p.git'
properties = [
myProp : "chaste unicorn",
"spring-boot.version" : "3.0.0",
"project.core.version": "4.0.0"
"spring-boot.version" : "${springBootVersion}",
"project.core.version": "${version}"
]
licenses {
license {
Expand All @@ -112,26 +112,26 @@ publishing {
connection = 'scm:git:git://github.com/WHY-lWoHvYe/valentine-p2p.git'
developerConnection = 'scm:git:ssh://github.com/WHY-lWoHvYe/valentine-p2p.git'
url = 'https://github.com/WHY-lWoHvYe/valentine-p2p/tree/main'
tag = 'unicorn-v4.0.0-SNAPSHOT'
tag = "unicorn-v${version}-SNAPSHOT"
}
}
}
}
}

signing {
sign publishing.publications.mavenJava
}

javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}

nexusStaging {
serverUrl = "https://s01.oss.sonatype.org/service/local/"
//required only for projects registered in Sonatype after 2021-02-24
// packageGroup = "org.mycompany.myproject" //optional if packageGroup == project.getGroup()
// stagingProfileId = "yourStagingProfileId" //when not defined will be got from server using "packageGroup"
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv('OSSRH_USERNAME') ?: providers.systemProperty("ossrhUsername").orElse("").forUseAtConfigurationTime())
password.set(System.getenv('OSSRH_PASSWORD') ?: providers.systemProperty("ossrhPassword").orElse("").forUseAtConfigurationTime())
}
}
}
26 changes: 6 additions & 20 deletions buildSrc/src/main/groovy/com.lwohvye.java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
}

repositories {
mavenLocal()
mavenCentral()
flatDir {
dirs "$rootProject.projectDir/ex-lib"
Expand All @@ -21,31 +21,17 @@ repositories {
}

group = 'com.lwohvye'
version = '4.0.0-SNAPSHOT'
version = '4.0.0-alpha'
java.sourceCompatibility = JavaVersion.VERSION_19

ext {
ossrhUsername = System.getenv('OSSRH_USERNAME') ?: ossrhUsername ?: ''
ossrhPassword = System.getenv('OSSRH_PASSWORD') ?: ossrhPassword ?: ''
}

java {
withSourcesJar()
}

publishing {
repositories {
maven {
name = "OSSRH"
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
signing {
required { !version.endsWith("-SNAPSHOT") }
publishing.publications.configureEach {
sign it
}
}

Expand Down
1 change: 1 addition & 0 deletions document/jdk/Java-Preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
- [Virtual Threads in Spring 6.x](https://spring.io/blog/2022/10/11/embracing-virtual-threads)
- [Blog-Understanding Java's Project Loom](https://www.marcobehler.com/guides/java-project-loom?mkt_tok=NDI2LVFWRC0xMTQAAAGIcjkwHcDNBFot5rdRdBEUuF6VoChWteoULzKapDGmwmAvhMcx0grhQ0louho-dN1ckoHsIo1dWoRkkUbuaEtY9jNg8gRmb1XxVmmNrLmADNkSKVgN)
- [IntelliJ IDEA Conf 2022 | Project Loom: Revolution in Concurrency or Obscure Implementation Detail?](https://www.youtube.com/watch?v=0DUlUzqr09I)
- [Running Kotlin Coroutines on Project Loom](https://kt.academy/article/dispatcher-loom)

通过JProfiler可以查看Thread的情况,这一点不得不说收费的就是不一样。VisualVM和jconsole都看不到类型信息。
可以看的基本的main Thread,及19后听到的CarrierThreads和VirtualThreads
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ commonsBeanutilsVersion=1.9.4
commonsConfigurationVersion=2.8.0
easyCaptchaVersion=1.6.2
fastutilVersion=8.5.9
hutoolVersion=5.8.10
hutoolVersion=5.8.12
ip2regionVersion=3.0.1
jjwtVersion=0.11.5
kotlinVersion=1.8.0
Expand All @@ -28,7 +28,7 @@ log4jdbcVersion=1.18
logbackVersion=1.4.5
logstashVersion=7.2
mapstructVersion=1.5.3.Final
mapstructSpringVersion=0.1.2
mapstructSpringExtensionsVersion=1.0.0
oshiCoreVersion=6.4.0
poiVersion=5.2.2
quartzVersion=2.3.2
Expand Down
18 changes: 1 addition & 17 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
#
# Copyright (c) 2023. lWoHvYe(Hongyan Wang)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
36 changes: 27 additions & 9 deletions unicorn-code-gen/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
plugins {
id 'com.lwohvye.java-conventions'
id 'org.gradlex.extra-java-module-info'
id 'signing'
}

description = '代码生成模块'
Expand Down Expand Up @@ -42,14 +41,34 @@ publishing {
fromResolutionResult()
}
}
pom {
name = 'Unicorn Code Generator'
description = 'Server and Web Code Generator'
url = 'https://github.com/WHY-lWoHvYe/valentine-p2p.git'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'lWoHvYe'
name = '王红岩(lWoHvYe)'
email = 'lWoHvYe@outlook.com'
url = 'https://www.lwohvye.com'
}
}
scm {
connection = 'scm:git:git://github.com/WHY-lWoHvYe/valentine-p2p.git'
developerConnection = 'scm:git:ssh://github.com/WHY-lWoHvYe/valentine-p2p.git'
url = 'https://github.com/WHY-lWoHvYe/valentine-p2p/tree/main'
}
}
}
}
}

signing {
sign publishing.publications.mavenJavaCodeGen
}

dependencies {
api project(':unicorn-core')
api 'org.springframework.boot:spring-boot-starter-freemarker'
Expand All @@ -61,8 +80,7 @@ dependencies {

extraJavaModuleInfo {
failOnMissingModuleInfo.set(false)
automaticModule("cn.hutool:hutool-all", 'cn.hutool')
automaticModule("org.mapstruct.extensions.spring:mapstruct-spring-extensions", 'org.mapstruct.extensions.spring')
automaticModule("org.redisson:redisson", 'org.redisson')
automaticModule("net.coobird:thumbnailator", 'net.coobird.thumbnailator')
automaticModule("cn.hutool:hutool-all", 'hutool.all')
automaticModule("org.redisson:redisson", 'redisson')
automaticModule("net.coobird:thumbnailator", 'thumbnailator')
}
55 changes: 32 additions & 23 deletions unicorn-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugins {
id 'com.lwohvye.java-conventions'
// id 'extra-java-module-info' // apply my own plugin written in buildSrc
id 'org.gradlex.extra-java-module-info'
id 'signing'
// id 'org.springframework.boot'
}

Expand Down Expand Up @@ -55,14 +54,34 @@ publishing {
fromResolutionResult()
}
}
pom {
name = 'Unicorn Core'
description = 'Common module with BaseConfig, Utils, QueryAnno and so on'
url = 'https://github.com/WHY-lWoHvYe/valentine-p2p.git'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'lWoHvYe'
name = '王红岩(lWoHvYe)'
email = 'lWoHvYe@outlook.com'
url = 'https://www.lwohvye.com'
}
}
scm {
connection = 'scm:git:git://github.com/WHY-lWoHvYe/valentine-p2p.git'
developerConnection = 'scm:git:ssh://github.com/WHY-lWoHvYe/valentine-p2p.git'
url = 'https://github.com/WHY-lWoHvYe/valentine-p2p/tree/main'
}
}
}
}
}

signing {
sign publishing.publications.mavenJavaCore
}

dependencies {
api platform(SpringBootPlugin.BOM_COORDINATES)
api 'org.springframework.boot:spring-boot-starter-data-jpa'
Expand All @@ -82,43 +101,33 @@ dependencies {
api "org.apache.poi:poi-ooxml:$poiVersion"
implementation "xerces:xercesImpl:$xercesVersion"
api "org.mapstruct:mapstruct:$mapstructVersion"
api "org.mapstruct.extensions.spring:mapstruct-spring-extensions:$mapstructSpringVersion"
// mapstruct-spring-extensions seems unused
api "org.mapstruct.extensions.spring:mapstruct-spring-annotations:${mapstructSpringExtensionsVersion}"
api 'org.hibernate.validator:hibernate-validator'
api "nl.basjes.parse.useragent:yauaa:$yauaaVersion"
api 'com.github.ben-manes.caffeine:caffeine'
implementation "net.logstash.logback:logstash-logback-encoder:$logstashVersion"
api "net.coobird:thumbnailator:$thumbnailatorVersion"
api 'org.jetbrains:annotations:23.0.0'
api 'org.jetbrains:annotations:24.0.0'
api 'io.vavr:vavr:0.10.4'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
compileOnlyApi "org.projectlombok:lombok:${lombokVersion}"
compileOnlyApi "org.mapstruct:mapstruct-processor:$mapstructVersion"
runtimeOnly 'com.mysql:mysql-connector-j'
log4jdbcRuntimeOnly "com.lwohvye.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:$log4jdbcVersion"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.mapstruct:mapstruct-processor:$mapstructVersion"
annotationProcessor "org.mapstruct.extensions.spring:mapstruct-spring-extensions:${mapstructSpringExtensionsVersion}"
}

// TODO: 2022/9/1 这个无法传递,就很不好
extraJavaModuleInfo {
failOnMissingModuleInfo.set(false)
// This does not have to be a complete description (e.g. here 'org.apache.commons.collections' does not export anything here).
// It only needs to be good enough to work in the context of this application we are building.
/* module('commons-beanutils-1.9.4.jar', 'org.apache.commons.beanutils', '1.9.4') {
exports('org.apache.commons.beanutils')

requires('org.apache.commons.logging')
requires('java.sql')
requires('java.desktop')
}
module('commons-cli-1.4.jar', 'org.apache.commons.cli', '3.2.2') {
exports('org.apache.commons.cli')
}
module('commons-collections-3.2.2.jar', 'org.apache.commons.collections', '3.2.2')
automaticModule('commons-logging-1.2.jar', 'org.apache.commons.logging')*/
automaticModule("cn.hutool:hutool-all", 'cn.hutool')
automaticModule("org.mapstruct.extensions.spring:mapstruct-spring-extensions", 'org.mapstruct.extensions.spring')
automaticModule("org.redisson:redisson", 'org.redisson')
automaticModule("net.coobird:thumbnailator", 'net.coobird.thumbnailator')
automaticModule("cn.hutool:hutool-all", 'hutool.all')
automaticModule("org.redisson:redisson", 'redisson')
automaticModule("net.coobird:thumbnailator", 'thumbnailator')
}

tasks.named('compileJava') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public interface BaseMapper<D, E> extends Converter<E, D> {
/**
* Entity转DTO,由Spring的Converter替换。这个只能单向转换,当都是这个方向时,用这个可以减少Mapper的注入
* @see https://mapstruct.org/news/2022-02-07-mapstruct-spring-extensions-0-1-1-released/
* but mapstruct-spring-extensions seems unused, things works well just with spring converter
*
* @param entity /
* @return /
Expand Down
Loading