-
Notifications
You must be signed in to change notification settings - Fork 3
Better Gradle build files #41
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
Changes from all commits
d7b5446
02e84bc
049bbdf
a45fa88
57942f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,6 @@ | ||
| plugins { | ||
| id("org.jetbrains.kotlin.jvm").version("2.1.10").apply(false) | ||
| id("org.gradle.java-library") | ||
| id("org.gradle.maven-publish") | ||
| id("org.gradle.signing") | ||
| id("org.jetbrains.kotlin.jvm").version("2.2.0").apply(false) | ||
| id("org.jetbrains.dokka").version("2.0.0").apply(false) | ||
| id("org.jetbrains.dokka-javadoc").version("2.0.0").apply(false) | ||
| id("com.vanniktech.maven.publish").version("0.36.0").apply(false) | ||
| } | ||
|
|
||
| // library version is defined in gradle.properties | ||
| val libraryVersion: String by project | ||
| group = "org.bitcoindevkit" | ||
| version = libraryVersion |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
|
||
| plugins { | ||
| id("org.jetbrains.kotlin.jvm") version "2.1.10" | ||
| id("application") | ||
| id("org.jetbrains.kotlin.jvm") | ||
| } | ||
|
|
||
| repositories { | ||
|
|
@@ -11,24 +11,19 @@ repositories { | |
|
|
||
| dependencies { | ||
| implementation(project(":lib")) | ||
| testImplementation(kotlin("test")) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There were no tests in this module. |
||
| implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") | ||
| implementation("org.slf4j:slf4j-api:2.0.16") | ||
| implementation("ch.qos.logback:logback-classic:1.5.13") | ||
| } | ||
|
|
||
| tasks.test { | ||
| useJUnitPlatform() | ||
| } | ||
|
|
||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_11 | ||
| targetCompatibility = JavaVersion.VERSION_11 | ||
| withSourcesJar() | ||
| withJavadocJar() | ||
| } | ||
|
|
||
| tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
| tasks.withType<KotlinCompile> { | ||
| compilerOptions { | ||
| jvmTarget.set(JvmTarget.JVM_11) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| org.gradle.jvmargs=-Xmx1536m | ||
| android.enableJetifier=true | ||
| kotlin.code.style=official | ||
| libraryVersion=2.4.0-SNAPSHOT | ||
| org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled | ||
| org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,106 +1,97 @@ | ||
| import org.gradle.api.tasks.testing.logging.TestExceptionFormat.* | ||
| import org.gradle.api.tasks.testing.logging.TestLogEvent.* | ||
| import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
| import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
| import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
|
||
| // library version is defined in gradle.properties | ||
| val libraryVersion: String by project | ||
|
|
||
| plugins { | ||
| id("org.jetbrains.kotlin.jvm") | ||
| id("org.gradle.java-library") | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was an unused plugin. |
||
| id("org.gradle.maven-publish") | ||
| id("org.gradle.signing") | ||
| id("com.vanniktech.maven.publish") | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two are replaced by the vannitech plugin.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its great how vanniktech clears out all the "plumbing" work |
||
| id("org.jetbrains.dokka") | ||
| id("org.jetbrains.dokka-javadoc") | ||
| } | ||
|
|
||
| group = "org.bitcoindevkit" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We had those in other files initially because of the super old plugin we used for publishing, which we don't use anymore anyway. Bringing those here cleans up the weird locations for the versions. |
||
| version = "2.3.0-SNAPSHOT" | ||
|
|
||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_11 | ||
| targetCompatibility = JavaVersion.VERSION_11 | ||
| withSourcesJar() | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two lines are now handled by the vannitech plugin. |
||
| withJavadocJar() | ||
| } | ||
|
|
||
| tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
| kotlinOptions { | ||
| jvmTarget = "11" | ||
| tasks.withType<KotlinCompile> { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the new way to declare compiler options. |
||
| compilerOptions { | ||
| jvmTarget.set(JvmTarget.JVM_11) | ||
| } | ||
| } | ||
|
|
||
| testing { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was never needed. |
||
| suites { | ||
| val test by getting(JvmTestSuite::class) { | ||
| useKotlinTest("1.9.23") | ||
| } | ||
| } | ||
| } | ||
| tasks.test { | ||
| useJUnitPlatform() | ||
|
|
||
| tasks.withType<Test> { | ||
| testLogging { | ||
| events(PASSED, SKIPPED, FAILED, STANDARD_OUT, STANDARD_ERROR) | ||
| exceptionFormat = FULL | ||
| events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED, TestLogEvent.STANDARD_OUT) | ||
| exceptionFormat = TestExceptionFormat.FULL | ||
| showExceptions = true | ||
| showStackTraces = true | ||
| showCauses = true | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") | ||
| // JNA | ||
| implementation("net.java.dev.jna:jna:5.14.0") | ||
|
|
||
| // Coroutines | ||
| implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") | ||
|
|
||
| // Tests | ||
| testImplementation(kotlin("test")) | ||
| } | ||
|
|
||
| afterEvaluate { | ||
| publishing { | ||
| publications { | ||
| create<MavenPublication>("maven") { | ||
| groupId = "org.bitcoindevkit" | ||
| artifactId = "bdk-jvm" | ||
| version = libraryVersion | ||
| mavenPublishing { | ||
| coordinates( | ||
| groupId = group.toString(), | ||
| artifactId = "bdk-jvm", | ||
| version = version.toString() | ||
| ) | ||
|
|
||
| from(components["java"]) | ||
| pom { | ||
| name.set("bdk-jvm") | ||
| description.set("Bitcoin Dev Kit Kotlin language bindings.") | ||
| url.set("https://bitcoindevkit.org") | ||
| licenses { | ||
| license { | ||
| name.set("APACHE 2.0") | ||
| url.set("https://github.com/bitcoindevkit/bdk/blob/master/LICENSE-APACHE") | ||
| } | ||
| license { | ||
| name.set("MIT") | ||
| url.set("https://github.com/bitcoindevkit/bdk/blob/master/LICENSE-MIT") | ||
| } | ||
| } | ||
| developers { | ||
| developer { | ||
| id.set("bdkdevelopers") | ||
| name.set("Bitcoin Dev Kit Developers") | ||
| email.set("dev@bitcoindevkit.org") | ||
| } | ||
| } | ||
| scm { | ||
| connection.set("scm:git:github.com/bitcoindevkit/bdk-ffi.git") | ||
| developerConnection.set("scm:git:ssh://github.com/bitcoindevkit/bdk-ffi.git") | ||
| url.set("https://github.com/bitcoindevkit/bdk-ffi/tree/master") | ||
| } | ||
| } | ||
| pom { | ||
| name.set("bdk-jvm") | ||
| description.set("Bitcoin Dev Kit Kotlin language bindings.") | ||
| url.set("https://bitcoindevkit.org") | ||
| inceptionYear.set("2021") | ||
| licenses { | ||
| license { | ||
| name.set("APACHE 2.0") | ||
| url.set("https://github.com/bitcoindevkit/bdk/blob/master/LICENSE-APACHE") | ||
| } | ||
| license { | ||
| name.set("MIT") | ||
| url.set("https://github.com/bitcoindevkit/bdk/blob/master/LICENSE-MIT") | ||
| } | ||
| } | ||
| developers { | ||
| developer { | ||
| id.set("bdkdevelopers") | ||
| name.set("Bitcoin Dev Kit Developers") | ||
| email.set("dev@bitcoindevkit.org") | ||
| } | ||
| } | ||
| scm { | ||
| url.set("https://github.com/bitcoindevkit/bdk-ffi/") | ||
| connection.set("scm:git:github.com/bitcoindevkit/bdk-ffi.git") | ||
| developerConnection.set("scm:git:ssh://github.com/bitcoindevkit/bdk-ffi.git") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| signing { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed anymore, as if you publish to your local maven the vanniteck plugin doesn't require signature in the first place if your keys are not set. |
||
| if (project.hasProperty("localBuild")) { | ||
| isRequired = false | ||
| } | ||
| sign(publishing.publications) | ||
| mavenPublishing { | ||
| publishToMavenCentral() | ||
| signAllPublications() | ||
| } | ||
|
|
||
| dokka { | ||
| moduleName.set("bdk-jvm") | ||
| moduleVersion.set(libraryVersion) | ||
| moduleVersion.set(version.toString()) | ||
| dokkaSourceSets.main { | ||
| includes.from("README.md") | ||
| sourceLink { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an unused plugin.