Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Jul 18, 2024
1 parent 54c6c47 commit 87c02aa
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 17 deletions.
30 changes: 30 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import io.github.gradlenexus.publishplugin.NexusPublishExtension
import java.time.Duration

plugins {
id("io.github.gradle-nexus.publish-plugin")
}

rootProject.run {

plugins.apply("io.github.gradle-nexus.publish-plugin")

extensions.getByType(NexusPublishExtension::class.java).run {

// Documentation for this plugin, see https://github.com/gradle-nexus/publish-plugin/blob/v1.3.0/README.md
this.repositories {
sonatype {
nexusUrl.set(uri("https://aws.oss.sonatype.org/service/local/"))
// For CI environments, the username and password should be stored in
// ORG_GRADLE_PROJECT_sonatypeUsername and ORG_GRADLE_PROJECT_sonatypePassword respectively.
username.set(properties["ossrhUsername"].toString())
password.set(properties["ossrhPassword"].toString())
}
}

// these are not strictly required. The default timeouts are set to 1 minute. But Sonatype can be really slow.
// If you get the error "java.net.SocketTimeoutException: timeout", these lines will help.
connectTimeout.set(Duration.ofMinutes(3))
clientTimeout.set(Duration.ofMinutes(3))
}
}
10 changes: 5 additions & 5 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.time.Duration

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
Expand Down Expand Up @@ -29,6 +31,7 @@ object Versions {
const val ktlintGradle = "10.2.1"
const val pig = "0.6.1"
const val shadow = "8.1.1"
const val nexus = "2.0.0"
}

object Plugins {
Expand All @@ -38,6 +41,7 @@ object Plugins {
const val ktlintGradle = "org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktlintGradle}"
const val pig = "org.partiql:pig-gradle-plugin:${Versions.pig}"
const val shadow = "com.github.johnrengelman:shadow:${Versions.shadow}"
const val nexus = "io.github.gradle-nexus:publish-plugin:${Versions.nexus}"
}

dependencies {
Expand All @@ -47,9 +51,5 @@ dependencies {
implementation(Plugins.ktlintGradle)
implementation(Plugins.pig)
implementation(Plugins.shadow)
}

allprojects {
group = rootProject.properties["group"] as String
version = rootProject.properties["version"] as String
implementation(Plugins.nexus)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package org.partiql.gradle.plugin.publish

import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import io.github.gradlenexus.publishplugin.NexusPublishExtension
import io.github.gradlenexus.publishplugin.NexusPublishPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
Expand All @@ -29,14 +31,14 @@ import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import java.io.File
import java.time.Duration

/**
* Gradle plugin to consolidates the following publishing logic
Expand Down Expand Up @@ -160,17 +162,6 @@ abstract class PublishPlugin : Plugin<Project> {
}
}
}
repositories {
maven {
url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
val ossrhUsername: String by rootProject
val ossrhPassword: String by rootProject
username = ossrhUsername
password = ossrhPassword
}
}
}
}

// Sign only if publishing to Maven Central
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

rootProject.name = "partiql"

pluginManagement {
repositories {
gradlePluginPortal()
}
}

include(
":custom-ktlint-rules",
"partiql-ast",
Expand Down

0 comments on commit 87c02aa

Please sign in to comment.