Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
6c7247cb
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6c7247cb
编写于
11月 24, 2020
作者:
S
sebastian.sellmair
提交者:
Sebastian Sellmair
11月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
syncKotlinAndAndroidSourceSets: Don't register Kotlin source dirs in Android java source dirs
上级
2286498d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
35 deletion
+19
-35
libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt
...tbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt
+9
-15
libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt
...rains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt
+10
-18
libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt
...otlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt
+0
-2
未找到文件。
libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/AbstractKotlinAndroidGradleTests.kt
浏览文件 @
6c7247cb
...
...
@@ -25,14 +25,6 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() {
fun
testAndroidMppSourceSets
():
Unit
=
with
(
Project
(
"new-mpp-android-source-sets"
,
GradleVersionRequired
.
FOR_MPP_SUPPORT
))
{
build
(
"sourceSets"
)
{
assertSuccessful
()
assertContains
(
"Java sources: [lib/src/androidTest/java, lib/src/androidAndroidTest/kotlin]"
)
assertContains
(
"Java sources: [lib/src/androidTestDebug/java, lib/src/androidAndroidTestDebug/kotlin]"
)
assertContains
(
"Java sources: [lib/src/debug/java, lib/src/androidDebug/kotlin, lib/src/debug/kotlin]"
)
assertContains
(
"Java sources: [lib/src/main/java, lib/src/androidMain/kotlin, lib/src/main/kotlin]"
)
assertContains
(
"Java sources: [lib/src/release/java, lib/src/androidRelease/kotlin, lib/src/release/kotlin]"
)
assertContains
(
"Java sources: [lib/src/test/java, lib/src/androidTest/kotlin, lib/src/test/kotlin]"
)
assertContains
(
"Java sources: [lib/src/testDebug/java, lib/src/androidTestDebug/kotlin, lib/src/testDebug/kotlin]"
)
assertContains
(
"Java sources: [lib/src/testRelease/java, lib/src/androidTestRelease/kotlin, lib/src/testRelease/kotlin]"
)
assertContains
(
"Android resources: [lib/src/main/res, lib/src/androidMain/res]"
)
assertContains
(
"Assets: [lib/src/main/assets, lib/src/androidMain/assets]"
)
...
...
@@ -50,14 +42,13 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() {
assertContains
(
"JNI libraries: [lib/src/androidTestDebug/jniLibs, lib/src/androidAndroidTestDebug/jniLibs]"
)
assertContains
(
"Java-style resources: [lib/src/androidTestDebug/resources, lib/src/androidAndroidTestDebug/resources]"
)
assertContains
(
"Java sources: [lib/betaSrc/paidBeta/java, lib/src/androidPaidBeta/kotlin, lib/src/paidBeta/kotlin]"
)
assertContains
(
"Java sources: [lib/betaSrc/paidBetaDebug/java, lib/src/androidPaidBetaDebug/kotlin, lib/src/paidBetaDebug/kotlin]"
)
assertContains
(
"Java sources: [lib/betaSrc/paidBetaRelease/java, lib/src/androidPaidBetaRelease/kotlin, lib/src/paidBetaRelease/kotlin]"
)
assertContains
(
"Java sources: [lib/betaSrc/freeBeta/java, lib/src/androidFreeBeta/kotlin, lib/src/freeBeta/kotlin]"
)
assertContains
(
"Java sources: [lib/betaSrc/freeBetaDebug/java, lib/src/androidFreeBetaDebug/kotlin, lib/src/freeBetaDebug/kotlin]"
)
assertContains
(
"Java sources: [lib/betaSrc/freeBetaRelease/java, lib/src/androidFreeBetaRelease/kotlin, lib/src/freeBetaRelease/kotlin]"
)
assertContains
(
"Java-style resources: [lib/betaSrc/paidBeta/resources, lib/src/androidPaidBeta/resources]"
)
assertContains
(
"Java-style resources: [lib/betaSrc/paidBetaDebug/resources, lib/src/androidPaidBetaDebug/resources]"
)
assertContains
(
"Java-style resources: [lib/betaSrc/paidBetaRelease/resources, lib/src/androidPaidBetaRelease/resources]"
)
assertContains
(
"Java-style resources: [lib/betaSrc/freeBeta/resources, lib/src/androidFreeBeta/resources]"
)
assertContains
(
"Java-style resources: [lib/betaSrc/freeBetaDebug/resources, lib/src/androidFreeBetaDebug/resources]"
)
assertContains
(
"Java-style resources: [lib/betaSrc/freeBetaRelease/resources, lib/src/androidFreeBetaRelease/resources]"
)
}
build
(
"testFreeBetaDebug"
)
{
...
...
@@ -73,10 +64,13 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() {
}
// Test for KT-35016: MPP should recognize android instrumented tests correctly
// TODO: https://issuetracker.google.com/issues/173770818 enable after fix in AGP
/*
build("connectedAndroidTest") {
assertFailed()
assertContains("No connected devices!")
}
*/
}
@Test
...
...
libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/SyncKotlinAndAndroidSourceSetsTest.kt
浏览文件 @
6c7247cb
...
...
@@ -45,10 +45,11 @@ class SyncKotlinAndAndroidSourceSetsTest {
val
kotlinAndroidMainSourceSet
=
kotlin
.
sourceSets
.
getByName
(
"androidMain"
)
val
androidMainSourceSet
=
android
.
sourceSets
.
getByName
(
"main"
)
assertEquals
(
androidMainSourceSet
.
java
.
srcDirs
.
toSet
(),
kotlinAndroidMainSourceSet
.
kotlin
.
srcDirs
.
toSet
(),
"Expected all source directories being present in all models"
assertTrue
(
kotlinAndroidMainSourceSet
.
kotlin
.
srcDirs
.
containsAll
(
androidMainSourceSet
.
java
.
srcDirs
),
"Expected all Android java srcDirs in Kotlin source set.\n"
+
"Kotlin=${kotlinAndroidMainSourceSet.kotlin.srcDirs}\n"
+
"Android=${androidMainSourceSet.java.srcDirs}"
)
}
...
...
@@ -59,10 +60,11 @@ class SyncKotlinAndAndroidSourceSetsTest {
val
kotlinAndroidTestSourceSet
=
kotlin
.
sourceSets
.
getByName
(
"androidTest"
)
val
testSourceSet
=
android
.
sourceSets
.
getByName
(
"test"
)
assertEquals
(
testSourceSet
.
java
.
srcDirs
.
toSet
(),
kotlinAndroidTestSourceSet
.
kotlin
.
srcDirs
.
toSet
(),
"Expected all source directories being present in all models"
assertTrue
(
kotlinAndroidTestSourceSet
.
kotlin
.
srcDirs
.
containsAll
(
testSourceSet
.
java
.
srcDirs
),
"Expected all Android java srcDirs in Kotlin source set.\n"
+
"Kotlin=${kotlinAndroidTestSourceSet.kotlin.srcDirs}\n"
+
"Android=${testSourceSet.java.srcDirs}"
)
}
...
...
@@ -73,11 +75,6 @@ class SyncKotlinAndAndroidSourceSetsTest {
val
kotlinAndroidAndroidTestSourceSet
=
kotlin
.
sourceSets
.
getByName
(
"androidAndroidTest"
)
val
androidTestSourceSet
=
android
.
sourceSets
.
getByName
(
"androidTest"
)
assertTrue
(
androidTestSourceSet
.
java
.
srcDirs
.
toSet
().
containsAll
(
kotlinAndroidAndroidTestSourceSet
.
kotlin
.
srcDirs
),
"Expected all kotlin source directories being registered on AGP"
)
assertTrue
(
project
.
file
(
"src/androidTest/kotlin"
)
!
in
kotlinAndroidAndroidTestSourceSet
.
kotlin
.
srcDirs
,
"Expected no source directory of 'androidTest' kotlin source set (Unit Test) "
+
...
...
@@ -172,11 +169,6 @@ class SyncKotlinAndAndroidSourceSetsTest {
kotlinAndroidMain
.
kotlin
.
srcDirs
.
containsAll
(
setOf
(
project
.
file
(
"fromKotlin"
),
project
.
file
(
"fromAndroid"
))),
"Expected custom configured source directories being present on kotlin source set after evaluation"
)
assertTrue
(
androidMain
.
java
.
srcDirs
.
containsAll
(
setOf
(
project
.
file
(
"fromKotlin"
),
project
.
file
(
"fromAndroid"
))),
"Expected custom configured source directories being present on android source set after evaluation"
)
}
@Test
...
...
libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/syncKotlinAndAndroidSourceSets.kt
浏览文件 @
6c7247cb
...
...
@@ -79,7 +79,6 @@ private fun syncKotlinAndAndroidSourceDirs(
}
kotlinSourceSet
.
kotlin
.
srcDirs
(*
androidSourceSet
.
java
.
srcDirs
.
toTypedArray
())
androidSourceSet
.
java
.
srcDirs
(*
kotlinSourceSet
.
kotlin
.
srcDirs
.
toTypedArray
())
/*
Make sure to include user configuration as well.
...
...
@@ -88,7 +87,6 @@ private fun syncKotlinAndAndroidSourceDirs(
*/
target
.
project
.
whenEvaluated
{
kotlinSourceSet
.
kotlin
.
srcDirs
(*
androidSourceSet
.
java
.
srcDirs
.
toTypedArray
())
androidSourceSet
.
java
.
srcDirs
(*
kotlinSourceSet
.
kotlin
.
srcDirs
.
toTypedArray
())
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录