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

feat(fs): support for copyFile methods #1066

Merged
merged 1 commit into from
Jul 6, 2024
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
20 changes: 20 additions & 0 deletions packages/engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import elide.internal.conventions.publishing.publish

plugins {
kotlin("jvm")
kotlin("kapt")
kotlin("plugin.serialization")
alias(libs.plugins.micronaut.minimal.library)
alias(libs.plugins.micronaut.graalvm)
Expand Down Expand Up @@ -54,4 +55,23 @@ dependencies {
api(libs.graalvm.polyglot)
implementation(libs.kotlinx.serialization.core)
implementation(libs.kotlinx.serialization.json)

testApi(projects.packages.base)
testApi(projects.packages.graalvm)
testAnnotationProcessor(mn.micronaut.inject.java)
}

val testInternals by configurations.registering {
extendsFrom(configurations.testImplementation.get())
isCanBeConsumed = true
isCanBeResolved = false
}

val testJar by tasks.registering(Jar::class) {
archiveBaseName.set("engine-test")
from(sourceSets.test.get().output)
}

artifacts {
add(testInternals.name, testJar)
}
1 change: 1 addition & 0 deletions packages/engine/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>ForbiddenComment:AbstractLanguageConfig.kt$AbstractLanguageConfig$// @TODO: don't unconditionally mount all members</ID>
<ID>MatchingDeclarationName:GuestTestExecutor.kt$GuestTestExecutorFactory : GuestExecutorProvider</ID>
<ID>ReturnCount:Version.kt$Version$public override operator fun compareTo(other: Version): Int</ID>
<ID>TooGenericExceptionThrown:AbstractLanguagePlugin.kt$AbstractLanguagePlugin$throw Exception("Failed to resolve language resources with key $manifestKey for language $languageId", cause)</ID>
</CurrentIssues>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package elide.runtime.gvm.test

import io.micronaut.context.annotation.Requires
import elide.annotations.Eager
import elide.annotations.Factory
import elide.annotations.Singleton
import elide.runtime.gvm.GuestExecution
import elide.runtime.gvm.GuestExecutor
import elide.runtime.gvm.GuestExecutorProvider

/**
* Guest Test Executor Factory
*
* Initializes a direct executor for use during test execution.
*/
@Requires(env = ["test"])
@Eager @Factory internal class GuestTestExecutorFactory : GuestExecutorProvider {
@Singleton override fun executor(): GuestExecutor = GuestExecution.direct()
}
1 change: 1 addition & 0 deletions packages/graalvm-py/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ dependencies {
kaptTest(mn.micronaut.inject.java)
testImplementation(projects.packages.test)
testImplementation(projects.packages.graalvm)
testApi(project(":packages:engine", configuration = "testInternals"))
testImplementation(project(":packages:graalvm", configuration = "testBase"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package elide.runtime.gvm
import org.graalvm.polyglot.Value
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
import kotlinx.coroutines.test.runTest
import elide.runtime.core.DelicateElideApi
import elide.runtime.core.PolyglotContext
import elide.runtime.core.PolyglotEngineConfiguration
Expand All @@ -32,7 +33,7 @@ abstract class PythonTest : AbstractDualTest<AbstractDualTest.Python>() {
}

@Suppress("SameParameterValue")
private fun executeGuestInternal(ctx: PolyglotContext, bindUtils: Boolean, op: Python,): Value {
private fun executeGuestInternal(ctx: PolyglotContext, bindUtils: Boolean, op: Python): Value {
// resolve the script
val script = op.invoke(ctx)

Expand Down Expand Up @@ -71,8 +72,8 @@ abstract class PythonTest : AbstractDualTest<AbstractDualTest.Python>() {
}

// Run the provided `op` on the host, and the provided `guest` via `executeGuest`.
override fun dual(bind: Boolean, op: () -> Unit): DualTestExecutionProxy<Python> {
op.invoke()
override fun dual(bind: Boolean, op: suspend () -> Unit): DualTestExecutionProxy<Python> {
runTest { op.invoke() }
return object : DualTestExecutionProxy<Python>() {
override fun guest(guestOperation: Python) = GuestTestExecution(::withContext) {
executeGuestInternal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.graalvm.polyglot.Value
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
import java.util.function.Function
import kotlinx.coroutines.test.runTest
import elide.runtime.core.DelicateElideApi
import elide.runtime.core.PolyglotContext
import elide.runtime.core.PolyglotEngineConfiguration
Expand Down Expand Up @@ -79,8 +80,8 @@ abstract class AbstractPythonIntrinsicTest<T : GuestIntrinsic> : AbstractIntrins
}

// Run the provided `op` on the host, and the provided `guest` via `executeGuest`.
override fun dual(bind: Boolean, op: () -> Unit): DualTestExecutionProxy<Python> {
op.invoke()
override fun dual(bind: Boolean, op: suspend () -> Unit): DualTestExecutionProxy<Python> {
runTest { op.invoke() }
return object : DualTestExecutionProxy<Python>() {
override fun guest(guestOperation: Python) = GuestTestExecution(::withContext) {
executeGuestInternal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package elide.runtime.gvm
import org.graalvm.polyglot.Value
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
import kotlinx.coroutines.test.runTest
import elide.runtime.core.DelicateElideApi
import elide.runtime.core.PolyglotContext
import elide.runtime.core.PolyglotEngineConfiguration
Expand Down Expand Up @@ -75,8 +76,8 @@ ctx: PolyglotContext,
}

// Run the provided `op` on the host, and the provided `guest` via `executeGuest`.
override fun dual(bind: Boolean, op: () -> Unit): DualTestExecutionProxy<Ruby> {
op.invoke()
override fun dual(bind: Boolean, op: suspend () -> Unit): DualTestExecutionProxy<Ruby> {
runTest { op.invoke() }
return object : DualTestExecutionProxy<Ruby>() {
override fun guest(guestOperation: Ruby) = GuestTestExecution(::withContext) {
executeGuestInternal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.graalvm.polyglot.Value
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicReference
import java.util.function.Function
import kotlinx.coroutines.test.runTest
import elide.runtime.core.DelicateElideApi
import elide.runtime.core.PolyglotContext
import elide.runtime.core.PolyglotEngineConfiguration
Expand Down Expand Up @@ -85,8 +86,8 @@ ctx: PolyglotContext,
}

// Run the provided `op` on the host, and the provided `guest` via `executeGuest`.
override fun dual(bind: Boolean, op: () -> Unit): DualTestExecutionProxy<Ruby> {
op.invoke()
override fun dual(bind: Boolean, op: suspend () -> Unit): DualTestExecutionProxy<Ruby> {
runTest { op.invoke() }
return object : DualTestExecutionProxy<Ruby>() {
override fun guest(guestOperation: Ruby) = GuestTestExecution(::withContext) {
executeGuestInternal(
Expand Down
5 changes: 5 additions & 0 deletions packages/graalvm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `graalvm`

Main logic module for Elide's integration points with GraalVM.


Loading
Loading