From 6b3727eb17ae8ab6c25685e902c0527b01054ffa Mon Sep 17 00:00:00 2001 From: "Matthew O. Smith" Date: Thu, 7 May 2015 11:57:06 -0600 Subject: [PATCH] gh-18 Gradle is working for one example --- .../project/GradleProjectsCreator.groovy | 18 +++++++++++++++--- .../malabar/project/MavenProjectHandler.groovy | 2 +- .../project/TestGradleProjectsCreator.groovy | 14 +++++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/main/groovy/com/software_ninja/malabar/project/GradleProjectsCreator.groovy b/src/main/groovy/com/software_ninja/malabar/project/GradleProjectsCreator.groovy index e0e7533..420b662 100755 --- a/src/main/groovy/com/software_ninja/malabar/project/GradleProjectsCreator.groovy +++ b/src/main/groovy/com/software_ninja/malabar/project/GradleProjectsCreator.groovy @@ -27,17 +27,29 @@ public class GradleProjectsCreator { println deps0; def deps = deps0.grep({ it.scope == gradleScope }); println deps; + println "COntect Roots:" + model.contentRoots; + def crs = model.contentRoots; + def dependencies = model.dependencies; - [ dependencies : deps.gather{it.file.toString()}, + [ dependencies : dependencies.collect({ it.file.absolutePath}), resources: [] , - sources: "test" == scope ? model.modules.contentRoots.testDirectories.gather({it.directory}) : - model.modules.contentRoots.sourceDirectories.gather({it.directory}), + sources: "test" == scope ? crs.collect({cr -> [cr.testDirectories.collect({it.directory.absolutePath}), + cr.generatedTestDirectories.collect({it.directory.absolutePath}) + ]}).flatten() + : + crs.collect({cr -> [cr.sourceDirectories.collect({it.directory.absolutePath}), + cr.generatedSourceDirectories.collect({it.directory.absolutePath}) + + ]}).flatten() , + elements: "test" == scope ? model.compilerOutput.outputDir.toString() : model.compilerOutput.testOutputDir.toString() ] } + + } diff --git a/src/main/groovy/com/software_ninja/malabar/project/MavenProjectHandler.groovy b/src/main/groovy/com/software_ninja/malabar/project/MavenProjectHandler.groovy index 26e4a7d..f27e915 100755 --- a/src/main/groovy/com/software_ninja/malabar/project/MavenProjectHandler.groovy +++ b/src/main/groovy/com/software_ninja/malabar/project/MavenProjectHandler.groovy @@ -110,7 +110,7 @@ public class MavenProjectHandler { projectInfo['runtime']['elements'] + projectInfo['test']['classpath']; def resourceCache = new ResourceCache(); - classpath.each({if(it != null) resourceCache.submit(it)}); + classpath.each({if(it != null) {println "IT:" + it; resourceCache.submit(it)}}); bootClasspath.split(System.getProperty("path.separator")).each({if(it != null) resourceCache.submit(it)}); def staticClassloader = createClassLoaderStatic(classpath); diff --git a/src/test/groovy/com/software_ninja/malabar/project/TestGradleProjectsCreator.groovy b/src/test/groovy/com/software_ninja/malabar/project/TestGradleProjectsCreator.groovy index 0af9487..d1fb4c4 100755 --- a/src/test/groovy/com/software_ninja/malabar/project/TestGradleProjectsCreator.groovy +++ b/src/test/groovy/com/software_ninja/malabar/project/TestGradleProjectsCreator.groovy @@ -9,9 +9,17 @@ public class TestGradleProjectsCreator { GradleProjectsCreator target = new GradleProjectsCreator(); @Test - void testArgs(){ - println System.getProperty ('user.dir'); - target.create("", "."); + void testArgs() throws Exception { + println "USER.DIR" + System.getProperty ('user.dir'); + def proj = target.create("", "."); + println "GRADLE PROJECT:" + proj; + Class c = proj[0].getClass(); + Class[] theInterfaces = c.getInterfaces(); + for (int i = 0; i < theInterfaces.length; i++) { + String interfaceName = theInterfaces[i].getName(); + System.out.println( "INTERFACE:" + interfaceName); + } + println "DEPENDENCIES: " + target.resolveDependencies( proj[0], "", "runtime") ; }