Switch spring usages to regular dependency
This commit is contained in:
committed by
Vyacheslav Gerasimov
parent
d301938d23
commit
69787bd0d1
@@ -129,6 +129,7 @@ extra["versions.json"] = "20160807"
|
|||||||
extra["versions.native-platform"] = "0.14"
|
extra["versions.native-platform"] = "0.14"
|
||||||
extra["versions.ant-launcher"] = "1.8.0"
|
extra["versions.ant-launcher"] = "1.8.0"
|
||||||
extra["versions.robolectric"] = "3.1"
|
extra["versions.robolectric"] = "3.1"
|
||||||
|
extra["versions.org.springframework"] = "4.2.0.RELEASE"
|
||||||
|
|
||||||
val markdownVer = "4054 - Kotlin 1.0.2-dev-566".replace(" ", "%20") // fixed here, was last with "status:SUCCESS,tag:forKotlin"
|
val markdownVer = "4054 - Kotlin 1.0.2-dev-566".replace(" ", "%20") // fixed here, was last with "status:SUCCESS,tag:forKotlin"
|
||||||
extra["markdownParserRepo"] = "https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/$markdownVer/([artifact]_[ext]/)[artifact](.[ext])"
|
extra["markdownParserRepo"] = "https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/$markdownVer/([artifact]_[ext]/)[artifact](.[ext])"
|
||||||
|
|||||||
@@ -14,15 +14,22 @@ import java.io.File
|
|||||||
fun Project.commonDep(coord: String): String {
|
fun Project.commonDep(coord: String): String {
|
||||||
val parts = coord.split(':')
|
val parts = coord.split(':')
|
||||||
return when (parts.size) {
|
return when (parts.size) {
|
||||||
1 -> "$coord:$coord:${rootProject.extra["versions.$coord"]}"
|
1 -> "$coord:$coord:${commonVer(coord, coord)}"
|
||||||
2 -> "${parts[0]}:${parts[1]}:${rootProject.extra["versions.${parts[1]}"]}"
|
2 -> "${parts[0]}:${parts[1]}:${commonVer(parts[0], parts[1])}"
|
||||||
3 -> coord
|
3 -> coord
|
||||||
else -> throw IllegalArgumentException("Illegal maven coordinates: $coord")
|
else -> throw IllegalArgumentException("Illegal maven coordinates: $coord")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.commonDep(group: String, artifact: String, vararg suffixesAndClassifiers: String): String =
|
fun Project.commonDep(group: String, artifact: String, vararg suffixesAndClassifiers: String): String =
|
||||||
"$group:$artifact${suffixesAndClassifiers.filterNot { it.startsWith(':') }.joinToString("")}:${rootProject.extra["versions.$artifact"]}${suffixesAndClassifiers.filter { it.startsWith(':') }.joinToString("")}"
|
"$group:$artifact${suffixesAndClassifiers.filterNot { it.startsWith(':') }.joinToString("")}:${commonVer(group, artifact)}${suffixesAndClassifiers.filter { it.startsWith(':') }.joinToString("")}"
|
||||||
|
|
||||||
|
fun Project.commonVer(group: String, artifact: String) =
|
||||||
|
when {
|
||||||
|
rootProject.extra.has("versions.$artifact") -> rootProject.extra["versions.$artifact"]
|
||||||
|
rootProject.extra.has("versions.$group") -> rootProject.extra["versions.$group"]
|
||||||
|
else -> throw GradleException("Neither versions.$artifact nor versions.$group is defined in the root project's extra")
|
||||||
|
}
|
||||||
|
|
||||||
fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File(rootDir, "dependencies"), subdir: String? = null, optional: Boolean = false): ConfigurableFileCollection {
|
fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File(rootDir, "dependencies"), subdir: String? = null, optional: Boolean = false): ConfigurableFileCollection {
|
||||||
val dir = if (subdir != null) File(baseDir, subdir) else baseDir
|
val dir = if (subdir != null) File(baseDir, subdir) else baseDir
|
||||||
|
|||||||
@@ -159,11 +159,12 @@ object ConfigLibraryUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addLibrary(module: Module, libraryName: String, rootPath: String, jarPaths: Array<String>) {
|
fun addLibrary(module: Module, libraryName: String, rootPath: String?, jarPaths: Array<String>) {
|
||||||
val editor = NewLibraryEditor()
|
val editor = NewLibraryEditor()
|
||||||
editor.name = libraryName
|
editor.name = libraryName
|
||||||
for (jarPath in jarPaths) {
|
for (jarPath in jarPaths) {
|
||||||
editor.addRoot(VfsUtil.getUrlForLibraryRoot(File(rootPath, jarPath)), OrderRootType.CLASSES)
|
val jarFile = if (rootPath == null) File(jarPath) else File(rootPath, jarPath)
|
||||||
|
editor.addRoot(VfsUtil.getUrlForLibraryRoot(jarFile), OrderRootType.CLASSES)
|
||||||
}
|
}
|
||||||
|
|
||||||
addLibrary(editor, module)
|
addLibrary(editor, module)
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ val ideaProjectResources = project(":idea").the<JavaPluginConvention>().sourceS
|
|||||||
|
|
||||||
evaluationDependsOn(":prepare:idea-plugin")
|
evaluationDependsOn(":prepare:idea-plugin")
|
||||||
|
|
||||||
|
val springClasspath by configurations.creating
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":kotlin-reflect-api"))
|
compileOnly(project(":kotlin-reflect-api"))
|
||||||
compile(projectDist(":kotlin-stdlib"))
|
compile(projectDist(":kotlin-stdlib"))
|
||||||
@@ -90,6 +92,12 @@ dependencies {
|
|||||||
testRuntime(project(":plugins:uast-kotlin-idea"))
|
testRuntime(project(":plugins:uast-kotlin-idea"))
|
||||||
testRuntime(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
testRuntime(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
||||||
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
|
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 {
|
afterEvaluate {
|
||||||
@@ -195,6 +203,9 @@ projectTest {
|
|||||||
dependsOn(prepareResources)
|
dependsOn(prepareResources)
|
||||||
dependsOn(preparePluginXml)
|
dependsOn(preparePluginXml)
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
|
doFirst {
|
||||||
|
systemProperty("spring.classpath", springClasspath.asPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val generateTests by generator("org.jetbrains.kotlin.tests.GenerateUltimateTestsKt")
|
val generateTests by generator("org.jetbrains.kotlin.tests.GenerateUltimateTestsKt")
|
||||||
|
|||||||
+7
-19
@@ -30,31 +30,19 @@ import com.intellij.util.PathUtil
|
|||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
||||||
import org.jetbrains.kotlin.idea.test.TestFixtureExtension
|
import org.jetbrains.kotlin.idea.test.TestFixtureExtension
|
||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.jetbrains.kotlin.tests.ULTIMATE_TEST_ROOT
|
import java.io.File
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
class SpringTestFixtureExtension() : TestFixtureExtension {
|
class SpringTestFixtureExtension() : TestFixtureExtension {
|
||||||
private var module: Module? = null
|
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) {
|
override fun setUp(module: Module) {
|
||||||
this.module = module
|
this.module = module
|
||||||
val library = SpringFramework.FRAMEWORK_4_2_0
|
|
||||||
val libraryPath = "$SPRING_LIBRARY_ROOT/${library.version}/"
|
val springClasspath = System.getProperty("spring.classpath")
|
||||||
val jarNames = HashSet<String>(library.artifactIds.size)
|
?: throw RuntimeException("Unable to get a valid classpath from 'spring.classpath' property, please set it accordingly");
|
||||||
for (id in library.artifactIds) {
|
|
||||||
jarNames.add("spring-$id-${library.version}.jar")
|
ConfigLibraryUtil.addLibrary(module, "spring", null, springClasspath.split(File.pathSeparator).toTypedArray())
|
||||||
}
|
|
||||||
ConfigLibraryUtil.addLibrary(module, "spring" + library.version, libraryPath, jarNames.toTypedArray())
|
|
||||||
|
|
||||||
FacetUtil.addFacet(module, SpringFacet.getSpringFacetType())
|
FacetUtil.addFacet(module, SpringFacet.getSpringFacetType())
|
||||||
}
|
}
|
||||||
@@ -79,7 +67,7 @@ class SpringTestFixtureExtension() : TestFixtureExtension {
|
|||||||
facet.removeFileSets()
|
facet.removeFileSets()
|
||||||
FacetUtil.deleteFacet(facet)
|
FacetUtil.deleteFacet(facet)
|
||||||
}
|
}
|
||||||
ConfigLibraryUtil.removeLibrary(module, "spring" + SpringFramework.FRAMEWORK_4_2_0.version)
|
ConfigLibraryUtil.removeLibrary(module, "spring")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
@@ -9,22 +9,6 @@
|
|||||||
|
|
||||||
<property name="download" value="dependencies/download"/>
|
<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">
|
<macrodef name="get-nodejs-intellij-plugin">
|
||||||
<sequential>
|
<sequential>
|
||||||
<get src="http://plugins.jetbrains.com/plugin/download?updateId=37668" dest="${download}/nodejs_plugin.zip" usetimestamp="true"/>
|
<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">
|
<target name="fetch-extras">
|
||||||
<mkdir dir="${download}"/>
|
<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/>
|
<get-nodejs-intellij-plugin/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user