-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Focus on refreshVersions
- Loading branch information
Showing
140 changed files
with
2,114 additions
and
2,875 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
.github/workflows/gradle4-build.yml → .github/workflows/sample-android.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
# .github/workflows/gradle-build-pr.yml | ||
# https://github.com/marketplace/actions/gradle-command | ||
name: Run gradle checkAll | ||
on: [push, pull_request] | ||
name: sample-android | ||
on: [pull_request] | ||
jobs: | ||
gradle: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
java-version: 8 | ||
- uses: eskatos/gradle-command-action@v1 | ||
with: | ||
gradle-version: 4.8 | ||
arguments: checkAll | ||
build-root-directory: composite | ||
arguments: refreshVersions | ||
gradle-version: 5.6.3 | ||
build-root-directory: sample-android |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,7 @@ build/ | |
.idea/ | ||
!gradle-wrapper.jar | ||
_DS_Store | ||
*.iml | ||
local.properties | ||
.gradle | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1 @@ | ||
# Dependencies and Plugin versions with their available updates | ||
# Generated by $ ./gradlew refreshVersions | ||
# See https://github.com/jmfayard/buildSrcVersions/issues/77 | ||
plugin.org.gradle.kotlin.kotlin.dsl=1.2.9 | ||
# available=1.3.1 | ||
plugin.de.fayard.refreshVersions=0.7.0 | ||
plugin.com.gradle.plugin-publish=0.10.0 | ||
# available=0.10.1 | ||
plugin.com.gradle.build-scan=2.4.1 | ||
# available=2.4.2 | ||
version.kotlintest.runner.junit5=3.1.9 | ||
# available=3.4.1 | ||
version.gradle.versions.plugin=0.25.0 | ||
version.org.jetbrains.kotlin=1.3.41 | ||
# available=1.3.50 | ||
version.kotlinpoet=1.3.0 | ||
version.moshi=1.7.0 | ||
# available=1.8.0 | ||
version.okio=2.1.0 | ||
# You can edit the rest of the file, it will be kept intact | ||
resolutionStrategyConfig=verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/** | ||
* File generated by $ ./gradlew refreshVersions | ||
* | ||
* Gradle has replaced the buildscript { ... } block by a better alternative that looks like this | ||
* | ||
``` | ||
plugins { | ||
id("com.android.application") | ||
id("com.louiscad.splitties") | ||
id("org.jetbrains.kotlin.android") | ||
id("org.jetbrains.kotlin.kapt") | ||
id("kotlin-android-extensions") | ||
} | ||
``` | ||
* This boilerplate does two things: | ||
* | ||
* 1. it configures the plugin versions using the file `versions.properties` generated by | ||
* $ ./gradlew refreshVersions | ||
* | ||
* 2. it fixes the bug of the Android Gradle Plugin that doesn't publish the required metadata | ||
* Please see and upvote the issue: | ||
* https://issuetracker.google.com/issues/64551265 | ||
* | ||
* Include this file like this: | ||
* | ||
```kotlin | ||
// settings.gradle.kts | ||
pluginManagement { | ||
repositories { | ||
google() | ||
gradlePluginPortal() | ||
} | ||
} | ||
apply(from = "plugins.gradle.kts") | ||
// rootProject.name = xxx | ||
// include(":app") | ||
``` | ||
***/ | ||
@Suppress("CAST_NEVER_SUCCEEDS") | ||
(this as Settings).pluginManagement { | ||
|
||
/** | ||
* This `resolutionStrategy` allows plugin versions to be configured from | ||
* `versions.properties | ||
* The convention is simply | ||
* plugin.$PLUGINID=$PLUGIN_VERSION | ||
* To check what happen, you can set the property | ||
* resolutionStrategyConfig=verbose | ||
**/ | ||
val resolutionStrategyConfig = extra["resolutionStrategyConfig"] | ||
val versionProperties = file("../versions.properties") | ||
if (resolutionStrategyConfig == "false" || versionProperties.canRead().not()) return@pluginManagement | ||
val androidPluginIds = listOf("com.android.application", "com.android.library") | ||
val kotlinPluginIds = listOf("org.jetbrains.kotlin.android", "org.jetbrains.kotlin.kapt", "kotlin-android-extensions") | ||
@Suppress("UNCHECKED_CAST") | ||
val properties: Map<String, String> = java.util.Properties().apply { | ||
load(versionProperties.reader()) | ||
} as Map<String, String> | ||
require("module.kotlin" in properties) { "version.properties MUST contain module.kotlin=.... and/or module.android=...." } | ||
resolutionStrategy.eachPlugin { | ||
val pluginId = requested.id.id | ||
val version = properties["plugin.$pluginId"] | ||
val message = when { | ||
pluginId in kotlinPluginIds -> { | ||
val module = "org.jetbrains.kotlin:kotlin-gradle-plugin:${properties["module.kotlin"]}" | ||
useModule(module) | ||
"ResolutionStrategy used module=$module for plugin=$pluginId" | ||
} | ||
pluginId in androidPluginIds -> { | ||
val module = "com.android.tools.build:gradle:${properties["module.android"]}" | ||
useModule(module) | ||
"ResolutionStrategy used module=$module for plugin=$pluginId" | ||
} | ||
version != null -> { | ||
useVersion(version) | ||
"ResolutionStrategy used version=$version for plugin=$pluginId" | ||
} | ||
else -> "ResolutionStrategy did not find a version for $pluginId" | ||
} | ||
if (resolutionStrategyConfig == "verbose") println(message) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
pluginManagement { | ||
val resolutionStrategyConfig: String? by extra | ||
resolutionStrategy.eachPlugin { | ||
val property = "plugin.${requested.id.id}" | ||
if (extra.has(property) && resolutionStrategyConfig != "false") { | ||
val version = extra.get(property) as String | ||
useVersion(version) | ||
if (resolutionStrategyConfig == "verbose") println("ResolutionStrategy selected version=$version from property=$property") | ||
} | ||
repositories { | ||
mavenLocal() | ||
gradlePluginPortal() | ||
} | ||
} | ||
apply(from = "gradle/plugins.gradle.kts") | ||
rootProject.name = "plugin" |
Oops, something went wrong.