Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Libray development: open source your ideas

Libray development: open source your ideas

Have you ever thought that your idea could help other developers? Join the magic world of open source! In this talk we are going to share some tips and the secrets to become an open source master. Of course some practical examples based on our experience cannot miss.
Thanks to Marco Gomiero for collaborating in this presentation.

Avatar for Andrea Maglie

Andrea Maglie

October 06, 2018
Tweet

More Decks by Andrea Maglie

Other Decks in Technology

Transcript

  1. MARCO GOMIERO - Computer Engineer (Almost) - Android Engineer @

    Uniwhere - Co-Leader @ GDG Venezia WHO WE ARE ANDREA MAGLIE FOLLOW ME: • twitter.com/marcoGomier • github.com/prof18 • [email protected] • marcogomiero.com - Computer Engineer - Software Engineer @ Musement - Founder @ GDG Venezia FOLLOW ME: • twitter.com/TechIsFun • github.com/TechIsFun • [email protected] • andreamaglie.com
  2. AGENDA 1. Why ? 2. How to publish code and

    make it “open” 3. How to check code quality 4. How to publish artifacts 5. How to choose a license
  3. 1. Start a new project from GitHub 2. Push local

    project to GitHub 3. Fork a project
  4. > git init > git add . > git commit

    -m "git setup" > git remote add origin <remote repository URL> > git push -u origin master 2. Push local project to GitHub
  5. 3. travis.yml (1) language: android android: components: - build-tools-27.0.3 -

    android-27 - add-on - extra script: - "./gradlew build"
  6. 3. travis.yml (3) ... deploy: provider: releases api_key: secure: pEgyNmHdAexY2Vtjn

    file: rssparser/build/outputs/aar/rssparser-release.aar skip_cleanup: true on: repo: TechIsFun/RSS-Parser branch: master tags: true
  7. • https://github.com/checkstyle/checkstyle • tool for checking Java source code for

    adherence to a Code Standard or set of validation rules
  8. • JCenter is a Maven repository hosted by Bintray •

    Default Repository of Android Studio
  9. Library module: publish.gradle (2) publishing { publications { Production(MavenPublication) {

    artifact("$buildDir/outputs/aar/rssparser-release.aar") { builtBy tasks.getByName("assembleRelease") } groupId artifactId 'rssparser' version this.version pom.withXml { def dependenciesNode = asNode().appendNode('dependencies') // Add the dependecies configurations.implementation.allDependencies.each { // Ensure dependencies such as fileTree are not included in the pom. if (it.name != 'unspecified') { def dependencyNode = dependenciesNode.appendNode('dependency') dependencyNode.appendNode('groupId', it.group) dependencyNode.appendNode('artifactId', it.name) dependencyNode.appendNode('version', it.version) } } } } } }
  10. Library module: publish.gradle (2) publishing { publications { Production(MavenPublication) {

    artifact("$buildDir/outputs/aar/rssparser-release.aar") { builtBy tasks.getByName("assembleRelease") } groupId artifactId 'rssparser' version this.version pom.withXml { def dependenciesNode = asNode().appendNode('dependencies') // Add the dependecies configurations.implementation.allDependencies.each { // Ensure dependencies such as fileTree are not included in the pom. if (it.name != 'unspecified') { def dependencyNode = dependenciesNode.appendNode('dependency') dependencyNode.appendNode('groupId', it.group) dependencyNode.appendNode('artifactId', it.name) dependencyNode.appendNode('version', it.version) } } } } } }
  11. Library module: publish.gradle (2) publishing { publications { Production(MavenPublication) {

    artifact("$buildDir/outputs/aar/rssparser-release.aar") { builtBy tasks.getByName("assembleRelease") } groupId artifactId 'rssparser' version this.version pom.withXml { def dependenciesNode = asNode().appendNode('dependencies') // Add the dependecies configurations.implementation.allDependencies.each { // Ensure dependencies such as fileTree are not included in the pom. if (it.name != 'unspecified') { def dependencyNode = dependenciesNode.appendNode('dependency') dependencyNode.appendNode('groupId', it.group) dependencyNode.appendNode('artifactId', it.name) dependencyNode.appendNode('version', it.version) } } } } } }
  12. Library module: publish.gradle (3) bintray { user = properties.getProperty("bintray.user") key

    = properties.getProperty("bintray.apikey") publications = ['Production'] configurations = ['archives'] override = true pkg { repo = 'maven' name = 'RSS-Parser' description = "An Android library to parse RSS Feed" publicDownloadNumbers = true licenses = ['Apache-2.0'] vcsUrl = 'https://github.com/prof18/RSS-Parser.git' version { name = this.version desc = "Example ${this.version}" released = new Date() vcsTag = this.version } } }
  13. Library module: publish.gradle (3) bintray { user = properties.getProperty("bintray.user") key

    = properties.getProperty("bintray.apikey") publications = ['Production'] configurations = ['archives'] override = true pkg { repo = 'maven' name = 'RSS-Parser' description = "An Android library to parse RSS Feed" publicDownloadNumbers = true licenses = ['Apache-2.0'] vcsUrl = 'https://github.com/prof18/RSS-Parser.git' version { name = this.version desc = "Example ${this.version}" released = new Date() vcsTag = this.version } } }
  14. Library module: publish.gradle (3) bintray { user = properties.getProperty("bintray.user") key

    = properties.getProperty("bintray.apikey") publications = ['Production'] configurations = ['archives'] override = true pkg { repo = 'maven' name = 'RSS-Parser' description = "An Android library to parse RSS Feed" publicDownloadNumbers = true licenses = ['Apache-2.0'] vcsUrl = 'https://github.com/prof18/RSS-Parser.git' version { name = this.version desc = "Example ${this.version}" released = new Date() vcsTag = this.version } } }
  15. apply plugin: 'com.android.library' android { compileSdkVersion 28 ... } dependencies

    { ... } apply from: 'publish.gradle' Library module: build.gradle
  16. apply plugin: 'com.android.library' android { compileSdkVersion 28 ... } dependencies

    { ... } apply from: 'publish.gradle' Library module: build.gradle
  17. DevFest Veneto 2018 It’s coming!! 24 Novembre @ Fabrica -

    Catena di Villorba - TV Call For Paper opening soon!
  18. Android Developers Italia Android Developers Italia é la community italiana

    di sviluppatori Android su Slack! androiddevs.it