Move Android JPS plugin tests to android-jps-plugin module
Original commit: b7f8496e5b
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.jet.jps.build.android
|
||||
|
||||
import org.jetbrains.jps.builders.JpsBuildTestCase
|
||||
import org.jetbrains.jps.android.model.JpsAndroidSdkProperties
|
||||
import org.jetbrains.jps.android.model.JpsAndroidSdkType
|
||||
import org.jetbrains.jps.model.library.JpsOrderRootType
|
||||
import org.jetbrains.jps.model.JpsSimpleElement
|
||||
import org.jetbrains.jps.model.library.sdk.JpsSdk
|
||||
import org.jetbrains.jps.model.impl.JpsSimpleElementImpl
|
||||
|
||||
import java.io.File
|
||||
|
||||
public abstract class AbstractAndroidJpsTestCase : JpsBuildTestCase() {
|
||||
|
||||
private val SDK_NAME = "Android API 17 Platform"
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
System.setProperty("kotlin.jps.tests", "true")
|
||||
}
|
||||
|
||||
public fun doTest(path: String) {
|
||||
addJdkAndAndroidSdk()
|
||||
loadProject(path + getTestName(true) + ".ipr")
|
||||
rebuildAll()
|
||||
makeAll().assertSuccessful()
|
||||
deleteDirectory(File(path + "/out"))
|
||||
}
|
||||
|
||||
public 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-17", jdkName)
|
||||
val sdkPath = getHomePath() + "/androidSDK/"
|
||||
val library = myModel!!.getGlobal().addSdk<JpsSimpleElement<JpsAndroidSdkProperties>>(SDK_NAME, sdkPath, "", JpsAndroidSdkType.INSTANCE, JpsSimpleElementImpl(properties))
|
||||
library!!.addRoot(File(sdkPath + "/platforms/android-17/android.jar"), JpsOrderRootType.COMPILED)
|
||||
return library.getProperties()
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.jet.jps.build.android;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("jps-plugin/testData/android")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class AndroidJpsTestCaseGenerated extends AbstractAndroidJpsTestCase {
|
||||
public void testAllFilesPresentInAndroid() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("jps-plugin/testData/android"), Pattern.compile("^([^\\.]+)$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("simple")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/android/simple/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.myapp"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="17"/>
|
||||
<application android:label="app_name" >
|
||||
<activity android:name=".MyActivity"
|
||||
android:label="app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World, MyActivity"
|
||||
android:id="@+id/textField"/>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
|
||||
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/assets" />
|
||||
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/libs" />
|
||||
<option name="USE_CUSTOM_APK_RESOURCE_FOLDER" value="false" />
|
||||
<option name="CUSTOM_APK_RESOURCE_FOLDER" value="" />
|
||||
<option name="USE_CUSTOM_COMPILER_MANIFEST" value="false" />
|
||||
<option name="CUSTOM_COMPILER_MANIFEST" value="" />
|
||||
<option name="APK_PATH" value="" />
|
||||
<option name="LIBRARY_PROJECT" value="false" />
|
||||
<option name="RUN_PROCESS_RESOURCES_MAVEN_TASK" value="true" />
|
||||
<option name="GENERATE_UNSIGNED_APK" value="false" />
|
||||
<option name="CUSTOM_DEBUG_KEYSTORE_PATH" value="" />
|
||||
<option name="PACK_TEST_CODE" value="false" />
|
||||
<option name="RUN_PROGUARD" value="false" />
|
||||
<option name="PROGUARD_CFG_PATH" value="/proguard-project.txt" />
|
||||
<resOverlayFolders>
|
||||
<path>/res-overlay</path>
|
||||
</resOverlayFolders>
|
||||
<includeSystemProguardFile>true</includeSystemProguardFile>
|
||||
<includeAssetsFromLibraries>false</includeAssetsFromLibraries>
|
||||
<additionalNativeLibs />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 17 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<excludeFromCompile>
|
||||
<directory url="file://$PROJECT_DIR$/gen" includeSubdirectories="true" />
|
||||
</excludeFromCompile>
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/simple.iml" filepath="$PROJECT_DIR$/simple.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="Android API 17 Platform" project-jdk-type="Android SDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.example.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
|
||||
public class MyActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.main)
|
||||
textField.setText("test")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user