0

I am building my Android projects with Azure pipelines, but I'm still copy pasting aar files from libraries to apps. How do I publish my libs in a private package manager, so I can use them in my apps?

With c# / nuget I got this working easily. Feeds seem to support Maven/Gradle, but I don't see how I can push my libs into a feed (builds are successfull). What's the "nuget push" equivalent?

I find alot about how to sign/publish apps, and documentation on how to do it with Xamarin, which uses ... nuget. Do I need to write Grade / Maven stuff myself, eventhough pipeline tasks are all over the place and there's a DevOps for Mobile youtube series (Xamarin)?

Please point me in the direction of some not outdated documentation and/or how I can learn what to put in my yaml files.

Heinzlmaen
  • 869
  • 10
  • 20
  • Here is a [blog](https://softwarehut.com/blog/tech/case-study-library-releases-and-how-to-do-them) about the Android library, with the Gradle build system. You can view to see if it helps. – Hugh Lin Mar 05 '20 at 08:32
  • Thanks, that's a possibility. But the goal is not to publish from my local machine. I want a pipeline configured by a yaml file to do stuff, so I can use all of what Azure has to offer regarding CI/CD. – Heinzlmaen Mar 06 '20 at 09:39
  • Not get your latest information, are the workarounds below helpful for you? Or if you have any concern, feel free to share it here. – Hugh Lin Mar 16 '20 at 09:20
  • I read through them, but at this point I already dropped too many resources on this topic. I decided to go back to copy & pasting aar files, since that is more efficient. I could have manually built years worth of projects in the time it takes me to get this running. – Heinzlmaen Mar 23 '20 at 08:04

2 Answers2

0

Push Android artifact to Azure DevOps Feed

You could use maven new maven-publish plugin with following gradle build config to publish Android artifact to Azure DevOps Feed:

apply plugin: 'maven-publish'

task sourceJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier "sources"
}

publishing {
    publications {
        bar(MavenPublication) {
            groupId 'com.foo'
            artifactId 'bar'
            version '0.1'
            artifact(sourceJar)
            artifact("$buildDir/outputs/aar/bar-release.aar")
        }
    }
    repositories {
        maven {
            url "$buildDir/repo"
        }
    }
}

You could check this thread and this thread for some details.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
0

but I'm still copy pasting aar files from libraries to apps

In this case, if you want to publish a set of related files from a pipeline as a single package, you can use Universal Packages hosted in Azure Artifacts feeds.

Universal Packages are created from a directory of files. By default, the Universal Packages task will publish all files in $(Build.ArtifactStagingDirectory). To prepare your Universal Package for publishing, either configure preceding tasks to place output files in that directory, or use the Copy Files utility task to assemble the files that you want to publish.

To publish a Universal Package to your feed, add the following snippet to your azure-pipelines.yml file.

- task: UniversalPackages@0
  displayName: Universal Publish
  inputs:
    command: publish
    publishDirectory: '$(Build.ArtifactStagingDirectory)'
    vstsFeedPublish: '<Feed name>'
    vstsFeedPackagePublish: '<Package name>'
    packagePublishDescription: '<Package description>'

You can refer to this official document for details.

Hugh Lin
  • 17,829
  • 2
  • 21
  • 25