Skip to content

Commit c455a3d

Browse files
jimgoogGerrit Code Review
authored and
Gerrit Code Review
committed
Merge "Kotlin 1.8.20" into androidx-main
2 parents a20c848 + f0b820e commit c455a3d

File tree

31 files changed

+136
-75
lines changed

31 files changed

+136
-75
lines changed

buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt

+3-9
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,6 @@ class AndroidXImplPlugin @Inject constructor(val componentFactory: SoftwareCompo
291291
task.kotlinOptions.freeCompilerArgs += kotlinCompilerArgs
292292
}
293293

294-
// If no one else is going to register a source jar, then we should.
295-
// This cross-plugin hands-off logic shouldn't be necessary once we clean up sourceSet
296-
// logic (b/235828421)
297-
if (!project.plugins.hasPlugin(LibraryPlugin::class.java) &&
298-
!project.plugins.hasPlugin(JavaPlugin::class.java)) {
299-
project.configureSourceJarForJava()
300-
}
301-
302294
val isAndroidProject = project.plugins.hasPlugin(LibraryPlugin::class.java) ||
303295
project.plugins.hasPlugin(AppPlugin::class.java)
304296
// Explicit API mode is broken for Android projects
@@ -489,7 +481,6 @@ class AndroidXImplPlugin @Inject constructor(val componentFactory: SoftwareCompo
489481

490482
private fun configureWithJavaPlugin(project: Project, extension: AndroidXExtension) {
491483
project.configureErrorProneForJava()
492-
project.configureSourceJarForJava()
493484

494485
// Force Java 1.8 source- and target-compatibility for all Java libraries.
495486
val javaExtension = project.extensions.getByType<JavaPluginExtension>()
@@ -507,6 +498,9 @@ class AndroidXImplPlugin @Inject constructor(val componentFactory: SoftwareCompo
507498
targetCompatibility = VERSION_1_8
508499
}
509500
}
501+
if (!project.plugins.hasPlugin(KotlinBasePluginWrapper::class.java)) {
502+
project.configureSourceJarForJava()
503+
}
510504
}
511505

512506
project.configureJavaCompilationWarnings(extension)

buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ private fun Project.replaceBaseMultiplatformPublication(
344344
val kotlinComponent = components.findByName("kotlin") as SoftwareComponentInternal
345345
withSourcesComponents(
346346
componentFactory,
347-
setOf("sourcesElements", "androidxSourcesElements")
347+
setOf("androidxSourcesElements")
348348
) { sourcesComponents ->
349349
configure<PublishingExtension> {
350350
publications { pubs ->

buildSrc/private/src/main/kotlin/androidx/build/SourceJarTaskHelper.kt

+12
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ fun Project.configureSourceJarForAndroid(extension: LibraryExtension) {
6363
it.duplicatesStrategy = DuplicatesStrategy.FAIL
6464
}
6565
registerSourcesVariant(sourceJar)
66+
67+
// b/272214715
68+
configurations.whenObjectAdded {
69+
if (it.name == "debugSourcesElements" || it.name == "releaseSourcesElements") {
70+
it.artifacts.whenObjectAdded { _ ->
71+
it.attributes.attribute(
72+
DocsType.DOCS_TYPE_ATTRIBUTE,
73+
project.objects.named(DocsType::class.java, "fake-sources")
74+
)
75+
}
76+
}
77+
}
6678
}
6779
project.afterEvaluate {
6880
// we can only tell if a project is multiplatform after it is configured

buildSrc/private/src/main/kotlin/androidx/build/uptodatedness/TaskUpToDateValidator.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ val DONT_TRY_RERUNNING_TASKS = setOf(
147147
// https://github.com/gradle/gradle/issues/11203
148148
"partiallyDejetifyArchive",
149149
"stripArchiveForPartialDejetification",
150-
"createArchive"
150+
"createArchive",
151+
152+
// b/275795136
153+
":room:integration-tests:room-testapp-kotlin:kspWithKspGenJavaDebugAndroidTestKotlin",
154+
// b/275795136
155+
":room:integration-tests:room-testapp-kotlin:kspWithKspGenKotlinDebugAndroidTestKotlin"
151156
)
152157

153158
val DONT_TRY_RERUNNING_TASK_TYPES = setOf(

compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ContextReceiversTransformTests.kt

+27-27
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
6969
""",
7070
"""
7171
@Composable
72-
fun Test(%this%: Foo, %composer: Composer?, %changed: Int) {
72+
fun Test(_context_receiver_0: Foo, %composer: Composer?, %changed: Int) {
7373
%composer = %composer.startRestartGroup(<>)
7474
sourceInformation(%composer, "C(Test):Test.kt")
7575
if (%changed and 0b0001 !== 0 || !%composer.skipping) {
@@ -83,7 +83,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
8383
%composer.skipToGroupEnd()
8484
}
8585
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
86-
Test(%this%, %composer, updateChangedFlags(%changed or 0b0001))
86+
Test(_context_receiver_0, %composer, updateChangedFlags(%changed or 0b0001))
8787
}
8888
}
8989
"""
@@ -107,7 +107,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
107107
""",
108108
"""
109109
@Composable
110-
fun A(%this%: Foo, %this%: Bar, %composer: Composer?, %changed: Int) {
110+
fun A(_context_receiver_0: Foo, _context_receiver_1: Bar, %composer: Composer?, %changed: Int) {
111111
%composer = %composer.startRestartGroup(<>)
112112
sourceInformation(%composer, "C(A):Test.kt")
113113
if (%changed and 0b0001 !== 0 || !%composer.skipping) {
@@ -121,11 +121,11 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
121121
%composer.skipToGroupEnd()
122122
}
123123
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
124-
A(%this%, %this%, %composer, updateChangedFlags(%changed or 0b0001))
124+
A(_context_receiver_0, _context_receiver_1, %composer, updateChangedFlags(%changed or 0b0001))
125125
}
126126
}
127127
@Composable
128-
fun B(%this%: Foo, %this%: Bar, %this%: FooBar, %composer: Composer?, %changed: Int) {
128+
fun B(_context_receiver_0: Foo, _context_receiver_1: Bar, _context_receiver_2: FooBar, %composer: Composer?, %changed: Int) {
129129
%composer = %composer.startRestartGroup(<>)
130130
sourceInformation(%composer, "C(B):Test.kt")
131131
if (%changed and 0b0001 !== 0 || !%composer.skipping) {
@@ -139,7 +139,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
139139
%composer.skipToGroupEnd()
140140
}
141141
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
142-
B(%this%, %this%, %this%, %composer, updateChangedFlags(%changed or 0b0001))
142+
B(_context_receiver_0, _context_receiver_1, _context_receiver_2, %composer, updateChangedFlags(%changed or 0b0001))
143143
}
144144
}
145145
"""
@@ -163,7 +163,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
163163
""",
164164
"""
165165
@Composable
166-
fun String.A(%this%: Foo, %this%: Bar, %composer: Composer?, %changed: Int) {
166+
fun String.A(_context_receiver_0: Foo, _context_receiver_1: Bar, %composer: Composer?, %changed: Int) {
167167
%composer = %composer.startRestartGroup(<>)
168168
sourceInformation(%composer, "C(A):Test.kt")
169169
if (%changed and 0b0001 !== 0 || !%composer.skipping) {
@@ -177,11 +177,11 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
177177
%composer.skipToGroupEnd()
178178
}
179179
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
180-
A(%this%, %this%, %composer, updateChangedFlags(%changed or 0b0001))
180+
A(_context_receiver_0, _context_receiver_1, %composer, updateChangedFlags(%changed or 0b0001))
181181
}
182182
}
183183
@Composable
184-
fun String.B(%this%: Foo, %this%: Bar, %this%: FooBar, %composer: Composer?, %changed: Int) {
184+
fun String.B(_context_receiver_0: Foo, _context_receiver_1: Bar, _context_receiver_2: FooBar, %composer: Composer?, %changed: Int) {
185185
%composer = %composer.startRestartGroup(<>)
186186
sourceInformation(%composer, "C(B):Test.kt")
187187
if (%changed and 0b0001 !== 0 || !%composer.skipping) {
@@ -195,7 +195,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
195195
%composer.skipToGroupEnd()
196196
}
197197
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
198-
B(%this%, %this%, %this%, %composer, updateChangedFlags(%changed or 0b0001))
198+
B(_context_receiver_0, _context_receiver_1, _context_receiver_2, %composer, updateChangedFlags(%changed or 0b0001))
199199
}
200200
}
201201
"""
@@ -223,7 +223,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
223223
""",
224224
"""
225225
@Composable
226-
fun A(%this%: Foo, %this%: Bar, a: Int, %composer: Composer?, %changed: Int, %default: Int) {
226+
fun A(_context_receiver_0: Foo, _context_receiver_1: Bar, a: Int, %composer: Composer?, %changed: Int, %default: Int) {
227227
%composer = %composer.startRestartGroup(<>)
228228
sourceInformation(%composer, "C(A):Test.kt")
229229
if (%changed and 0b0001 !== 0 || !%composer.skipping) {
@@ -240,11 +240,11 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
240240
%composer.skipToGroupEnd()
241241
}
242242
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
243-
A(%this%, %this%, a, %composer, updateChangedFlags(%changed or 0b0001), %default)
243+
A(_context_receiver_0, _context_receiver_1, a, %composer, updateChangedFlags(%changed or 0b0001), %default)
244244
}
245245
}
246246
@Composable
247-
fun B(%this%: Foo, %this%: Bar, %this%: FooBar, a: Int, b: String?, c: Int, %composer: Composer?, %changed: Int, %default: Int) {
247+
fun B(_context_receiver_0: Foo, _context_receiver_1: Bar, _context_receiver_2: FooBar, a: Int, b: String?, c: Int, %composer: Composer?, %changed: Int, %default: Int) {
248248
%composer = %composer.startRestartGroup(<>)
249249
sourceInformation(%composer, "C(B):Test.kt")
250250
if (%changed and 0b0001 !== 0 || !%composer.skipping) {
@@ -264,11 +264,11 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
264264
%composer.skipToGroupEnd()
265265
}
266266
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
267-
B(%this%, %this%, %this%, a, b, c, %composer, updateChangedFlags(%changed or 0b0001), %default)
267+
B(_context_receiver_0, _context_receiver_1, _context_receiver_2, a, b, c, %composer, updateChangedFlags(%changed or 0b0001), %default)
268268
}
269269
}
270270
@Composable
271-
fun C(%this%: Foo, a: Int, bar: Bar?, %composer: Composer?, %changed: Int, %default: Int) {
271+
fun C(_context_receiver_0: Foo, a: Int, bar: Bar?, %composer: Composer?, %changed: Int, %default: Int) {
272272
%composer = %composer.startRestartGroup(<>)
273273
sourceInformation(%composer, "C(C):Test.kt")
274274
val %dirty = %changed
@@ -296,7 +296,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
296296
%composer.skipToGroupEnd()
297297
}
298298
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
299-
C(%this%, a, bar, %composer, updateChangedFlags(%changed or 0b0001), %default)
299+
C(_context_receiver_0, a, bar, %composer, updateChangedFlags(%changed or 0b0001), %default)
300300
}
301301
}
302302
"""
@@ -316,7 +316,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
316316
""",
317317
"""
318318
@Composable
319-
fun String.B(%this%: Foo, %this%: Bar, %this%: FooBar, a: Int, b: String?, c: Int, %composer: Composer?, %changed: Int, %default: Int) {
319+
fun String.B(_context_receiver_0: Foo, _context_receiver_1: Bar, _context_receiver_2: FooBar, a: Int, b: String?, c: Int, %composer: Composer?, %changed: Int, %default: Int) {
320320
%composer = %composer.startRestartGroup(<>)
321321
sourceInformation(%composer, "C(B):Test.kt")
322322
if (%changed and 0b0001 !== 0 || !%composer.skipping) {
@@ -336,7 +336,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
336336
%composer.skipToGroupEnd()
337337
}
338338
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
339-
B(%this%, %this%, %this%, a, b, c, %composer, updateChangedFlags(%changed or 0b0001), %default)
339+
B(_context_receiver_0, _context_receiver_1, _context_receiver_2, a, b, c, %composer, updateChangedFlags(%changed or 0b0001), %default)
340340
}
341341
}
342342
"""
@@ -516,9 +516,9 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
516516
""",
517517
"""
518518
@Composable
519-
fun Test(%this%: A, %this%: B, %this%: C, %this%: D, %this%: E, %this%: F, %this%: G, %this%: H, %this%: I, %this%: J, %this%: K, %this%: L, %composer: Composer?, %changed: Int, %changed1: Int) {
519+
fun Test(_context_receiver_0: A, _context_receiver_1: B, _context_receiver_2: C, _context_receiver_3: D, _context_receiver_4: E, _context_receiver_5: F, _context_receiver_6: G, _context_receiver_7: H, _context_receiver_8: I, _context_receiver_9: J, _context_receiver_10: K, _context_receiver_11: L, %composer: Composer?, %changed: Int, %changed1: Int) {
520520
%composer = %composer.startRestartGroup(<>)
521-
sourceInformation(%composer, "C(Test):Test.kt")
521+
sourceInformation(%composer, "C(Test)P(!2,4,5,6,7,8,9,10,11):Test.kt")
522522
if (%changed and 0b0001 !== 0 || %changed1 and 0b0001 !== 0 || !%composer.skipping) {
523523
if (isTraceInProgress()) {
524524
traceEventStart(<>, %changed, %changed1, <>)
@@ -530,7 +530,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
530530
%composer.skipToGroupEnd()
531531
}
532532
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
533-
Test(%this%, %this%, %this%, %this%, %this%, %this%, %this%, %this%, %this%, %this%, %this%, %this%, %composer, updateChangedFlags(%changed or 0b0001), updateChangedFlags(%changed1))
533+
Test(_context_receiver_0, _context_receiver_1, _context_receiver_2, _context_receiver_3, _context_receiver_4, _context_receiver_5, _context_receiver_6, _context_receiver_7, _context_receiver_8, _context_receiver_9, _context_receiver_10, _context_receiver_11, %composer, updateChangedFlags(%changed or 0b0001), updateChangedFlags(%changed1))
534534
}
535535
}
536536
"""
@@ -551,7 +551,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
551551
"""
552552
@Composable
553553
@ComposableInferredTarget(scheme = "[0[0]]")
554-
fun Test(%this%: Foo, a: String, b: Function3<String, Composer, Int, Unit>, %composer: Composer?, %changed: Int) {
554+
fun Test(_context_receiver_0: Foo, a: String, b: Function3<String, Composer, Int, Unit>, %composer: Composer?, %changed: Int) {
555555
%composer = %composer.startRestartGroup(<>)
556556
sourceInformation(%composer, "C(Test)<b("yay...>:Test.kt")
557557
val %dirty = %changed
@@ -570,7 +570,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
570570
%composer.skipToGroupEnd()
571571
}
572572
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
573-
Test(%this%, a, b, %composer, updateChangedFlags(%changed or 0b0001))
573+
Test(_context_receiver_0, a, b, %composer, updateChangedFlags(%changed or 0b0001))
574574
}
575575
}
576576
"""
@@ -629,14 +629,14 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
629629
}
630630
}
631631
@Composable
632-
fun Test(%this%: Foo, a: String?, b: Int, %composer: Composer?, %changed: Int, %default: Int) {
632+
fun Test(_context_receiver_0: Foo, a: String?, b: Int, %composer: Composer?, %changed: Int, %default: Int) {
633633
%composer = %composer.startRestartGroup(<>)
634634
sourceInformation(%composer, "C(Test):Test.kt")
635635
val %dirty = %changed
636636
if (%default and 0b0001 !== 0) {
637637
%dirty = %dirty or 0b0110
638638
} else if (%changed and 0b1110 === 0) {
639-
%dirty = %dirty or if (%composer.changed(%this%)) 0b0100 else 0b0010
639+
%dirty = %dirty or if (%composer.changed(_context_receiver_0)) 0b0100 else 0b0010
640640
}
641641
if (%default and 0b0010 !== 0) {
642642
%dirty = %dirty or 0b00110000
@@ -659,7 +659,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
659659
traceEventStart(<>, %changed, -1, <>)
660660
}
661661
val combineParams = a + b
662-
if (%this%.someString == combineParams) {
662+
if (_context_receiver_0.someString == combineParams) {
663663
println("Same same")
664664
}
665665
if (isTraceInProgress()) {
@@ -669,7 +669,7 @@ class ContextReceiversTransformTests : AbstractIrTransformTest() {
669669
%composer.skipToGroupEnd()
670670
}
671671
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
672-
Test(%this%, a, b, %composer, updateChangedFlags(%changed or 0b0001), %default)
672+
Test(_context_receiver_0, a, b, %composer, updateChangedFlags(%changed or 0b0001), %default)
673673
}
674674
}
675675
"""

compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/FcsTypeResolutionTests.kt

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ class FcsTypeResolutionTests : AbstractComposeDiagnosticsTest() {
3838
3939
@Composable
4040
fun Int.Foo(content: @Composable Int.(foo: String) -> Unit) {
41-
content(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>
41+
content<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>()<!>
4242
}
4343
4444
@Composable
4545
fun Bar(content: @Composable Int.() -> Unit) {
46-
content(<!NO_VALUE_FOR_PARAMETER!>)<!>
46+
content<!NO_VALUE_FOR_PARAMETER!>()<!>
4747
}
4848
"""
4949
)
@@ -208,10 +208,10 @@ class FcsTypeResolutionTests : AbstractComposeDiagnosticsTest() {
208208
// otherwise correct file "red".
209209
@Composable fun Test(F: @Composable (x: Foo) -> Unit) {
210210
// NOTE: constructor attributes and fn params get a "missing parameter" diagnostic
211-
A(<!NO_VALUE_FOR_PARAMETER!>)<!>
211+
A<!NO_VALUE_FOR_PARAMETER!>()<!>
212212
213213
// local
214-
F(<!NO_VALUE_FOR_PARAMETER!>)<!>
214+
F<!NO_VALUE_FOR_PARAMETER!>()<!>
215215
216216
val x = Foo(123)
217217
@@ -271,7 +271,7 @@ class FcsTypeResolutionTests : AbstractComposeDiagnosticsTest() {
271271
272272
@Composable fun Test() {
273273
<!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>Foo()<!>
274-
<!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>Bar(<!NO_VALUE_FOR_PARAMETER!>)<!><!>
274+
<!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>Bar<!NO_VALUE_FOR_PARAMETER!>()<!><!>
275275
}
276276
277277
""".trimIndent()
@@ -358,7 +358,7 @@ class FcsTypeResolutionTests : AbstractComposeDiagnosticsTest() {
358358
}
359359
360360
@Composable fun Test() {
361-
Foo(abc=<!NO_VALUE_FOR_PARAMETER!>)<!>
361+
Foo(<!NO_VALUE_FOR_PARAMETER!>abc=)<!>
362362
363363
// NOTE(lmr): even though there is NO diagnostic here, there *is* a parse
364364
// error. This is intentional and done to mimic how kotlin handles function
@@ -502,7 +502,7 @@ class FcsTypeResolutionTests : AbstractComposeDiagnosticsTest() {
502502
503503
@Composable fun Test() {
504504
ChildrenRequired2 {}
505-
ChildrenRequired2(<!NO_VALUE_FOR_PARAMETER!>)<!>
505+
ChildrenRequired2<!NO_VALUE_FOR_PARAMETER!>()<!>
506506
507507
ChildrenOptional3 {}
508508
ChildrenOptional3()

0 commit comments

Comments
 (0)