Skip to content

Commit

Permalink
gradle-local-repository: New option -c
Browse files Browse the repository at this point in the history
  • Loading branch information
uli-heller committed Jul 6, 2014
1 parent 22bba53 commit d37cc85
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ Version History

### 0.7.0 (not yet released)

### 0.6.2 2014-07-06
### 0.6.3 2014-07-06

* gradle-local-repository: Fixed handling of parent dependencies - copy poms

### 0.6.2 2014-07-06

* no improvements

### 0.6.1 2014-07-06

* no improvements
Expand Down
20 changes: 17 additions & 3 deletions gradle-local-repository/scripts/copyArtifacts.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import groovy.transform.EqualsAndHashCode;
import groovy.transform.ToString;


def cli = new CliBuilder(usage: "copyArtifacts [-v][-h] -g gradleHome -t to", posix: true);
def cli = new CliBuilder(usage: "gradle-local-repository [-v][-h] [-c copyPomsFile] -g gradleHome -t to", posix: true);
cli.with {
h longOpt: 'help', 'Show usage information'
v longOpt: 'verbose', 'Create debug output'
g longOpt: 'gradle-home', required: true, args: 1, argName: 'gradleHomeDir', '...'
t longOpt: 'to', required: true, args: 1, argName: 'toDir', '...'
c longOpt: 'copy-poms', args: 1, argName: 'copyPomsFile', 'File containing a list of forced poms to copy'
g longOpt: 'gradle-home', required: true, args: 1, argName: 'gradleHomeDir', 'Name of the gradle home directory'
t longOpt: 'to', required: true, args: 1, argName: 'toDir', 'Destination folder'
};

def options = cli.parse(args);
Expand All @@ -24,10 +25,20 @@ if (options.h) {
boolean fVerbose = options.v;
String groovyHomeDirString = options.g;
String toDirString = options.t;
String copyPomsString = options.c ? options.c : null;

File groovyHomeDir = new File(groovyHomeDirString);
File toDir = new File(toDirString);

def copyPoms = [];

if (copyPomsString) {
File fcps = new File(copyPomsString);
fcps.eachLine {
copyPoms += it;
}
}

def allJars = [];
def allIvys = [];
def allPoms = [];
Expand Down Expand Up @@ -69,6 +80,9 @@ for (Ivy ivy : allIvys) {
allJars.findAll{ jar -> jar.groupArtifactVersion.equals(gav) }.each {
fCreateAndCopy = true; // there is a jar file -> destination has to be created
}
if (copyPoms.contains(gav.artifact)) {
fCreateAndCopy = true;
}
if (! fCreateAndCopy) { // we're not sure about the destination yet...
def xmlPom; // so we'll parse the pom file
allPoms.findAll{ jar -> jar.groupArtifactVersion.equals(gav) }.each {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.7.0.BUILD-SNAPSHOT
version=0.6.3

0 comments on commit d37cc85

Please sign in to comment.