Switch spring usages to regular dependency

This commit is contained in:
Ilya Chernikov
2017-11-15 10:31:35 +01:00
committed by Vyacheslav Gerasimov
parent d301938d23
commit 69787bd0d1
6 changed files with 32 additions and 46 deletions
+11
View File
@@ -41,6 +41,8 @@ val ideaProjectResources = project(":idea").the<JavaPluginConvention>().sourceS
evaluationDependsOn(":prepare:idea-plugin")
val springClasspath by configurations.creating
dependencies {
compileOnly(project(":kotlin-reflect-api"))
compile(projectDist(":kotlin-stdlib"))
@@ -90,6 +92,12 @@ dependencies {
testRuntime(project(":plugins:uast-kotlin-idea"))
testRuntime(files("${System.getProperty("java.home")}/../lib/tools.jar"))
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
springClasspath(commonDep("org.springframework", "spring-core"))
springClasspath(commonDep("org.springframework", "spring-beans"))
springClasspath(commonDep("org.springframework", "spring-context"))
springClasspath(commonDep("org.springframework", "spring-tx"))
springClasspath(commonDep("org.springframework", "spring-web"))
}
afterEvaluate {
@@ -195,6 +203,9 @@ projectTest {
dependsOn(prepareResources)
dependsOn(preparePluginXml)
workingDir = rootDir
doFirst {
systemProperty("spring.classpath", springClasspath.asPath)
}
}
val generateTests by generator("org.jetbrains.kotlin.tests.GenerateUltimateTestsKt")
@@ -30,31 +30,19 @@ import com.intellij.util.PathUtil
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
import org.jetbrains.kotlin.idea.test.TestFixtureExtension
import org.jetbrains.kotlin.test.InTextDirectivesUtils
import org.jetbrains.kotlin.tests.ULTIMATE_TEST_ROOT
import java.util.*
import java.io.File
@Suppress("unused")
class SpringTestFixtureExtension() : TestFixtureExtension {
private var module: Module? = null
enum class SpringFramework(val version: String, vararg val artifactIds: String) {
FRAMEWORK_4_2_0(
"4.2.0.RELEASE",
"core", "beans", "context", "tx", "web"
)
}
val SPRING_LIBRARY_ROOT = "$ULTIMATE_TEST_ROOT/dependencies/spring"
override fun setUp(module: Module) {
this.module = module
val library = SpringFramework.FRAMEWORK_4_2_0
val libraryPath = "$SPRING_LIBRARY_ROOT/${library.version}/"
val jarNames = HashSet<String>(library.artifactIds.size)
for (id in library.artifactIds) {
jarNames.add("spring-$id-${library.version}.jar")
}
ConfigLibraryUtil.addLibrary(module, "spring" + library.version, libraryPath, jarNames.toTypedArray())
val springClasspath = System.getProperty("spring.classpath")
?: throw RuntimeException("Unable to get a valid classpath from 'spring.classpath' property, please set it accordingly");
ConfigLibraryUtil.addLibrary(module, "spring", null, springClasspath.split(File.pathSeparator).toTypedArray())
FacetUtil.addFacet(module, SpringFacet.getSpringFacetType())
}
@@ -79,7 +67,7 @@ class SpringTestFixtureExtension() : TestFixtureExtension {
facet.removeFileSets()
FacetUtil.deleteFacet(facet)
}
ConfigLibraryUtil.removeLibrary(module, "spring" + SpringFramework.FRAMEWORK_4_2_0.version)
ConfigLibraryUtil.removeLibrary(module, "spring")
}
}
finally {
-22
View File
@@ -9,22 +9,6 @@
<property name="download" value="dependencies/download"/>
<macrodef name="get-spring-library">
<attribute name="lib"/>
<attribute name="version"/>
<sequential>
<get-maven-library
server="http://central.maven.org/maven2"
prefix="org/springframework"
lib="@{lib}"
version="@{version}"
src="false"
download="${download}"
dependencies="dependencies/spring/@{version}"/>
</sequential>
</macrodef>
<macrodef name="get-nodejs-intellij-plugin">
<sequential>
<get src="http://plugins.jetbrains.com/plugin/download?updateId=37668" dest="${download}/nodejs_plugin.zip" usetimestamp="true"/>
@@ -35,12 +19,6 @@
<target name="fetch-extras">
<mkdir dir="${download}"/>
<get-spring-library lib="spring-core" version="4.2.0.RELEASE"/>
<get-spring-library lib="spring-beans" version="4.2.0.RELEASE"/>
<get-spring-library lib="spring-context" version="4.2.0.RELEASE"/>
<get-spring-library lib="spring-tx" version="4.2.0.RELEASE"/>
<get-spring-library lib="spring-web" version="4.2.0.RELEASE"/>
<get-nodejs-intellij-plugin/>
</target>