diff --git a/matrix-sdk-android/gradle-publish.gradle b/matrix-sdk-android/gradle-publish.gradle index c90d73fdcf3fc011d5e51f284fb23b2b4c46bc32..a86d37c6d36411d77fca0056c832ef6598cdb087 100644 --- a/matrix-sdk-android/gradle-publish.gradle +++ b/matrix-sdk-android/gradle-publish.gradle @@ -1,4 +1,4 @@ -apply plugin: 'java' +apply plugin: 'com.android.library' apply plugin: 'maven-publish' def groupIdString = "org.matrix.android" @@ -9,6 +9,11 @@ def publicationName = "release" def projectId = "16" def token = "e3yxa-_Duy7xLabSa7_z" +task sourceJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = "sources" +} + publishing { publications { "$publicationName"(MavenPublication) { @@ -16,17 +21,16 @@ publishing { artifactId artifactIdString version versionName artifact artifactPath + artifact sourceJar // To include project dependencies pom.withXml { def dependencies = asNode().appendNode('dependencies') - configurations.implementation.allDependencies.each { - if (it.group != null) { - def dependency = dependencies.appendNode('dependency') - dependency.appendNode('groupId', it.moduleGroup) - dependency.appendNode('artifactId', it.moduleName) - dependency.appendNode('version', it.moduleVersion) - } + configurations.getByName("${publicationName}CompileClasspath").getResolvedConfiguration().getFirstLevelModuleDependencies().each { + def dependency = dependencies.appendNode('dependency') + dependency.appendNode('groupId', it.moduleGroup) + dependency.appendNode('artifactId', it.moduleName) + dependency.appendNode('version', it.moduleVersion) } } } @@ -44,8 +48,4 @@ publishing { } } } -} -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 } \ No newline at end of file