Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 4.01 KB

DEVELOPMENT.md

File metadata and controls

93 lines (70 loc) · 4.01 KB

AndroidArtifacts Development

When you are interested in the internals or details of that plugin read on.

Plugins

This projects provides basically three plugins. The guru.stefma.androidartifacts and the guru.stefma.javaartifacts plugins are the "core" plugins which do the actually "work". They are set up the publishing {} block for the current project.

The guru.stefma.artifacts plugin is an "umbrella" plugin which will only apply the correct "worker plugin" - based on the current environment.

Anyway. Both worker plugins share the same API. The ArtifactsExtension. Beside of this I want to make sure that each generated Task should be named and behave similar in each plugin.

AndroidArtifacts Plugin

Tasks

The following tasks are available for a default Android library with a release and a debug build type:

  • androidArtifactDebug
  • androidArtifactDebugJavadoc
  • androidArtifactDebugSources
  • androidArtifactRelease
  • androidArtifactReleaseJavadoc
  • androidArtifactReleaseSources

If you library provides more than these two default BuildTypes (release & debug) more tasks with the respective BuildType name will be created.

When the kotlin-android or the org.jetbrains.kotlin.android plugin is applied there will be also a androidArtifactDebugKdoc and androidArtifactReleaseKdoc task.

Tasks output

The output for the androidArtifact{$libraryVariant} is expected at $project/build/generated/outputs/aar/$projectName-$variantName.aar. This is the default output path for the assemble{$libraryVariant} task which is generated by the Android Gradle Plugin.

The *Javadoc, *Sources and *Kdoc task output will be created inside the $project/build/libs/$projectName-$version-$type.jar (while $type is either javadocs, sources or kdoc).

The published aar can be then found in your local maven. Typically this is located at ~/.m2/repository/.

Dependencies and POM generation

Currently we only support the following dependency configurations:

  • api
  • implementation
  • compileOnly
  • runtimeOnly

All other configurations will be ignored and not added to the POM.

JavaArtifacts Plugin

Tasks

This plugin will create exactly the same tasks like the guru.stefma.androidartifacts plugin but with the suffix java instead of the build type (e.g. release).

This leads to the following available tasks:

  • androidArtifactJava
  • androidArtifactJavaJavadoc
  • androidArtifactJavaSources

When the kotlin or the org.jetbrains.kotlin.jvm plugin is applied there will be also a androidArtifactJavaKdoc task.

Tasks output

All of the generated jar's can be found inside the $project/build/libs/$projectName-$version-$type.jar directory.

Tasks

One task which is available across these plugins is the androidArtifactGeneratedPublications task. This will display all generated publication names.

This is quite useful if you want to find out which publication you want to use for different actions. Like publishing it to Bintray or Artifactory.

Publishing docs

This plugin has a setup to publish it's Dokka and Gradle Site to now.sh.

Manually publishing

To publish the Dokka and the Gradle Site just run the publishDocsToNow task. This will publish each of them to now.sh. Implied that the now-cli is installed on the host.

Publishing via CI

The CI is configured to publish both sites automatically.

It will publish both documentations to a "now staging" domain (something like now-kasklkasd.now.sh) on "all branches" expect master and expect all pushed tags.

The CI will publish it to androidartifacts.now.sh when a branch got merged into the master branch or when we **tag **was pushed.

Consumer

For testing purpose (or for quick examples) there are some "consumers" inside this project. You can check them out in subprojects/consumer.