Return-Path: X-Original-To: apmail-ant-notifications-archive@minotaur.apache.org Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 79EC118E2C for ; Mon, 21 Mar 2016 11:21:13 +0000 (UTC) Received: (qmail 6735 invoked by uid 500); 21 Mar 2016 11:21:13 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 6634 invoked by uid 500); 21 Mar 2016 11:21:13 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 6483 invoked by uid 99); 21 Mar 2016 11:21:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Mar 2016 11:21:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CC5CEDFDE0; Mon, 21 Mar 2016 11:21:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bodewig@apache.org To: notifications@ant.apache.org Date: Mon, 21 Mar 2016 11:21:12 -0000 Message-Id: <3bb1f96787344a80ac93770a45217e87@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/5] ant git commit: Added unit test for excludes in multi module compilation. Repository: ant Updated Branches: refs/heads/master 038e1948e -> edca1db3d Added unit test for excludes in multi module compilation. Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/ea99177e Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/ea99177e Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/ea99177e Branch: refs/heads/master Commit: ea99177eb266696cebf3555014301ec6edc7ca5a Parents: 7bd7ed4 Author: Tomas Zezula Authored: Fri Mar 11 15:44:59 2016 +0100 Committer: Stefan Bodewig Committed: Mon Mar 21 12:02:59 2016 +0100 ---------------------------------------------------------------------- .../compilers/DefaultCompilerAdapterTest.java | 50 ++++++++++++++++++++ 1 file changed, 50 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/ea99177e/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java index 2972cdb..798345b 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapterTest.java @@ -306,6 +306,56 @@ public class DefaultCompilerAdapterTest { } } + @Test + public void testMultiModuleCompilationWithExcludes() throws IOException { + final File workDir = createWorkDir("testMMCWE"); + try { + final File src = new File(workDir, "src"); + src.mkdir(); + final File java1 = createFile(src,"main/m1/lin/classes/org/apache/ant/tests/J1.java"); + final File java2 = createFile(src,"main/m3/sol/classes/org/apache/ant/tests/J2.java"); + final File java3 = createFile(src,"main/m3/sol/classes/org/apache/ant/invisible/J3.java"); + final File build = new File(workDir, "build"); + build.mkdirs(); + final Project prj = new Project(); + prj.setBaseDir(workDir); + final LogCapturingJavac javac = new LogCapturingJavac(); + javac.setProject(prj); + final DefaultCompilerAdapter impl = new DefaultCompilerAdapter() { + @Override + public boolean execute() throws BuildException { + setupModernJavacCommand(); + return true; + } + }; + final String moduleSrcPathStr = "src/main/*/{lin,sol}/classes"; + final Path moduleSourcePath = new Path(prj); + moduleSourcePath.setPath(moduleSrcPathStr); + javac.setModulesourcepath(moduleSourcePath); + javac.setSource("9"); + javac.setTarget("9"); + javac.setDestdir(build); + javac.setIncludeantruntime(false); + javac.createExclude().setName("org/**/invisible/**"); + javac.add(impl); + javac.execute(); + final File[] compileList = impl.compileList; + Assert.assertNotNull(compileList); + //J1.java, J2.java has to be in files list but not J3.java + final Set expectedFiles = new TreeSet(); + Collections.addAll(expectedFiles, + java1.getAbsolutePath(), + java2.getAbsolutePath()); + final Set actualFiles = new TreeSet(); + for (File compileFile : compileList) { + actualFiles.add(compileFile.getAbsolutePath()); + } + assertEquals(expectedFiles, actualFiles); + } finally { + delete(workDir); + } + } + private void commonSourceDowngrades(String javaVersion) { testSource("1.3", javaVersion, "If you specify -target 1.1 you now must also specify"