From cc5c7f117d1bc80aebb0a70e1f3d8ec3dd0cccc5 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Thu, 11 Oct 2018 21:03:21 +0900 Subject: [PATCH] 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 --- tools/eclipse/project.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/eclipse/project.py b/tools/eclipse/project.py index e515a3a27c..ce4baf9b83 100755 --- a/tools/eclipse/project.py +++ b/tools/eclipse/project.py @@ -128,7 +128,9 @@ def gen_plugin_classpath(root): if path.exists(path.join(root, 'src', 'test', 'java')): testpath = """ """ + out="eclipse-out/test"> + + """ 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()