Merge pull request #298 from nskvortsov/master
kotlin-android plugin doesn't work with android-library plugin #KT-3911 Fixed
This commit is contained in:
+26
-23
@@ -1,27 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root>
|
||||
<item name="org.gradle.api.plugins.Convention T getPlugin(java.lang.Class<T>)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.Convention java.util.Map<java.lang.String,java.lang.Object> getPlugins()">
|
||||
<annotation name="jet.runtime.typeinfo.KotlinSignature">
|
||||
<val name="value" val=""fun getPlugins() : MutableMap<String, Any>"" />
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.Convention org.gradle.api.internal.DynamicObject getExtensionsAsDynamicObject()">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name="jet.runtime.typeinfo.KotlinSignature">
|
||||
<val name="value" val=""fun getExtensionsAsDynamicObject() : DynamicObject"" />
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.ExtensionAware org.gradle.api.plugins.ExtensionContainer getExtensions()">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.PluginContainer T apply(java.lang.Class<T>)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.PluginContainer org.gradle.api.Plugin apply(java.lang.String)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.Convention T getPlugin(java.lang.Class<T>)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.Convention java.util.Map<java.lang.String,java.lang.Object> getPlugins()">
|
||||
<annotation name="jet.runtime.typeinfo.KotlinSignature">
|
||||
<val name="value" val=""fun getPlugins() : MutableMap<String, Any>"" />
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.Convention org.gradle.api.internal.DynamicObject getExtensionsAsDynamicObject()">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
<annotation name="jet.runtime.typeinfo.KotlinSignature">
|
||||
<val name="value" val=""fun getExtensionsAsDynamicObject() : DynamicObject"" />
|
||||
</annotation>
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.ExtensionAware org.gradle.api.plugins.ExtensionContainer getExtensions()">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.PluginContainer T apply(java.lang.Class<T>)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name="org.gradle.api.plugins.PluginContainer org.gradle.api.Plugin apply(java.lang.String)">
|
||||
<annotation name="org.jetbrains.annotations.NotNull" />
|
||||
</item>
|
||||
<item name='org.gradle.api.plugins.PluginContainer org.gradle.api.Plugin findPlugin(java.lang.String)'>
|
||||
<annotation name='org.jetbrains.annotations.Nullable'/>
|
||||
</item>
|
||||
</root>
|
||||
|
||||
|
||||
+2
-2
@@ -241,9 +241,9 @@ open class KotlinAndroidPlugin: Plugin<Project> {
|
||||
}
|
||||
|
||||
kotlinTask.doFirst({ task ->
|
||||
var plugin = project.getPlugins().getPlugin("android")
|
||||
var plugin = project.getPlugins().findPlugin("android")
|
||||
if (null == plugin) {
|
||||
plugin = project.getPlugins().getPlugin("android-library")
|
||||
plugin = project.getPlugins().findPlugin("android-library")
|
||||
}
|
||||
val basePlugin : BasePlugin = plugin as BasePlugin
|
||||
val javaSources = project.files(javaSourceList)
|
||||
|
||||
+6
-12
@@ -58,6 +58,8 @@ class KotlinAndroidGradleIT {
|
||||
println(buildOutput)
|
||||
|
||||
assertEquals(result, 0)
|
||||
|
||||
assertTrue(buildOutput.contains(":LibAlfa:compileReleaseKotlin"), "Should contain ':LibAlfa:compileReleaseKotlin'")
|
||||
assertTrue(buildOutput.contains(":compileFlavor1DebugKotlin"), "Should contain ':compileFlavor1DebugKotlin'")
|
||||
assertTrue(buildOutput.contains(":compileFlavor2DebugKotlin"), "Should contain ':compileFlavor2DebugKotlin'")
|
||||
assertTrue(buildOutput.contains(":compileFlavor1JnidebugKotlin"), "Should contain ':compileFlavor1JnidebugKotlin'")
|
||||
@@ -92,18 +94,9 @@ class KotlinAndroidGradleIT {
|
||||
println(up2dateBuildOutput)
|
||||
|
||||
assertEquals(up2dateResult, 0)
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor1DebugKotlin UP-TO-DATE"), "Should contain ':compileFlavor1DebugKotlin UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor2DebugKotlin UP-TO-DATE"), "Should contain ':compileFlavor2DebugKotlin UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor1JnidebugKotlin UP-TO-DATE"), "Should contain ':compileFlavor1JnidebugKotlin' UP-TO-DATE")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor1ReleaseKotlin UP-TO-DATE"), "Should contain ':compileFlavor1ReleaseKotlin UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor2JnidebugKotlin UP-TO-DATE"), "Should contain ':compileFlavor2JnidebugKotlin UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor2ReleaseKotlin UP-TO-DATE"), "Should contain ':compileFlavor2ReleaseKotlin UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor1Debug UP-TO-DATE"), "Should contain ':compileFlavor1Debug UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor2Debug UP-TO-DATE"), "Should contain ':compileFlavor2Debug UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor1Jnidebug UP-TO-DATE"), "Should contain ':compileFlavor1Jnidebug UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor2Jnidebug UP-TO-DATE"), "Should contain ':compileFlavor2Jnidebug UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor1Release UP-TO-DATE"), "Should contain ':compileFlavor1Release UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":compileFlavor2Release UP-TO-DATE"), "Should contain ':compileFlavor2Release UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":LibAlfa:compileReleaseKotlin UP-TO-DATE"), "Should contain ':LibAlfa:compileReleaseKotlin UP-TO-DATE'")
|
||||
assertTrue(up2dateBuildOutput.contains(":LibAlfa:compileRelease UP-TO-DATE"), "Should contain ':LibAlfa:compileReleas UP-TO-DATE'")
|
||||
|
||||
|
||||
// Run the build third time, re-run tasks
|
||||
|
||||
@@ -126,6 +119,7 @@ class KotlinAndroidGradleIT {
|
||||
println(rebuildOutput)
|
||||
|
||||
assertEquals(reresult, 0)
|
||||
assertTrue(buildOutput.contains(":LibAlfa:compileReleaseKotlin"), "Should contain ':LibAlfa:compileReleaseKotlin'")
|
||||
assertTrue(rebuildOutput.contains(":compileFlavor1DebugKotlin"), "Should contain ':compileFlavor1DebugKotlin'")
|
||||
assertTrue(rebuildOutput.contains(":compileFlavor2DebugKotlin"), "Should contain ':compileFlavor2DebugKotlin'")
|
||||
assertTrue(rebuildOutput.contains(":compileFlavor1JnidebugKotlin"), "Should contain ':compileFlavor1JnidebugKotlin'")
|
||||
|
||||
+2
-2
@@ -7,14 +7,14 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.1-SNAPSHOT'
|
||||
classpath 'com.android.tools.build:gradle:0.4'
|
||||
classpath 'com.android.tools.build:gradle:0.5.+'
|
||||
}
|
||||
}
|
||||
apply plugin: 'android'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
dependencies {
|
||||
compile files('libs/android-support-v4.jar')
|
||||
compile project(':LibAlfa')
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url 'file://' + pathToKotlinPlugin
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:0.1-SNAPSHOT'
|
||||
classpath 'com.android.tools.build:gradle:0.5.+'
|
||||
}
|
||||
}
|
||||
apply plugin: 'android-library'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile files('libs/android-support-v4.jar')
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 17
|
||||
buildToolsVersion "17.0.0"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 7
|
||||
targetSdkVersion 16
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.jetbrains.kotlin.gradle.test.android.libalfa"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="17"
|
||||
android:targetSdkVersion="17" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name="org.jetbrains.kotlin.gradle.test.android.libalfa.LibMainActivity"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
+23
@@ -0,0 +1,23 @@
|
||||
package org.jetbrains.kotlin.gradle.test.android.libalfa;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.view.Menu;
|
||||
|
||||
public class LibMainActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.lib_activity_main);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.lib_main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
fun foo() {
|
||||
}
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
+16
@@ -0,0 +1,16 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
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=".LibMainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/hello_world" />
|
||||
|
||||
</RelativeLayout>
|
||||
+6
@@ -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>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<!-- Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw600dp devices (e.g. 7" tablets) here. -->
|
||||
</resources>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<!-- Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. -->
|
||||
<dimen name="activity_horizontal_margin">128dp</dimen>
|
||||
</resources>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme for API 11+. This theme completely replaces
|
||||
AppBaseTheme from res/values/styles.xml on API 11+ devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
|
||||
<!-- API 11 theme customizations can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Base application theme for API 14+. This theme completely replaces
|
||||
AppBaseTheme from BOTH res/values/styles.xml and
|
||||
res/values-v11/styles.xml on API 14+ devices.
|
||||
-->
|
||||
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
|
||||
<!-- API 14 theme customizations can go here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
+5
@@ -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>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">LibAlfa</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="hello_world">Hello world!</string>
|
||||
|
||||
</resources>
|
||||
+20
@@ -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>
|
||||
+1
-1
@@ -1 +1 @@
|
||||
include ':AndroidAlfa'
|
||||
include ':AndroidAlfa', ':LibAlfa'
|
||||
|
||||
Reference in New Issue
Block a user