project.py: Enable test source attributes in .classpath
In Eclipse Proton, there is a new "Contains test sources" attribute on source folders. Test source folders and dependencies are shown with a darker icon in the build path settings, the package explorer and other locations. See the Photon release notes [1] for details. Add the necessary "test" attribute on the classpathentry. This has no impact on earlier versions of Eclipse, or IDEs other than Eclipse; they will simply ignore this attribute. [1] https://www.eclipse.org/photon/noteworthy/ Change-Id: I9ff701bd2328cc9b6d7c4726ce51dc55345b3810
This commit is contained in:
parent
aa0ebc8915
commit
cc5c7f117d
@ -128,7 +128,9 @@ def gen_plugin_classpath(root):
|
||||
if path.exists(path.join(root, 'src', 'test', 'java')):
|
||||
testpath = """
|
||||
<classpathentry excluding="**/BUILD" kind="src" path="src/test/java"\
|
||||
out="eclipse-out/test"/>"""
|
||||
out="eclipse-out/test">
|
||||
<attributes><attribute name="test" value="true"/></attributes>
|
||||
</classpathentry>"""
|
||||
else:
|
||||
testpath = ""
|
||||
print("""\
|
||||
@ -161,6 +163,13 @@ def gen_classpath(ext):
|
||||
e.setAttribute('output', out)
|
||||
if exported:
|
||||
e.setAttribute('exported', 'true')
|
||||
if out and "test" in out:
|
||||
atts = doc.createElement('attributes')
|
||||
testAtt = doc.createElement('attribute')
|
||||
testAtt.setAttribute('name', 'test')
|
||||
testAtt.setAttribute('value', 'true')
|
||||
atts.appendChild(testAtt)
|
||||
e.appendChild(atts)
|
||||
doc.documentElement.appendChild(e)
|
||||
|
||||
doc = make_classpath()
|
||||
|
Loading…
Reference in New Issue
Block a user