Skip to content

Commit a11a939

Browse files
Update dependency com.facebook:ktfmt to v0.62 (#1982)
* Update dependency com.facebook:ktfmt to v0.62 * Fix style --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Goooler <[email protected]>
1 parent 296c119 commit a11a939

File tree

8 files changed

+44
-51
lines changed

8 files changed

+44
-51
lines changed

build.gradle.kts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ spotless {
6060
kotlinGradle { ktfmt(libs.ktfmt.get().version).googleStyle() }
6161
}
6262

63-
val testPluginClasspath by
64-
configurations.registering {
65-
isCanBeResolved = true
66-
description = "Plugins used in integration tests could be resolved in classpath."
67-
}
63+
val testPluginClasspath by configurations.registering {
64+
isCanBeResolved = true
65+
description = "Plugins used in integration tests could be resolved in classpath."
66+
}
6867

6968
val testKit by sourceSets.creating
7069
val testKitImplementation by configurations.getting

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pluginPublish = { module = "com.gradle.publish:plugin-publish-plugin", version.r
2727

2828
androidx-gradlePluginLints = "androidx.lint:lint-gradle:1.0.0-alpha05"
2929
# Dummy to get renovate updates, the version is used in rootProject build.gradle with spotless.
30-
ktfmt = "com.facebook:ktfmt:0.61"
30+
ktfmt = "com.facebook:ktfmt:0.62"
3131

3232
junit-bom = "org.junit:junit-bom:6.0.3"
3333
assertk = "com.willowtreeapps.assertk:assertk:0.28.1"

src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/RelocationTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,9 @@ class RelocationTest : BasePluginTest() {
636636

637637
val originalModule =
638638
KotlinModuleMetadata.read(requireResourceAsStream(originalModuleFilePath).readBytes())
639-
val relocatedModule =
640-
outputShadowedJar.use { KotlinModuleMetadata.read(it.getBytes(relocatedModuleFilePath)) }
639+
val relocatedModule = outputShadowedJar.use {
640+
KotlinModuleMetadata.read(it.getBytes(relocatedModuleFilePath))
641+
}
641642

642643
assertThat(relocatedModule.version.toString()).isEqualTo("2.2.0")
643644
assertThat(originalModule.version.toString()).isEqualTo("2.2.0")

src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/TransformersTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ class TransformersTest : BaseTransformerTest() {
144144

145145
runWithSuccess(shadowJarPath)
146146

147-
val actualFileBytes =
148-
outputShadowedJar.use { jar -> jar.getStream(PLUGIN_CACHE_FILE).use { it.readAllBytes() } }
147+
val actualFileBytes = outputShadowedJar.use { jar ->
148+
jar.getStream(PLUGIN_CACHE_FILE).use { it.readAllBytes() }
149+
}
149150
assertThat(actualFileBytes.contentHashCode()).all {
150151
// Hash of the original plugin cache file.
151152
isNotEqualTo(-2114104185)

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/DependencyFilter.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,9 @@ public interface DependencyFilter : Serializable {
112112
it == resolvedDependency.moduleGroup ||
113113
resolvedDependency.moduleGroup.matches(it.toRegex())
114114
} ?: true
115-
val nameMatch =
116-
name.let {
117-
it == resolvedDependency.moduleName ||
118-
resolvedDependency.moduleName.matches(it.toRegex())
119-
}
115+
val nameMatch = name.let {
116+
it == resolvedDependency.moduleName || resolvedDependency.moduleName.matches(it.toRegex())
117+
}
120118
val versionMatch =
121119
version?.let {
122120
// Version like `1.0.0+1` can't be converted to regex directly because `+` is a special

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.kt

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@ import org.gradle.language.base.plugins.LifecycleBasePlugin
6464
@CacheableTask
6565
public abstract class ShadowJar : Jar() {
6666
private val dependencyFilterForMinimize = MinimizeDependencyFilter(project)
67-
private val shadowDependencies =
68-
project.provider {
69-
// Find shadow configuration here instead of get, as the ShadowJar tasks could be registered
70-
// without Shadow plugin applied.
71-
project.configurations.findByName(ShadowBasePlugin.CONFIGURATION_NAME) ?: project.files()
72-
}
67+
private val shadowDependencies = project.provider {
68+
// Find shadow configuration here instead of get, as the ShadowJar tasks could be registered
69+
// without Shadow plugin applied.
70+
project.configurations.findByName(ShadowBasePlugin.CONFIGURATION_NAME) ?: project.files()
71+
}
7372

7473
init {
7574
group = LifecycleBasePlugin.BUILD_GROUP
@@ -98,34 +97,30 @@ public abstract class ShadowJar : Jar() {
9897
public open val minimizeJar: Property<Boolean> = objectFactory.property(false)
9998

10099
@get:Classpath
101-
public open val toMinimize: ConfigurableFileCollection =
102-
objectFactory.fileCollection {
103-
minimizeJar.map {
104-
if (it) (dependencyFilterForMinimize.resolve(configurations.get()) - apiJars)
105-
else emptySet()
106-
}
100+
public open val toMinimize: ConfigurableFileCollection = objectFactory.fileCollection {
101+
minimizeJar.map {
102+
if (it) (dependencyFilterForMinimize.resolve(configurations.get()) - apiJars) else emptySet()
107103
}
104+
}
108105

109106
@get:Classpath
110-
public open val apiJars: ConfigurableFileCollection =
111-
objectFactory.fileCollection {
112-
minimizeJar.map { if (it) project.getApiJars() else emptySet<File>() }
113-
}
107+
public open val apiJars: ConfigurableFileCollection = objectFactory.fileCollection {
108+
minimizeJar.map { if (it) project.getApiJars() else emptySet<File>() }
109+
}
114110

115111
@get:InputFiles
116112
@get:PathSensitive(PathSensitivity.RELATIVE)
117-
public open val sourceSetsClassesDirs: ConfigurableFileCollection =
118-
objectFactory.fileCollection {
119-
minimizeJar.map {
120-
if (it) {
121-
project.sourceSets.map { sourceSet ->
122-
sourceSet.output.classesDirs.filter(File::isDirectory)
123-
}
124-
} else {
125-
emptySet()
113+
public open val sourceSetsClassesDirs: ConfigurableFileCollection = objectFactory.fileCollection {
114+
minimizeJar.map {
115+
if (it) {
116+
project.sourceSets.map { sourceSet ->
117+
sourceSet.output.classesDirs.filter(File::isDirectory)
126118
}
119+
} else {
120+
emptySet()
127121
}
128122
}
123+
}
129124

130125
/** [ResourceTransformer]s to be applied in the shadow steps. */
131126
@get:Nested
@@ -148,10 +143,9 @@ public abstract class ShadowJar : Jar() {
148143

149144
/** Final dependencies to be shadowed. */
150145
@get:Classpath
151-
public open val includedDependencies: ConfigurableFileCollection =
152-
objectFactory.fileCollection {
153-
dependencyFilter.zip(configurations) { df, cs -> df.resolve(cs) }
154-
}
146+
public open val includedDependencies: ConfigurableFileCollection = objectFactory.fileCollection {
147+
dependencyFilter.zip(configurations) { df, cs -> df.resolve(cs) }
148+
}
155149

156150
/**
157151
* Enables auto relocation of packages in the dependencies.

src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/transformers/ResourceTransformer.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public interface ResourceTransformer : Named {
4949
@JvmStatic
5050
public fun <T : ResourceTransformer> Class<T>.create(objectFactory: ObjectFactory): T {
5151
// If the constructor takes a single ObjectFactory, inject it in.
52-
val constructor =
53-
constructors.find { it.parameterTypes.singleOrNull() == ObjectFactory::class.java }
52+
val constructor = constructors.find {
53+
it.parameterTypes.singleOrNull() == ObjectFactory::class.java
54+
}
5455
return if (constructor != null) {
5556
objectFactory.newInstance(this@create)
5657
} else {

src/test/kotlin/com/github/jengelman/gradle/plugins/shadow/relocation/RelocatorsTest.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ class RelocatorsTest {
4343
private companion object {
4444
val primitiveTypes = setOf('B', 'C', 'D', 'F', 'I', 'J', 'S', 'Z')
4545

46-
val primitiveTypePatterns =
47-
primitiveTypes.map {
48-
// Methods like `void method(boolean arg1, org.package.ClassA arg2)`
49-
Arguments.of("(${it}Lorg/package/ClassA;)V", "(${it}Lshadow/org/package/ClassA;)V")
50-
}
46+
val primitiveTypePatterns = primitiveTypes.map {
47+
// Methods like `void method(boolean arg1, org.package.ClassA arg2)`
48+
Arguments.of("(${it}Lorg/package/ClassA;)V", "(${it}Lshadow/org/package/ClassA;)V")
49+
}
5150

5251
@JvmStatic
5352
fun signaturePatternsProvider() =

0 commit comments

Comments
 (0)