mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fail if base dir isn't defined
This commit is contained in:
@@ -25,6 +25,7 @@ import com.jetbrains.python.psi.PyFileElementType
|
||||
import com.jetbrains.python.psi.impl.stubs.PyPrebuiltStubsProvider.PREBUILT_INDEXES_PATH_PROPERTY
|
||||
import com.jetbrains.python.psi.impl.stubs.PyPrebuiltStubsProvider.SDK_STUBS_STORAGE_NAME
|
||||
import junit.framework.TestCase
|
||||
import org.junit.Assert
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
@@ -37,14 +38,25 @@ val stubsFileName = SDK_STUBS_STORAGE_NAME
|
||||
|
||||
val MERGE_STUBS_FROM_PATHS = "MERGE_STUBS_FROM_PATHS"
|
||||
|
||||
val path: String? = System.getProperty(PREBUILT_INDEXES_PATH_PROPERTY)
|
||||
val baseDir = if (path != null && File(path).exists()) {
|
||||
path
|
||||
}
|
||||
else {
|
||||
System.getProperty("user.dir")
|
||||
|
||||
fun getBaseDirValue(): String? {
|
||||
val path: String? = System.getProperty(PREBUILT_INDEXES_PATH_PROPERTY)
|
||||
|
||||
if (path == null) {
|
||||
Assert.fail("$PREBUILT_INDEXES_PATH_PROPERTY variable is not defined")
|
||||
}
|
||||
else
|
||||
if (File(path).exists()) {
|
||||
return path
|
||||
}
|
||||
else {
|
||||
Assert.fail("Directory $path doesn't exist")
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
val baseDir = getBaseDirValue()
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (System.getenv().containsKey(MERGE_STUBS_FROM_PATHS)) {
|
||||
mergeStubs(System.getenv(MERGE_STUBS_FROM_PATHS).split(File.pathSeparatorChar))
|
||||
@@ -173,9 +185,9 @@ fun buildStubs() {
|
||||
val root = System.getenv(PYCHARM_PYTHONS)
|
||||
|
||||
for (python in File(root).listFiles()) {
|
||||
indexSdkAndStoreSerializedStubs("${PathManager.getHomePath()}/python/testData/empty",
|
||||
python.absolutePath,
|
||||
"$baseDir/$stubsFileName")
|
||||
indexSdkAndStoreSerializedStubs("${PathManager.getHomePath()}/python/testData/empty",
|
||||
python.absolutePath,
|
||||
"$baseDir/$stubsFileName")
|
||||
}
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
|
||||
Reference in New Issue
Block a user