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

fix: change project groupId #1

Merged
merged 5 commits into from
Nov 3, 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
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,29 @@ EVM-based blockchains. It targets <b>JVM</b> and <b>Android</b> platforms. </p>
> [!NOTE]
> `ethers-kt` API is not yet stable and might be subject to change. It will be stabilized in the 1.0.0 release.

The latest release of the library is available under [Releases](https://github.com/Kr1ptal/ethers-kt/releases).
All releases are published to Maven Central. Changelog of each release can be found
under [Releases](https://github.com/Kr1ptal/ethers-kt/releases).

It's recommended to define BOM platform dependency to ensure that ethers-kt artifacts are compatible with each other.

```kotlin
// Define a maven repository for github packages where the library is published
// Define a maven repository where the library is published
repositories {
maven {
url = uri("https://maven.pkg.github.com/kr1ptal/ethers-kt")
}
mavenCentral()

// for snapshot versions, use the following repository
//maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") }
}

dependencies {
// Define a BOM and its version
implementation(platform("io.ethers:ethers-bom:0.1.0"))
implementation(platform("io.kriptal.ethers:ethers-bom:0.1.0"))

// Define any required artifacts without version
implementation("io.ethers:ethers-abi")
implementation("io.ethers:ethers-core")
implementation("io.ethers:ethers-providers")
implementation("io.ethers:ethers-signers")
implementation("io.kriptal.ethers:ethers-abi")
implementation("io.kriptal.ethers:ethers-core")
implementation("io.kriptal.ethers:ethers-providers")
implementation("io.kriptal.ethers:ethers-signers")
}
```

Expand Down
10 changes: 2 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ tasks.withType<Test> {
}

allprojects {
group = "io.ethers"
version = "0.1.0"
}

subprojects {
if (name != "ethers-abigen-plugin") {
apply(plugin = "maven-publish-conventions")
}
group = "io.kriptal.ethers"
version = "0.1.0-SNAPSHOT"
}
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/Extensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import org.gradle.api.Project


fun Project.isLibraryReleaseMode(): Boolean {
return System.getenv("LIB_RELEASE").equals("true", ignoreCase = true)
}
74 changes: 58 additions & 16 deletions buildSrc/src/main/kotlin/maven-publish-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,54 @@
plugins {
`maven-publish`
id("signing-conventions")
}

val configureRepositories: Action<PublishingExtension> = Action {
repositories {
if (System.getenv("LIB_RELEASE").equals("true", ignoreCase = true)) {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/Kr1ptal/ethers-kt")

credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
val configureMavenCentralRepo: Action<RepositoryHandler> = Action {
if (isLibraryReleaseMode()) {
maven {
name = "mavenCentral"

url = if (version.toString().endsWith("-SNAPSHOT")) {
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
} else {
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
}

credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
}
} else {
mavenLocal()
}
} else {
mavenLocal()
}
}

val configurePom = Action<MavenPom> {
name = project.name
description =
"Async, high-performance Kotlin library for interacting with EVM-based blockchains. Targeting JVM and Android platforms."
url = "https://github.com/Kr1ptal/ethers-kt"

licenses {
license {
name = "Apache-2.0 License"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
developers {
developer {
id = "kriptal"
name = "Kriptal"
organization = "Kriptal"
organizationUrl = "https://kriptal.io"
}
}
scm {
url = "https://github.com/Kr1ptal/ethers-kt"
connection = "scm:git:git://github.com/Kr1ptal/ethers-kt.git"
developerConnection = "scm:git:ssh://git@github.com/Kr1ptal/ethers-kt.git"
}
}

Expand All @@ -28,22 +60,32 @@ project.pluginManager.withPlugin("java") {
publishing {
publications {
create<MavenPublication>("library") {
pom(configurePom)
from(components["java"])
}
}

configureRepositories.execute(this)
repositories(configureMavenCentralRepo)
}

signing {
sign(publishing.publications["library"])
}
}

project.pluginManager.withPlugin("java-platform") {
publishing {
publications {
create<MavenPublication>("library-bom") {
create<MavenPublication>("libraryBom") {
pom(configurePom)
from(components["javaPlatform"])
}
}

configureRepositories.execute(this)
repositories(configureMavenCentralRepo)
}

signing {
sign(publishing.publications["libraryBom"])
}
}
13 changes: 13 additions & 0 deletions buildSrc/src/main/kotlin/signing-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
signing
}

signing {
isRequired = isLibraryReleaseMode()

val signingKeyId = System.getenv("ORG_GRADLE_PROJECT_signingKeyId")
val signingKey = System.getenv("ORG_GRADLE_PROJECT_signingKey")
val signingPassword = System.getenv("ORG_GRADLE_PROJECT_signingKeyPassword")

useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
}
1 change: 1 addition & 0 deletions ethers-abi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
`project-conventions`
id(libs.plugins.kotlin.kapt.get().pluginId) // https://github.com/gradle/gradle/issues/20084#issuecomment-1060822638
`jmh-conventions`
`maven-publish-conventions`
}

dependencies {
Expand Down
5 changes: 3 additions & 2 deletions ethers-abigen-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
`java-gradle-plugin`
`project-conventions`
`signing-conventions`
`java-gradle-plugin`
id("com.gradle.plugin-publish") version "1.2.1"
}

Expand All @@ -17,7 +18,7 @@ gradlePlugin {

plugins {
create("abigen-plugin") {
id = "io.ethers.abigen-plugin"
id = "io.kriptal.ethers.abigen-plugin"
implementationClass = "io.ethers.abigen.plugin.EthersAbigenPlugin"

displayName = "Plugin for generating JVM contract bindings for Ethereum smart contracts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class EthersAbigenPluginTest : FunSpec({
test("plugin is successfully applied") {
val project = ProjectBuilder.builder().build()
project.plugins.apply("org.jetbrains.kotlin.jvm")
project.plugins.apply("io.ethers.abigen-plugin")
project.plugins.apply("io.kriptal.ethers.abigen-plugin")

(project.plugins.getPlugin(EthersAbigenPlugin::class.java) is EthersAbigenPlugin) shouldBe true
}

test("plugin applies defaults to tasks") {
val project = ProjectBuilder.builder().build()
project.plugins.apply("org.jetbrains.kotlin.jvm")
project.plugins.apply("io.ethers.abigen-plugin")
project.plugins.apply("io.kriptal.ethers.abigen-plugin")

val ext = project.extensions.getByType(EthersAbigenExtension::class.java)

Expand All @@ -37,7 +37,7 @@ class EthersAbigenPluginTest : FunSpec({
val project = ProjectBuilder.builder().build()

shouldThrow<PluginApplicationException> {
project.plugins.apply("io.ethers.abigen-plugin")
project.plugins.apply("io.kriptal.ethers.abigen-plugin")
}
}

Expand Down Expand Up @@ -70,7 +70,7 @@ class EthersAbigenPluginTest : FunSpec({
plugins {
id 'base'
id 'org.jetbrains.kotlin.jvm'
id 'io.ethers.abigen-plugin'
id 'io.kriptal.ethers.abigen-plugin'
}

ethersAbigen {
Expand Down Expand Up @@ -129,7 +129,7 @@ class EthersAbigenPluginTest : FunSpec({
plugins {
id 'base'
id 'org.jetbrains.kotlin.jvm'
id 'io.ethers.abigen-plugin'
id 'io.kriptal.ethers.abigen-plugin'
}

ethersAbigen {
Expand Down
2 changes: 1 addition & 1 deletion ethers-abigen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
`project-conventions`
`maven-publish-conventions`
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions ethers-bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
`java-platform`
`maven-publish-conventions`
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions ethers-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id(libs.plugins.kotlin.kapt.get().pluginId) // https://github.com/gradle/gradle/issues/20084#issuecomment-1060822638
`jmh-conventions`
kotlin("plugin.serialization") version libs.versions.kotlin.get()
`maven-publish-conventions`
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion ethers-crypto/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
`project-conventions`
`maven-publish-conventions`
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions ethers-providers/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
`project-conventions`
`maven-publish-conventions`
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion ethers-rlp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
`project-conventions`
`maven-publish-conventions`
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion ethers-signers/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
`project-conventions`
`maven-publish-conventions`
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ org.gradle.parallel=true
org.gradle.vfs.watch=true
org.gradle.caching=true
##################### OTHER PROPERTIES #####################
kotlin.code.style=official
kotlin.code.style=official
1 change: 1 addition & 0 deletions logger/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
`project-conventions`
`maven-publish-conventions`
}

repositories {
Expand Down