Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6d10538
update to Gradle 7.5
aSemy Jul 23, 2022
329e08d
merge .gitignore
aSemy Jul 23, 2022
64cd016
minor readme fixes
aSemy Jul 23, 2022
ae0ffb2
set up buildSrc and convention plugins (with config mostly copied fro…
aSemy Jul 23, 2022
3ad80da
update settings plugin to use shared repo config, and update Gradle p…
aSemy Jul 23, 2022
04928e2
enable Gradle caching options (faster IDE, build, tests speeds)
aSemy Jul 23, 2022
240e39d
update projects to use convention plugins, and remove custom dir sett…
aSemy Jul 23, 2022
3cb0751
set snapshot repo as 'snapshots only' (better performance)
aSemy Jul 23, 2022
c0e9329
buildsrc - format plugins
aSemy Jul 23, 2022
e54e338
fix explicitApi, and add task-config avoidance on test tasks
aSemy Jul 23, 2022
cd9b95b
gradle does NOT like parallel! Lots of OOM exceptions
aSemy Jul 23, 2022
9bc840c
enable detekt for Kotlin projects
aSemy Jul 23, 2022
df43ed3
move snapshot repo to common repo definitions
aSemy Jul 23, 2022
0fdab96
apply version-management.gradle.kts plugin, update some log dependencies
aSemy Jul 23, 2022
e47e882
fix Maven publishing for JVM
aSemy Jul 24, 2022
6bda350
add dokka to Javadoc Jar
aSemy Jul 24, 2022
1c0de97
rm jsExecution feature TODO (it's Gradle config to create a feature v…
aSemy Jul 24, 2022
0babfef
update project dependencies to use typesafe-accessors
aSemy Jul 24, 2022
c88edbc
rm idea plugin from buildSrc/build.gradle.kts
aSemy Jul 24, 2022
edc8596
initial migration to Kotlin Multiplatform
aSemy Jul 24, 2022
4c6dca6
bump Kotlin, Ktor
aSemy Jul 24, 2022
cdc7fd6
set up test-utils
aSemy Jul 24, 2022
d33e4d5
Merge remote-tracking branch 'origin/master' into feat/kotlin-multipl…
aSemy Jul 26, 2022
9ab5806
bump versions again (overwritten during merge)
aSemy Jul 26, 2022
8abdfc6
update Gradle caching for GitHub actions
aSemy Jul 26, 2022
6b2803b
add concurrency, timeout, and disable fail-fast for tests
aSemy Jul 26, 2022
14a2c33
Merge branch 'github-actions-update' into feat/kotlin-multiplatform
aSemy Jul 26, 2022
7f674fa
Merge branch 'github-actions-update' into feat/kotlin-multiplatform
aSemy Jul 26, 2022
6c3bb86
Merge remote-tracking branch 'origin/master' into feat/kotlin-multipl…
aSemy Aug 26, 2022
4854cbe
bump gradle
aSemy Aug 26, 2022
685cb89
add jvm test dependencies
aSemy Aug 26, 2022
53f5518
toLowerCase() -> lowercase()
aSemy Aug 26, 2022
2b18c73
spelling scoope -> scope
aSemy Aug 26, 2022
0a64903
fix code warnings
aSemy Aug 26, 2022
b429225
bump kover plugin version
aSemy Aug 26, 2022
6bc29c3
try bumping kover version
aSemy Aug 26, 2022
444aeaa
revert kover, try to fix the other bug by manually setting the engine…
aSemy Aug 26, 2022
04c9d48
fix Kover coverage
aSemy Sep 7, 2022
ef935bd
fix Kover coverage
aSemy Sep 7, 2022
09de5c7
remove jsExecution feature variant, publish browser-fetcher directly
aSemy Sep 7, 2022
a104400
configure kotlin-multiplatform publishing
aSemy Sep 7, 2022
f393237
all -> configureEach
aSemy Sep 7, 2022
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
30 changes: 24 additions & 6 deletions assertions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
plugins {
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.`publish-jvm`
buildsrc.convention.`kotlin-multiplatform`
buildsrc.convention.kover
buildsrc.convention.`publish-kotlin-multiplatform`
}

dependencies {
api(projects.htmlParser)
api(projects.dsl)
api(projects.fetcher.baseFetcher)
kotlin {
jvm {}

sourceSets {
val commonMain by getting {
dependencies {
api(projects.htmlParser)
api(projects.dsl)
api(projects.fetcher.baseFetcher)
}
}

val jvmTest by getting {
dependencies {
implementation(Deps.jUnit)
implementation(Deps.strikt)
implementation(Deps.Mockk.mockk)
implementation(Deps.Mockk.dslJvm)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ public infix fun ContentType.toContain(expected: ContentTypes): ContentType /* =
this.apply { generalAssertion(raw().contains(expected.value), expected) }

private fun ContentType.raw() = (this as String)
.toLowerCase()
.lowercase()
.replace("\\s".toRegex(), "")
63 changes: 47 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import kotlinx.kover.api.KoverNames

plugins {
buildsrc.convention.base
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.`publish-jvm`
buildsrc.convention.`kotlin-multiplatform`
buildsrc.convention.`publish-kotlin-multiplatform`

id("org.jetbrains.kotlinx.kover")
buildsrc.convention.kover

id("io.github.gradle-nexus.publish-plugin")
}
Expand All @@ -13,22 +14,52 @@ val release_version: String by project
version = release_version
group = "it.skrape"

dependencies {
api(projects.assertions)
api(projects.fetcher.asyncFetcher)
api(projects.fetcher.baseFetcher)
api(projects.fetcher.browserFetcher)
api(projects.dsl)
api(projects.fetcher.httpFetcher)
api(projects.htmlParser)
kotlin {
jvm {}

sourceSets {
val commonMain by getting {
dependencies {
api(projects.assertions)
api(projects.fetcher.asyncFetcher)
api(projects.fetcher.baseFetcher)
api(projects.fetcher.browserFetcher)
api(projects.dsl)
api(projects.fetcher.httpFetcher)
api(projects.htmlParser)
}
}
}
}

tasks.withType<Test>().configureEach {
finalizedBy(tasks.koverReport, tasks.koverCollectReports)
finalizedBy(tasks.koverReport)
// lazily access koverMergedReport task because it doesn't have a specific DSL accessor or type
val koverMergedReportTask = tasks.matching { it.name == KoverNames.MERGED_REPORT_TASK_NAME }
finalizedBy(koverMergedReportTask)
}

kover {
coverageEngine.set(kotlinx.kover.api.CoverageEngine.INTELLIJ)
koverMerged {
enable()

filters {
projects {
excludes += listOf(
":examples:scraping",
":examples:use-pre-release-version",
":fetcher:async-fetcher",
":fetcher:base-fetcher",
":fetcher:browser-fetcher",
":fetcher:http-fetcher",

// Intermediate projects, without a build.gradle.kts.
// (These exclusions can be removed in a future Kover release https://github.com/Kotlin/kotlinx-kover/issues/222)
":examples",
":fetcher",
":test-utils",
)
}
}
}

nexusPublishing {
Expand All @@ -38,6 +69,6 @@ nexusPublishing {
}

tasks.wrapper {
gradleVersion = "7.5"
gradleVersion = "7.5.1"
distributionType = Wrapper.DistributionType.ALL
}
6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ plugins {
}

// set the versions of Gradle plugins that the subprojects will use here
val kotlinVersion = "1.6.21"
val kotlinVersion = "1.7.10"

val detektPlugin = "1.19.0"
val gradleNexusPublishPlugin = "1.1.0"
val gradleTestLoggerPlugin = "3.1.0"
val gradleVersionsPlugin = "0.39.0"
val kotlinDokkaPlugin = "1.6.21"
val kotlinxKoverPlugin = "0.5.0"
val kotlinDokkaPlugin = "1.7.10"
val kotlinxKoverPlugin = "0.6.0"
val useLatestVersionsPlugin = "0.2.18"

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Deps.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Versions {
const val kotlin = "1.6.21"
const val kotlin = "1.7.10"
const val coroutines = "1.6.1"
const val ktor = "2.0.3" //2.0.1
const val ktor = "2.0.3"
const val serialization = "1.0.1"
const val datetime = "0.1.1"
const val jsoup = "1.13.1" // 1.14.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
kotlin {
explicitApi()
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of("8"))
languageVersion.set(JavaLanguageVersion.of("8"))
}
}

Expand All @@ -40,8 +40,8 @@ tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.apply {
jvmTarget = "1.8"
freeCompilerArgs += listOf("-Xjsr305=strict")
apiVersion = "1.4"
languageVersion = "1.4"
apiVersion = "1.5"
languageVersion = "1.7"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ plugins {
id("buildsrc.convention.base")
id("buildsrc.convention.detekt")
}

kotlin {
explicitApi()

targets.configureEach {
compilations.configureEach {
kotlinOptions {
apiVersion = "1.5"
languageVersion = "1.7"
}
}
}
}
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/buildsrc/convention/kover.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package buildsrc.convention

import kotlinx.kover.api.IntellijEngine

plugins {
id("org.jetbrains.kotlinx.kover")
}

kover {
// https://search.maven.org/artifact/org.jetbrains.intellij.deps/intellij-coverage-agent
engine.set(IntellijEngine("1.0.681"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package buildsrc.convention

import buildsrc.config.createSkrapeItPom
import gradle.kotlin.dsl.accessors._4ad077ad74816558e52d7069eb18a2f7.publishing
import gradle.kotlin.dsl.accessors._4ad077ad74816558e52d7069eb18a2f7.signing
import org.gradle.api.provider.Provider
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.provideDelegate

plugins {
`maven-publish`
signing
}

description = "Configuration for publishing Kotlin Multiplatform libraries to Sonatype Maven Central"

val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project

val signingEnabled: Provider<Boolean> = provider {
signingKeyId != null && signingKey != null && signingPassword != null
}

val javadocJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Empty Javadoc Jar (required by Maven Central)"
archiveClassifier.set("javadoc")
}

publishing {
repositories {
// publish to local dir, for testing
maven(rootProject.layout.buildDirectory.dir("maven-internal")) {
name = "LocalProjectDir"
}
}
publications.withType<MavenPublication>().configureEach {
artifact(javadocJar)

createSkrapeItPom {
name.set("skrape{it} ${project.name}")
}
}
}
Comment on lines +34 to +48
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason Sonatype isn't defined here..

I would expect to see something like this:

https://github.com/kotest/kotest/blob/945e029b4aea4ca39487f2dcf10d9a066dd7050a/buildSrc/src/main/kotlin/kotest-publishing-conventions.gradle.kts#L22-L31

The same in the publish-jvm convention plugin...

Was it removed, and it should be re-added now?


signing {
if (signingEnabled.get()) {
sign(publishing.publications)

useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
}
}
9 changes: 7 additions & 2 deletions dsl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
plugins {
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.`publish-jvm`
buildsrc.convention.`kotlin-multiplatform`

buildsrc.convention.kover
}

kotlin {
jvm {}
}
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ More specifically it searches a bunch [kotlinweekly newsletters](http://www.kotl
## Pre-Release version usage

Need a new feature really urgent?
The [pre-release example](use-pre-release-version) show cases how to use jitpack releases directly taken from master commit even before official release to maven central has happened.
The [pre-release example](use-pre-release-version) show cases how to use jitpack releases directly taken from master commit even before official release to maven central has happened.
37 changes: 27 additions & 10 deletions fetcher/async-fetcher/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
plugins {
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.`publish-jvm`
buildsrc.convention.`kotlin-multiplatform`
buildsrc.convention.`publish-kotlin-multiplatform`
}

dependencies {
implementation(projects.fetcher.baseFetcher)
implementation(Deps.Ktor.client)
implementation(Deps.Ktor.clientApache)
implementation(Deps.Ktor.clientLogging)
implementation(Deps.logback)
implementation(Deps.log4jOverSlf4j)
kotlin {
jvm {}

testImplementation(projects.testUtils)
sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.fetcher.baseFetcher)
implementation(Deps.Ktor.client)
implementation(Deps.Ktor.clientApache)
implementation(Deps.Ktor.clientLogging)
}
}

val jvmMain by getting {
dependencies {
implementation(Deps.logback)
implementation(Deps.log4jOverSlf4j)
}
}

val jvmTest by getting {
dependencies {
implementation(projects.testUtils)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ internal fun String?.toExpires(): Expires {
}
}

internal fun String?.toSameSite(): SameSite = when (this?.toLowerCase()) {
internal fun String?.toSameSite(): SameSite = when (this?.lowercase()) {
"strict" -> SameSite.STRICT
"lax" -> SameSite.LAX
"none" -> SameSite.NONE
Expand Down
46 changes: 31 additions & 15 deletions fetcher/base-fetcher/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
@file:Suppress("PropertyName")

val kotlin_version: String by project

plugins {
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.`publish-jvm`
buildsrc.convention.`kotlin-multiplatform`
buildsrc.convention.`publish-kotlin-multiplatform`
}

dependencies {
implementation(projects.dsl)
implementation(Deps.Kotlin.reflect) {
because("to support Result#extractIt by creating instance of a class")
}
api(Deps.KotlinX.Coroutines.jdk8)
kotlin {
jvm {}
sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.dsl)
api(Deps.KotlinX.Coroutines.core)
}
}

val jvmMain by getting {
dependencies {
api(Deps.jsoup)
implementation(Deps.Kotlin.reflect) {
because("to support Result#extractIt by creating instance of a class")
}
api(Deps.KotlinX.Coroutines.jdk8)
}
}

testImplementation(projects.testUtils)
testImplementation(Deps.Ktor.client)
testImplementation(Deps.Ktor.clientApache)
val jvmTest by getting {

dependencies {
implementation(projects.testUtils)

implementation(Deps.Ktor.client)
implementation(Deps.Ktor.clientApache)
}
}
}
}
Loading