Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
7e58e4d9
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,发现更多精彩内容 >>
提交
7e58e4d9
编写于
5月 02, 2012
作者:
P
pTalanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add srcdir as K2JSCompiler parameter.
上级
ce929fab
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
31 deletion
+34
-31
compiler/cli/src/org/jetbrains/jet/cli/js/K2JSCompiler.java
compiler/cli/src/org/jetbrains/jet/cli/js/K2JSCompiler.java
+29
-29
compiler/cli/src/org/jetbrains/jet/cli/js/K2JSCompilerArguments.java
...i/src/org/jetbrains/jet/cli/js/K2JSCompilerArguments.java
+5
-2
未找到文件。
compiler/cli/src/org/jetbrains/jet/cli/js/K2JSCompiler.java
浏览文件 @
7e58e4d9
...
...
@@ -20,12 +20,14 @@ import com.google.common.base.Predicates;
import
com.intellij.openapi.Disposable
;
import
com.intellij.psi.PsiFile
;
import
jet.Function0
;
import
jet.modules.Module
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.jet.analyzer.AnalyzeExhaust
;
import
org.jetbrains.jet.cli.common.CLICompiler
;
import
org.jetbrains.jet.cli.common.ExitCode
;
import
org.jetbrains.jet.cli.common.messages.*
;
import
org.jetbrains.jet.cli.common.messages.AnalyzerWithCompilerReport
;
import
org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity
;
import
org.jetbrains.jet.cli.common.messages.MessageRenderer
;
import
org.jetbrains.jet.cli.common.messages.PrintingMessageCollector
;
import
org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentUtil
;
import
org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment
;
import
org.jetbrains.jet.lang.psi.JetFile
;
...
...
@@ -34,7 +36,6 @@ import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
import
org.jetbrains.k2js.analyze.AnalyzerFacadeForJS
;
import
org.jetbrains.k2js.config.Config
;
import
java.io.File
;
import
java.io.PrintStream
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -61,37 +62,36 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments, K2JSCompile
@Override
protected
ExitCode
doExecute
(
PrintStream
stream
,
K2JSCompilerArguments
arguments
,
MessageRenderer
renderer
)
{
PrintingMessageCollector
messageCollector
=
new
PrintingMessageCollector
(
stream
,
renderer
,
true
);
if
(
arguments
.
module
=
=
null
)
{
stream
.
print
(
renderer
.
render
(
CompilerMessageSeverity
.
ERROR
,
"Module
should be specifi
ed"
,
NO_LOCATION
));
if
(
arguments
.
module
!
=
null
)
{
stream
.
print
(
renderer
.
render
(
CompilerMessageSeverity
.
ERROR
,
"Module
arg is not support
ed"
,
NO_LOCATION
));
return
ExitCode
.
INTERNAL_ERROR
;
}
File
directory
=
new
File
(
arguments
.
module
).
getParentFile
();
List
<
Module
>
modules
=
CompileEnvironmentUtil
.
loadModuleScript
(
arguments
.
module
,
MessageCollector
.
PLAIN_TEXT_TO_SYSTEM_ERR
);
for
(
Module
module
:
modules
)
{
Disposable
rootDisposable
=
CompileEnvironmentUtil
.
createMockDisposable
();
final
JetCoreEnvironment
environmentForJS
=
JetCoreEnvironment
.
getCoreEnvironmentForJS
(
rootDisposable
);
CompileEnvironmentUtil
.
addSourcesFromModuleToEnvironment
(
environmentForJS
,
module
,
directory
);
AnalyzerWithCompilerReport
analyzerWithCompilerReport
=
new
AnalyzerWithCompilerReport
(
messageCollector
);
final
List
<
JetFile
>
sources
=
environmentForJS
.
getSourceFiles
();
analyzerWithCompilerReport
.
analyzeAndReport
(
new
Function0
<
AnalyzeExhaust
>()
{
@Override
public
AnalyzeExhaust
invoke
()
{
BindingContext
context
=
AnalyzerFacadeForJS
.
analyzeFiles
(
sources
,
Predicates
.<
PsiFile
>
alwaysTrue
(),
new
Config
(
environmentForJS
.
getProject
())
{
@NotNull
@Override
protected
List
<
JetFile
>
generateLibFiles
()
{
return
Collections
.
emptyList
();
}
});
return
AnalyzeExhaust
.
success
(
context
,
JetStandardLibrary
.
getInstance
());
}
},
sources
);
if
(
arguments
.
srcdir
==
null
)
{
stream
.
print
(
renderer
.
render
(
CompilerMessageSeverity
.
ERROR
,
"Specify sources location via -srcdir"
,
NO_LOCATION
));
return
ExitCode
.
INTERNAL_ERROR
;
}
Disposable
rootDisposable
=
CompileEnvironmentUtil
.
createMockDisposable
();
final
JetCoreEnvironment
environmentForJS
=
JetCoreEnvironment
.
getCoreEnvironmentForJS
(
rootDisposable
);
environmentForJS
.
addSources
(
arguments
.
srcdir
);
AnalyzerWithCompilerReport
analyzerWithCompilerReport
=
new
AnalyzerWithCompilerReport
(
messageCollector
);
final
List
<
JetFile
>
sources
=
environmentForJS
.
getSourceFiles
();
analyzerWithCompilerReport
.
analyzeAndReport
(
new
Function0
<
AnalyzeExhaust
>()
{
@Override
public
AnalyzeExhaust
invoke
()
{
BindingContext
context
=
AnalyzerFacadeForJS
.
analyzeFiles
(
sources
,
Predicates
.<
PsiFile
>
alwaysTrue
(),
new
Config
(
environmentForJS
.
getProject
())
{
@NotNull
@Override
protected
List
<
JetFile
>
generateLibFiles
()
{
return
Collections
.
emptyList
();
}
});
return
AnalyzeExhaust
.
success
(
context
,
JetStandardLibrary
.
getInstance
());
}
},
sources
);
stream
.
print
(
renderer
.
render
(
CompilerMessageSeverity
.
ERROR
,
"Greeting"
,
NO_LOCATION
));
return
ExitCode
.
OK
;
}
...
...
compiler/cli/src/org/jetbrains/jet/cli/js/K2JSCompilerArguments.java
浏览文件 @
7e58e4d9
...
...
@@ -23,12 +23,15 @@ import org.jetbrains.jet.cli.common.CompilerArguments;
* @author Pavel Talanov
*/
public
class
K2JSCompilerArguments
extends
CompilerArguments
{
@Argument
(
value
=
"output"
,
description
=
"
o
utput directory"
)
@Argument
(
value
=
"output"
,
description
=
"
O
utput directory"
)
public
String
outputDir
;
@Argument
(
value
=
"module"
,
description
=
"
m
odule to compile"
)
@Argument
(
value
=
"module"
,
description
=
"
M
odule to compile"
)
public
String
module
;
@Argument
(
value
=
"srcdir"
,
description
=
"Sources directory"
)
public
String
srcdir
;
@Argument
(
value
=
"tags"
,
description
=
"Demarcate each compilation message (error, warning, etc) with an open and close tag"
)
public
boolean
tags
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录