Skip to content

tynn-xyz/BuildSrc

Repository files navigation

BuildSrc

Build

Convenience build tool extensions for Gradle - Kotlin and Android

Gradle Plugin Portal

Convention Plugins

Plugin

plugins {
    id 'xyz.tynn.convention.project' version 'x.y.z'
}

The published base convention plugin which should be applied to the root project.

  • Applies xyz.tynn.convention.android to all Android application and library projects
  • Applies xyz.tynn.convention.release to all projects with maven-publish
  • Configures the Versions Plugin to use the current Gradle release and disallow release candidates as upgradable versions from stable versions
  • Configures all Test tasks to log the full exception on failure
  • Configures the wrapper task to use the complete Gradle distribution by default
  • Creates a clean task if none has been added after the evaluation

BOM convention

plugins {
    id 'xyz.tynn.convention.bom'
}

Configures the project to collect all other published projects to create a Gradle BOM to align the dependency versions.

Android convention

plugins {
    id 'xyz.tynn.convention.android'
}

Configures an Android project and provides a marker plugin to simplify further configurations.

subprojects {
    pluginManager.withPlugin('xyz.tynn.convention.android') {
        android {
            ...
        }
    }
}

Default configuration

  • Sets the namespace to ${group}.${project.name}
  • Sets the compile and target SDK level to 33
  • Sets the minimum SDK level to 24 by default
    • Override with android.defaults.sdk.min in gradle.properties
  • Uses the AndroidX test runner by default

App configuration

Release

Enables minification by default and uses the debug signing config for builds.

Debug

Configures a .debug application id suffix and +debug version name suffix.

Lint configuration

Configures Lint to abort on error and treat warnings as errors.

Kotlin explicit API

Uses the Kotlin explicit API configuration for Android. Instead of adding -Xexplicit-api=strict manually it is now possible to just use the Kotlin DSL variants.

kotlin {
    explicitApi()
}

Kotlin convention

plugins {
    id 'xyz.tynn.convention.release'
}

Configures a Kotlin project and provides a marker plugin to simplify further configurations. It adds an implementation dependency to the Stdlib and a test implementation dependency Kotlin Test.

Release convention

plugins {
    id 'xyz.tynn.convention.release'
}

Configures Maven publishing of a release publication for the project. The POM is setup with project.name and PROJECT_URL environment variable.

Optionally configures signing if the SIGNING_KEY and SIGNING_PASSWORD environment variables are provided.

Supported project structures

  • java
  • java-platform
  • version-catalog
  • com.android.library

License

Copyright (C) 2019-2023 Christian Schmitz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.