57 lines
1.6 KiB
Groovy
57 lines
1.6 KiB
Groovy
apply plugin: com.google.gradle.osdetector.OsDetectorPlugin
|
|
|
|
|
|
subprojects { proj ->
|
|
proj.afterEvaluate {
|
|
// Used to generate initial maven-dir layout
|
|
task "create-dirs" {
|
|
description = "Create default maven directory structure"
|
|
doLast {
|
|
sourceSets*.java.srcDirs*.each { it.mkdirs() }
|
|
sourceSets*.resources.srcDirs*.each { it.mkdirs() }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Script to create a copy of the protobuf compiler jar in the top-level build directory
|
|
// (will make it easier to configure the intellij protobuf plugin)
|
|
repositories {
|
|
mavenLocal();
|
|
mavenCentral();
|
|
}
|
|
|
|
|
|
project.ext.protocLocation = 'com.google.protobuf:protoc:3.+'
|
|
|
|
// Copied from Google's protobuf plugin code
|
|
File getProtocDep(protocLocation) {
|
|
// create a project configuration dependency for the artifact
|
|
Configuration config = project.configurations.create("protobufToolsLocator") {
|
|
visible = false
|
|
transitive = false
|
|
extendsFrom = []
|
|
}
|
|
|
|
def groupId, artifact, version
|
|
(groupId, artifact, version) = protocLocation.split(":")
|
|
def notation = [group: groupId,
|
|
name: artifact,
|
|
version: version,
|
|
classifier: project.osdetector.classifier,
|
|
ext: 'exe']
|
|
Dependency dep = project.dependencies.add(config.name, notation)
|
|
|
|
File file = config.fileCollection(dep).singleFile
|
|
|
|
return file
|
|
}
|
|
|
|
|
|
task getprotoc(type: Copy) {
|
|
from getProtocDep(project.ext.protocLocation)
|
|
rename { file -> return "protoc" }
|
|
into "${buildDir}/"
|
|
}
|
|
|