Skip to content

Commit

Permalink
[expr] Add maven publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
lasyard committed Nov 14, 2023
1 parent 6ccebb7 commit 158344f
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions annotations/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
plugins {
id 'java-conventions'
id 'java-library'
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
id 'maven-publish'
}

gitProperties {
keys = gradle.gitPropertiesKeys
}

dependencies {
Expand All @@ -25,3 +31,24 @@ dependencies {
implementation group: 'com.squareup', name: 'javapoet', version: 'javapoet'.v()
implementation group: 'org.apache.commons', name: 'commons-lang3', version: 'commons-lang3'.v()
}

publishing {
publications {
annotations(MavenPublication) {
artifactId = 'dingo-expr-annotations'
from components.java
pom {
name = 'dingo-expr-annotations'
description = 'Annotation processors for Dingo Expression.'
}
gradle.setPom(it)
}
}
repositories {
gradle.setOssrhRepo(it, project)
}
}

signing {
sign publishing.publications.annotations
}
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

group GROUP
version VERSION

subprojects {
group GROUP
version VERSION
}
3 changes: 3 additions & 0 deletions buildSrc/src/main/groovy/java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
plugins {
id 'java'
id 'checkstyle'
id 'signing'
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
withSourcesJar()
withJavadocJar()
}

checkstyle {
Expand Down
27 changes: 27 additions & 0 deletions coding/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,35 @@
plugins {
id 'java-conventions'
id 'java-library'
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
id 'maven-publish'
}

gitProperties {
keys = gradle.gitPropertiesKeys
}

dependencies {
api project(':dingo-expr-runtime')
}

publishing {
publications {
coding(MavenPublication) {
artifactId = 'dingo-expr-coding'
from components.java
pom {
name = 'dingo-expr-coding'
description = 'Coding library of Dingo Expression.'
}
gradle.setPom(it)
}
}
repositories {
gradle.setOssrhRepo(it, project)
}
}

signing {
sign publishing.publications.coding
}
9 changes: 9 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@ logback.version=1.2.3
# To be same as in Calcite
checkerframework.version=3.12.0
checkstyle.version=8.30

gradleGitPropertiesVersion=2.4.1

#
# For release script. These are not the real credentials.
# You should set env `MAVEN_USERNAME` & `MAVEN_TOKEN` and run `gradle publish`.
#
ossrhUsername=dingodb
ossrhPassword=xxxxxxxx
27 changes: 27 additions & 0 deletions json/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
plugins {
id 'java-conventions'
id 'java-library'
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
id 'maven-publish'
}

gitProperties {
keys = gradle.gitPropertiesKeys
}

dependencies {
Expand All @@ -26,3 +32,24 @@ dependencies {
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner', version: 'jackson'.v()
implementation project(':dingo-expr-runtime')
}

publishing {
publications {
json(MavenPublication) {
artifactId = 'dingo-expr-json'
from components.java
pom {
name = 'dingo-expr-json'
description = 'Json library of Dingo Expression.'
}
gradle.setPom(it)
}
}
repositories {
gradle.setOssrhRepo(it, project)
}
}

signing {
sign publishing.publications.json
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private DataParser(DataFormat format, SchemaRoot schemaRoot) {
/**
* Create a {@link DataParser} of json format.
*
* @param schemaRoot the {@link SchemaRoot}
* @return a {@link DataParser}
*/
public static @NonNull DataParser json(SchemaRoot schemaRoot) {
Expand All @@ -78,6 +79,7 @@ private DataParser(DataFormat format, SchemaRoot schemaRoot) {
/**
* Create a {@link DataParser} of yaml format.
*
* @param schemaRoot the {@link SchemaRoot}
* @return a {@link DataParser}
*/
public static @NonNull DataParser yaml(SchemaRoot schemaRoot) {
Expand All @@ -87,7 +89,8 @@ private DataParser(DataFormat format, SchemaRoot schemaRoot) {
/**
* Create a {@link DataParser} of a specified format.
*
* @param format the {@link DataFormat}
* @param format the {@link DataFormat}
* @param schemaRoot the {@link SchemaRoot}
* @return a {@link DataParser}
*/
public static @NonNull DataParser get(DataFormat format, SchemaRoot schemaRoot) {
Expand Down
2 changes: 1 addition & 1 deletion libexpr
Submodule libexpr updated 1 files
+1 −1 README.md
27 changes: 27 additions & 0 deletions parser/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ plugins {
id 'antlr'
id 'java-conventions'
id 'java-library'
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
id 'maven-publish'
}

gitProperties {
keys = gradle.gitPropertiesKeys
}

dependencies {
Expand All @@ -38,3 +44,24 @@ tasks.withType(Checkstyle).configureEach {
exclude '**/DingoExprParserBaseVisitor.java'
exclude '**/DingoExprParserVisitor.java'
}

publishing {
publications {
parser(MavenPublication) {
artifactId = 'dingo-expr-parser'
from components.java
pom {
name = 'dingo-expr-parser'
description = 'Literal parser of Dingo Expression.'
}
gradle.setPom(it)
}
}
repositories {
gradle.setOssrhRepo(it, project)
}
}

signing {
sign publishing.publications.parser
}
27 changes: 27 additions & 0 deletions runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
plugins {
id 'java-conventions'
id 'java-library'
id 'com.gorylenko.gradle-git-properties' version "${gradleGitPropertiesVersion}"
id 'maven-publish'
}

gitProperties {
keys = gradle.gitPropertiesKeys
}

dependencies {
Expand All @@ -25,3 +31,24 @@ dependencies {
implementation group: 'org.apache.commons', name: 'commons-lang3', version: 'commons-lang3'.v()
implementation group: 'org.apache.commons', name: 'commons-text', version: 'commons-text'.v()
}

publishing {
publications {
runtime(MavenPublication) {
artifactId = 'dingo-expr-runtime'
from components.java
pom {
name = 'dingo-expr-runtime'
description = 'Runtime library of Dingo Expression.'
}
gradle.setPom(it)
}
}
repositories {
gradle.setOssrhRepo(it, project)
}
}

signing {
sign publishing.publications.runtime
}
51 changes: 51 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,57 @@ rootProject.name = 'dingo-expr'
// function String.v()
String.metaClass.v = { ext[(delegate as String) + '.version'] }

gradle.ext.gitPropertiesKeys = [
'git.branch',
'git.commit.id',
'git.commit.time',
'git.dirty',
'git.remote.origin.url',
'git.tags',
'git.total.commit.count',
]

gradle.ext.setOssrhRepo = { handler, project ->
handler.maven {
name = "OSSRH"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = (project.version as String).endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("MAVEN_USERNAME") != null
? System.getenv("MAVEN_USERNAME")
: project.findProperty("ossrhUsername")
password = System.getenv("MAVEN_TOKEN") != null
? System.getenv("MAVEN_TOKEN")
: project.findProperty("ossrhPassword")
}
}
}

gradle.ext.setPom = {
it.pom {
url = 'https://www.dingodb.com/'
scm {
connection = 'scm:git:[email protected]:dingodb/dingo-expr.git'
developerConnection = 'scm:git:[email protected]:dingodb/dingo-expr.git'
url = 'https://github.com/dingodb/dingo-expr/tree/main'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'dingodb'
name = 'DingoDB Develop Team'
email = '[email protected]'
}
}
}
}

// Modules
include 'annotations'
findProject(':annotations')?.name = 'dingo-expr-annotations'
Expand Down

0 comments on commit 158344f

Please sign in to comment.