Attach sources to kotlin library project don't

2020-07-02 02:47发布

I want to attach the sources to an kotlin library project and it looks I succeeded as I have the source-jars now in here:

https://jitpack.io/com/github/walleth/kethereum/bip44/0.21/

the version before I did not export the sources - so I thought it is successful.

https://jitpack.io/com/github/walleth/kethereum/bip44/0.20/

Unfortunately AS does not show the sources. I am generating them like this:

allprojects {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
    }

    apply plugin: "kotlin"
    apply plugin: "jacoco"
    apply plugin: "maven"
    apply plugin: "com.github.ben-manes.versions"

    dependencies {
        compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

        testCompile 'org.assertj:assertj-core:3.8.0'
        testCompile 'junit:junit:4.12'
    }

    task sourcesJar(type: Jar, dependsOn: classes) {
        classifier = 'sources'
        from sourceSets.main.allSource
    }

    task javadocJar(type: Jar, dependsOn: javadoc) {
        classifier = 'javadoc'
        from javadoc.destinationDir
    }

    artifacts {
        archives sourcesJar
        archives javadocJar
    }
}

Also the source-jars contain the kotlin files. It is all in this project: https://github.com/walleth/kethereum

1条回答
Animai°情兽
2楼-- · 2020-07-02 03:39

This is what we have for Maven Publication.

task androidSourcesJar(type: Jar) {
    archiveClassifier.set('sources')
    from android.sourceSets.main.java.srcDirs
}

And then you can use artifact androidSourcesJar.

查看更多
登录 后发表回答