Infrastructure: move compiler plugin tests back to their modules
This commit is contained in:
@@ -6,10 +6,27 @@ dependencies {
|
||||
compile(project(":jps-plugin"))
|
||||
compile(project(":plugins:android-extensions-compiler"))
|
||||
compile(ideaPluginDeps("android-jps-plugin", plugin = "android", subdir = "lib/jps"))
|
||||
|
||||
testCompile(projectTests(":jps-plugin"))
|
||||
testCompile(project(":compiler:tests-common"))
|
||||
testCompileOnly(ideaSdkDeps("jps-build-test", subdir = "jps/test"))
|
||||
testRuntime(ideaPluginDeps("*.jar", plugin = "android"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(projectTests(":kotlin-build-common"))
|
||||
testRuntime(ideaSdkCoreDeps("*.jar"))
|
||||
testRuntime(ideaSdkDeps("*.jar"))
|
||||
testRuntime(ideaSdkDeps("*.jar", subdir = "jps/test"))
|
||||
testRuntime(ideaSdkDeps("*.jar", subdir = "jps"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
projectTest {
|
||||
workingDir = rootDir
|
||||
}
|
||||
|
||||
testsJar {}
|
||||
@@ -70,9 +70,8 @@ class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider {
|
||||
val libDirectory = File(PathUtil.getJarPathForClass(this::class.java)).parentFile.parentFile
|
||||
File(libDirectory, JAR_FILE_NAME).absolutePath
|
||||
} else {
|
||||
// We're in tests now (in out/production/android-extensions/android-extensions-jps)
|
||||
val kotlinProjectDirectory = File(PathUtil.getJarPathForClass(this::class.java)).parentFile.parentFile.parentFile
|
||||
File(kotlinProjectDirectory, "dist/kotlinc/lib/$JAR_FILE_NAME").absolutePath
|
||||
// We're in tests now (project root dir)
|
||||
File("dist/kotlinc/lib/$JAR_FILE_NAME").absolutePath
|
||||
})
|
||||
}
|
||||
else emptyList()
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.jps.build.android
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.jps.android.model.JpsAndroidSdkProperties
|
||||
import org.jetbrains.jps.model.JpsSimpleElement
|
||||
import org.jetbrains.jps.model.library.sdk.JpsSdk
|
||||
import org.jetbrains.jps.android.model.JpsAndroidSdkType
|
||||
import org.jetbrains.jps.model.impl.JpsSimpleElementImpl
|
||||
import org.jetbrains.jps.model.library.JpsOrderRootType
|
||||
import org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractAndroidJpsTestCase : BaseKotlinJpsBuildTestCase() {
|
||||
|
||||
private val SDK_NAME = "Android API 21 Platform"
|
||||
|
||||
fun doTest(path: String) {
|
||||
addJdkAndAndroidSdk()
|
||||
loadProject(path + getTestName(true) + ".ipr")
|
||||
rebuildAllModules()
|
||||
buildAllModules().assertSuccessful()
|
||||
FileUtil.delete(File(path + "/out"))
|
||||
}
|
||||
|
||||
private fun addJdkAndAndroidSdk(): JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> {
|
||||
val jdkName = "java_sdk"
|
||||
addJdk(jdkName)
|
||||
val properties = JpsAndroidSdkProperties("android-23", jdkName)
|
||||
val sdkPath = homePath + "/../dependencies/androidSDK"
|
||||
val library = myModel.global.addSdk(SDK_NAME, sdkPath, "", JpsAndroidSdkType.INSTANCE, JpsSimpleElementImpl(properties))
|
||||
library.addRoot(File(sdkPath + "/platforms/android-23/android.jar"), JpsOrderRootType.COMPILED)
|
||||
return library.properties
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.jps.build.android;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("plugins/android-extensions/android-extensions-jps/testData/android")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class AndroidJpsTestCaseGenerated extends AbstractAndroidJpsTestCase {
|
||||
public void testAllFilesPresentInAndroid() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("plugins/android-extensions/android-extensions-jps/testData/android"), Pattern.compile("^([^\\.]+)$"), TargetBackend.ANY, false);
|
||||
}
|
||||
|
||||
@TestMetadata("simple")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-jps/testData/android/simple/");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user