Hi,

A while ago I used to just write:

    task androidSourcesJar(type: Jar) {
        onlyIf { gradle.taskGraph.hasTask(uploadArchives)  }
        classifier = 'sources'
        //basename = artifact_id
        from android.sourceSets.main.allSource
    }



But allSource has been removed at some point from gradle android plugin.


I switched to something like this:

    task androidSourcesJar(type: Jar) {
        onlyIf { gradle.taskGraph.hasTask(uploadArchives)  }
        classifier = 'sources'
        //basename = artifact_id
        from android.sourceSets.main.java.source,
                android.sourceSets.main.res,
                android.sourceSets.main.assets,
                android.sourceSets.main.renderscript,
                android.sourceSets.main.aidl,
                android.sourceSets.main.jni,
                android.sourceSets.main.jniLibs
    }


Which also doesn't work well.

The generated sources.jar contains only the java files starting from the 
main package name in the root directory:

sources.jar
    com/
           my/
                package/
                             ...


no res files.

And the thing get worst if you have variants.

I want to obtain something like the default structure of an Android project 
with gradle as source file. Ideally something that could also be used to 
recompile the project.


I couldn't find any doc on how we are supposed to do this.

This is the code I use to push artifacts on my company Artifactory:

afterEvaluate { project ->
    uploadArchives {
        repositories {
            mavenDeployer {
//                beforeDeployment { MavenDeployment deployment -> 
signing.signPom(deployment) }

                pom.groupId = GROUP
                pom.artifactId = POM_ARTIFACT_ID
                pom.version = VERSION_NAME

                repository(url: getReleaseRepositoryUrl()) {
                    authentication(userName: getRepositoryUsername(), 
password: getRepositoryPassword())
                }

                snapshotRepository(url: getSnapshotRepositoryUrl()) {
                    authentication(userName: getRepositoryUsername(), 
password: getRepositoryPassword())
                }

                pom.project {
                    name POM_NAME
                    packaging POM_PACKAGING
                    description POM_DESCRIPTION
                    url POM_URL

                    scm {
                        url POM_SCM_URL
                        connection POM_SCM_CONNECTION
                        developerConnection POM_SCM_DEV_CONNECTION
                    }

                    licenses {
                        license {
                            name POM_LICENCE_NAME
                            url POM_LICENCE_URL
                            distribution POM_LICENCE_DIST
                        }
                    }

                    developers {
                        developer {
                            id POM_DEVELOPER_ID
                            name POM_DEVELOPER_NAME
                        }
                    }
                }
            }
        }
    } 



    artifacts {
        archives androidSourcesJar
        archives androidJavadocsJar
    } 



Signing is commented cause I do not need it (but I wish I know how to set 
it up)


And the  androidSourcesJar is the task I showed you above.

The androidJavadocsJar is out of the scope of these question and it also 
have some issue :)

Can someone help?

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to