Skip to content

Commit

Permalink
publish all modules to maven central and plugin to gradle plugin portal
Browse files Browse the repository at this point in the history
  • Loading branch information
kdabir committed Apr 12, 2021
1 parent 9b7ff1b commit aec1edf
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 107 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
name: Release

on:
release:
types: [ published ]
# release:
# types: [ published ]

## TODO use the version to update gradle version
workflow_dispatch:
inputs:
name:
description: 'Version'
required: false


jobs:
build:
Expand All @@ -19,13 +27,13 @@ jobs:
- name: Build with Gradle
run: ./gradlew build

- name: Publish norm-runtime to Maven Central
- name: Publish to Maven Central
env:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_SIGNING_PASSPHRASE: ${{ secrets.OSSRH_SIGNING_PASSPHRASE }}
OSSRH_SIGNING_SECRET_KEY: ${{ secrets.OSSRH_SIGNING_SECRET_KEY }}
run: ./gradlew runtime:publish
run: ./gradlew runtime:publish codegen:publish cli:publish api:publish

- name: Publish norm plugin to Gradle Plugin Portal
env:
Expand Down
5 changes: 5 additions & 0 deletions api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plugins {
id 'com.medly.norm-maven-publish'
}

description = "Norm TypeMapper API"
22 changes: 0 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,5 @@ subprojects {
}
}

project(":codegen") {
dependencies {
implementation project(":runtime")
api project(":api")

api 'org.postgresql:postgresql:42.2.19'
implementation 'com.squareup:kotlinpoet:1.7.2'

implementation 'org.atteo:evo-inflector:1.2.2'
implementation 'org.apache.commons:commons-text:1.9'
}
}

project(":cli") {
apply plugin: 'application'

applicationName = 'norm-codegen'
mainClassName = "norm.cli.NormCliKt"

dependencies {
implementation project(":codegen")
implementation "com.github.ajalt:clikt:2.7.1"
}
}
12 changes: 12 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id 'groovy-gradle-plugin'
}

repositories {
gradlePluginPortal() // so that external plugins can be resolved in dependencies section
mavenCentral()
}

dependencies {
implementation "org.jetbrains.dokka:dokka-gradle-plugin:1.4.30"
}
88 changes: 88 additions & 0 deletions buildSrc/src/main/groovy/com.medly.norm-maven-publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
plugins {
id 'maven-publish'
id 'signing'
id "org.jetbrains.dokka"
}


repositories {
mavenCentral()
jcenter {
content {
includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm")
}
}
}

//tasks {
// dokka {
// outputFormat = "html"
// outputDirectory = "$buildDir/javadoc"
// }
//}

task dokkaJar(type: Jar) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka"
archiveClassifier.set("javadoc")
from(tasks.getByName("dokkaJavadoc"))
dependsOn(tasks.getByName("dokkaJavadoc"))
}

task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact dokkaJar

pom {
name = project.name
description = project.description
url.set("https://github.com/medly/norm")
licenses {
license {
name = "MIT"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
id = "kdabir"
name = "Kunal Dabir"
email = "[email protected]"
}
}
scm {
connection = "scm:git:[email protected]:medly/norm.git"
developerConnection = "scm:git:ssh://github.com/medly/norm.git"
url = "https://github.com/medly/norm"
}
}
}
}

repositories {
maven {
credentials {
username System.getenv("OSSRH_USERNAME")
password System.getenv("OSSRH_PASSWORD")
}

url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
}
}
}


signing {
def signingKey = System.getenv("OSSRH_SIGNING_SECRET_KEY")
def signingPassword = System.getenv("OSSRH_SIGNING_PASSPHRASE")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava // must come after above block
}
15 changes: 15 additions & 0 deletions cli/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
plugins {
id 'application'
id 'com.medly.norm-maven-publish'
}

description = "Command Line Interface for Norm's Code generator"

applicationName = 'norm-codegen'
mainClassName = "norm.cli.NormCliKt"

dependencies {
implementation project(":codegen")
implementation "com.github.ajalt:clikt:2.7.1"
}

16 changes: 16 additions & 0 deletions codegen/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
id 'com.medly.norm-maven-publish'
}

description = "Norm's Code generator to generate data classes from SQL queries"

dependencies {
implementation project(":runtime")
api project(":api")

api 'org.postgresql:postgresql:42.2.19'
implementation 'com.squareup:kotlinpoet:1.7.2'

implementation 'org.atteo:evo-inflector:1.2.2'
implementation 'org.apache.commons:commons-text:1.9'
}
15 changes: 15 additions & 0 deletions plugin/plugin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,18 @@ gradlePlugin {
}
}
}

pluginBundle {
website = 'https://github.com/medly/norm'
vcsUrl = 'https://github.com/medly/norm'
description = "Generate kotlin data classes from SQL queries using NORM"
tags = ['kotlin', 'postgres', 'codegen']

plugins {
norm {
id = "com.medly.norm"
displayName = "Norm Gradle Plugin"
}
}
}

83 changes: 2 additions & 81 deletions runtime/build.gradle
Original file line number Diff line number Diff line change
@@ -1,84 +1,5 @@
plugins {
id 'maven-publish'
id 'signing'
id "org.jetbrains.dokka" version "0.10.1"
id 'com.medly.norm-maven-publish'
}

repositories {
mavenCentral()
}

group = "com.medly.norm"

tasks {
dokka {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
}
}

task dokkaJar(type: Jar) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka"
archiveClassifier.set("javadoc")
from(tasks.dokka)
dependsOn(tasks.dokka)
}

task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact dokkaJar

pom {
name = "norm runtime"
description = "runtime component for norm"
url.set("https://github.com/medly/norm")
licenses {
license {
name = "MIT"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
id = "kdabir"
name = "Kunal Dabir"
email = "[email protected]"
}
}
scm {
connection = "scm:git:[email protected]:medly/norm.git"
developerConnection = "scm:git:ssh://github.com/medly/norm.git"
url = "https://github.com/medly/norm"
}
}
}
}

repositories {
maven {
credentials {
username System.getenv("OSSRH_USERNAME")
password System.getenv("OSSRH_PASSWORD")
}

url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
}
}
}


signing {
def signingKey = System.getenv("OSSRH_SIGNING_SECRET_KEY")
def signingPassword = System.getenv("OSSRH_SIGNING_PASSPHRASE")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava // must come after above block
}
description = "Norm runtime layer"

0 comments on commit aec1edf

Please sign in to comment.