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

Get rid of Symbols synchronization on Usages, Builders feaures #190

Merged
merged 3 commits into from
Oct 10, 2023
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
13 changes: 10 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ val semVer: String? by project
val includeDokka: String? by project

group = "org.jacodb"
version = semVer ?: "1.3-SNAPSHOT"
version = semVer ?: "1.4-SNAPSHOT"

plugins {
kotlin("jvm") version Versions.kotlin
kotlin("plugin.allopen") version Versions.kotlin
kotlin("plugin.serialization") version Versions.kotlin apply false
with(Plugins.Dokka) { id(id) version (version) }
with(Plugins.Licenser) { id(id) version (version) }
id(Plugins.Dokka)
id(Plugins.Licenser)
`java-library`
`java-test-fixtures`
`maven-publish`
Expand Down Expand Up @@ -96,6 +96,13 @@ allprojects {
setup(jacocoTestReport)
}

jar {
manifest {
attributes["Implementation-Title"] = project.name
attributes["Implementation-Version"] = archiveVersion
}
}

val lifecycleTest by creating(Test::class) {
useJUnitPlatform {
includeTags(Tests.lifecycleTag)
Expand Down
68 changes: 35 additions & 33 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
@file:Suppress("PublicApiImplicitType", "MemberVisibilityCanBePrivate", "unused", "ConstPropertyName")

import org.gradle.plugin.use.PluginDependenciesSpec


object Versions {
const val asm = "9.5"
const val dokka = "1.7.20"
const val gradle_download = "5.3.0"
const val gradle_versions = "0.47.0"
const val guava = "31.1-jre"
const val hikaricp = "5.0.1"
const val guava = "31.1-jre"
const val javax_activation = "1.1"
const val javax_mail = "1.4.7"
const val javax_servlet_api = "2.5"
Expand All @@ -27,7 +30,6 @@ object Versions {
const val kotlinx_serialization = "1.4.1"
const val licenser = "0.6.1"
const val mockito = "4.8.0"
const val postgresql = "42.5.1"
const val shadow = "8.1.1"
const val slf4j = "1.7.36"
const val soot_utbot_fork = "4.4.0-FORK-2"
Expand Down Expand Up @@ -157,13 +159,6 @@ object Libs {
version = Versions.kotlinx_cli
)

// https://github.com/pgjdbc/pgjdbc
val postgresql = dep(
group = "org.postgresql",
name = "postgresql",
version = Versions.postgresql
)

// https://github.com/brettwooldridge/HikariCP
val hikaricp = dep(
group = "com.zaxxer",
Expand Down Expand Up @@ -283,39 +278,46 @@ object Libs {
}

object Plugins {

abstract class ProjectPlugin(val version: String, val id: String)

// https://github.com/Kotlin/dokka
object Dokka {
const val version = Versions.dokka
const val id = "org.jetbrains.dokka"
}
object Dokka: ProjectPlugin(
version = Versions.dokka,
id = "org.jetbrains.dokka"
)

// https://github.com/michel-kraemer/gradle-download-task
object GradleDownload {
const val version = Versions.gradle_download
const val id = "de.undercouch.download"
}
object GradleDownload: ProjectPlugin(
version = Versions.gradle_download,
id = "de.undercouch.download"
)

// https://github.com/ben-manes/gradle-versions-plugin
object GradleVersions {
const val version = Versions.gradle_versions
const val id = "com.github.ben-manes.versions"
}
object GradleVersions: ProjectPlugin(
version = Versions.gradle_versions,
id = "com.github.ben-manes.versions"
)

// https://github.com/Kotlin/kotlinx-benchmark
object KotlinxBenchmark {
const val version = Versions.kotlinx_benchmark
const val id = "org.jetbrains.kotlinx.benchmark"
}
object KotlinxBenchmark : ProjectPlugin(
version = Versions.kotlinx_benchmark,
id = "org.jetbrains.kotlinx.benchmark"
)

// https://github.com/CadixDev/licenser
object Licenser {
const val version = Versions.licenser
const val id = "org.cadixdev.licenser"
}
object Licenser : ProjectPlugin(
version = Versions.licenser,
id = "org.cadixdev.licenser"
)

// https://github.com/johnrengelman/shadow
object Shadow {
const val version = Versions.shadow
const val id = "com.github.johnrengelman.shadow"
}
object Shadow : ProjectPlugin(
version = Versions.shadow,
id = "com.github.johnrengelman.shadow"
)
}

fun PluginDependenciesSpec.id(plugin: Plugins.ProjectPlugin) {
id(plugin.id).version(plugin.version)
}
2 changes: 0 additions & 2 deletions jacodb-api/src/main/kotlin/org/jacodb/api/Api.kt
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ interface JcDatabasePersistence : Closeable {
fun findClassSources(cp: JcClasspath, fullName: String): List<ClassSource>

fun createIndexes() {}

fun getScript(name: String): String
}

interface RegisteredLocation {
Expand Down
4 changes: 2 additions & 2 deletions jacodb-benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import kotlinx.benchmark.gradle.JvmBenchmarkTarget

plugins {
`java-test-fixtures`
with(Plugins.GradleDownload) { id(id) version (version) }
with(Plugins.KotlinxBenchmark) { id(id) version (version) }
id(Plugins.GradleDownload)
id(Plugins.KotlinxBenchmark)
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ fun main() {
runBlocking {
val db = jacodb {
loadByteCode(allClasspath)
persistent(
"d:\\work\\jacodb\\jacodb-classpath.db",
)
// persistent(
// "d:\\work\\jacodb\\jacodb-classpath.db",
// )
installFeatures(InMemoryHierarchy, Usages, Builders)
}.also {
println("AWAITING db took ${System.currentTimeMillis() - start}ms")
Expand Down
39 changes: 20 additions & 19 deletions jacodb-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import org.jooq.codegen.GenerationTool
import org.jooq.meta.jaxb.*
import org.jooq.meta.jaxb.Configuration
import org.jooq.meta.jaxb.Database
import org.jooq.meta.jaxb.Generate
import org.jooq.meta.jaxb.Generator
import org.jooq.meta.jaxb.Jdbc
import org.jooq.meta.jaxb.Target
import java.nio.file.Paths

Expand All @@ -18,7 +15,7 @@ buildscript {
classpath(Libs.jooq_kotlin)
// classpath(Libs.postgresql)
// classpath(Libs.hikaricp)
// classpath(Libs.sqlite)
classpath(Libs.sqlite)
}
}

Expand All @@ -38,15 +35,13 @@ dependencies {
implementation(Libs.kotlinx_serialization_cbor)
implementation(Libs.jdot)
implementation(Libs.guava)
implementation(Libs.postgresql)
implementation(Libs.hikaricp)
implementation(Libs.sqlite)

testImplementation(Libs.javax_activation)
testImplementation(Libs.javax_mail)
testImplementation(Libs.joda_time)
testImplementation(Libs.slf4j_simple)
// testImplementation(files("src/test/resources/samples"))
testImplementation(Libs.hikaricp)

testFixturesImplementation(project(":jacodb-api"))
testFixturesImplementation(kotlin("reflect"))
Expand All @@ -58,10 +53,10 @@ dependencies {
testFixturesImplementation(Libs.kotlinx_coroutines_core)
}

tasks.register("generateSqlScheme") {
val databaseLocation = project.properties["database_location"]
if (databaseLocation != null) {
val url = "jdbc:sqlite:file:$databaseLocation"
tasks {
register("generateSqlScheme") {
val location = "src/main/resources/sqlite/empty.db"
val url = "jdbc:sqlite:file:$location"
val driver = "org.sqlite.JDBC"
GenerationTool.generate(
Configuration()
Expand All @@ -86,12 +81,18 @@ tasks.register("generateSqlScheme") {
)
)
}
}

tasks.register<JavaExec>("generateDocSvgs") {
dependsOn("testClasses")
mainClass.set("org.utbot.jcdb.impl.cfg.IRSvgGeneratorKt")
classpath = sourceSets.test.get().runtimeClasspath
val svgDocs = Paths.get(rootDir.absolutePath, "docs", "svg").toFile()
args = listOf(svgDocs.absolutePath)
register<JavaExec>("generateDocSvgs") {
dependsOn("testClasses")
mainClass.set("org.utbot.jcdb.impl.cfg.IRSvgGeneratorKt")
classpath = sourceSets.test.get().runtimeClasspath
val svgDocs = Paths.get(rootDir.absolutePath, "docs", "svg").toFile()
args = listOf(svgDocs.absolutePath)
}

processResources {
filesMatching("**/*.properties") {
expand("version" to project.version)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,10 @@
package org.jacodb.impl.storage.jooq


import kotlin.collections.List

import org.jacodb.impl.storage.jooq.tables.*
import org.jooq.Catalog
import org.jooq.Table
import org.jooq.impl.SchemaImpl
import org.jacodb.impl.storage.jooq.tables.Annotations
import org.jacodb.impl.storage.jooq.tables.Annotationvalues
import org.jacodb.impl.storage.jooq.tables.Builders
import org.jacodb.impl.storage.jooq.tables.Bytecodelocations
import org.jacodb.impl.storage.jooq.tables.Calls
import org.jacodb.impl.storage.jooq.tables.Classes
import org.jacodb.impl.storage.jooq.tables.Classhierarchies
import org.jacodb.impl.storage.jooq.tables.Classinnerclasses
import org.jacodb.impl.storage.jooq.tables.Fields
import org.jacodb.impl.storage.jooq.tables.Methodparameters
import org.jacodb.impl.storage.jooq.tables.Methods
import org.jacodb.impl.storage.jooq.tables.Outerclasses
import org.jacodb.impl.storage.jooq.tables.Symbols


/**
Expand All @@ -63,6 +49,11 @@ open class DefaultSchema : SchemaImpl("", DefaultCatalog.DEFAULT_CATALOG) {
*/
val ANNOTATIONVALUES get() = Annotationvalues.ANNOTATIONVALUES

/**
* The table <code>ApplicationMetadata</code>.
*/
val APPLICATIONMETADATA get() = Applicationmetadata.APPLICATIONMETADATA

/**
* The table <code>Builders</code>.
*/
Expand Down Expand Up @@ -113,6 +104,11 @@ open class DefaultSchema : SchemaImpl("", DefaultCatalog.DEFAULT_CATALOG) {
*/
val OUTERCLASSES get() = Outerclasses.OUTERCLASSES

/**
* The table <code>Refactorings</code>.
*/
val REFACTORINGS get() = Refactorings.REFACTORINGS

/**
* The table <code>Symbols</code>.
*/
Expand All @@ -123,6 +119,7 @@ open class DefaultSchema : SchemaImpl("", DefaultCatalog.DEFAULT_CATALOG) {
override fun getTables(): List<Table<*>> = listOf(
Annotations.ANNOTATIONS,
Annotationvalues.ANNOTATIONVALUES,
Applicationmetadata.APPLICATIONMETADATA,
Builders.BUILDERS,
Bytecodelocations.BYTECODELOCATIONS,
Calls.CALLS,
Expand All @@ -133,6 +130,7 @@ open class DefaultSchema : SchemaImpl("", DefaultCatalog.DEFAULT_CATALOG) {
Methodparameters.METHODPARAMETERS,
Methods.METHODS,
Outerclasses.OUTERCLASSES,
Refactorings.REFACTORINGS,
Symbols.SYMBOLS
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,36 @@
package org.jacodb.impl.storage.jooq.indexes


import org.jacodb.impl.storage.jooq.tables.*
import org.jooq.Index
import org.jooq.impl.DSL
import org.jooq.impl.Internal
import org.jacodb.impl.storage.jooq.tables.Builders
import org.jacodb.impl.storage.jooq.tables.Calls



// -------------------------------------------------------------------------
// INDEX definitions
// -------------------------------------------------------------------------

val BUILDERSJOIN: Index = Internal.createIndex(DSL.name("BuildersJoin"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.BUILDER_CLASS_SYMBOL_ID), false)
val BUILDERSSEARCH: Index = Internal.createIndex(DSL.name("BuildersSearch"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.LOCATION_ID, Builders.BUILDERS.CLASS_SYMBOL_ID, Builders.BUILDERS.PRIORITY), false)
val ANNOTATIONS_CLASSID: Index = Internal.createIndex(DSL.name("Annotations_classId"), Annotations.ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.CLASS_ID), false)
val ANNOTATIONS_FIELDID: Index = Internal.createIndex(DSL.name("Annotations_fieldId"), Annotations.ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.FIELD_ID), false)
val ANNOTATIONS_METHODID: Index = Internal.createIndex(DSL.name("Annotations_methodId"), Annotations.ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.METHOD_ID), false)
val ANNOTATIONS_PARAMSID: Index = Internal.createIndex(DSL.name("Annotations_paramsId"), Annotations.ANNOTATIONS, arrayOf(Annotations.ANNOTATIONS.PARAM_ID), false)
val BUILDERSJOIN: Index = Internal.createIndex(DSL.name("BuildersJoin"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.BUILDER_CLASS_NAME), false)
val BUILDERSSEARCH: Index = Internal.createIndex(DSL.name("BuildersSearch"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.LOCATION_ID, Builders.BUILDERS.CLASS_NAME, Builders.BUILDERS.PRIORITY), false)
val BUILDERSSORTING: Index = Internal.createIndex(DSL.name("BuildersSorting"), Builders.BUILDERS, arrayOf(Builders.BUILDERS.PRIORITY), false)
val CALLSSEARCH: Index = Internal.createIndex(DSL.name("CallsSearch"), Calls.CALLS, arrayOf(Calls.CALLS.OPCODE, Calls.CALLS.LOCATION_ID, Calls.CALLS.CALLEE_CLASS_SYMBOL_ID, Calls.CALLS.CALLEE_NAME_SYMBOL_ID, Calls.CALLS.CALLEE_DESC_HASH), false)
val BYTECODELOCATIONS_HASH: Index = Internal.createIndex(DSL.name("Bytecodelocations_hash"), Bytecodelocations.BYTECODELOCATIONS, arrayOf(Bytecodelocations.BYTECODELOCATIONS.UNIQUEID), true)
val CALLSSEARCH: Index = Internal.createIndex(DSL.name("CallsSearch"), Calls.CALLS, arrayOf(Calls.CALLS.OPCODE, Calls.CALLS.LOCATION_ID, Calls.CALLS.CALLEE_CLASS_NAME, Calls.CALLS.CALLEE_NAME, Calls.CALLS.CALLEE_DESC_HASH), false)
val `CLASS HIERARCHIES`: Index = Internal.createIndex(DSL.name("Class Hierarchies"), Classhierarchies.CLASSHIERARCHIES, arrayOf(Classhierarchies.CLASSHIERARCHIES.SUPER_ID), false)
val CLASSES_LOCATION: Index = Internal.createIndex(DSL.name("Classes_location"), Classes.CLASSES, arrayOf(Classes.CLASSES.LOCATION_ID), false)
val CLASSES_NAME: Index = Internal.createIndex(DSL.name("Classes_name"), Classes.CLASSES, arrayOf(Classes.CLASSES.NAME), false)
val CLASSES_OUTERMETHODID: Index = Internal.createIndex(DSL.name("Classes_outerMethodId"), Classes.CLASSES, arrayOf(Classes.CLASSES.OUTER_METHOD), false)
val CLASSHIERARCHIES_CLASSID: Index = Internal.createIndex(DSL.name("ClassHierarchies_classId"), Classhierarchies.CLASSHIERARCHIES, arrayOf(Classhierarchies.CLASSHIERARCHIES.CLASS_ID), false)
val CLASSHIERARCHIES_SUPERID: Index = Internal.createIndex(DSL.name("ClassHierarchies_superId"), Classhierarchies.CLASSHIERARCHIES, arrayOf(Classhierarchies.CLASSHIERARCHIES.SUPER_ID), false)
val CLASSINNERCLASSES_CLASSID: Index = Internal.createIndex(DSL.name("ClassInnerClasses_classId"), Classinnerclasses.CLASSINNERCLASSES, arrayOf(Classinnerclasses.CLASSINNERCLASSES.CLASS_ID), false)
val CLASSINNERCLASSES_INNERCLASSID: Index = Internal.createIndex(DSL.name("ClassInnerClasses_innerClassId"), Classinnerclasses.CLASSINNERCLASSES, arrayOf(Classinnerclasses.CLASSINNERCLASSES.INNER_CLASS_ID), false)
val FIELDS_CLASS_ID_NAME: Index = Internal.createIndex(DSL.name("Fields_class_id_name"), Fields.FIELDS, arrayOf(Fields.FIELDS.CLASS_ID, Fields.FIELDS.NAME), true)
val FIELDS_CLASSID: Index = Internal.createIndex(DSL.name("Fields_classId"), Fields.FIELDS, arrayOf(Fields.FIELDS.CLASS_ID), false)
val METHODPARAMETERS_METHODID: Index = Internal.createIndex(DSL.name("MethodParameters_methodId"), Methodparameters.METHODPARAMETERS, arrayOf(Methodparameters.METHODPARAMETERS.METHOD_ID), false)
val METHODS_CLASS_ID_NAME_DESC: Index = Internal.createIndex(DSL.name("Methods_class_id_name_desc"), Methods.METHODS, arrayOf(Methods.METHODS.CLASS_ID, Methods.METHODS.NAME, Methods.METHODS.DESC), true)
val METHODS_CLASSID: Index = Internal.createIndex(DSL.name("Methods_classId"), Methods.METHODS, arrayOf(Methods.METHODS.CLASS_ID), false)
val SYMBOLS_NAME: Index = Internal.createIndex(DSL.name("Symbols_name"), Symbols.SYMBOLS, arrayOf(Symbols.SYMBOLS.NAME), true)
Loading