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

Update Gradle config #194

Merged
merged 19 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ out
gen
/target/
/pemfile_cached
/.gradle
.gradle/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

build
build/
/classes/
/gradle.properties-e
/gradle.propertiesr
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ First and foremost skrape{it} aims to be a testing tool (not tied to a particula
- [x] Designed to deserialize HTML but can handle any XML-related markup specifications such as SVG, UML, RSS or XML itself.
- [x] DSL to select html elements as well as supporting CSS query-selector syntax by string invocation.
### Http-Client
- [x] Http-Client without verbosity and ceremony to make requests and corresponding request options like headers, cookies etc in a fluent style interface.
- [x] Http-Client without verbosity and ceremony to make requests and corresponding request options like headers, cookies etc. in a fluent style interface.
- [x] Pre-configure client regarding auth and other request settings
- [x] Can handle client side rendered web pages. Javascript execution results can optionally be considered in the response body.
### Idomatic
### Idiomatic
- [x] Easy to use, idiomatic and type-safe DSL to ensure a high level of readability.
- [x] Build-in matchers/assertions based on infix functions to archive a very high level of readability.
- [x] DSL is behaving like a Fluent-Api to make data extraction/scraping as comfortable as possible.
Expand Down Expand Up @@ -497,6 +497,6 @@ the development, maintenance takes time.
However, if you are using this project and be happy with it or just want to encourage me to continue creating stuff or fund the caffeine and pizzas that fuel its development, there are few ways you can do it :-
- **Starring and sharing the project** :rocket: to help make it more popular
- Giving proper credit when you use skrape{it}, tell your friends and others about it :smiley:
- Sponsor Skrape{it} with a one-time donations via PayPal by just click this button → [![Donate](https://img.shields.io/badge/-donate-blue.svg?logo=paypal)](https://www.paypal.me/skrapeit) or use the GitHub sponsors programm to support on a monthly basis :sparkling_heart:
- Sponsor skrape{it} with a one-time donations via PayPal by just click this button → [![Donate](https://img.shields.io/badge/-donate-blue.svg?logo=paypal)](https://www.paypal.me/skrapeit) or use the GitHub sponsors program to support on a monthly basis :sparkling_heart:

[![Stargazers repo roster for @skrapeit/skrape.it](https://reporoster.com/stars/skrapeit/skrape.it)](https://github.com/skrapeit/skrape.it/stargazers)
5 changes: 3 additions & 2 deletions assertions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
plugins {
kotlin("jvm")
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.`maven-publishing`
}

dependencies {
api(projects.htmlParser)
api(projects.dsl)
api(projects.baseFetcher)
api(projects.fetcher.baseFetcher)
}
305 changes: 154 additions & 151 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@file:Suppress("UNUSED_VARIABLE", "LocalVariableName")
//@file:Suppress("UNUSED_VARIABLE", "LocalVariableName")

import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import io.gitlab.arturbosch.detekt.extensions.DetektExtension.Companion.DEFAULT_SRC_DIR_KOTLIN
Expand All @@ -7,10 +7,10 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`java-library`
`maven-publish`
signing
kotlin("jvm")
buildsrc.convention.base
buildsrc.convention.`kotlin-jvm`
buildsrc.convention.`maven-publishing`

id("org.jetbrains.dokka") apply false
id("org.jetbrains.kotlinx.kover")
id("com.github.ben-manes.versions")
Expand All @@ -20,154 +20,152 @@ plugins {
id("io.github.gradle-nexus.publish-plugin")
}

allprojects {
val release_version: String by project
version = release_version
group = "it.skrape"

repositories {
mavenCentral()
}

apply(plugin = "com.github.ben-manes.versions")
apply(plugin = "se.patrikerdes.use-latest-versions")

apply(plugin = "com.adarshr.test-logger")
testlogger {
setTheme("mocha-parallel")
slowThreshold = 1000
showStandardStreams = false
}

apply(plugin = "io.gitlab.arturbosch.detekt")
detekt {
toolVersion = "1.19.0"
autoCorrect = true
buildUponDefaultConfig = true
source = files(DEFAULT_SRC_DIR_KOTLIN)
config = files("$rootDir/detekt.yml")
}

apply(plugin = "org.jetbrains.kotlin.jvm")
kotlin {
explicitApi = ExplicitApiMode.Strict
}
@Suppress("PropertyName")
val release_version: String by project
version = release_version
group = "it.skrape"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
withJavadocJar()
withSourcesJar()
}

val includeToPublishing = listOf(
"assertions",
"base-fetcher",
"dsl",
"http-fetcher",
"async-fetcher",
"browser-fetcher",
"html-parser",
"ktor-extension",
"mock-mvc-extension",
"skrapeit"
)
if (this.name in includeToPublishing) {
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "maven-publish")
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifactId = if (rootProject.name == project.name) rootProject.name else "${rootProject.name}-${project.name}"
from(components["java"])
pom {
name.set("skrape{it}")
description.set("A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. First and foremost it aims to be a testing lib, but it can also be used to scrape websites in a convenient fashion.")
url.set("https://docs.skrape.it")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("christian-draeger")
name.set("Christian Dräger")
}
}
scm {
connection.set("scm:git:git://github.com/skrapeit/skrape.it.git")
developerConnection.set("scm:git:ssh://github.com:skrapeit/skrape.it.git")
url.set("https://github.com/skrapeit/skrape.it/tree/master")
}
}
}
}
}

apply(plugin = "signing")
signing {
sign(publishing.publications["mavenJava"])
allprojects {

val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
}
}
// apply(plugin = "com.github.ben-manes.versions")
// apply(plugin = "se.patrikerdes.use-latest-versions")

// apply(plugin = "com.adarshr.test-logger")
// testlogger {
// setTheme("mocha-parallel")
// slowThreshold = 1000
// showStandardStreams = false
// }

// apply(plugin = "io.gitlab.arturbosch.detekt")
// detekt {
// toolVersion = "1.19.0"
// autoCorrect = true
// buildUponDefaultConfig = true
// source = files(DEFAULT_SRC_DIR_KOTLIN)
// config = files("$rootDir/detekt.yml")
// }

// apply(plugin = "org.jetbrains.kotlin.jvm")
// kotlin {
// explicitApi = ExplicitApiMode.Strict
// }

// java {
// toolchain {
// languageVersion.set(JavaLanguageVersion.of(8))
// }
// withJavadocJar()
// withSourcesJar()
// }

// val includeToPublishing = listOf(
// "assertions",
// "base-fetcher",
// "dsl",
// "http-fetcher",
// "async-fetcher",
// "browser-fetcher",
// "html-parser",
// "ktor-extension",
// "mock-mvc-extension",
// "skrapeit"
// )
// if (this.name in includeToPublishing) {
// apply(plugin = "org.jetbrains.dokka")
// apply(plugin = "maven-publish")
// publishing {
// publications {
// create<MavenPublication>("mavenJava") {
// artifactId = if (rootProject.name == project.name) rootProject.name else "${rootProject.name}-${project.name}"
// from(components["java"])
// pom {
// name.set("skrape{it}")
// description.set("A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. First and foremost it aims to be a testing lib, but it can also be used to scrape websites in a convenient fashion.")
// url.set("https://docs.skrape.it")
// licenses {
// license {
// name.set("MIT License")
// url.set("https://opensource.org/licenses/MIT")
// }
// }
// developers {
// developer {
// id.set("christian-draeger")
// name.set("Christian Dräger")
// }
// }
// scm {
// connection.set("scm:git:git://github.com/skrapeit/skrape.it.git")
// developerConnection.set("scm:git:ssh://github.com:skrapeit/skrape.it.git")
// url.set("https://github.com/skrapeit/skrape.it/tree/master")
// }
// }
// }
// }
// }
//
// apply(plugin = "signing")
// signing {
// sign(publishing.publications["mavenJava"])
//
// val signingKeyId: String? by project
// val signingKey: String? by project
// val signingPassword: String? by project
// useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
// }
// }
}

subprojects {

dependencies {
testImplementation(Deps.jUnit)
testImplementation(Deps.strikt)
testImplementation(Deps.Mockk.mockk)
testImplementation(Deps.Mockk.dslJvm)
}
//
// dependencies {
// testImplementation(Deps.jUnit)
// testImplementation(Deps.strikt)
// testImplementation(Deps.Mockk.mockk)
// testImplementation(Deps.Mockk.dslJvm)
// }
tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
}

withType<KotlinCompile> {
kotlinOptions.apply {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xjsr305=strict")
apiVersion = "1.4"
languageVersion = "1.4"
}
}

withType<Test> {
shouldRunAfter(useLatestVersions)
dependsOn(detekt)
useJUnitPlatform()
systemProperties = mapOf(
"junit.jupiter.execution.parallel.enabled" to true,
"junit.jupiter.execution.parallel.mode.default" to "concurrent",
"junit.jupiter.execution.parallel.mode.classes.default" to "concurrent"
)
}

withType<DependencyUpdatesTask> {

gradleReleaseChannel = "current"

rejectVersionIf {
val isFlaggedAsNonStable =
listOf("alpha", "beta", "RC", "rc", "dev", "M1", "M2", "M3").any { candidate.version.contains(it) }
.not()
val isSemanticVersion = "^[0-9,.v-]+(-r)?$".toRegex().matches(candidate.version)
(isFlaggedAsNonStable || isSemanticVersion).not()
}
}

val updateDependencies by creating {
dependsOn(useLatestVersions, test)
}
// withType<JavaCompile> {
// options.encoding = "UTF-8"
// }

// withType<KotlinCompile> {
// kotlinOptions.apply {
// jvmTarget = "1.8"
// freeCompilerArgs = listOf("-Xjsr305=strict")
// apiVersion = "1.4"
// languageVersion = "1.4"
// }
// }

// withType<Test> {
// shouldRunAfter(useLatestVersions)
// dependsOn(detekt)
// useJUnitPlatform()
// systemProperties = mapOf(
// "junit.jupiter.execution.parallel.enabled" to true,
// "junit.jupiter.execution.parallel.mode.default" to "concurrent",
// "junit.jupiter.execution.parallel.mode.classes.default" to "concurrent"
// )
// }

// withType<DependencyUpdatesTask> {
//
// gradleReleaseChannel = "current"
//
// rejectVersionIf {
// val isFlaggedAsNonStable =
// listOf("alpha", "beta", "RC", "rc", "dev", "M1", "M2", "M3").any { candidate.version.contains(it) }
// .not()
// val isSemanticVersion = "^[0-9,.v-]+(-r)?$".toRegex().matches(candidate.version)
// (isFlaggedAsNonStable || isSemanticVersion).not()
// }
// }

// val updateDependencies by creating {
// dependsOn(useLatestVersions, test)
// }
}
}

Expand All @@ -192,10 +190,15 @@ nexusPublishing {

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

tasks.wrapper {
gradleVersion = "7.5"
distributionType = Wrapper.DistributionType.ALL
}
2 changes: 0 additions & 2 deletions buildSrc/.gitignore

This file was deleted.

Loading