Skip to content

Commit

Permalink
build(deps): new 2p-kt version
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilbocc committed Sep 17, 2024
1 parent 5476bd8 commit 4f9ee1e
Show file tree
Hide file tree
Showing 17 changed files with 3,278 additions and 230 deletions.
22 changes: 11 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ cache:
## needs:
## - job: Sign Artefacts

pages:
script:
- mkdir public
- $GCMD $BEFORE_TASK $PAGES_TASK $AFTER_TASK $GOPTS
- cp -r doc/build/docs/orchid/* public
artifacts:
paths:
- public
# allow_failure: true
only:
- /^(master)|(release)|(documentation)$/
#pages:
# script:
# - mkdir public
# - $GCMD $BEFORE_TASK $PAGES_TASK $AFTER_TASK $GOPTS
# - cp -r doc/build/docs/orchid/* public
# artifacts:
# paths:
# - public
# # allow_failure: true
# only:
# - /^(master)|(release)|(documentation)$/
14 changes: 7 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import io.github.gciatto.kt.mpp.Plugins
import io.github.gciatto.kt.mpp.ProjectType
import io.github.gciatto.kt.mpp.log
import io.github.gciatto.kt.mpp.nodeVersion
import io.github.gciatto.kt.mpp.helpers.ProjectType
import io.github.gciatto.kt.mpp.utils.log
// import io.github.gciatto.kt.mpp.nodeVersion

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
Expand Down Expand Up @@ -71,10 +71,10 @@ kotlin {
}
}

project.findProperty("nodeVersion")?.toString()?.takeIf { it.isNotBlank() }?.let {
nodeVersion(it)
log("override NodeJS version: $it", LogLevel.LIFECYCLE)
}
//project.findProperty("nodeVersion")?.toString()?.takeIf { it.isNotBlank() }?.let {
// nodeVersion(it)
// log("override NodeJS version: $it", LogLevel.LIFECYCLE)
//}

afterEvaluate {
subprojects {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package it.unibo.tuprolog.argumentation.core.dsl

import it.unibo.tuprolog.dsl.theory.LogicProgrammingScopeWithTheories
import it.unibo.tuprolog.dsl.solve.LogicProgrammingScope
import it.unibo.tuprolog.solve.Solver

interface PrologWithArgumentation : LogicProgrammingScopeWithTheories {
interface PrologWithArgumentation : LogicProgrammingScope {
infix fun Any.call(other: Any) = structOf("::", this.toTerm(), other.toTerm())
}

internal class PrologWithArgumentationImpl :
PrologWithArgumentation, LogicProgrammingScopeWithTheories by LogicProgrammingScopeWithTheories.of()
PrologWithArgumentation, LogicProgrammingScope by LogicProgrammingScope.of(Solver.prolog)


fun <R> arg2pScope(function: PrologWithArgumentation.() -> R): R = PrologWithArgumentationImpl().function()
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Context : ArgLibrary, ArgContext {

override fun solve(request: Solve.Request<ExecutionContext>): Sequence<Solve.Response> {
val term: Term = request.arguments[0]
arg2pScope { this@Context.dynamicSolver[this@Context.selectedSolver]!!.solve("retractall"(term)) }.first()
arg2pScope { this@Context.dynamicSolver[this@Context.selectedSolver]!!.solve(("retractall"(term))) }.first()
return sequenceOf(request.replyWith(true))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import it.unibo.tuprolog.core.operators.OperatorSet
import it.unibo.tuprolog.core.operators.Specifier
import it.unibo.tuprolog.core.parsing.parse
import it.unibo.tuprolog.core.toTerm
import it.unibo.tuprolog.dsl.theory.LogicProgrammingScopeWithTheories
import it.unibo.tuprolog.dsl.theory.logicProgramming
import it.unibo.tuprolog.dsl.solve.LogicProgrammingScope
import it.unibo.tuprolog.dsl.solve.prolog
import it.unibo.tuprolog.solve.ExecutionContext
import it.unibo.tuprolog.solve.library.Library
import it.unibo.tuprolog.solve.primitive.BinaryRelation
Expand Down Expand Up @@ -83,7 +83,7 @@ object PrologStrictCompatibility : ArgsFlag<Boolean, Unit> {

object ConversionUtils {
fun modifiers(target: Clause, context: Solve.Request<ExecutionContext>): Term =
logicProgramming {
prolog {
target.bodyItems.map { term ->
if (term.isStruct && term.asStruct()?.functor == "\\+") {
"~"(term.asStruct()!!.args[0])
Expand All @@ -99,17 +99,17 @@ object ConversionUtils {
context: Solve.Request<ExecutionContext>,
first: Term,
force: Boolean = false,
mapper: (Iterable<Clause>, LogicProgrammingScopeWithTheories) -> Term
mapper: (Iterable<Clause>, LogicProgrammingScope) -> Term
): Sequence<Substitution> {
context.ensuringArgumentIsVariable(0)
return logicProgramming {
return prolog {
sequenceOf(
Substitution.of(
first.castToVar(),
if (force || context.solve(Struct.parse("prologStrictCompatibility")).first().isYes) {
mapper(context.context.staticKb.clauses, this)
} else {
emptyList
emptyLogicList
}
)
)
Expand All @@ -122,7 +122,7 @@ object StrictRules : UnaryPredicate.WithoutSideEffects<ExecutionContext>("prolog
ConversionUtils.commonMap(this, first) { clauses, prologScope ->
clauses.filter { !it.isFact }
.map {
prologScope.listOf(
prologScope.logicListOf(
"rule_${Random.nextInt(0, Int.MAX_VALUE)}",
ConversionUtils.modifiers(it, this@computeAllSubstitutions),
it.head!!
Expand All @@ -137,7 +137,7 @@ object Axioms : UnaryPredicate.WithoutSideEffects<ExecutionContext>("prologAxiom
clauses
.filter { it.isFact && !listOf(":->", "->", "=>", ":=>", ":", ":=", ",").contains(it.head!!.functor) }
.map {
prologScope.listOf(
prologScope.logicListOf(
"rule_${Random.nextInt(0, Int.MAX_VALUE)}",
it.head!!
)
Expand All @@ -151,7 +151,7 @@ object Premises : UnaryPredicate.WithoutSideEffects<ExecutionContext>("prologPre
clauses
.filter { it.isFact && it.head!!.functor == ":=" && it.head!!.arity == 1 }
.map {
prologScope.listOf(
prologScope.logicListOf(
"rule_${Random.nextInt(0, Int.MAX_VALUE)}",
it.head!!.args[0]
)
Expand Down Expand Up @@ -183,7 +183,7 @@ object DefeasibleRules : UnaryPredicate.WithoutSideEffects<ExecutionContext>("pr
} else {
prologScope.clauseOf(clause.head!!.args[0].asStruct(), clause.head!!.args[1])
}.let {
prologScope.listOf(
prologScope.logicListOf(
"rule_${Random.nextInt(0, Int.MAX_VALUE)}",
ConversionUtils.modifiers(it, this@computeAllSubstitutions),
it.head!!
Expand All @@ -199,7 +199,7 @@ object Bps : UnaryPredicate.WithoutSideEffects<ExecutionContext>("bpsNew") {
clauses
.filter { it.isFact && it.head?.functor == "bp" }
.map {
Struct.of("abstractBp", prologScope.listOf(it.head!!.args))
Struct.of("abstractBp", prologScope.logicListOf(it.head!!.args))
}.toTerm()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class SpeedTest {
current_flag(LastCallOptimization.name, V)

assertSolutionEquals(
ktListOf(query.yes(V to LastCallOptimization.OFF)),
listOf(query.yes(V to LastCallOptimization.OFF)),
solver.solve(query).toList()
)

Expand Down Expand Up @@ -160,7 +160,7 @@ class SpeedTest {
val query = current_flag(LastCallOptimization.name, V)

assertSolutionEquals(
ktListOf(query.yes(V to LastCallOptimization.ON)),
listOf(query.yes(V to LastCallOptimization.ON)),
solver.solve(query).toList()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ class EngineInterfaceTest {
testGoalNoBacktracking("answerQuery"("a", "Y", "O", "U"), solverWithTheory()) {
it.yes(
"Y" to listOf("a"),
"O" to emptyList,
"U" to emptyList
"O" to emptyLogicList,
"U" to emptyLogicList
)
}

testGoalNoBacktracking("answerQuery"("c", "Y", "O", "U"), solverWithTheory()) {
it.yes(
"Y" to emptyList,
"O" to emptyList,
"Y" to emptyLogicList,
"O" to emptyLogicList,
"U" to listOf("c")
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UtilsTest {
fun sort() {
arg2pScope {
testGoal("utils" call "sort"(listOf("b", "a", "c", "d"), "X")) {
ktListOf(
listOf(
it.yes("X" to listOf("d", "c", "b", "a")),
it.no()
)
Expand All @@ -25,7 +25,7 @@ class UtilsTest {
fun subtractList() {
arg2pScope {
testGoal("utils" call "subtract"(listOf("b", "a", "c", "d", "a"), listOf("b", "a"), "X")) {
ktListOf(
listOf(
it.yes("X" to listOf("c", "d"))
)
}
Expand All @@ -35,12 +35,12 @@ class UtilsTest {
@Test
fun isEmptyList() {
arg2pScope {
testGoal("utils" call "isEmptyList"(emptyList)) {
ktListOf(it.yes())
testGoal("utils" call "isEmptyList"(emptyLogicList)) {
listOf(it.yes())
}

testGoal("utils" call "isEmptyList"(listOf("a"))) {
ktListOf(it.no())
listOf(it.no())
}
}
}
Expand All @@ -49,13 +49,13 @@ class UtilsTest {
fun appendaList() {
arg2pScope {
testGoal("utils" call "appendLists"(listOf(listOf("a", "b"), listOf("c", "d"), listOf("e", "f")), "X")) {
ktListOf(
listOf(
it.yes("X" to listOf("a", "b", "c", "d", "e", "f"))
)
}

testGoal("utils" call "appendLists"(listOf(listOf("a", "b")), "X")) {
ktListOf(
listOf(
it.yes("X" to listOf("a", "b"))
)
}
Expand All @@ -67,7 +67,7 @@ class UtilsTest {
arg2pScope {
val solver = solver(
Theory.Companion.of(
ktListOf(
listOf(
fact { "a"(1) },
fact { "a"(1, 2) },
fact { "a"(1, 2, 3) },
Expand All @@ -77,7 +77,7 @@ class UtilsTest {
)

testGoal("utils" call "search"("a", 4, "X"), solver) {
ktListOf(
listOf(
it.yes("X" to "a"(1)),
it.yes("X" to "a"(1, 2)),
it.yes("X" to "a"(1, 2, 3)),
Expand All @@ -86,14 +86,14 @@ class UtilsTest {
}

testGoal("utils" call "search"("a", 2, "X"), solver) {
ktListOf(
listOf(
it.yes("X" to "a"(1)),
it.yes("X" to "a"(1, 2))
)
}

testGoal("utils" call "search"("b", 2, "X"), solver) {
ktListOf(it.no())
listOf(it.no())
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions doc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ plugins {
}

dependencies {
orchidRuntimeOnly("io.github.javaeden.orchid:OrchidDocs:$orchidVersion")
orchidRuntimeOnly("io.github.javaeden.orchid:OrchidEditorial:$orchidVersion")
// orchidRuntimeOnly("io.github.javaeden.orchid:OrchidDocs:$orchidVersion")
// orchidRuntimeOnly("io.github.javaeden.orchid:OrchidEditorial:$orchidVersion")
}

@Suppress("Deprecation")
repositories {
mavenCentral()
maven("https://jitpack.io")
jcenter()
maven("https://kotlin.bintray.com/kotlinx")
}

orchid {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kotlin.code.style=official
kotlin.mpp.stability.nowarn=true
kotlin.js.compiler=ir

ktCompilerArgs=
ktCompilerArgs=-opt-in=kotlin.RequiresOptIn;-Xexpect-actual-classes
ktCompilerArgsJs=
ktCompilerArgsJvm=-Xjvm-default=all
allWarningsAsErrors=false
Expand Down
33 changes: 20 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[versions]
kotlin = "1.8.21"
kotlin = "1.9.24"
jvm = "11"
node = "18-latest"
ktMpp = "2.2.1"
semVer = "1.1.10"
shadowVer = "8.1.1"
ktMpp = "4.1.4"
semVer = "3.1.7"
#shadowVer = "8.1.1"
javaFxVer = "0.0.14"

javaFx = "19.0.2.1"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
Expand All @@ -20,26 +20,33 @@ ktMpp-versions = { id = "io.github.gciatto.kt-mpp.versions", version.ref = "ktMp
ktMpp-jsOnly = { id = "io.github.gciatto.kt-mpp.js-only", version.ref = "ktMpp" }
ktMpp-jvmOnly = { id = "io.github.gciatto.kt-mpp.jvm-only", version.ref = "ktMpp" }
ktMpp-multiplatform = { id = "io.github.gciatto.kt-mpp.multiplatform", version.ref = "ktMpp" }
ktMpp-fatJar = { id = "io.github.gciatto.kt-mpp.fat-jar", version.ref = "ktMpp" }
gitSemVer = { id = "org.danilopianini.git-sensitive-semantic-versioning", version.ref = "semVer" }
shadowJar = { id = "com.github.johnrengelman.shadow", version.ref = "shadowVer" }
javaFx = { id = "org.openjfx.javafxplugin", version.ref = "javaFxVer" }
#shadowJar = { id = "com.github.johnrengelman.shadow", version.ref = "shadowVer" }
#javaFx = { id = "org.openjfx.javafxplugin", version.ref = "javaFxVer" }


[libraries]
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
ktNpmPublish = "io.github.gciatto:kt-npm-publish:0.3.9"
javaFxLib = "org.openjfx:javafx-graphics:21-ea+24"
#javaFxLib = "org.openjfx:javafx-graphics:21-ea+24"
javafx-base = { module = "org.openjfx:javafx-base", version.ref = "javaFx" }
javafx-fxml = { module = "org.openjfx:javafx-fxml", version.ref = "javaFx" }
javafx-controls = { module = "org.openjfx:javafx-controls", version.ref = "javaFx" }
javafx-graphics = { module = "org.openjfx:javafx-graphics", version.ref = "javaFx" }
richtextFx = "org.fxmisc.richtext:richtextfx:0.11.2"
logback-classic = "ch.qos.logback:logback-classic:1.4.9"
logback-core = "ch.qos.logback:logback-core:1.4.9"
jung-api = "net.sf.jung:jung-api:2.1.1"
jung-visualization = "net.sf.jung:jung-visualization:2.1.1"
jung-graphimpl = "net.sf.jung:jung-graph-impl:2.1.1"
jung-algorithms = "net.sf.jung:jung-algorithms:2.1.1"
jung-io = "net.sf.jung:jung-io:2.1.1"
tuprolog-ide = "it.unibo.tuprolog:ide:0.31.11"
tuprolog-dsl-solve = "it.unibo.tuprolog:dsl-solve:0.31.11"
tuprolog-solve-classic = "it.unibo.tuprolog:solve-classic:0.31.11"
tuprolog-parser-theory = "it.unibo.tuprolog:parser-theory:0.31.11"
tuprolog-test-solve = "it.unibo.tuprolog:test-solve:0.31.11"
tuprolog-ide = "it.unibo.tuprolog:ide:1.0.4"
tuprolog-dsl-solve = "it.unibo.tuprolog:dsl-solve:1.0.4"
tuprolog-solve-classic = "it.unibo.tuprolog:solve-classic:1.0.4"
tuprolog-parser-theory = "it.unibo.tuprolog:parser-theory:1.0.4"
tuprolog-test-solve = "it.unibo.tuprolog:test-solve:1.0.4"
akka-bom = "com.typesafe.akka:akka-bom_2.13:2.8.3"
akka-actor-typed = "com.typesafe.akka:akka-actor-typed_2.13:2.8.3"
akka-cluster-sharding-typed = "com.typesafe.akka:akka-cluster-sharding-typed_2.13:2.8.3"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 4f9ee1e

Please sign in to comment.