Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
d50fd747
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d50fd747
编写于
8月 15, 2013
作者:
E
erikj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8015145: Smartjavac needs more flexibility with linking to sources
Reviewed-by: jjg, ohrstrom
上级
daa791a5
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
49 addition
and
9 deletion
+49
-9
src/share/classes/com/sun/tools/sjavac/JavacState.java
src/share/classes/com/sun/tools/sjavac/JavacState.java
+4
-1
src/share/classes/com/sun/tools/sjavac/Main.java
src/share/classes/com/sun/tools/sjavac/Main.java
+10
-7
test/tools/sjavac/SJavac.java
test/tools/sjavac/SJavac.java
+35
-1
未找到文件。
src/share/classes/com/sun/tools/sjavac/JavacState.java
浏览文件 @
d50fd747
...
...
@@ -808,8 +808,11 @@ public class JavacState
// Create a set of filenames with full paths.
for
(
Source
s
:
now
.
sources
().
values
())
{
// Don't include link only sources when comparing sources to compile
if
(!
s
.
isLinkedOnly
())
{
calculatedSources
.
add
(
s
.
file
().
getPath
());
}
}
// Read in the file and create another set of filenames with full paths.
try
{
BufferedReader
in
=
new
BufferedReader
(
new
FileReader
(
makefileSourceList
));
...
...
src/share/classes/com/sun/tools/sjavac/Main.java
浏览文件 @
d50fd747
...
...
@@ -249,16 +249,19 @@ public class Main {
return
-
1
;
}
// Find all source files allowable for linking.
// Create a map of all source files that are available for linking. Both -src and
// -sourcepath point to such files. It is possible to specify multiple
// -sourcepath options to enable different filtering rules. If the
// filters are the same for multiple sourcepaths, they may be concatenated
// using :(;). Before sending the list of sourcepaths to javac, they are
// all concatenated. The list created here is used by the SmartFileWrapper to
// make sure only the correct sources are actually available.
// We might find more modules here as well.
Map
<
String
,
Source
>
sources_to_link_to
=
new
HashMap
<
String
,
Source
>();
// Always reuse -src for linking as well! This means that we might
// get two -sourcepath on the commandline after the rewrite, which is
// fine. We can have as many as we like. You need to have separate -src/-sourcepath/-classpath
// if you need different filtering rules for different roots. If you have the same filtering
// rules for all sourcepath roots, you can concatenate them using :(;) as before.
rewriteOptions
(
args
,
"-src"
,
"-sourcepath"
);
findFiles
(
args
,
"-src"
,
Util
.
set
(
".java"
),
sources_to_link_to
,
modules
,
current_module
,
true
);
findFiles
(
args
,
"-sourcepath"
,
Util
.
set
(
".java"
),
sources_to_link_to
,
modules
,
current_module
,
true
);
// Rewrite the -src option to make it through to the javac instances.
rewriteOptions
(
args
,
"-src"
,
"-sourcepath"
);
// Find all class files allowable for linking.
// And pickup knowledge of all modules found here.
...
...
test/tools/sjavac/SJavac.java
浏览文件 @
d50fd747
...
...
@@ -21,6 +21,11 @@
* questions.
*/
/*
* @test
* @summary Tests sjavac basic functionality
*/
import
java.util.*
;
import
java.io.*
;
import
java.net.*
;
...
...
@@ -82,11 +87,13 @@ class SJavac {
compileWithOverrideSource
();
compileWithInvisibleSources
();
compileCircularSources
();
compileExcludingDependency
();
delete
(
gensrc
);
delete
(
gensrc2
);
delete
(
gensrc3
);
delete
(
bin
);
delete
(
headers
);
}
void
initialCompile
()
throws
Exception
{
...
...
@@ -381,6 +388,33 @@ class SJavac {
delete
(
bin
);
}
/**
* Tests compiling class A that depends on class B without compiling class B
* @throws Exception If test fails
*/
void
compileExcludingDependency
()
throws
Exception
{
System
.
out
.
println
(
"\nVerify that excluding classes from compilation but not from linking works."
);
System
.
out
.
println
(
"---------------------------------------------------------------------------"
);
delete
(
gensrc
);
delete
(
bin
);
previous_bin_state
=
collectState
(
bin
);
populate
(
gensrc
,
"alfa/A.java"
,
"package alfa; public class A { beta.B b; }"
,
"beta/B.java"
,
"package beta; public class B { }"
);
compile
(
"-x"
,
"beta"
,
"-src"
,
"gensrc"
,
"-x"
,
"alfa"
,
"-sourcepath"
,
"gensrc"
,
"-d"
,
"bin"
,
"--server:portfile=testserver,background=false"
);
Map
<
String
,
Long
>
new_bin_state
=
collectState
(
bin
);
verifyThatFilesHaveBeenAdded
(
previous_bin_state
,
new_bin_state
,
"bin/alfa/A.class"
,
"bin/javac_state"
);
}
void
removeFrom
(
Path
dir
,
String
...
args
)
throws
IOException
{
for
(
String
filename
:
args
)
{
Path
p
=
dir
.
resolve
(
filename
);
...
...
@@ -405,7 +439,7 @@ class SJavac {
}
}
void
delete
(
Path
root
)
throws
IOException
{
void
delete
(
final
Path
root
)
throws
IOException
{
if
(!
Files
.
exists
(
root
))
return
;
Files
.
walkFileTree
(
root
,
new
SimpleFileVisitor
<
Path
>()
{
@Override
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录