Skip to content

Commit

Permalink
Squash type inference
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Chukharev committed Dec 26, 2024
1 parent 1bd6291 commit 04fb56f
Show file tree
Hide file tree
Showing 106 changed files with 50,651 additions and 240 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ buildSrc/.gradle
# Ignore Python execution cache
__pycache__/
run_python_with_gdb.sh

# Ignore Kotlin build directory
.kotlin/
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
plugins {
id(Plugins.Shadow)
id("usvm.kotlin-conventions")
}
3 changes: 1 addition & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ repositories {
maven("https://jitpack.io")
}


dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion")
implementation("org.glavo:gjavah:$gjavahVersion")
}
}
1 change: 0 additions & 1 deletion buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
rootProject.name="usvm-conventions"

38 changes: 23 additions & 15 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import org.gradle.plugin.use.PluginDependenciesSpec

object Versions {
const val detekt = "1.18.1"
const val clikt = "5.0.0"
const val detekt = "1.23.7"
const val ini4j = "0.5.4"
const val jacodb = "6539d5020c"
const val jacodb = "7df406e5e7"
const val juliet = "1.3.2"
const val junit = "5.9.3"
const val kotlin = "2.1.0"
Expand All @@ -18,7 +19,7 @@ object Versions {
const val mockk = "1.13.4"
const val rd = "2023.2.0"
const val sarif4k = "0.5.0"
const val shadow = "8.1.1"
const val shadow = "8.3.3"
const val slf4j = "1.6.1"

// versions for jvm samples
Expand Down Expand Up @@ -121,6 +122,11 @@ object Libs {
name = "jacodb-core",
version = Versions.jacodb
)
val jacodb_api_common = dep(
group = jacodbPackage,
name = "jacodb-api-common",
version = Versions.jacodb
)
val jacodb_api_jvm = dep(
group = jacodbPackage,
name = "jacodb-api-jvm",
Expand All @@ -136,16 +142,6 @@ object Libs {
name = "jacodb-storage",
version = Versions.jacodb
)
val jacodb_ets = dep(
group = jacodbPackage,
name = "jacodb-ets",
version = Versions.jacodb
)
val jacodb_api_common = dep(
group = jacodbPackage,
name = "jacodb-api-common",
version = Versions.jacodb
)
val jacodb_approximations = dep(
group = jacodbPackage,
name = "jacodb-approximations",
Expand All @@ -156,6 +152,11 @@ object Libs {
name = "jacodb-taint-configuration",
version = Versions.jacodb
)
val jacodb_ets = dep(
group = jacodbPackage,
name = "jacodb-ets",
version = Versions.jacodb
)

// https://github.com/Kotlin/kotlinx.coroutines
val kotlinx_coroutines_core = dep(
Expand Down Expand Up @@ -240,6 +241,13 @@ object Libs {
name = "PythonTypesAPI",
version = Versions.pythonTypesAPI
)

// https://github.com/ajalt/clikt
val clikt = dep(
group = "com.github.ajalt.clikt",
name = "clikt",
version = Versions.clikt
)
}

object Plugins {
Expand All @@ -258,9 +266,9 @@ object Plugins {
version = Versions.rd
)

// https://github.com/johnrengelman/shadow
// https://github.com/GradleUp/shadow
object Shadow : ProjectPlugin(
id = "com.github.johnrengelman.shadow",
id = "com.gradleup.shadow",
version = Versions.shadow
)
}
Expand Down
7 changes: 3 additions & 4 deletions buildSrc/src/main/kotlin/DetektConfiguration.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import gradle.kotlin.dsl.accessors._466a692754d3da37fc853e1c7ad8ae1e.detekt
import gradle.kotlin.dsl.accessors._466a692754d3da37fc853e1c7ad8ae1e.detektPlugins
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import io.gitlab.arturbosch.detekt.report.ReportMergeTask
import org.gradle.api.Project
import org.gradle.api.tasks.TaskProvider
Expand All @@ -11,7 +10,7 @@ import org.gradle.kotlin.dsl.withType

fun Project.configureDetekt() {
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:${detekt.toolVersion}")
"detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:${Versions.detekt}")
}

val includes = listOf(
Expand All @@ -36,7 +35,7 @@ fun Project.configureDetekt() {
val configFile = rootDir.resolve("detekt").resolve("config.yml")
val reportFile = rootProject.layout.buildDirectory.file("reports/detekt/detekt.sarif")

detekt {
extensions.configure<DetektExtension>("detekt") {
buildUponDefaultConfig = true
ignoreFailures = true
parallel = true
Expand Down
12 changes: 6 additions & 6 deletions buildSrc/src/main/kotlin/usvmpython/tasks/JNIHeaderTask.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package usvmpython.tasks

import gradle.kotlin.dsl.accessors._466a692754d3da37fc853e1c7ad8ae1e.main
import gradle.kotlin.dsl.accessors._466a692754d3da37fc853e1c7ad8ae1e.sourceSets
import org.glavo.javah.JavahTask
import org.gradle.api.Project
import usvmpython.getGeneratedHeadersPath
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.kotlin.dsl.get
import usvmpython.CPYTHON_ADAPTER_CLASS

import usvmpython.getGeneratedHeadersPath

fun Project.generateJNIForCPythonAdapterTask() {
val task = JavahTask()
task.outputDir = getGeneratedHeadersPath().toPath()
val classpath = sourceSets.main.get().runtimeClasspath
val sourceSets = extensions.getByName("sourceSets") as SourceSetContainer
val classpath = sourceSets["main"].runtimeClasspath
classpath.files.forEach {
task.addClassPath(it.toPath())
}
task.addClass(CPYTHON_ADAPTER_CLASS)
task.run()
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package usvmpython.tasks

import gradle.kotlin.dsl.accessors._466a692754d3da37fc853e1c7ad8ae1e.sourceSets
import gradle.kotlin.dsl.accessors._466a692754d3da37fc853e1c7ad8ae1e.test
import org.gradle.api.Project
import org.gradle.api.tasks.Exec
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.environment
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.register
import usvmpython.*
import java.io.File
Expand Down Expand Up @@ -45,10 +45,11 @@ fun Project.registerBuildSamplesTask(): TaskProvider<JavaExec> {
dependsOn(installMypyRunner)
inputs.files(fileTree(samplesSourceDir).exclude("**/__pycache__/**"))
outputs.dir(samplesBuildDir)
classpath = sourceSets.test.get().runtimeClasspath
val sourceSets = extensions.getByName("sourceSets") as SourceSetContainer
classpath = sourceSets["test"].runtimeClasspath
args = listOf(samplesSourceDir.canonicalPath, samplesBuildDir.canonicalPath, pythonBinaryPath)
environment("LD_LIBRARY_PATH" to "$cpythonBuildPath/lib:$cpythonAdapterBuildPath")
environment("PYTHONHOME" to cpythonBuildPath)
mainClass.set(BUILD_SAMPLES_ENTRY_POINT)
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
21 changes: 21 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ include("usvm-jvm-instrumentation")
include("usvm-sample-language")
include("usvm-dataflow")
include("usvm-jvm-dataflow")
include("usvm-dataflow-ts")

include("usvm-python")
include("usvm-python:cpythonadapter")
Expand All @@ -21,6 +22,11 @@ findProject(":usvm-python:usvm-python-runner")?.name = "usvm-python-runner"
include("usvm-python:usvm-python-commons")
findProject(":usvm-python:usvm-python-commons")?.name = "usvm-python-commons"

// Actually, `includeBuild("../jacodb")` is enough, but there is a bug in IDEA when path is a symlink.
// As a workaround, we convert it to a real absolute path.
// See IDEA bug: https://youtrack.jetbrains.com/issue/IDEA-329756
// includeBuild(file("../jacodb").toPath().toRealPath().toAbsolutePath())

pluginManagement {
resolutionStrategy {
eachPlugin {
Expand All @@ -30,3 +36,18 @@ pluginManagement {
}
}
}

plugins {
id("com.gradle.develocity") version ("3.18.2")
}

develocity {
buildScan {
// Accept the term of use for the build scan plugin:
termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use")
termsOfUseAgree.set("yes")

// Publish build scans on-demand, when `--scan` option is provided:
publishing.onlyIf { false }
}
}
1 change: 1 addition & 0 deletions usvm-dataflow-ts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
logs/
Loading

0 comments on commit 04fb56f

Please sign in to comment.