diff --git a/compiler/android-tests/android-module/android-module.iml b/compiler/android-tests/android-module/android-module.iml
new file mode 100644
index 00000000000..29057e99fbf
--- /dev/null
+++ b/compiler/android-tests/android-module/android-module.iml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /res-overlay
+
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/compiler/android-tests/android-module/android-module.ipr b/compiler/android-tests/android-module/android-module.ipr
new file mode 100644
index 00000000000..6d88254ff08
--- /dev/null
+++ b/compiler/android-tests/android-module/android-module.ipr
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/compiler/android-tests/android-module/res/values/strings.xml b/compiler/android-tests/android-module/res/values/strings.xml
new file mode 100644
index 00000000000..ab73ea8e812
--- /dev/null
+++ b/compiler/android-tests/android-module/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+
+ android1
+
diff --git a/compiler/android-tests/android-module/src/org/jetbrains/jet/compiler/android/MyActivity.java b/compiler/android-tests/android-module/src/org/jetbrains/jet/compiler/android/MyActivity.java
new file mode 100644
index 00000000000..dcc2f36e308
--- /dev/null
+++ b/compiler/android-tests/android-module/src/org/jetbrains/jet/compiler/android/MyActivity.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010-2012 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.compiler.android;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class MyActivity extends Activity {
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ System.out.println(R.string.app_name);
+ }
+}
\ No newline at end of file
diff --git a/compiler/android-tests/android-tests.iml b/compiler/android-tests/android-tests.iml
index 82dfa01213e..30dba87a875 100644
--- a/compiler/android-tests/android-tests.iml
+++ b/compiler/android-tests/android-tests.iml
@@ -14,6 +14,7 @@
+
diff --git a/compiler/android-tests/src/org/jetbrains/jet/compiler/CodegenTestsOnAndroidRunner.java b/compiler/android-tests/src/org/jetbrains/jet/compiler/CodegenTestsOnAndroidRunner.java
index 67ab11f2375..431c888691b 100644
--- a/compiler/android-tests/src/org/jetbrains/jet/compiler/CodegenTestsOnAndroidRunner.java
+++ b/compiler/android-tests/src/org/jetbrains/jet/compiler/CodegenTestsOnAndroidRunner.java
@@ -62,9 +62,6 @@ public class CodegenTestsOnAndroidRunner {
// If map is empty => there are no failed tests
if (resultMap.isEmpty()) {
- // Clear tmp folder where we run android tests
- FileUtil.delete(new File(pathManager.getTmpFolder()));
-
statistics = parseOutputForTestsNumberIfTestsPassed(resultOutput);
}
else {
diff --git a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/AndroidJpsBuildTestCase.java b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/AndroidJpsBuildTestCase.java
new file mode 100644
index 00000000000..52f7a5972d2
--- /dev/null
+++ b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/AndroidJpsBuildTestCase.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2010-2012 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.compiler.android;
+
+import org.jetbrains.jps.builders.JpsBuildTestCase;
+
+import java.io.File;
+import java.io.IOException;
+
+public class AndroidJpsBuildTestCase extends JpsBuildTestCase {
+ private static final String PROJECT_NAME = "android-module";
+ private static final String SDK_NAME = "Android_SDK";
+
+ private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
+
+ public void doTest() {
+ initProject();
+ rebuildAll();
+ makeAll().assertSuccessful();
+ }
+
+ @Override
+ protected String getProjectName() {
+ return "android-module";
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ doTest();
+ }
+
+ @Override
+ public String getName() {
+ return "AndroidJpsTest";
+ }
+
+ @Override
+ protected File doGetProjectDir() throws IOException {
+ return workDir;
+ }
+
+ private void initProject() {
+ addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
+ loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
+ }
+}
diff --git a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/AndroidRunner.java b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/AndroidRunner.java
index 035a9ca794e..c5c165887d7 100644
--- a/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/AndroidRunner.java
+++ b/compiler/android-tests/tests/org/jetbrains/jet/compiler/android/AndroidRunner.java
@@ -19,6 +19,7 @@ package org.jetbrains.jet.compiler.android;
import com.google.common.io.Files;
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.TestSuite;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.compiler.CodegenTestsOnAndroidRunner;
import org.jetbrains.jet.compiler.PathManager;
@@ -30,24 +31,34 @@ import java.io.File;
public class AndroidRunner extends TestSuite {
+ private static PathManager pathManager;
+
+ @NotNull
+ public static PathManager getPathManager() {
+ if (pathManager == null) {
+ File tmpFolder = Files.createTempDir();
+ System.out.println("Created temporary folder for running android tests: " + tmpFolder.getAbsolutePath());
+ File rootFolder = new File("");
+ pathManager = new PathManager(rootFolder.getAbsolutePath(), tmpFolder.getAbsolutePath());
+ }
+ return pathManager;
+ }
+
public static TestSuite suite() throws Throwable {
- File tmpFolder = Files.createTempDir();
- System.out.println("Created temporary folder for running android tests: " + tmpFolder.getAbsolutePath());
- File rootFolder = new File("");
- PathManager pathManager = new PathManager(rootFolder.getAbsolutePath(), tmpFolder.getAbsolutePath());
+ PathManager pathManager = getPathManager();
FileUtil.copyDir(new File(pathManager.getAndroidModuleRoot()), new File(pathManager.getTmpFolder()));
- try {
- CodegenTestsOnAndroidGenerator.generate(pathManager);
- }
- catch(Throwable e) {
- FileUtil.delete(new File(pathManager.getTmpFolder()));
- throw new RuntimeException(e);
- }
-
+ CodegenTestsOnAndroidGenerator.generate(pathManager);
+
System.out.println("Run tests on android...");
- return CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
+ TestSuite suite = CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
+ suite.addTest(new AndroidJpsBuildTestCase());
+ return suite;
+ }
+
+ public void tearDown() throws Exception {
+ // Clear tmp folder where we run android tests
+ FileUtil.delete(new File(pathManager.getTmpFolder()));
}
-
}