-
Notifications
You must be signed in to change notification settings - Fork 7
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
Use Gradle 8.6, Kotlin build script, and conventional gradle layout #94
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.kt] | ||
ij_kotlin_imports_layout = * | ||
ij_kotlin_packages_to_use_import_on_demand=com.amazon.ionelement.** | ||
|
||
[test/**.kt] | ||
[src/test/kotlin/**.kt] | ||
ktlint_ignore_back_ticked_identifier=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
|
||
plugins { | ||
id("java-library") | ||
|
||
kotlin("jvm") version "1.6.20" | ||
id("maven-publish") | ||
id("signing") | ||
id("org.jetbrains.dokka") version "1.6.20" | ||
id("jacoco") | ||
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.9.0" | ||
id("org.jlleitschuh.gradle.ktlint") version "10.3.0" | ||
|
||
// TODO: Configure and use this | ||
id("com.diffplug.spotless") version "6.11.0" | ||
} | ||
|
||
repositories { | ||
// Use Maven Central for resolving dependencies. | ||
mavenCentral() | ||
} | ||
|
||
group = "com.amazon.ion" | ||
version = "1.3.0-SNAPSHOT" | ||
description = "An immutable in-memory representation of Amazon Ion for Kotlin" | ||
|
||
val isCI: Boolean = System.getenv("CI") == "true" | ||
val githubRepositoryUrl = "https://github.com/amazon-ion/ion-element-kotlin/" | ||
val isReleaseVersion: Boolean = !version.toString().endsWith("SNAPSHOT") | ||
|
||
dependencies { | ||
api("com.amazon.ion:ion-java:[1.4.0,)") | ||
compileOnly("com.amazon.ion:ion-java:1.4.0") | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") | ||
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.4") | ||
testImplementation("org.jetbrains.kotlin:kotlin-test") | ||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2") | ||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.2") | ||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2") | ||
|
||
// Use the Kotlin JUnit 5 integration. | ||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") | ||
testRuntimeOnly("org.junit.platform:junit-platform-launcher") | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
lateinit var sourcesJar: AbstractArchiveTask | ||
lateinit var javadocJar: AbstractArchiveTask | ||
|
||
tasks { | ||
|
||
compileKotlin { | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
apiVersion = "1.3" | ||
languageVersion = "1.4" // Can be read by 1.3 compiler, so consumers on kotlin 1.3 are still supported. | ||
freeCompilerArgs = listOf( | ||
"-opt-in=kotlin.RequiresOptIn" // Using RequiresOptIn requires opt-in itself, at least in kotlin-1.4 | ||
) | ||
} | ||
} | ||
|
||
ktlint { | ||
version.set("0.45.2") | ||
outputToConsole.set(true) | ||
} | ||
|
||
sourcesJar = create<Jar>("sourcesJar") sourcesJar@{ | ||
archiveClassifier.set("sources") | ||
from(sourceSets.named("main")) | ||
} | ||
|
||
javadocJar = create<Jar>("javadocJar") javadocJar@{ | ||
archiveClassifier.set("javadoc") | ||
from(javadoc) | ||
} | ||
|
||
withType<Sign> { | ||
setOnlyIf { isReleaseVersion && gradle.taskGraph.hasTask(":publish") } | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
// report is always generated after tests run | ||
finalizedBy(jacocoTestReport) | ||
} | ||
|
||
jacocoTestReport { | ||
dependsOn(test) | ||
reports { | ||
xml.required.set(true) | ||
html.required.set(true) | ||
} | ||
doLast { | ||
logger.quiet("Coverage report written to file://${reports.html.outputLocation.get()}/index.html") | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
publications.create<MavenPublication>("ion-element") { | ||
// from(components.java) | ||
artifact(sourcesJar) | ||
artifact(javadocJar) | ||
|
||
pom { | ||
name.set("Ion Element Kotlin") | ||
description.set(project.description) | ||
url.set(githubRepositoryUrl) | ||
scm { | ||
connection.set("scm:git:[email protected]:amazon-ion/ion-element-kotlin.git") | ||
developerConnection.set("scm:git:[email protected]:amazon-ion/ion-element-kotlin.git") | ||
url.set("[email protected]:amazon-ion/ion-element-kotlin.git") | ||
} | ||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
developers { | ||
developer { | ||
name.set("Amazon Ion Team") | ||
email.set("[email protected]") | ||
organization.set("Amazon Ion") | ||
organizationUrl.set("https://github.com/amazon-ion") | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
url = uri("https://aws.oss.sonatype.org/service/local/") | ||
credentials { | ||
username = properties["ossrhUsername"].toString() | ||
password = properties["ossrhPassword"].toString() | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
// Allow publishing to maven local even if we don't have the signing keys | ||
// This works because when not required, the signing task will be skipped | ||
// if signing.keyId, signing.password, signing.secretKeyRingFile, etc are | ||
// not present in gradle.properties. | ||
isRequired = isReleaseVersion | ||
|
||
if (isCI) { | ||
val signingKeyId: String? by project | ||
val signingKey: String? by project | ||
val signingPassword: String? by project | ||
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#Mon Mar 29 11:55:05 PDT 2021 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should these minimum requirements be raised given some of the fixes we've recently made in ion-java?
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.
I don't know. Ion Element only uses the reader/writer APIs. In general, I think it's okay to allow users of
ion-element-kotlin
to choose any compatible version ofion-java
.We will probably need to revisit this once Ion 1.1 is done since there will probably be new APIs in
ion-java
thation-element-kotlin
should leverage.