diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-06-19 18:52:49 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-06-20 16:15:48 +0300 |
commit | 24e3ebb492436ed53b7a4cda5fc7568004471b73 (patch) | |
tree | 8f9afc7426279f9f9324e6acf0afc62af227030f | |
parent | 438fffa8b59c3aca1fd016fbf11689b34eeb0976 (diff) | |
download | dokka-24e3ebb492436ed53b7a4cda5fc7568004471b73.tar.gz dokka-24e3ebb492436ed53b7a4cda5fc7568004471b73.tar.bz2 dokka-24e3ebb492436ed53b7a4cda5fc7568004471b73.zip |
Add android integration test, multi-flavour app test
42 files changed, 783 insertions, 1 deletions
@@ -86,4 +86,7 @@ gradle-app.setting # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 # gradle/wrapper/gradle-wrapper.properties -!lib/*.jar
\ No newline at end of file +!lib/*.jar + +local.properties +android.local.properties
\ No newline at end of file diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt index f93e1868..255138a9 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt @@ -17,6 +17,8 @@ val androidPluginClasspathData = pluginClasspathData.resolveSibling("android-dok val dokkaFatJarPathData = pluginClasspathData.resolveSibling("fatjar.txt") +val androidLocalProperties = testDataFolder.resolve("android.local.properties").let { if (Files.exists(it)) it else null } + abstract class AbstractDokkaGradleTest { @get:Rule val testProjectDir = TemporaryFolder() diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt new file mode 100644 index 00000000..de22a980 --- /dev/null +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidAppTest.kt @@ -0,0 +1,66 @@ +package org.jetbrains.dokka.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.junit.Test +import java.io.File +import java.nio.file.Files +import kotlin.test.assertEquals + +class AndroidAppTest : AbstractDokkaGradleTest() { + override val pluginClasspath: List<File> = androidPluginClasspathData.toFile().readLines().map { File(it) } + + fun prepareTestData(testDataRootPath: String) { + val testDataRoot = testDataFolder.resolve(testDataRootPath) + val tmpRoot = testProjectDir.root.toPath() + + testDataRoot.resolve("app").copy(tmpRoot.resolve("app")) + testDataRoot.resolve("build.gradle").copy(tmpRoot.resolve("build.gradle")) + testDataRoot.resolve("settings.gradle").copy(tmpRoot.resolve("settings.gradle")) + + androidLocalProperties?.copy(tmpRoot.resolve("local.properties")) + } + + + data class AndroidPluginParams(val pluginVersion: String, val buildToolsVersion: String, val compileSdk: Int) { + fun asArguments(): List<String> = listOf( + "-Pabt_plugin_version=$pluginVersion", + "-Pabt_version=$buildToolsVersion", + "-Psdk_version=$compileSdk" + ) + } + + + private fun doTest(gradleVersion: String, kotlinVersion: String, androidPluginParams: AndroidPluginParams) { + prepareTestData("androidApp") + + val result = configure(gradleVersion, kotlinVersion, + arguments = arrayOf("dokka", "--stacktrace") + androidPluginParams.asArguments()) + .build() + + println(result.output) + + assertEquals(TaskOutcome.SUCCESS, result.task(":app:dokka")?.outcome) + + val docsOutput = "app/build/dokka" + + checkOutputStructure("androidApp/fileTree.txt", docsOutput) + + checkNoErrorClasses(docsOutput) + checkNoUnresolvedLinks(docsOutput) + + checkExternalLink(docsOutput, "<span class=\"identifier\">Activity</span>", + """<a href="https://developer.android.com/reference/android/app/Activity.html"><span class="identifier">Activity</span></a>""") + } + + @Test fun `test kotlin 1_1_2-5 and gradle 4_0 and abt 3_0_0-alpha3`() { + doTest("4.0", "1.1.2-5", AndroidPluginParams("3.0.0-alpha3", "25.0.2", 25)) + } + + @Test fun `test kotlin 1_1_2 and gradle 3_5 and abt 2_3_0`() { + doTest("3.5", "1.1.2", AndroidPluginParams("2.3.0", "25.0.0", 24)) + } + + @Test fun `test kotlin 1_0_7 and gradle 2_14_1 and abt 2_2_3`() { + doTest("2.14.1", "1.0.7", AndroidPluginParams("2.2.3", "25.0.0", 24)) + } +}
\ No newline at end of file diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt new file mode 100644 index 00000000..aee0e14c --- /dev/null +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidMultiFlavourAppTest.kt @@ -0,0 +1,58 @@ +package org.jetbrains.dokka.gradle + +import org.gradle.testkit.runner.TaskOutcome +import org.jetbrains.dokka.gradle.AndroidAppTest.AndroidPluginParams +import org.junit.Test +import java.io.File +import kotlin.test.assertEquals + +class AndroidMultiFlavourAppTest : AbstractDokkaGradleTest() { + override val pluginClasspath: List<File> = androidPluginClasspathData.toFile().readLines().map { File(it) } + + fun prepareTestData(testDataRootPath: String) { + val testDataRoot = testDataFolder.resolve(testDataRootPath) + val tmpRoot = testProjectDir.root.toPath() + + testDataRoot.resolve("app").copy(tmpRoot.resolve("app")) + testDataRoot.resolve("build.gradle").copy(tmpRoot.resolve("build.gradle")) + testDataRoot.resolve("settings.gradle").copy(tmpRoot.resolve("settings.gradle")) + + androidLocalProperties?.copy(tmpRoot.resolve("local.properties")) + } + + private fun doTest(gradleVersion: String, kotlinVersion: String, androidPluginParams: AndroidPluginParams) { + prepareTestData("androidMultiFlavourApp") + + val result = configure(gradleVersion, kotlinVersion, + arguments = arrayOf("dokka", "dokkaFullFlavourOnly", "--stacktrace") + androidPluginParams.asArguments()) + .build() + + println(result.output) + + assertEquals(TaskOutcome.SUCCESS, result.task(":app:dokka")?.outcome) + assertEquals(TaskOutcome.SUCCESS, result.task(":app:dokkaFullFlavourOnly")?.outcome) + + val docsOutput = "app/build/dokka" + + checkOutputStructure("androidMultiFlavourApp/fileTree.txt", docsOutput) + + checkNoErrorClasses(docsOutput) + checkNoUnresolvedLinks(docsOutput) + + checkExternalLink(docsOutput, "<span class=\"identifier\">Activity</span>", + """<a href="https://developer.android.com/reference/android/app/Activity.html"><span class="identifier">Activity</span></a>""") + } + + @Test fun `test kotlin 1_1_2-5 and gradle 4_0 and abt 3_0_0-alpha3`() { + doTest("4.0", "1.1.2-5", AndroidPluginParams("3.0.0-alpha3", "25.0.2", 25)) + } + + @Test fun `test kotlin 1_1_2 and gradle 3_5 and abt 2_3_0`() { + doTest("3.5", "1.1.2", AndroidPluginParams("2.3.0", "25.0.0", 24)) + } + + @Test fun `test kotlin 1_0_7 and gradle 2_14_1 and abt 2_2_3`() { + doTest("2.14.1", "1.0.7", AndroidPluginParams("2.2.3", "25.0.0", 24)) + } + +}
\ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidApp/app/build.gradle b/runners/gradle-integration-tests/testData/androidApp/app/build.gradle new file mode 100644 index 00000000..1555de9f --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/build.gradle @@ -0,0 +1,50 @@ +buildscript { + repositories { + jcenter() + mavenLocal() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$test_kotlin_version" + } +} + +plugins { + id 'org.jetbrains.dokka-android' +} + + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' +apply plugin: 'org.jetbrains.dokka-android' + +android { + compileSdkVersion Integer.parseInt(sdk_version) + buildToolsVersion abt_version + + defaultConfig { + applicationId "org.example.kotlin.mixed" + minSdkVersion 14 + targetSdkVersion Integer.parseInt(sdk_version) + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt') + } + } + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$test_kotlin_version" +} + + +dokka { + dokkaFatJar = new File(dokka_fatjar) +}
\ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/AndroidManifest.xml b/runners/gradle-integration-tests/testData/androidApp/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..b4e1a892 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="org.example.kotlin.mixed" > + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" > + + <activity + android:name=".JavaActivity" + android:label="@string/title_activity_main_activity1" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + <activity + android:name=".KotlinActivity" + android:label="@string/title_activity_main_activity2" /> + + </application> + +</manifest> diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/java/org/example/kotlin/mixed/JavaActivity.java b/runners/gradle-integration-tests/testData/androidApp/app/src/main/java/org/example/kotlin/mixed/JavaActivity.java new file mode 100644 index 00000000..3668c594 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/java/org/example/kotlin/mixed/JavaActivity.java @@ -0,0 +1,34 @@ +package org.example.kotlin.mixed; + +import android.content.Intent; +import android.os.Bundle; +import android.app.Activity; +import android.view.Menu; +import android.view.View; +import android.widget.Button; + +public class JavaActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Button next = (Button) findViewById(R.id.Button01); + next.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + Intent myIntent = new Intent(view.getContext(), KotlinActivity.class); + startActivityForResult(myIntent, 0); + } + }); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.main, menu); + return true; + } + +} diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/kotlin/org/example/kotlin/mixed/KotlinActivity.kt b/runners/gradle-integration-tests/testData/androidApp/app/src/main/kotlin/org/example/kotlin/mixed/KotlinActivity.kt new file mode 100644 index 00000000..ca2f27b0 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/kotlin/org/example/kotlin/mixed/KotlinActivity.kt @@ -0,0 +1,28 @@ +package org.example.kotlin.mixed + +import android.content.Intent +import android.os.Bundle +import android.app.Activity +import android.view.Menu +import android.widget.Button + +class KotlinActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main2) + + val next = findViewById(R.id.Button02) as Button + next.setOnClickListener { + val intent: Intent = Intent() + setResult(RESULT_OK, intent) + finish() + } + } + + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + // Inflate the menu; this adds items to the action bar if it is present. + menuInflater.inflate(R.menu.main_activity2, menu) + return true + } +} diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..96a442e5 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..359047df --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-xhdpi/ic_launcher.png b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..71c6d760 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/layout/activity_main.xml b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..ede57c39 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,24 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + tools:context=".MainActivity"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Activity 1" /> + + <Button android:text="Next" + android:id="@+id/Button01" + android:layout_width="250px" + android:textSize="18px" + android:layout_height="55px"> + </Button> + +</LinearLayout> diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/layout/activity_main2.xml b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/layout/activity_main2.xml new file mode 100644 index 00000000..d707536a --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/layout/activity_main2.xml @@ -0,0 +1,24 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + tools:context=".MainActivity"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Activity 2" /> + + <Button android:text="Next" + android:id="@+id/Button02" + android:layout_width="250px" + android:textSize="18px" + android:layout_height="55px"> + </Button> + +</LinearLayout> diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/menu/main.xml b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/menu/main.xml new file mode 100644 index 00000000..f3b10b6c --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/menu/main.xml @@ -0,0 +1,6 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@+id/action_settings" + android:title="@string/action_settings" + android:orderInCategory="100" + android:showAsAction="never" /> +</menu> diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/menu/main_activity2.xml b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/menu/main_activity2.xml new file mode 100644 index 00000000..f3b10b6c --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/menu/main_activity2.xml @@ -0,0 +1,6 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@+id/action_settings" + android:title="@string/action_settings" + android:orderInCategory="100" + android:showAsAction="never" /> +</menu> diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/dimens.xml b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/dimens.xml new file mode 100644 index 00000000..47c82246 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ +<resources> + <!-- Default screen margins, per the Android Design guidelines. --> + <dimen name="activity_horizontal_margin">16dp</dimen> + <dimen name="activity_vertical_margin">16dp</dimen> +</resources> diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/strings.xml b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..d8f08bc2 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/strings.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">AndroidSample</string> + <string name="action_settings">Settings</string> + <string name="hello_world">Hello world!</string> + <string name="title_activity_main_activity1">JavaActivity</string> + <string name="title_activity_main_activity2">KotlinActivity</string> + +</resources> diff --git a/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/styles.xml b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..6ce89c7b --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/app/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + +</resources> diff --git a/runners/gradle-integration-tests/testData/androidApp/build.gradle b/runners/gradle-integration-tests/testData/androidApp/build.gradle new file mode 100644 index 00000000..59477b52 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/build.gradle @@ -0,0 +1,21 @@ +buildscript { + repositories { + mavenCentral() + jcenter() + maven { url 'https://maven.google.com' } + maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } + } + dependencies { + classpath "com.android.tools.build:gradle:$abt_plugin_version" + } +} + +allprojects { + repositories { + mavenCentral() + jcenter() + maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } + } +} diff --git a/runners/gradle-integration-tests/testData/androidApp/fileTree.txt b/runners/gradle-integration-tests/testData/androidApp/fileTree.txt new file mode 100644 index 00000000..3827b69e --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/fileTree.txt @@ -0,0 +1,19 @@ +/ + app/ + alltypes/ + index.html + index-outline.html + index.html + org.example.kotlin.mixed/ + -java-activity/ + -init-.html + index.html + on-create-options-menu.html + -kotlin-activity/ + -init-.html + index.html + on-create-options-menu.html + on-create.html + index.html + package-list + style.css diff --git a/runners/gradle-integration-tests/testData/androidApp/settings.gradle b/runners/gradle-integration-tests/testData/androidApp/settings.gradle new file mode 100644 index 00000000..1feb2867 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidApp/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = "androidApp" + +include ':app'
\ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle new file mode 100644 index 00000000..ee68ba6d --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/build.gradle @@ -0,0 +1,75 @@ +buildscript { + repositories { + jcenter() + mavenLocal() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$test_kotlin_version" + } +} + +plugins { + id 'org.jetbrains.dokka-android' +} + + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' +apply plugin: 'org.jetbrains.dokka-android' + +android { + compileSdkVersion Integer.parseInt(sdk_version) + buildToolsVersion abt_version + + defaultConfig { + applicationId "org.example.kotlin.mixed" + minSdkVersion 14 + targetSdkVersion Integer.parseInt(sdk_version) + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt') + } + } + + flavorDimensions "mode" + productFlavors { + free { + dimension "mode" + applicationIdSuffix ".free" + versionNameSuffix "-free" + } + full { + dimension "mode" + applicationIdSuffix ".full" + versionNameSuffix "-full" + } + } + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + free.java.srcDirs += 'src/free/kotlin' + } +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$test_kotlin_version" +} + + +dokka { + outputDirectory = "$buildDir/dokka/all" + dokkaFatJar = new File(dokka_fatjar) +} + +task dokkaFullFlavourOnly(type: org.jetbrains.dokka.gradle.DokkaAndroidTask) { + kotlinTasks { + ["compileFullReleaseKotlin"] + } + dokkaFatJar = new File(dokka_fatjar) + outputDirectory = "$buildDir/dokka/fullOnly" + moduleName = "full" +}
\ No newline at end of file diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/AndroidManifest.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/AndroidManifest.xml new file mode 100644 index 00000000..3ecbcd3a --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/AndroidManifest.xml @@ -0,0 +1,9 @@ +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> + + <application> + <activity + android:name="org.example.kotlin.mixed.free.AdActivity" + android:label="@string/title_activity_ad" + android:theme="@style/AppTheme"></activity> + </application> +</manifest> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/kotlin/org/example/kotlin/mixed/free/AdActivity.kt b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/kotlin/org/example/kotlin/mixed/free/AdActivity.kt new file mode 100644 index 00000000..b0b980fd --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/kotlin/org/example/kotlin/mixed/free/AdActivity.kt @@ -0,0 +1,14 @@ +package org.example.kotlin.mixed.free + +import android.os.Bundle +import android.app.Activity +import org.example.kotlin.mixed.R + +class AdActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_ad) + } + +} diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/res/layout/activity_ad.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/res/layout/activity_ad.xml new file mode 100644 index 00000000..e6443d05 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/res/layout/activity_ad.xml @@ -0,0 +1,24 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + tools:context=".free.AdActivity"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Advertisment" /> + + <Button android:text="Next" + android:id="@+id/Button02" + android:layout_width="250px" + android:textSize="18px" + android:layout_height="55px"> + </Button> + +</LinearLayout> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/res/values/strings.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/res/values/strings.xml new file mode 100644 index 00000000..bbdf2d06 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/free/res/values/strings.xml @@ -0,0 +1,3 @@ +<resources> + <string name="title_activity_ad">AdActivity</string> +</resources> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/AndroidManifest.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..b4e1a892 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="org.example.kotlin.mixed" > + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" > + + <activity + android:name=".JavaActivity" + android:label="@string/title_activity_main_activity1" > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + + <activity + android:name=".KotlinActivity" + android:label="@string/title_activity_main_activity2" /> + + </application> + +</manifest> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/java/org/example/kotlin/mixed/JavaActivity.java b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/java/org/example/kotlin/mixed/JavaActivity.java new file mode 100644 index 00000000..3668c594 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/java/org/example/kotlin/mixed/JavaActivity.java @@ -0,0 +1,34 @@ +package org.example.kotlin.mixed; + +import android.content.Intent; +import android.os.Bundle; +import android.app.Activity; +import android.view.Menu; +import android.view.View; +import android.widget.Button; + +public class JavaActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Button next = (Button) findViewById(R.id.Button01); + next.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + Intent myIntent = new Intent(view.getContext(), KotlinActivity.class); + startActivityForResult(myIntent, 0); + } + }); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.main, menu); + return true; + } + +} diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/kotlin/org/example/kotlin/mixed/KotlinActivity.kt b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/kotlin/org/example/kotlin/mixed/KotlinActivity.kt new file mode 100644 index 00000000..ca2f27b0 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/kotlin/org/example/kotlin/mixed/KotlinActivity.kt @@ -0,0 +1,28 @@ +package org.example.kotlin.mixed + +import android.content.Intent +import android.os.Bundle +import android.app.Activity +import android.view.Menu +import android.widget.Button + +class KotlinActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main2) + + val next = findViewById(R.id.Button02) as Button + next.setOnClickListener { + val intent: Intent = Intent() + setResult(RESULT_OK, intent) + finish() + } + } + + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + // Inflate the menu; this adds items to the action bar if it is present. + menuInflater.inflate(R.menu.main_activity2, menu) + return true + } +} diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..96a442e5 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..359047df --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-xhdpi/ic_launcher.png b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 00000000..71c6d760 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/layout/activity_main.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..ede57c39 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,24 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + tools:context=".MainActivity"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Activity 1" /> + + <Button android:text="Next" + android:id="@+id/Button01" + android:layout_width="250px" + android:textSize="18px" + android:layout_height="55px"> + </Button> + +</LinearLayout> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/layout/activity_main2.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/layout/activity_main2.xml new file mode 100644 index 00000000..d707536a --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/layout/activity_main2.xml @@ -0,0 +1,24 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + android:paddingBottom="@dimen/activity_vertical_margin" + tools:context=".MainActivity"> + + <TextView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Activity 2" /> + + <Button android:text="Next" + android:id="@+id/Button02" + android:layout_width="250px" + android:textSize="18px" + android:layout_height="55px"> + </Button> + +</LinearLayout> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/menu/main.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/menu/main.xml new file mode 100644 index 00000000..f3b10b6c --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/menu/main.xml @@ -0,0 +1,6 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@+id/action_settings" + android:title="@string/action_settings" + android:orderInCategory="100" + android:showAsAction="never" /> +</menu> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/menu/main_activity2.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/menu/main_activity2.xml new file mode 100644 index 00000000..f3b10b6c --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/menu/main_activity2.xml @@ -0,0 +1,6 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@+id/action_settings" + android:title="@string/action_settings" + android:orderInCategory="100" + android:showAsAction="never" /> +</menu> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/dimens.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/dimens.xml new file mode 100644 index 00000000..47c82246 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ +<resources> + <!-- Default screen margins, per the Android Design guidelines. --> + <dimen name="activity_horizontal_margin">16dp</dimen> + <dimen name="activity_vertical_margin">16dp</dimen> +</resources> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/strings.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..d8f08bc2 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/strings.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">AndroidSample</string> + <string name="action_settings">Settings</string> + <string name="hello_world">Hello world!</string> + <string name="title_activity_main_activity1">JavaActivity</string> + <string name="title_activity_main_activity2">KotlinActivity</string> + +</resources> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/styles.xml b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..6ce89c7b --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/app/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + +</resources> diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/build.gradle b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/build.gradle new file mode 100644 index 00000000..59477b52 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/build.gradle @@ -0,0 +1,21 @@ +buildscript { + repositories { + mavenCentral() + jcenter() + maven { url 'https://maven.google.com' } + maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } + } + dependencies { + classpath "com.android.tools.build:gradle:$abt_plugin_version" + } +} + +allprojects { + repositories { + mavenCentral() + jcenter() + maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } + } +} diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/fileTree.txt b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/fileTree.txt new file mode 100644 index 00000000..5e969d8b --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/fileTree.txt @@ -0,0 +1,45 @@ +/ + all/ + app/ + alltypes/ + index.html + index-outline.html + index.html + org.example.kotlin.mixed/ + -java-activity/ + -init-.html + index.html + on-create-options-menu.html + -kotlin-activity/ + -init-.html + index.html + on-create-options-menu.html + on-create.html + index.html + org.example.kotlin.mixed.free/ + -ad-activity/ + -init-.html + index.html + on-create.html + index.html + package-list + style.css + fullOnly/ + full/ + alltypes/ + index.html + index-outline.html + index.html + org.example.kotlin.mixed/ + -java-activity/ + -init-.html + index.html + on-create-options-menu.html + -kotlin-activity/ + -init-.html + index.html + on-create-options-menu.html + on-create.html + index.html + package-list + style.css diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/settings.gradle b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/settings.gradle new file mode 100644 index 00000000..1feb2867 --- /dev/null +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = "androidApp" + +include ':app'
\ No newline at end of file |