Skip to content
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
23 changes: 6 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 15
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 15
java-version: 17

- name: Cache Gradle packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand All @@ -41,7 +41,7 @@ jobs:
run: ./gradlew clean build

- name: Upload test report directory
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: always()
with:
name: testDebugStuff
Expand All @@ -51,19 +51,8 @@ jobs:
- name: Run Test Coverage
run: ./gradlew jacocoTestReport

- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/[email protected]
with:
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv

- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
env:
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: xpathqs/core
32 changes: 17 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,31 +20,30 @@
* SOFTWARE.
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.api.tasks.testing.logging.TestLogEvent

version = "0.1.6"
group = "org.xpathqs"
val kotestVersion = "5.8.0"

plugins {
kotlin("jvm") version "2.0.0-Beta4"
id("org.jetbrains.kotlin.jvm") version "2.3.0"
id("org.jetbrains.dokka") version "1.4.32"
`java-library`
jacoco
`maven-publish`
signing
id("io.codearte.nexus-staging") version "0.30.0"
id("io.gitlab.arturbosch.detekt").version("1.23.5")
id("info.solidsoft.pitest").version("1.9.0")
id("org.jetbrains.kotlinx.kover") version "0.6.1"
id("io.gitlab.arturbosch.detekt").version("1.23.8")
id("info.solidsoft.pitest").version("1.19.0-rc.2")
id("org.jetbrains.kotlinx.kover") version "0.9.4"
}

java {
withJavadocJar()
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jacoco {
Expand All @@ -57,13 +56,15 @@ repositories {
}

detekt {
config = files("$projectDir/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
config.from(
files("$projectDir/detekt.yml")
)
}

dependencies {
implementation("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0")
implementation("org.jetbrains.kotlin:kotlin-reflect:2.0.0-Beta4")
implementation("org.yaml:snakeyaml:1.28")
implementation("org.jetbrains.kotlin:kotlin-reflect:2.3.0")
implementation("org.yaml:snakeyaml:2.0")
implementation("net.oneandone.reflections8:reflections8:0.11.7")

testImplementation("org.xpathqs:gwt:0.2.5")
Expand Down Expand Up @@ -142,8 +143,9 @@ tasks.test {
}
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"

kotlin {
jvmToolchain(17)
}

tasks.jar {
Expand All @@ -159,8 +161,8 @@ tasks.jar {

tasks.jacocoTestReport {
reports {
xml.isEnabled = false
csv.isEnabled = true
xml.required.set(true)
html.required.set(false)
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 XPATH-QS
# Copyright (c) 2025 XPATH-QS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,6 +22,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
16 changes: 13 additions & 3 deletions src/main/kotlin/org/xpathqs/core/reflection/SelectorParser.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -89,11 +89,11 @@ class SelectorParser(
rootObj.children = srf.innerSelectors

srf.innerSelectorProps.filter {
it.call(rootObj) !is NullSelector
safeEvaluate(it) !is NullSelector
}.forEach { prop ->
prop.isAccessible = true

val sel = prop.call(rootObj) as BaseSelector
val sel = safeEvaluate(prop) as BaseSelector
val ann = prop.findAnnotation<Name>()?.value ?: prop.name
setFields(
to = sel,
Expand Down Expand Up @@ -180,4 +180,14 @@ class SelectorParser(
to.freeze()
}
}

private fun safeEvaluate(prop: KProperty<*>) : Any? {
return runCatching {
prop.call(rootObj)
}.getOrNull() ?: run {
runCatching {
prop.call()
}.getOrNull()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,6 +24,7 @@ package org.xpathqs.core.reflection

import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.collections.shouldHaveSize
import org.xpathqs.core.reflection.pages.PageWithNoScan

class SelectorReflectionFieldsNoScanTest : AnnotationSpec() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,6 +24,10 @@ package org.xpathqs.core.reflection

import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder
import org.xpathqs.core.reflection.pages.PagePrivateMember
import org.xpathqs.core.reflection.pages.PageWithBase
import org.xpathqs.core.reflection.pages.PageWithBaseAndInnerGroupObject
import org.xpathqs.core.reflection.pages.PageWithBaseAndInnerObject
import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.selector.Selector

Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/org/xpathqs/core/reflection/pages/pages.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,7 +20,7 @@
* SOFTWARE.
*/

package org.xpathqs.core.reflection
package org.xpathqs.core.reflection.pages

import org.xpathqs.core.annotations.NoScan
import org.xpathqs.core.selector.base.BaseSelector
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,7 +26,7 @@ package org.xpathqs.core.reflection.parser
import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.shouldBe
import org.xpathqs.core.reflection.PageWithBaseAndInnerGroupObject
import org.xpathqs.core.reflection.pages.PageWithBaseAndInnerGroupObject
import org.xpathqs.core.reflection.SelectorParser
import org.xpathqs.xpathShouldBe

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,7 +26,7 @@ import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.shouldBe
import org.xpathqs.core.reflection.PageWithBaseAndInnerObject
import org.xpathqs.core.reflection.pages.PageWithBaseAndInnerObject
import org.xpathqs.core.reflection.SelectorParser
import org.xpathqs.core.selector.extensions.core.get
import org.xpathqs.xpathShouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,8 +24,8 @@ package org.xpathqs.core.reflection.parser

import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.AnnotationSpec
import org.xpathqs.core.reflection.PageWithBlockArgMembers
import org.xpathqs.core.reflection.PageWithBlockMembers
import org.xpathqs.core.reflection.pages.PageWithBlockArgMembers
import org.xpathqs.core.reflection.pages.PageWithBlockMembers
import org.xpathqs.core.reflection.SelectorParser
import org.xpathqs.core.selector.extensions.core.get
import org.xpathqs.nameShouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,7 +25,7 @@ package org.xpathqs.core.reflection.parser
import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.shouldNotBe
import org.xpathqs.core.reflection.PageWithBlockMembers
import org.xpathqs.core.reflection.pages.PageWithBlockMembers
import org.xpathqs.core.reflection.SelectorParser
import org.xpathqs.core.selector.extensions.core.get
import org.xpathqs.nameShouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,6 +26,7 @@ import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.collections.shouldHaveSize
import org.xpathqs.core.reflection.*
import org.xpathqs.core.reflection.pages.PageWithInnerObjectClassArg
import org.xpathqs.core.selector.extensions.core.get
import org.xpathqs.nameShouldBe
import org.xpathqs.xpathShouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,7 +25,7 @@ package org.xpathqs.core.reflection.parser
import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldBeEmpty
import org.xpathqs.core.reflection.PageWithNoScan
import org.xpathqs.core.reflection.pages.PageWithNoScan
import org.xpathqs.core.reflection.SelectorParser
import org.xpathqs.xpathShouldBe

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,7 +23,7 @@
package org.xpathqs.core.reflection.parser

import io.kotest.core.spec.style.AnnotationSpec
import org.xpathqs.core.reflection.PageWithInhGroup
import org.xpathqs.core.reflection.pages.PageWithInhGroup
import org.xpathqs.core.reflection.SelectorParser
import org.xpathqs.xpathShouldBe

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,7 +23,7 @@
package org.xpathqs.core.reflection.parser

import io.kotest.core.spec.style.AnnotationSpec
import org.xpathqs.core.reflection.PageNoBase
import org.xpathqs.core.reflection.pages.PageNoBase
import org.xpathqs.core.reflection.SelectorParser
import org.xpathqs.xpathShouldBe

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,7 +24,7 @@ package org.xpathqs.core.selector.block

import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.types.shouldNotBeSameInstanceAs
import org.xpathqs.core.reflection.SomeHolder
import org.xpathqs.core.reflection.pages.SomeHolder
import org.xpathqs.core.reflection.parse
import org.xpathqs.core.selector.base.BaseSelector
import org.xpathqs.core.selector.extensions.core.get
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 XPATH-QS
* Copyright (c) 2025 XPATH-QS
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -28,7 +28,7 @@ import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.shouldBe
import io.kotest.matchers.types.shouldBeSameInstanceAs
import io.kotest.matchers.types.shouldNotBeSameInstanceAs
import org.xpathqs.core.reflection.PageWithGroupBase
import org.xpathqs.core.reflection.pages.PageWithGroupBase
import org.xpathqs.core.reflection.SelectorParser
import org.xpathqs.core.selector.block.deepClone

Expand Down
Loading