Skip to content

Commit

Permalink
fixed the .gitignore
Browse files Browse the repository at this point in the history
Added missing class
  • Loading branch information
aantono committed May 20, 2014
1 parent 960aee9 commit 659d871
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.gradle
gradle
build
/**/gradle
/**/build
gradle-plugin-protobuf.i*
gradle.properties
.idea
/.idea
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package ws.antonov.gradle.plugins.protobuf

import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction

/**
* Created by aantonov on 5/19/14.
*/
class ProtobufExtract extends DefaultTask {

File extractedProtosDir

String configName

@TaskAction
def extract() {
project.configurations[configName].files.each { file ->
if (file.path.endsWith('.proto')) {
ant.copy(
file: file.path,
toDir: extractedProtosDir
)
//generateJavaTask.getSource().create(project.files(file))
} else if (file.path.endsWith('.jar') || file.path.endsWith('.zip')) {
ant.unzip(src: file.path, dest: extractedProtosDir)
} else {
def compression

if (file.path.endsWith('.tar')) {
compression = 'none'
} else
if (file.path.endsWith('.tar.gz')) {
compression = 'gzip'
} else if (file.path.endsWith('.tar.bz2')) {
compression = 'bzip2'
} else {
throw new GradleException(
"Unsupported file type (${file.path}); handles only jar, tar, tar.gz & tar.bz2")
}

ant.untar(
src: file.path,
dest: extractedProtosDir,
compression: compression)
}
}
}
}

0 comments on commit 659d871

Please sign in to comment.