diff --git a/jps/jps-plugin/jps-plugin.iml b/jps/jps-plugin/jps-plugin.iml index 201c8d3bb04..69240513cb7 100644 --- a/jps/jps-plugin/jps-plugin.iml +++ b/jps/jps-plugin/jps-plugin.iml @@ -23,5 +23,18 @@ + + + + + + + + + + + + + diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index 2a13192a5c2..a50171c021a 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -434,13 +434,15 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR } private fun getAndroidResPath(module: JpsModule, context: CompileContext): String { - val extension = AndroidJpsUtil.getExtension(module)!! + val extension = AndroidJpsUtil.getExtension(module) + if (extension == null) return "" val path = AndroidJpsUtil.getResourceDirForCompilationPath(extension) return File(path!!.getAbsolutePath() + "/layout").getAbsolutePath() } private fun getAndroidManifest(module: JpsModule): String { - val extension = AndroidJpsUtil.getExtension(module)!! + val extension = AndroidJpsUtil.getExtension(module) + if (extension == null) return "" return AndroidJpsUtil.getManifestFileForCompilationPath(extension)!!.getAbsolutePath() } diff --git a/jps/jps-plugin/test/org/jetbrains/jet/jps/build/android/AbstractAndroidJpsTestCase.kt b/jps/jps-plugin/test/org/jetbrains/jet/jps/build/android/AbstractAndroidJpsTestCase.kt new file mode 100644 index 00000000000..05de8ff8005 --- /dev/null +++ b/jps/jps-plugin/test/org/jetbrains/jet/jps/build/android/AbstractAndroidJpsTestCase.kt @@ -0,0 +1,33 @@ +/* + * 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 + +public abstract class AbstractAndroidJpsTestCase : JpsBuildTestCase() { + private val SDK_NAME = "Android_SDK" + override fun setUp() { + super.setUp() + System.setProperty("kotlin.jps.tests", "true") + } + public fun doTest(path: String) { + addJdk(SDK_NAME, getHomePath() + "/androidSDK/platforms/android-17" + "/android.jar") + loadProject(path + getTestName(true) + ".ipr") + rebuildAll() + makeAll().assertSuccessful() + } +} diff --git a/jps/jps-plugin/test/org/jetbrains/jet/jps/build/android/AndroidJpsTestCaseGenerated.java b/jps/jps-plugin/test/org/jetbrains/jet/jps/build/android/AndroidJpsTestCaseGenerated.java new file mode 100644 index 00000000000..bc507501bfc --- /dev/null +++ b/jps/jps-plugin/test/org/jetbrains/jet/jps/build/android/AndroidJpsTestCaseGenerated.java @@ -0,0 +1,44 @@ +/* + * 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); + } + +} diff --git a/jps/jps-plugin/testData/android/simple/AndroidManifest.xml b/jps/jps-plugin/testData/android/simple/AndroidManifest.xml new file mode 100644 index 00000000000..57d0d4c3e82 --- /dev/null +++ b/jps/jps-plugin/testData/android/simple/AndroidManifest.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/jps/jps-plugin/testData/android/simple/res/layout/main.xml b/jps/jps-plugin/testData/android/simple/res/layout/main.xml new file mode 100644 index 00000000000..024accd07c7 --- /dev/null +++ b/jps/jps-plugin/testData/android/simple/res/layout/main.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/jps/jps-plugin/testData/android/simple/simple.iml b/jps/jps-plugin/testData/android/simple/simple.iml new file mode 100644 index 00000000000..b92085bd371 --- /dev/null +++ b/jps/jps-plugin/testData/android/simple/simple.iml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/jps/jps-plugin/testData/android/simple/simple.ipr b/jps/jps-plugin/testData/android/simple/simple.ipr new file mode 100644 index 00000000000..a80d5700fa2 --- /dev/null +++ b/jps/jps-plugin/testData/android/simple/simple.ipr @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/jps/jps-plugin/testData/android/simple/src/com/example/myapp/Foo.java b/jps/jps-plugin/testData/android/simple/src/com/example/myapp/Foo.java new file mode 100644 index 00000000000..03041b80591 --- /dev/null +++ b/jps/jps-plugin/testData/android/simple/src/com/example/myapp/Foo.java @@ -0,0 +1,10 @@ +package com.example.myapp; + +/** + * Created by miha on 8/6/14. + */ +public class Foo { + public static void main(String[] args) { + System.out.println(R.id.LOL); + } +} diff --git a/jps/jps-plugin/testData/android/simple/src/com/example/myapp/MyActivity.kt b/jps/jps-plugin/testData/android/simple/src/com/example/myapp/MyActivity.kt new file mode 100644 index 00000000000..38d44fe8136 --- /dev/null +++ b/jps/jps-plugin/testData/android/simple/src/com/example/myapp/MyActivity.kt @@ -0,0 +1,19 @@ +package com.example.myapp + +import android.app.Activity +import android.os.Bundle + +public class MyActivity : Activity() { + /** + * Called when the activity is first created. + */ + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.main) + println(R.id.LOL) + fuck + this.LOL + LOL.setText("UIGFVIYUGFKGYUFOD") + LOL.setText("test") + } +}