<commit_before>package org.jetbrains.kotlin.ui.tests.scripts.templates

import org.eclipse.core.resources.IFile
import org.jetbrains.kotlin.core.model.ScriptTemplateProviderEx
import org.jetbrains.kotlin.script.KotlinScriptExternalDependencies
import org.jetbrains.kotlin.script.ScriptContents
import org.jetbrains.kotlin.script.ScriptDependenciesResolver
import org.jetbrains.kotlin.script.ScriptTemplateDefinition
import org.jetbrains.kotlin.script.asFuture
import java.util.concurrent.Future

class CustomEPResolverScriptTemplateProvider : ScriptTemplateProviderEx {
    override val templateClassClasspath = listOf("bin/", "target/classes/")
    override val templateClassName = "org.jetbrains.kotlin.ui.tests.scripts.templates.CustomReolverScriptTemplateDefinition"

    override fun isApplicable(file: IFile): Boolean {
        return file.name.contains("customEPResolver")
    }
    
    override val resolver: ScriptDependenciesResolver get() = CustomScriptDependenciesResolver()
}

class CustomScriptDependenciesResolver : ScriptDependenciesResolver {
    override fun resolve(
            script: ScriptContents,
            environment: Map<String, Any?>?,
            report: (ScriptDependenciesResolver.ReportSeverity, String, ScriptContents.Position?) -> Unit,
            previousDependencies: KotlinScriptExternalDependencies?): Future<KotlinScriptExternalDependencies?> {
        return object : KotlinScriptExternalDependencies {
            override val imports: Iterable<String> get() {
                return listOf("java.util.Date")
            }
        }.asFuture()
    }
}

@ScriptTemplateDefinition(
        resolver = TestKotlinScriptResolver::class, // Default resolver that doesn't conform resolver in extenstion point
        scriptFilePattern = "customEPResolver.kts"
)
open class CustomReolverScriptTemplateDefinition<commit_msg>Test working with workspace in custom resolver<commit_after>package org.jetbrains.kotlin.ui.tests.scripts.templates

import org.eclipse.core.resources.IFile
import org.eclipse.core.resources.ResourcesPlugin
import org.jetbrains.kotlin.core.model.ScriptTemplateProviderEx
import org.jetbrains.kotlin.script.KotlinScriptExternalDependencies
import org.jetbrains.kotlin.script.ScriptContents
import org.jetbrains.kotlin.script.ScriptDependenciesResolver
import org.jetbrains.kotlin.script.ScriptTemplateDefinition
import org.jetbrains.kotlin.script.asFuture
import org.junit.Assert
import java.util.concurrent.Future

class CustomEPResolverScriptTemplateProvider : ScriptTemplateProviderEx {
    override val templateClassClasspath = listOf("bin/", "target/classes/")
    override val templateClassName = "org.jetbrains.kotlin.ui.tests.scripts.templates.CustomReolverScriptTemplateDefinition"

    override fun isApplicable(file: IFile): Boolean {
        return file.name.contains("customEPResolver")
    }
    
    override val resolver: ScriptDependenciesResolver get() = CustomScriptDependenciesResolver()
}

class CustomScriptDependenciesResolver : ScriptDependenciesResolver {
    override fun resolve(
            script: ScriptContents,
            environment: Map<String, Any?>?,
            report: (ScriptDependenciesResolver.ReportSeverity, String, ScriptContents.Position?) -> Unit,
            previousDependencies: KotlinScriptExternalDependencies?): Future<KotlinScriptExternalDependencies?> {
        return object : KotlinScriptExternalDependencies {
            override val imports: Iterable<String> get() {
                // Test workspace is available
                Assert.assertTrue(ResourcesPlugin.getWorkspace().getRoot().getLocation() != null)
                
                return listOf("java.util.Date")
            }
        }.asFuture()
    }
}

@ScriptTemplateDefinition(
        resolver = TestKotlinScriptResolver::class, // Default resolver that doesn't conform resolver in extenstion point
        scriptFilePattern = "customEPResolver.kts"
)
open class CustomReolverScriptTemplateDefinition
{'fraction_non_alphanumeric': 0.08018040591330494, 'fraction_numerical': 0.0, 'mean_word_length': 4.308510638297872, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3321710', 'n_tokens_mistral': 1033, 'n_tokens_neox': 970, 'n_words': 195}