- No changes
0.19.1 (2024-07-31)
- Fixed package of the extension
SigningConfig.fromProperties
.
dsl
→com.redmadrobot.build.dsl
0.19 (2024-07-26)
Note
This release removes many implicit features that couldn't be configured from outside. It is also a part of a process of removing the features that could be easily implemented via pre-compiled script plugins (for example, SDK versions and tests configuration). It is recommended to migrate these configurations to pre-compiled script plugins.
Experimental extension addSharedSourceSetRoot(...)
has been replaced with the new stable version:
android {
// The old way (Deprecated)
addSharedSourceSetRoot("debug", "qa")
// The new way
sourceSets.addSharedSourceSetRoot("debug", "qa")
}
It is common practice to store keystore credentials in .properties
file.
This extension lets you apply configurations from a property file.
android {
signingConfigs.getByName<SigningConfig>("debug") {
fromProperties(file("cert/debug.properties"))
}
}
- common: Deprecate
redmadrobot.jvmTarget
with deprecation levelError
. Use JVM Toolchains instead to specify JVM target. Kotlin, Android Gradle Plugin, detekt and many other tools have support for this mechanism, In most cases, adding this into yourbuild.gradle.kts
should be enough:You can also configure automatic toolchains downloading.kotlin { jvmToolchain(17) }
- android: Don't set default
minSdk
(it was23
) andtargetSdk
(it was33
). It was a poor decision to set defaults for these fields as could implicitly bump an SDK version in a project. If you want to useredmadrobot.android
to align SDK versions among all modules, you should set these properties explicitly:redmadrobot { android { minSdk = 23 targetSdk = 34 } }
- common: Disable automatic repositories adding by default.
If you rely on this feature, consider declaring required repositories explicitly, or enable it in
gradle.properties
:redmadrobot.add.repositories=true
- android: Don't apply
org.gradle.android.cache-fix
plugin automatically. This change allows removing android-cache-fix-gradle-plugin from the project dependencies. See the plugin documentation to learn how to apply this plugin to your project. - android: Don't apply
proguard-android-optimize.txt
rules by default. If you need these rules, apply it manually:android { defaultConfig { proguardFile(getDefaultProguardFile("proguard-android-optimize.txt")) } }
- android: Do not add
LOCK_ORIENTATION
andCRASH_REPORTS_ENABLED
variables toBuildConfig
implicitly - kotlin: Don't set
allWarningsAsErrors
flag implicitly. It was impossible to disable this feature. To keep going with the old behavior, add the following code to your build script:val warningsAsErrors = findProperty("warningsAsErrors") == "true" || isRunningOnCi tasks.withType<KotlinJvmCompile>().configureEach { compilerOptions.allWarningsAsErrors = warningsAsErrors }
- android: Use
ANDROID_BUILD_TOOLS_VERSION
env variable forbuildToolsVersion
if the option is not configured (#132) - android: Make an extension
Project.collectProguardFiles
public - android: Add the option
redmadrobot.android.ndkVersion
to specify NDK version for all android modules - android: Remove the workaround for Explicit API enabling as the issue has been fixed in Kotlin 1.9
- android: Remove disabling of build features
aidl
,renderScript
andbuildConfig
as they are already disabled by default in new versions of AGP - kotlin: Deprecate accessor
kotlinCompile
. It is recommended to usekotlin.compilerOptions { ... }
to configure compilation instead. - Update Gradle to
8.9
Dependency | Minimal version |
---|---|
Gradle | 7.4 → 8.0 |
Kotlin Gradle Plugin | 1.7.10 → 1.9.0 |
Android Gradle Plugin | 7.4.0 → 8.4.0 |
infrastructure-kotlin:
- Kotlin
1.8.10
→2.0.0
infrastructure-android:
- Android Gradle Plugin
7.4.2
→8.5.1
- Remove
android-cache-fix-gradle-plugin
from dependencies - Remove
com.android.tools:common
from dependencies
infrastructure-detekt:
0.18.1 (2023-04-18)
- Fix compatibility with Gradle lower than 8.0 (#127)
- Update Gradle to 8.1
0.18 (2023-03-07)
⚠️ BREAKING CHANGE!
It should be simple to change KGP and APG versions, no matter what versions were used on gradle-infrastructure compilation. Previously it was hard to update gradle-infrastructure without updating AGP and KGP, and also it was hard to downgrade AGP or KGP if it was needed.
Since now, KGP and AGP removed from transitive dependencies, and you should add it to your project manually. You can use two different approaches to do it:
-
Add AGP and KGP to top-level
build.gradle.kts
withapply false
// (root)/build.gradle.kts plugins { // Use `apply false` in the top-level build.gradle file to add a Gradle // plugin as a build dependency but not apply it to the current (root) project. // Here you can specify desired AGP and KGP versions to use. id("com.android.application") version "7.4.2" apply false id("org.jetbrains.kotlin.android") version "1.8.10" apply false }
-
If you have
buildSrc
or some other module containing build logic, you can add AGP and KGP todependencies
of this module:// (root)/buildSrc/build.gradle.kts dependencies { // Here you can specify desired AGP and KGP versions to use. implementation(kotlin("gradle-plugin", version = "1.8.10")) implementation("com.android.tools.build:gradle:7.4.2") }
Minimal required AGP and KGP will always be specified in README.
- android: Fixed obfuscation on QA builds with AGP 7.2+ (#120)
- android: Default
targetSdk
changed from32
to33
- android: Don't set
targetSdk
in library modules. This field is deprecated and doesn't take any effect since AGP 7.4 (b/230625468) - android: Removed default
resourceConfigurations
. UseresourceConfigurations.add("ru")
if you want to keep old behavior (#115) - Change default target JVM from 1.8 to 11 (property
redmadrobot.jvmTarget
)
- android: Removed workaround for b/215407138 that is fixed in AGP 7.4
- publish: More detailed description for the case when plugin cannot recognize project type (#116)
- Update Gradle to 8.0.2
infrastructure-kotlin:
- Kotlin
1.7.10
→1.8.10
infrastructure-android:
- Android Gradle Plugin
7.2.1
→7.4.2
(:warning: Minimal required AGP version is7.4.0
) - Android cache fix Gradle plugin
2.5.6
→2.7.0
infrastructure-detekt:
0.17 (2022-07-29)
- android: Default
minSdk
changed from21
to23
(POTENTIALLY BREAKING CHANGE) - android: Change target JDK for plugins from 8 to 11
- Update Gradle to 7.5
- Make flag
redmadrobot.add.repositories
work also forcom.redmadrobot.detekt
plugin (#104)
- Kotlin Gradle Plugin
1.6.10
→1.7.10
- Android Gradle Plugin
7.1.3
→7.2.1
- Android cache fix Gradle plugin
2.5.1
→2.5.6
- Detekt
1.20.0
→1.21.0
- JGit
6.1.0
→6.2.0
0.16.2 (2022-06-17)
- Defaults from parent project are not applied to project (#107)
0.16.1 (2022-06-17)
- Ability to disable automatic repositories adding using project property
redmadrobot.add.repositories
(#104)
- Extension
test
will no longer expose internal typeTestOptionsImpl
(#105)
0.16 (2022-04-25)
- publish: Check if a publication can be configured automatically for the project
- android: Add files from
proguard/
directory toconsumerProguardFiles
inandroid-library
modules (#101)
- android: Default target API changed to 32
- android: Lint results location now configured only for
application
modules. Lint running will no longer conflict inandroid-library
modules (#102) - publish: Migrate android-library publication to the new publishing API introduced in AGP 7.1
- Revert change from 0.15 when
isRunningOnCi
were made extension onProject
- Added
@InternalGradleInfrastructureApi
annotation to all API that not intended for public use - Added missing KDocs for all public classes
- Android Gradle Plugin
7.0.4
→7.1.3
- Android cache fix Gradle plugin
2.4.6
→2.5.1
- detekt
1.19.0
→1.20.0
- plugin-publish-plugin
0.19.0
→0.21.0
- JGit
6.0.0
→6.1.0
0.15 (2022-01-20)
- Shortcuts for easy access to QA build type:
android { buildTypes { qa { // ... } } }
- Apply Lint settings to android-library modules (#98)
- Configuration caching support (experimental)
- Version catalogs publication via
com.redmadrobot.publish
- Breaking change: property
isRunningOnCi
changed to an extension-property onProject
for configuration caching support - Switch to experimental API added in AGP 7.0.0
- Changed QA build type fallbacks from
[release]
to[debug, release]
- Fixed error when trying to override
jvmTarget
orandroid
options or in subprojects - Use
jvmTarget
for java target and source compatibility (#93)
- Android Gradle Plugin 7.0.3 -> 7.0.4
- Android cache fix Gradle plugin 2.4.5 -> 2.4.6
0.14 (2021-12-27)
- Android Gradle Plugin 4.2.2 -> 7.0.3
- Android cache fix Gradle plugin 2.4.3 -> 2.4.5
- Kotlin 1.5.31 -> 1.6.10
- JGit 5.12.0 -> 6.0.0
- Added workaround for the case when detekt ignores kotlin sources when run on Android project with type resolution (detekt/detekt#4177)
0.13 (2021-12-13)
Breaking change!
Plugins group changed from redmadrobot
to com.redmadrobot
.
This change allows us to publish infrastructure plugins to Gradle Plugins Portal and make it easier to add plugins to project.
Changing resolutionStrategy
in settings.gradle.kts
is not needed anymore.
To make migration easier, it is allowed to apply plugins with deprecated IDs if you've specified resolutionStrategy
, but it will throw a warning to console.
Breaking change!
Why multi-modular structure?
Until now plugins' structure inside module infrastructure
was looking like this:
Plugin root-project
was used to add configurations for all others plugins.
With such structure all plugins should know about root-project
plugin to access configs, and root-project
should also know about all plugins to hold their configs.
It is possible only if all plugins are declared in the same module with root-project
.
So it was the main stopping factor from breaking infrastructure
to several independent modules.
Multi-modular structure gives important benefits to us:
- Allows modules to be updated independently, allowing users to pick what version of each module they want to use.
- Makes
infrastructure
more scalable. Because it is not more required to changeroot-project
when adding a new plugin. - Enables to use only "what you want" and don't bring extra dependencies to project.
Since now plugins are separated to modules:
Plugin root-project
is deprecated now and will be removed in further versions.
Extensions are added to project via *-config
plugins (exception is detekt
plugin, so it is designed to be applied to root project).
If you want to get the same behavior as applying root-project
, you can apply all config plugins to the root project:
apply {
id("com.redmadrobot.android-config") version "0.13"
id("com.redmadrobot.publish-config") version "0.13"
id("com.redmadrobot.detekt") version "0.13"
}
*-config
plugins can be applied to any project. Config from inner project will inherit options from outer project.- Options
redmadrobot.android.test
are inherited fromredmadrobot.test
- Kotlin 1.5.30 -> 1.5.31
- Detekt 1.18.1 -> 1.19.0
- Added repository extension
jitpack()
(#82)
- Breaking change! Repositories
ossrh
andossrhSnapshots
now use hosts01.oss.sonatype.org
by default. To keep legacy hostoss.sonatype.org
, useossrh(LEGACY)
instead. - Breaking change! Directory with ProGuard rules now intended to be in
application
project instead of root project. - Default
targetSdk
changed from 30 to 31. - Gradle updated to 7.3.1
- Non-Kotlin modules are excluded from checking that the module contains detekt #81
0.12.2 (2021-11-15)
- Fixed proguard file detection which was broken after file extensions check was added.
0.12.1 (2021-09-07)
- Fixed regex to create
detekt[Variant]All
,detektBaseline[Variant]All
when infrastructure root project differs from Gradle root project.
0.12 (2021-09-01)
- Kotlin Gradle Plugin 1.5.20 -> 1.5.30
- Android Gradle Plugin 4.2.1 -> 4.2.2
- Android cache fix Gradle plugin 2.4.0 -> 2.4.3
- detekt 1.17.1 -> 1.18.1
- Plugin
redmadrobot.root-project
now can be applied to any project that should be considered as "root" project for gradle-infrastructure. It may be useful for projects where you need to apply gradle-infrastructure only to particular subprojects. - Added Detekt tasks
detekt[Variant]All
with type resolution - Added the
detektBaselineAll
task to create a baseline file for Detekt rules. - Added
detektBaseline[Variant]All
tasks to create a baseline file for Detekt rules with type resolution. - Added option
redmadrobot.jvmTarget
to specify target JVM for Kotlin and Java compilers. - Added option
redmadrobot.android.testTasksFilter
to filter tasks that should be run on ':test'.
- Android libraries' publication moved back to
infrastructure
frominfrastructure-android
. - Use only files with extension
.pro
fromproguard
directory as inputs for R8.
- Kotlin API version changed from 1.3 to 1.4
- Gradle 7.1.1 -> 7.2
0.11 (2021-07-06)
- Kotlin Gradle Plugin 1.5.10 -> 1.5.20
- JGit 5.11.0 -> 5.12.0
- Added ability to configure
compileSdk
separately fromtargetSdk
- Added ability to configure
buildToolsVersion
for all android modules
- Update Gradle 7.0.2 -> 7.1.1
- Added KDoc comments to the all plugins
0.10 (2021-05-31)
Breaking change!
RedmadrobotExtension
migrated to lazy properties API.
Now all extension fields are properties.
You should use method .set(value)
instead of assignment operator =
to assign value.
redmadrobot {
android {
- minApi = 26
+ minApi.set(26)
}
}
This change helps us to check the Redmadrobot extension not used before it was configured.
Breaking change!
Previously plugins kotlin-library
, android-library
and application
used to add kotlin-stdlib-jdk8
and kotlin-test
dependencies by default.
It was a problem because:
- Sometimes you don't want to add these dependencies
- Or want to add it with different configuration (for example
compileOnly
instead ofimplementation
)
gradle-infrastructure should add only options valid for all our projects or default options that can be changed if needed. Default applied dependencies can't be removed if needed, so they should not be applied by default.
Option
redmadrobot.kotlinVersion
is deprecated and will not take any effect.
We've introduced this option to make it possible to change version of default kotlin dependencies. This option affects only dependencies added by gradle-infrastructure, not all Kotlin dependencies, and it is confusing. Moreover, this version does not affect Kotlin Gradle Plugin because it uses version specified in gradle-infrastructure at compilation time.
A more convenient way to align the Kotlin version for all dependencies including transitive ones is to use kotlin-bom
:
dependencies {
// Align versions of all Kotlin components
implementation(platform(kotlin("bom", version = "1.5.10")))
// Now you can add Kotlin components without version
implementation(kotlin("stdlib-jdk8"))
testImplementation(kotlin("test-junit5"))
}
- Specified default location for Detekt baseline:
$configsDir/detekt/baseline.xml
- Added the ability to check the Detekt only on changed files (#40).
- Update Gradle 7.0 -> 7.0.2
- Flag
publishing.signArtifacts
affects all artifacts not only the main one - Method
test.useJunit()
can take lambda to configure JUnit framework - Accessor
redmadrobot.android
can be used without imports RedmadrobotExtension
is extension-aware since now- Breaking change! All extensions and constants moved to package
com.redmadrobot.build.dsl
to make it possible to import all extensions via single import
- Publication not configured when
redmadrobot.publish
applied before other plugins - Look at flag
gradlePlugin.isAutomatedPublishing
when configuring gradle plugin publication
- Update Kotlin 1.4.32 -> 1.5.10
- Update AGP 4.1.3 -> 4.2.1
- Update Detekt 1.16.0 -> 1.17.1
0.9 (2021-05-04)
Module infrastructure
no more depends on AGP and doesn't require the google()
repository to be applied.
Plugins redmadrobot.application
and redmadrobot.android-library
was moved to infrastructure-android
module.
You should specify it in settings.gradle.kts to be able to use it:
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "redmadrobot") {
- useModule("com.redmadrobot.build:infrastructure:${requested.version}")
+ useModule("com.redmadrobot.build:infrastructure-android:${requested.version}")
}
}
}
Breaking change! If you use
redmadrobot.android
in the root project, you should add the following import:import com.redmadrobot.build.extension.android
BUILD_TYPE_STAGING
superseded with BUILD_TYPE_QA
.
To keep backward compatibility you can configure QA build type name using project property in gradle.properties
:
redmadrobot.android.build.type.qa=staging
- Apply android-cache-fix plugin to android projects (#44)
- Updated Gradle 6.8.3 -> 7.0
- Completely removed
jcenter
from repositories (#36)
- Flag
warningsAsErrors
now should work. It is enabled by default on CI.
0.8.2 (2021-03-30)
JCenter is at the end of life and should mot be used anymore.
Now jcenter()
used in gradle-infrastructure
only for exclusive content that not migrated to Maven Central yet.
You can get errors like this:
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.xwray:groupie:2.7.2
Searched in the following locations:
- ...
Required by:
project :app > com.xwray:groupie:2.7.2
To avoid these errors, declare jcenter
repository in your build script and configure it to be used only for missing dependencies.
repositories {
jcenter {
content {
// It is useful to add a link to the issue about migration from JCenter
// https://github.com/lisawray/groupie/issues/384
includeModule("com.xwray", "groupie")
}
}
}
- Detekt 1.15.0 -> 1.16.0
- Kotlin 1.4.31 -> 1.4.32
- AGP 4.1.2 -> 4.1.3
0.8.1 (2021-02-28)
- Add back
jcenter()
fordetekt-formatting
- Kotlin updated to 1.4.31
0.8 (2021-02-25)
Now you can configure common for all modules POM properties in redmadrobot.publishing
extension.
There are extension-functions to cover common configuration use-cases.
redmadrobot {
publishing {
pom {
// Configure <url>, <scm> and <issueManagement> tags for GitHub project by its name
setGitHubProject("RedMadRobot/gradle-infrastructure")
licenses {
mit() // Add MIT license
}
developers {
// Shorthand to add a developer
developer(id = "jdoe", name = "John Dow", email = "[email protected]")
}
}
}
}
Use publishing
extension in module build script to configure POM for this module.
Take publication name from PUBLICATION_NAME
constant.
publishing {
publications {
getByName<MavenPublication>(PUBLICATION_NAME) {
pom {
// Configure POM here
}
}
}
}
// or even shorter
publishing.publications.getByName<MavenPublication>(PUBLICATION_NAME) {
pom {
// Configure POM here
}
}
- Add javadoc publication for kotlin libraries and gradle plugins
- Fixed gradle plugins signing
0.7 (2021-02-25)
Breaking change! Removed adding
jcenter()
repository, replaced withmavenCentral()
. Check all your dependencies can be resolved. If you still wantjcenter
, add it manually.
Replace rmrBintray(...)
with ossrh()
or ossrhSnapshots()
:
publishing {
repositories {
- if (!isSnapshotVersion) rmrBintray("infrastructure")
+ if (isReleaseVersion) ossrh()
}
}
To be able to publish artifacts to OSSRH you should sign the artifacts.
Signing can be enabled in extension redmadrobot.publishing
:
redmadrobot {
publishing {
signArtifacts = true // false by default
useGpgAgent = true // true by default
}
}
Read Signing Plugin docs for more information about signing configuration.
Pull request: #35
- New extension
isReleaseVersion
opposite to existingisSnapshotVersion
- Fix Gradle plugins publication (#29)
- Update Gradle to 6.8.3
- Update Kotlin to 1.4.30
- Update AGP to 4.1.2
- Update dependencies in samples
- Added CHANGELOG.md :)