Skip to content

Commit

Permalink
Change the way we deal with IDEA
Browse files Browse the repository at this point in the history
Since the jar task is buggy in the sense that it will include files TWICE when
classesDir == resourcesDir, proceed another way: create a dedicated task which
will do the compile for IDEA.
  • Loading branch information
fge committed Jun 25, 2013
1 parent e8cfe39 commit 544196d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ target
.idea
build
.gradle

out
7 changes: 0 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ fatJar {
classifier = "full";
}

jar {
manifest {
version = "${version}";
symbolicName = "${name}";
}
}

processResources {
dependsOn(generateServiceFiles);
}
Expand Down
27 changes: 23 additions & 4 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ task pom << {
* cannot include separate directories for classes and resources...
*/
project.ext {
sourceSets.main.output.classesDir = "build/classes";
sourceSets.main.output.resourcesDir = "build/classes";
sourceSets.test.output.classesDir = "build/test-classes";
sourceSets.test.output.resourcesDir = "build/test-classes";
ideaPath = new File("out").canonicalFile;
ideaProd = new File("out/production/${name}").canonicalFile;
ideaTest = new File("out/test/${name}").canonicalFile;
};

project.ext {
Expand Down Expand Up @@ -137,3 +136,23 @@ boolean isImplementationOf(final Class<?> baseClass, final String className)
return false;
return Modifier.isPublic(modifiers) && baseClass.isAssignableFrom(c);
}

/*
* We have to do that, otherwise IDEA won't see the generated service files
*/
task prepareIdea(dependsOn: testClasses) << {
if (ideaPath.exists())
delete(ideaPath);
ideaProd.mkdirs();
ideaTest.mkdirs();
copy {
from(sourceSets.main.output.classesDir);
from(sourceSets.main.output.resourcesDir);
into(ideaProd);
};
copy {
from(sourceSets.test.output.classesDir);
from(sourceSets.test.output.resourcesDir);
into(ideaTest);
}
}

0 comments on commit 544196d

Please sign in to comment.