snowch / biginsight-examples

Example projects to help you quickly get started with BigInsights
Apache License 2.0
7 stars 4 forks source link

add gradle wrapper to each example #76

Closed snowch closed 8 years ago

snowch commented 8 years ago

I had one user confused by running ../../gradlew

We can get rid of this issue by adding gradle wrapper to each example. Here is an example to keep the wrappers all at the same version:

ext.gradleVersion = '2.9'

////////////////////////////////////////////////////////////////////////////////

task wrapper(type: Wrapper) {
    gradleVersion = gradleVersion
}

// utility task to setup wrapper in top level project and sub projects
task setupWrapper (dependsOn: wrapper) {

    new File("${projectDir}/examples").traverse( maxDepth: 0, type: groovy.io.FileType.DIRECTORIES ){ dir ->
        println "Wrapping examples directory ${dir.absolutePath}"
        exec {
            workingDir dir
            commandLine "${projectDir}/gradlew", "wrapper", "--gradle-version", gradleVersion
        }
    }
}

What do you think?

pregazzoni commented 8 years ago

so the setup task would have to be run first and we would not check-in the "wrapper" files in subdir i presume. Need to ignore gradlew, gradlew.bat and gradle/ in each subdir.

i guess this could also be optional. if you want to continue to type ../../gradlew

snowch commented 8 years ago

On the spark examples project, I checked in the generated files to make it as easy as possible for users.

pregazzoni commented 8 years ago

Issue is lots of duplicate code but usability trumps that :)

Also i guess you figured out how to keep those in sync.