Skip to content
Browse files

Merge branch 'lighthouse-1081-patch' of https://github.com/tkral/play

…into lighthouse-1081-patch

Conflicts:
	framework/src/play/deps/DependenciesManager.java
  • Loading branch information...
2 parents 1594db3 + 178dc40 commit d7ffcec1b5e1f49725b42e0e21817e7ff42aea91 @pepite pepite committed Aug 31, 2011
Showing with 30 additions and 1 deletion.
  1. +7 −1 framework/pym/play/commands/deps.py
  2. +23 −0 framework/src/play/deps/DependenciesManager.java
View
8 framework/pym/play/commands/deps.py
@@ -22,13 +22,19 @@ def execute(**kargs):
play_env = kargs.get("env")
force = "false"
+ trim = "false"
if args.count('--forceCopy') == 1:
args.remove('--forceCopy')
force = "true"
+
+ if args.count('--forProd') == 1:
+ args.remove('--forProd')
+ force = "true"
+ trim = "true"
classpath = app.getClasspath()
- add_options = ['-Dapplication.path=%s' % (app.path), '-Dframework.path=%s' % (play_env['basedir']), '-Dplay.id=%s' % play_env['id'], '-Dplay.version=%s' % play_env['version'], '-Dplay.forcedeps=%s' % (force)]
+ add_options = ['-Dapplication.path=%s' % (app.path), '-Dframework.path=%s' % (play_env['basedir']), '-Dplay.id=%s' % play_env['id'], '-Dplay.version=%s' % play_env['version'], '-Dplay.forcedeps=%s' % (force), '-Dplay.trimdeps=%s' % (trim)]
if args.count('--verbose'):
add_options.append('-Dverbose')
if args.count('--sync'):
View
23 framework/src/play/deps/DependenciesManager.java
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -55,6 +56,20 @@ public static void main(String[] args) throws Exception {
File framework;
File userHome;
HumanReadyLogger logger;
+
+ final FileFilter dirsToTrim = new FileFilter() {
+
+ @Override
+ public boolean accept(File file) {
+ return file.isDirectory() && isDirToTrim(file.getName());
+ }
+
+ private boolean isDirToTrim(String fileName) {
+ return "documentation".equals(fileName) || "src".equals(fileName) ||
+ "tmp".equals(fileName) || fileName.contains("sample") ||
+ fileName.contains("test");
+ }
+ };
public DependenciesManager(File application, File framework, File userHome) {
this.application = application;
@@ -199,6 +214,7 @@ public boolean problems() {
public File install(ArtifactDownloadReport artifact) throws Exception {
Boolean force = System.getProperty("play.forcedeps").equals("true");
+ Boolean trim = System.getProperty("play.trimdeps").equals("true");
try {
File from = artifact.getLocalFile();
if (!isPlayModule(artifact)) {
@@ -226,6 +242,13 @@ public File install(ArtifactDownloadReport artifact) throws Exception {
Files.unzip(from, to);
System.out.println("~ \tmodules/" + to.getName());
}
+
+ if (trim) {
+ for (File dirToTrim : to.listFiles(dirsToTrim)) {
+ Files.deleteDirectory(dirToTrim);
+ }
+ }
+
return to;
}
} catch (Exception e) {

0 comments on commit d7ffcec

Please sign in to comment.
Something went wrong with that request. Please try again.