Extract plugins tests to separate module with JDK 1.8

This commit is contained in:
Nikolay Krasko
2015-12-18 20:21:15 +03:00
parent 46b5305666
commit f80aaa97a6
20 changed files with 41 additions and 25 deletions
@@ -13,21 +13,5 @@
<orderEntry type="library" scope="PROVIDED" name="android-plugin" level="project" />
<orderEntry type="module" module-name="android-extensions-compiler" />
<orderEntry type="module" module-name="util" scope="PROVIDED" />
<orderEntry type="library" scope="TEST" name="jps-test" level="project" />
<orderEntry type="library" scope="TEST" name="idea-full" level="project" />
<orderEntry type="module" module-name="compiler-tests" scope="TEST" />
<orderEntry type="module-library" scope="TEST">
<library name="idea-gradle-plugin">
<CLASSES>
<root url="file://$MODULE_DIR$/../../../ideaSDK/plugins/gradle/lib" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$MODULE_DIR$/../../../ideaSDK/plugins/gradle/lib" />
</SOURCES>
<jarDirectory url="file://$MODULE_DIR$/../../../ideaSDK/plugins/gradle/lib" recursive="false" />
<jarDirectory url="file://$MODULE_DIR$/../../../ideaSDK/plugins/gradle/lib" recursive="false" type="SOURCES" />
</library>
</orderEntry>
</component>
</module>
@@ -1,69 +0,0 @@
/*
* 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 org.jetbrains.jps.builders.JpsBuildTestCase
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 java.io.File
abstract class AbstractAndroidJpsTestCase : JpsBuildTestCase() {
private val SDK_NAME = "Android API 21 Platform"
override fun setUp() {
super.setUp()
System.setProperty("kotlin.jps.tests", "true")
}
fun doTest(path: String) {
addJdkAndAndroidSdk()
loadProject(path + getTestName(true) + ".ipr")
rebuildAll()
makeAll().assertSuccessful()
deleteDirectory(File(path + "/out"))
}
fun deleteDirectory(path: File): Boolean {
if (path.exists() && path.isDirectory) {
val files = path.listFiles()
for (i in files.indices) {
if (files[i].isDirectory) {
deleteDirectory(files[i])
}
else {
files[i].delete()
}
}
}
return (path.delete())
}
private fun addJdkAndAndroidSdk(): JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> {
val jdkName = "java_sdk"
addJdk(jdkName)
val properties = JpsAndroidSdkProperties("android-21", jdkName)
val sdkPath = homePath + "/../dependencies/androidSDK"
val library = myModel.global.addSdk(SDK_NAME, sdkPath, "", JpsAndroidSdkType.INSTANCE, JpsSimpleElementImpl(properties))
library.addRoot(File(sdkPath + "/platforms/android-21/android.jar"), JpsOrderRootType.COMPILED)
return library.properties
}
}
@@ -1,43 +0,0 @@
/*
* Copyright 2010-2016 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.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("^([^\\.]+)$"), false);
}
@TestMetadata("simple")
public void testSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/android-extensions/android-extensions-jps/testData/android/simple/");
doTest(fileName);
}
}