Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
514fc029
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,发现更多精彩内容 >>
提交
514fc029
编写于
12月 20, 2016
作者:
D
Dmitry Jemerov
提交者:
Alexey Tsvetkov
12月 22, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Propagate 'implement' dependencies from Gradle to IDEA project model
上级
9b4b7960
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
158 addition
and
0 deletion
+158
-0
.idea/artifacts/KotlinPlugin.xml
.idea/artifacts/KotlinPlugin.xml
+3
-0
.idea/modules.xml
.idea/modules.xml
+1
-0
idea/idea.iml
idea/idea.iml
+1
-0
idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml
idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml
+13
-0
idea/kotlin-gradle-tooling/src/KotlinGradleModelBuilder.kt
idea/kotlin-gradle-tooling/src/KotlinGradleModelBuilder.kt
+49
-0
idea/kotlin-gradle-tooling/src/META-INF/services/org.jetbrains.plugins.gradle.tooling.ModelBuilderService
.../org.jetbrains.plugins.gradle.tooling.ModelBuilderService
+1
-0
idea/src/META-INF/gradle.xml
idea/src/META-INF/gradle.xml
+1
-0
idea/src/org/jetbrains/kotlin/idea/configuration/KotlinGradleProjectResolverExtension.kt
...dea/configuration/KotlinGradleProjectResolverExtension.kt
+89
-0
未找到文件。
.idea/artifacts/KotlinPlugin.xml
浏览文件 @
514fc029
...
@@ -100,6 +100,9 @@
...
@@ -100,6 +100,9 @@
<element
id=
"archive"
name=
"sam-with-receiver-ide-plugin.jar"
>
<element
id=
"archive"
name=
"sam-with-receiver-ide-plugin.jar"
>
<element
id=
"module-output"
name=
"sam-with-receiver-ide"
/>
<element
id=
"module-output"
name=
"sam-with-receiver-ide"
/>
</element>
</element>
<element
id=
"archive"
name=
"kotlin-gradle-tooling.jar"
>
<element
id=
"module-output"
name=
"kotlin-gradle-tooling"
/>
</element>
</element>
</element>
<element
id=
"directory"
name=
"kotlinc"
>
<element
id=
"directory"
name=
"kotlinc"
>
<element
id=
"dir-copy"
path=
"$PROJECT_DIR$/dist/kotlinc"
/>
<element
id=
"dir-copy"
path=
"$PROJECT_DIR$/dist/kotlinc"
/>
...
...
.idea/modules.xml
浏览文件 @
514fc029
...
@@ -74,6 +74,7 @@
...
@@ -74,6 +74,7 @@
<module
fileurl=
"file://$PROJECT_DIR$/js/js.translator/js.translator.iml"
filepath=
"$PROJECT_DIR$/js/js.translator/js.translator.iml"
group=
"compiler/js"
/>
<module
fileurl=
"file://$PROJECT_DIR$/js/js.translator/js.translator.iml"
filepath=
"$PROJECT_DIR$/js/js.translator/js.translator.iml"
group=
"compiler/js"
/>
<module
fileurl=
"file://$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml"
filepath=
"$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml"
group=
"ide/jps"
/>
<module
fileurl=
"file://$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml"
filepath=
"$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml"
group=
"ide/jps"
/>
<module
fileurl=
"file://$PROJECT_DIR$/plugins/kapt3/kapt3.iml"
filepath=
"$PROJECT_DIR$/plugins/kapt3/kapt3.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/plugins/kapt3/kapt3.iml"
filepath=
"$PROJECT_DIR$/plugins/kapt3/kapt3.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml"
filepath=
"$PROJECT_DIR$/idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml"
/>
<module
fileurl=
"file://$PROJECT_DIR$/compiler/light-classes/light-classes.iml"
filepath=
"$PROJECT_DIR$/compiler/light-classes/light-classes.iml"
group=
"compiler/java"
/>
<module
fileurl=
"file://$PROJECT_DIR$/compiler/light-classes/light-classes.iml"
filepath=
"$PROJECT_DIR$/compiler/light-classes/light-classes.iml"
group=
"compiler/java"
/>
<module
fileurl=
"file://$PROJECT_DIR$/plugins/lint/lint-api/lint-api.iml"
filepath=
"$PROJECT_DIR$/plugins/lint/lint-api/lint-api.iml"
group=
"plugins/lint"
/>
<module
fileurl=
"file://$PROJECT_DIR$/plugins/lint/lint-api/lint-api.iml"
filepath=
"$PROJECT_DIR$/plugins/lint/lint-api/lint-api.iml"
group=
"plugins/lint"
/>
<module
fileurl=
"file://$PROJECT_DIR$/plugins/lint/lint-checks/lint-checks.iml"
filepath=
"$PROJECT_DIR$/plugins/lint/lint-checks/lint-checks.iml"
group=
"plugins/lint"
/>
<module
fileurl=
"file://$PROJECT_DIR$/plugins/lint/lint-checks/lint-checks.iml"
filepath=
"$PROJECT_DIR$/plugins/lint/lint-checks/lint-checks.iml"
group=
"plugins/lint"
/>
...
...
idea/idea.iml
浏览文件 @
514fc029
...
@@ -58,5 +58,6 @@
...
@@ -58,5 +58,6 @@
<orderEntry
type=
"module"
module-name=
"noarg-ide"
scope=
"TEST"
/>
<orderEntry
type=
"module"
module-name=
"noarg-ide"
scope=
"TEST"
/>
<orderEntry
type=
"module"
module-name=
"sam-with-receiver-ide"
scope=
"TEST"
/>
<orderEntry
type=
"module"
module-name=
"sam-with-receiver-ide"
scope=
"TEST"
/>
<orderEntry
type=
"module"
module-name=
"descriptors"
/>
<orderEntry
type=
"module"
module-name=
"descriptors"
/>
<orderEntry
type=
"module"
module-name=
"kotlin-gradle-tooling"
/>
</component>
</component>
</module>
</module>
\ No newline at end of file
idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml
0 → 100644
浏览文件 @
514fc029
<?xml version="1.0" encoding="UTF-8"?>
<module
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
inherit-compiler-output=
"true"
>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src"
isTestSource=
"false"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
name=
"gradle-and-groovy-plugin"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"kotlin-runtime"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
idea/kotlin-gradle-tooling/src/KotlinGradleModelBuilder.kt
0 → 100644
浏览文件 @
514fc029
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jetbrains.kotlin.gradle
import
org.gradle.api.Project
import
org.gradle.api.artifacts.ProjectDependency
import
org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder
import
org.jetbrains.plugins.gradle.tooling.ModelBuilderService
import
java.io.Serializable
import
java.lang.Exception
interface
KotlinGradleModel
:
Serializable
{
val
implements
:
String
?
}
class
KotlinGradleModelImpl
(
override
val
implements
:
String
?)
:
KotlinGradleModel
class
KotlinGradleModelBuilder
:
ModelBuilderService
{
override
fun
getErrorMessageBuilder
(
project
:
Project
,
e
:
Exception
):
ErrorMessageBuilder
{
return
ErrorMessageBuilder
.
create
(
project
,
e
,
"Gradle import errors"
).
withDescription
(
"Unable to build Kotlin project configuration"
)
}
override
fun
canBuild
(
modelName
:
String
?):
Boolean
=
modelName
==
KotlinGradleModel
::
class
.
java
.
name
override
fun
buildAll
(
modelName
:
String
?,
project
:
Project
):
Any
{
val
implementsConfiguration
=
project
.
configurations
.
findByName
(
"implement"
)
if
(
implementsConfiguration
!=
null
)
{
val
implementsProjectDependency
=
implementsConfiguration
.
dependencies
.
filterIsInstance
<
ProjectDependency
>().
firstOrNull
()
if
(
implementsProjectDependency
!=
null
)
{
return
KotlinGradleModelImpl
(
implementsProjectDependency
.
dependencyProject
.
path
)
}
}
return
KotlinGradleModelImpl
(
null
)
}
}
idea/kotlin-gradle-tooling/src/META-INF/services/org.jetbrains.plugins.gradle.tooling.ModelBuilderService
0 → 100644
浏览文件 @
514fc029
org.jetbrains.kotlin.gradle.KotlinGradleModelBuilder
idea/src/META-INF/gradle.xml
浏览文件 @
514fc029
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<extensions
defaultExtensionNs=
"org.jetbrains.plugins.gradle"
>
<extensions
defaultExtensionNs=
"org.jetbrains.plugins.gradle"
>
<frameworkSupport
implementation=
"org.jetbrains.kotlin.idea.configuration.GradleKotlinJavaFrameworkSupportProvider"
/>
<frameworkSupport
implementation=
"org.jetbrains.kotlin.idea.configuration.GradleKotlinJavaFrameworkSupportProvider"
/>
<pluginDescriptions
implementation=
"org.jetbrains.kotlin.idea.configuration.KotlinGradlePluginDescription"
/>
<pluginDescriptions
implementation=
"org.jetbrains.kotlin.idea.configuration.KotlinGradlePluginDescription"
/>
<projectResolve
implementation=
"org.jetbrains.kotlin.idea.configuration.KotlinGradleProjectResolverExtension"
/>
</extensions>
</extensions>
<extensionPoints>
<extensionPoints>
...
...
idea/src/org/jetbrains/kotlin/idea/configuration/KotlinGradleProjectResolverExtension.kt
0 → 100644
浏览文件 @
514fc029
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jetbrains.kotlin.idea.configuration
import
com.intellij.openapi.externalSystem.model.DataNode
import
com.intellij.openapi.externalSystem.model.ProjectKeys
import
com.intellij.openapi.externalSystem.model.project.ModuleData
import
com.intellij.openapi.externalSystem.model.project.ModuleDependencyData
import
com.intellij.openapi.externalSystem.model.project.ProjectData
import
com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
import
com.intellij.openapi.roots.DependencyScope
import
org.gradle.tooling.model.idea.IdeaModule
import
org.jetbrains.kotlin.gradle.KotlinGradleModel
import
org.jetbrains.kotlin.gradle.KotlinGradleModelBuilder
import
org.jetbrains.plugins.gradle.model.ExternalProject
import
org.jetbrains.plugins.gradle.model.data.GradleSourceSetData
import
org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension
import
org.jetbrains.plugins.gradle.service.project.GradleProjectResolverUtil.getModuleId
class
KotlinGradleProjectResolverExtension
:
AbstractProjectResolverExtension
()
{
override
fun
getToolingExtensionsClasses
():
Set
<
Class
<
out
Any
>>
{
return
setOf
(
KotlinGradleModelBuilder
::
class
.
java
,
Unit
::
class
.
java
)
}
override
fun
getExtraProjectModelClasses
():
Set
<
Class
<
out
Any
>>
{
return
setOf
(
KotlinGradleModel
::
class
.
java
)
}
override
fun
populateModuleDependencies
(
gradleModule
:
IdeaModule
,
ideModule
:
DataNode
<
ModuleData
>,
ideProject
:
DataNode
<
ProjectData
>)
{
val
gradleModel
=
resolverCtx
.
getExtraProject
(
gradleModule
,
KotlinGradleModel
::
class
.
java
)
?:
return
gradleModel
.
implements
?.
let
{
implementsModuleId
->
val
targetModule
=
findModule
(
ideProject
,
implementsModuleId
)
?:
return
if
(
resolverCtx
.
isResolveModulePerSourceSet
)
{
populateSourceSetDependencies
(
gradleModule
,
ideModule
,
targetModule
)
}
else
{
addDependency
(
ideModule
,
targetModule
)
}
}
super
.
populateModuleDependencies
(
gradleModule
,
ideModule
,
ideProject
)
}
private
fun
addDependency
(
ideModule
:
DataNode
<
out
ModuleData
>,
targetModule
:
DataNode
<
out
ModuleData
>)
{
val
moduleDependencyData
=
ModuleDependencyData
(
ideModule
.
data
,
targetModule
.
data
)
moduleDependencyData
.
scope
=
DependencyScope
.
COMPILE
moduleDependencyData
.
isExported
=
false
ideModule
.
createChild
(
ProjectKeys
.
MODULE_DEPENDENCY
,
moduleDependencyData
)
}
private
fun
findModule
(
ideProject
:
DataNode
<
ProjectData
>,
moduleId
:
String
):
DataNode
<
ModuleData
>?
{
return
ideProject
.
children
.
find
{
(
it
.
data
as
?
ModuleData
)
?.
id
==
moduleId
}
as
DataNode
<
ModuleData
>?
}
private
fun
populateSourceSetDependencies
(
gradleModule
:
IdeaModule
,
fromModule
:
DataNode
<
ModuleData
>,
targetModule
:
DataNode
<
ModuleData
>)
{
val
fromSourceSets
=
ExternalSystemApiUtil
.
findAll
(
fromModule
,
GradleSourceSetData
.
KEY
)
.
associateBy
{
it
.
data
.
id
}
val
targetSourceSets
=
ExternalSystemApiUtil
.
findAll
(
targetModule
,
GradleSourceSetData
.
KEY
)
.
associateBy
{
it
.
data
.
id
.
substringAfterLast
(
':'
)
}
val
externalProject
=
resolverCtx
.
getExtraProject
(
gradleModule
,
ExternalProject
::
class
.
java
)
?:
return
for
(
sourceSet
in
externalProject
.
sourceSets
.
values
)
{
if
(
sourceSet
==
null
||
sourceSet
.
sources
.
isEmpty
())
continue
val
moduleId
=
getModuleId
(
externalProject
,
sourceSet
)
val
fromModuleDataNode
=
(
if
(
fromSourceSets
.
isEmpty
())
fromModule
else
fromSourceSets
[
moduleId
])
?:
continue
val
targetModuleDataNode
=
(
if
(
targetSourceSets
.
isEmpty
())
targetModule
else
targetSourceSets
[
sourceSet
.
name
])
?:
continue
addDependency
(
fromModuleDataNode
,
targetModuleDataNode
)
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录