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:
@@ -128,7 +128,9 @@ def gen_plugin_classpath(root):
|
|||||||
if path.exists(path.join(root, 'src', 'test', 'java')):
|
if path.exists(path.join(root, 'src', 'test', 'java')):
|
||||||
testpath = """
|
testpath = """
|
||||||
<classpathentry excluding="**/BUILD" kind="src" path="src/test/java"\
|
<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:
|
else:
|
||||||
testpath = ""
|
testpath = ""
|
||||||
print("""\
|
print("""\
|
||||||
@@ -161,6 +163,13 @@ def gen_classpath(ext):
|
|||||||
e.setAttribute('output', out)
|
e.setAttribute('output', out)
|
||||||
if exported:
|
if exported:
|
||||||
e.setAttribute('exported', 'true')
|
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.documentElement.appendChild(e)
|
||||||
|
|
||||||
doc = make_classpath()
|
doc = make_classpath()
|
||||||
|
Reference in New Issue
Block a user