Skip to content

Commit 582f0d4

Browse files
fix Kotlin MPP project not being configured when Android plugin is present (#351)
* fix Kotlin MPP project not being configured when Android plugin is present * Apply suggestions from code review * add integration test for Kotlin MPP with Android * Update plugin/src/integrationTest/kotlin/com/vanniktech/maven/publish/MavenPublishPluginIntegrationTest.kt * add withDebug to Gradle Runner Co-authored-by: Niklas Baudy <niklas.baudy@vanniktech.de>
1 parent 399b0f9 commit 582f0d4

File tree

16 files changed

+482
-11
lines changed

16 files changed

+482
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal()
4+
mavenCentral()
5+
google()
6+
}
7+
8+
dependencies {
9+
classpath "com.vanniktech:gradle-maven-publish-plugin:${System.getProperty("com.vanniktech.publish.version")}"
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
11+
classpath "com.android.tools.build:gradle:7.1.2"
12+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.10"
13+
}
14+
}
15+
16+
apply plugin: "com.android.library"
17+
apply plugin: "org.jetbrains.kotlin.multiplatform"
18+
apply plugin: "org.jetbrains.dokka"
19+
apply plugin: "com.vanniktech.maven.publish"
20+
21+
android {
22+
compileSdkVersion = 31
23+
namespace = "com.test"
24+
}
25+
26+
kotlin {
27+
jvm()
28+
js("nodeJs") {
29+
nodejs()
30+
}
31+
linuxX64("linux")
32+
android {
33+
publishLibraryVariants("release", "debug")
34+
}
35+
36+
sourceSets {
37+
commonMain {
38+
dependencies {
39+
}
40+
}
41+
jvmMain {
42+
dependencies {
43+
}
44+
}
45+
nodeJsMain {
46+
dependencies {
47+
}
48+
}
49+
linuxMain {
50+
dependencies {
51+
}
52+
}
53+
}
54+
}
55+
56+
apply from: "maven-publish.gradle"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<!-- This module was also published with a richer model, Gradle metadata, -->
5+
<!-- which should be used instead. Do not delete the following line which -->
6+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
7+
<!-- that they should prefer consuming it instead. -->
8+
<!-- do_not_remove: published-with-gradle-metadata -->
9+
<modelVersion>4.0.0</modelVersion>
10+
<groupId>com.example</groupId>
11+
<artifactId>test-artifact</artifactId>
12+
<version>1.0.0</version>
13+
<name>Gradle Maven Publish Plugin Test Artifact</name>
14+
<description>Testing the Gradle Maven Publish Plugin</description>
15+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
16+
<inceptionYear>2018</inceptionYear>
17+
<licenses>
18+
<license>
19+
<name>The Apache Software License, Version 2.0</name>
20+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
21+
<distribution>repo</distribution>
22+
</license>
23+
</licenses>
24+
<developers>
25+
<developer>
26+
<id>vanniktech</id>
27+
<name>Niklas Baudy</name>
28+
<url>https://github.com/vanniktech/</url>
29+
</developer>
30+
</developers>
31+
<scm>
32+
<connection>scm:git:git://github.com/vanniktech/gradle-maven-publish-plugin.git</connection>
33+
<developerConnection>scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git</developerConnection>
34+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
35+
</scm>
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.jetbrains.kotlin</groupId>
39+
<artifactId>kotlin-stdlib-common</artifactId>
40+
<version>1.6.10</version>
41+
<scope>runtime</scope>
42+
</dependency>
43+
</dependencies>
44+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<!-- This module was also published with a richer model, Gradle metadata, -->
4+
<!-- which should be used instead. Do not delete the following line which -->
5+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
6+
<!-- that they should prefer consuming it instead. -->
7+
<!-- do_not_remove: published-with-gradle-metadata -->
8+
<modelVersion>4.0.0</modelVersion>
9+
<groupId>com.example</groupId>
10+
<artifactId>test-artifact-android</artifactId>
11+
<version>1.0.0</version>
12+
<packaging>aar</packaging>
13+
<name>Gradle Maven Publish Plugin Test Artifact</name>
14+
<description>Testing the Gradle Maven Publish Plugin</description>
15+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
16+
<inceptionYear>2018</inceptionYear>
17+
<licenses>
18+
<license>
19+
<name>The Apache Software License, Version 2.0</name>
20+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
21+
<distribution>repo</distribution>
22+
</license>
23+
</licenses>
24+
<developers>
25+
<developer>
26+
<id>vanniktech</id>
27+
<name>Niklas Baudy</name>
28+
<url>https://github.com/vanniktech/</url>
29+
</developer>
30+
</developers>
31+
<scm>
32+
<connection>scm:git:git://github.com/vanniktech/gradle-maven-publish-plugin.git</connection>
33+
<developerConnection>scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git</developerConnection>
34+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
35+
</scm>
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.jetbrains.kotlin</groupId>
39+
<artifactId>kotlin-stdlib-jdk8</artifactId>
40+
<version>1.6.10</version>
41+
<scope>compile</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.jetbrains.kotlin</groupId>
45+
<artifactId>kotlin-stdlib-common</artifactId>
46+
<version>1.6.10</version>
47+
<scope>compile</scope>
48+
</dependency>
49+
</dependencies>
50+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<!-- This module was also published with a richer model, Gradle metadata, -->
4+
<!-- which should be used instead. Do not delete the following line which -->
5+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
6+
<!-- that they should prefer consuming it instead. -->
7+
<!-- do_not_remove: published-with-gradle-metadata -->
8+
<modelVersion>4.0.0</modelVersion>
9+
<groupId>com.example</groupId>
10+
<artifactId>test-artifact-android-debug</artifactId>
11+
<version>1.0.0</version>
12+
<packaging>aar</packaging>
13+
<name>Gradle Maven Publish Plugin Test Artifact</name>
14+
<description>Testing the Gradle Maven Publish Plugin</description>
15+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
16+
<inceptionYear>2018</inceptionYear>
17+
<licenses>
18+
<license>
19+
<name>The Apache Software License, Version 2.0</name>
20+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
21+
<distribution>repo</distribution>
22+
</license>
23+
</licenses>
24+
<developers>
25+
<developer>
26+
<id>vanniktech</id>
27+
<name>Niklas Baudy</name>
28+
<url>https://github.com/vanniktech/</url>
29+
</developer>
30+
</developers>
31+
<scm>
32+
<connection>scm:git:git://github.com/vanniktech/gradle-maven-publish-plugin.git</connection>
33+
<developerConnection>scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git</developerConnection>
34+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
35+
</scm>
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.jetbrains.kotlin</groupId>
39+
<artifactId>kotlin-stdlib-jdk8</artifactId>
40+
<version>1.6.10</version>
41+
<scope>compile</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.jetbrains.kotlin</groupId>
45+
<artifactId>kotlin-stdlib-common</artifactId>
46+
<version>1.6.10</version>
47+
<scope>compile</scope>
48+
</dependency>
49+
</dependencies>
50+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<!-- This module was also published with a richer model, Gradle metadata, -->
4+
<!-- which should be used instead. Do not delete the following line which -->
5+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
6+
<!-- that they should prefer consuming it instead. -->
7+
<!-- do_not_remove: published-with-gradle-metadata -->
8+
<modelVersion>4.0.0</modelVersion>
9+
<groupId>com.example</groupId>
10+
<artifactId>test-artifact-jvm</artifactId>
11+
<version>1.0.0</version>
12+
<name>Gradle Maven Publish Plugin Test Artifact</name>
13+
<description>Testing the Gradle Maven Publish Plugin</description>
14+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
15+
<inceptionYear>2018</inceptionYear>
16+
<licenses>
17+
<license>
18+
<name>The Apache Software License, Version 2.0</name>
19+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
20+
<distribution>repo</distribution>
21+
</license>
22+
</licenses>
23+
<developers>
24+
<developer>
25+
<id>vanniktech</id>
26+
<name>Niklas Baudy</name>
27+
<url>https://github.com/vanniktech/</url>
28+
</developer>
29+
</developers>
30+
<scm>
31+
<connection>scm:git:git://github.com/vanniktech/gradle-maven-publish-plugin.git</connection>
32+
<developerConnection>scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git</developerConnection>
33+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
34+
</scm>
35+
<dependencies>
36+
<dependency>
37+
<groupId>org.jetbrains.kotlin</groupId>
38+
<artifactId>kotlin-stdlib-jdk8</artifactId>
39+
<version>1.6.10</version>
40+
<scope>compile</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.jetbrains.kotlin</groupId>
44+
<artifactId>kotlin-stdlib-common</artifactId>
45+
<version>1.6.10</version>
46+
<scope>compile</scope>
47+
</dependency>
48+
</dependencies>
49+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<!-- This module was also published with a richer model, Gradle metadata, -->
4+
<!-- which should be used instead. Do not delete the following line which -->
5+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
6+
<!-- that they should prefer consuming it instead. -->
7+
<!-- do_not_remove: published-with-gradle-metadata -->
8+
<modelVersion>4.0.0</modelVersion>
9+
<groupId>com.example</groupId>
10+
<artifactId>test-artifact-linux</artifactId>
11+
<version>1.0.0</version>
12+
<packaging>klib</packaging>
13+
<name>Gradle Maven Publish Plugin Test Artifact</name>
14+
<description>Testing the Gradle Maven Publish Plugin</description>
15+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
16+
<inceptionYear>2018</inceptionYear>
17+
<licenses>
18+
<license>
19+
<name>The Apache Software License, Version 2.0</name>
20+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
21+
<distribution>repo</distribution>
22+
</license>
23+
</licenses>
24+
<developers>
25+
<developer>
26+
<id>vanniktech</id>
27+
<name>Niklas Baudy</name>
28+
<url>https://github.com/vanniktech/</url>
29+
</developer>
30+
</developers>
31+
<scm>
32+
<connection>scm:git:git://github.com/vanniktech/gradle-maven-publish-plugin.git</connection>
33+
<developerConnection>scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git</developerConnection>
34+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
35+
</scm>
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.jetbrains.kotlin</groupId>
39+
<artifactId>kotlin-stdlib-common</artifactId>
40+
<version>1.6.10</version>
41+
<scope>compile</scope>
42+
</dependency>
43+
</dependencies>
44+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<!-- This module was also published with a richer model, Gradle metadata, -->
4+
<!-- which should be used instead. Do not delete the following line which -->
5+
<!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
6+
<!-- that they should prefer consuming it instead. -->
7+
<!-- do_not_remove: published-with-gradle-metadata -->
8+
<modelVersion>4.0.0</modelVersion>
9+
<groupId>com.example</groupId>
10+
<artifactId>test-artifact-nodejs</artifactId>
11+
<version>1.0.0</version>
12+
<name>Gradle Maven Publish Plugin Test Artifact</name>
13+
<description>Testing the Gradle Maven Publish Plugin</description>
14+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
15+
<inceptionYear>2018</inceptionYear>
16+
<licenses>
17+
<license>
18+
<name>The Apache Software License, Version 2.0</name>
19+
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
20+
<distribution>repo</distribution>
21+
</license>
22+
</licenses>
23+
<developers>
24+
<developer>
25+
<id>vanniktech</id>
26+
<name>Niklas Baudy</name>
27+
<url>https://github.com/vanniktech/</url>
28+
</developer>
29+
</developers>
30+
<scm>
31+
<connection>scm:git:git://github.com/vanniktech/gradle-maven-publish-plugin.git</connection>
32+
<developerConnection>scm:git:ssh://git@github.com/vanniktech/gradle-maven-publish-plugin.git</developerConnection>
33+
<url>https://github.com/vanniktech/gradle-maven-publish-plugin/</url>
34+
</scm>
35+
<dependencies>
36+
<dependency>
37+
<groupId>org.jetbrains.kotlin</groupId>
38+
<artifactId>kotlin-stdlib-js</artifactId>
39+
<version>1.6.10</version>
40+
<scope>runtime</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.jetbrains.kotlin</groupId>
44+
<artifactId>kotlin-stdlib-common</artifactId>
45+
<version>1.6.10</version>
46+
<scope>compile</scope>
47+
</dependency>
48+
</dependencies>
49+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.vanniktech.maven.publish.test
2+
3+
import android.util.Log
4+
5+
/**
6+
* Just a Android actual test class with Javadoc.
7+
*/
8+
actual class ExpectedTestClass {
9+
/**
10+
* An actual test funtion that does something.
11+
*/
12+
actual fun test() {
13+
Log.i("test", "test")
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.vanniktech.maven.publish.test
2+
3+
/**
4+
* Just an expected test class with Javadoc.
5+
*/
6+
expect class ExpectedTestClass {
7+
/**
8+
* An expected test funtion that does something.
9+
*/
10+
fun test()
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.vanniktech.maven.publish.test
2+
3+
/**
4+
* Just a jvm actual test class with Javadoc.
5+
*/
6+
actual class ExpectedTestClass {
7+
/**
8+
* An actual test funtion that does something.
9+
*/
10+
actual fun test() {
11+
JavaTestClass.main(arrayOf())
12+
}
13+
}

0 commit comments

Comments
 (0)