Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoox authored Apr 8, 2021
1 parent c03a2e5 commit 520184d
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 37 deletions.
6 changes: 3 additions & 3 deletions gradle/scripts/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/line/gradle-scripts.git
branch = master
commit = b4670707c10f3eb59925b7edcd65aa83f6547eeb
parent = ff5d53d6186fbafc6d8a7b68084b389ef65eca99
cmdver = 0.4.1
commit = 5282f3234cad321ba23074663a940286a37030f4
parent = 85e0c4f5296916c0f802377cb8ca9d01cae1ac96
cmdver = 0.1.0
method = merge
19 changes: 15 additions & 4 deletions gradle/scripts/lib/common-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ rootProject.ext {
}
}

def managedDependencyVersions = [:]
def managedDependencyVersions = new TreeMap<String, String>() {
@Override
String get(Object key) {
def value = super.get(key)
if (value != null) {
return value
} else {
throw new IllegalArgumentException("Missing managed dependency: ${key}")
}
}
}
def managedDependencyExclusions = [:].withDefault { [] }
def managedDependencyOverrides = [] as Set
rootProject.ext.dependenciesYaml.forEach { String key, value ->
Expand Down Expand Up @@ -216,12 +226,10 @@ rootProject.ext {
def groupId = entry.key
entry.value.forEach { String artifactId, Map props ->
if (props.containsKey('javadocs')) {
def version = String.valueOf(managedDependencyVersions["${groupId}:${artifactId}"])
props['javadocs'].each { url ->
list.add([
groupId: groupId,
artifactId: artifactId,
version: version,
url: url
])
}
Expand All @@ -244,9 +252,12 @@ configure(rootProject) {
task managedVersions(
group: 'Build',
description: 'Generates the file that contains dependency versions.') {

def f = file("${project.buildDir}/managed_versions.yml")
inputs.properties managedDependencyVersions
outputs.file(f)

doLast {
def f = file("${project.buildDir}/managed_versions.yml")
f.parentFile.mkdir()
f.withWriter('UTF-8') {
new Yaml().dump(managedDependencyVersions, it)
Expand Down
3 changes: 2 additions & 1 deletion gradle/scripts/lib/common-git.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import static org.gradle.internal.os.OperatingSystem.*
import static org.gradle.internal.os.OperatingSystem.WINDOWS
import static org.gradle.internal.os.OperatingSystem.current

rootProject.ext {
// The path to the 'git' command
Expand Down
10 changes: 9 additions & 1 deletion gradle/scripts/lib/java-coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ if (!jacocoEnabled) {
return
}

// Override JaCoCo version if needed
def jacocoVersion = managedVersions.containsKey('org.jacoco:org.jacoco.ant') ?
managedVersions['org.jacoco:org.jacoco.ant'] : JacocoPlugin.DEFAULT_JACOCO_VERSION

// Collect JaCoCo execution data for all modules.
configure(projectsWithFlags('java')) {
if (project.hasFlags('no_aggregation')) {
Expand All @@ -14,6 +18,10 @@ configure(projectsWithFlags('java')) {

project.addFlags('coverage')

jacoco {
toolVersion = jacocoVersion
}

tasks.withType(Test) {
jacoco {
enabled = true
Expand All @@ -35,7 +43,7 @@ configure(rootProject) {
}

dependencies {
jacocoAnt "org.jacoco:org.jacoco.ant:${JacocoPlugin.DEFAULT_JACOCO_VERSION}"
jacocoAnt "org.jacoco:org.jacoco.ant:${jacocoVersion}"
}

task jacocoTestReport(type: JacocoReport) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/scripts/lib/java-javadoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ allprojects {
}

project.ext.javadocLinks.each {
addOfflineLink("${it['groupId']}/${it['artifactId']}/${it['version']}", it['url'])
addOfflineLink("${it['groupId']}/${it['artifactId']}", it['url'])
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/scripts/lib/java-rpc-proto.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ configure(projectsWithFlags('java')) {
}
if (project.ext.hasFlag('kotlin-grpc')) {
kotlinGrpc {
artifact = "io.grpc:protoc-gen-grpc-kotlin:${managedVersions['io.grpc:protoc-gen-grpc-kotlin']}"
artifact = "io.grpc:protoc-gen-grpc-kotlin:${managedVersions['io.grpc:protoc-gen-grpc-kotlin']}:jdk7@jar"
}
}

Expand Down
11 changes: 9 additions & 2 deletions gradle/scripts/lib/java-rpc-thrift.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ def libDir = "${buildscript.sourceFile.parentFile}"

configure(projectsWithFlags('java')) {
def thriftJsonEnabled = true
def fullCamel = false

ext {
thriftVersion = null
thriftPath = null
enableThriftFullCamel = { fullCamel = true }
disableThriftJson = { thriftJsonEnabled = false }
}

Expand Down Expand Up @@ -35,7 +38,7 @@ configure(projectsWithFlags('java')) {
srcDirs = [srcDirs]
}

def includeDirs = project.findProperty(sourceSet.getTaskName('', 'thriftIncludeDirs'))?: []
def includeDirs = project.findProperty(sourceSet.getTaskName('', 'thriftIncludeDirs')) ?: []
if (!(includeDirs instanceof Iterable) || includeDirs instanceof CharSequence) {
includeDirs = [includeDirs]
}
Expand Down Expand Up @@ -64,9 +67,13 @@ configure(projectsWithFlags('java')) {
}.each { sourceFile ->
logger.info("Using ${actualThriftPath} to generate Java sources from ${sourceFile}")
project.mkdir(javaOutputDir)
def javaGenerator = 'java'
if (fullCamel) {
javaGenerator = 'java:fullcamel'
}
project.exec {
commandLine actualThriftPath
args '-gen', 'java', '-out', javaOutputDir
args '-gen', javaGenerator, '-out', javaOutputDir
includeDirs.each {
args '-I', it
}
Expand Down
26 changes: 3 additions & 23 deletions gradle/scripts/lib/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,11 @@ configure(projectsWithFlags('java')) {

// Set the sensible compiler options.
tasks.withType(JavaCompile) {
def task = delegate
sourceCompatibility = project.findProperty('javaSourceCompatibility') ?: '1.8'
targetCompatibility = project.findProperty('javaTargetCompatibility') ?: '1.8'
options.encoding = 'UTF-8'
options.warnings = false
options.compilerArgs += '-parameters'
project.configurations.each { Configuration cfg ->
if (cfg.name == 'annotationProcessor' || cfg.name.endsWith('AnnotationProcessor')) {
cfg.withDependencies { deps ->
// Use incremental compilation only when there are no annotation processors,
// because it seems to cause compilation errors for some processors such as Lombok.
def useIncrementalCompilation = deps.size() == 0
options.incremental = useIncrementalCompilation
logger.info("${useIncrementalCompilation ? 'Enabling' : 'Disabling'} " +
"incremental compilation for '${task.path}'")
}
}
}
}

// Enable full exception logging for test failures.
Expand Down Expand Up @@ -93,18 +80,11 @@ configure(projectsWithFlags('java')) {
def dependencyTask = project.tasks.findByName("checkstyle${sourceSet.name.capitalize()}")
if (dependencyTask instanceof Checkstyle) {
tasks.checkstyle.dependsOn dependencyTask

// Run checkstyle as soon as possible after compilation to get feedback earlier.
tasks.named(sourceSet.compileJavaTaskName).configure {
finalizedBy dependencyTask
}
}
}

project.ext.getLintTask().dependsOn tasks.checkstyle

test {
dependsOn tasks.lint
}
def lintTask = project.ext.getLintTask()
lintTask.dependsOn tasks.checkstyle
tasks.check.dependsOn lintTask
}
}
Binary file not shown.
Binary file added gradle/scripts/lib/thrift/0.14/thrift.osx-x86_64
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/scripts/settings-flags.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import java.util.concurrent.ConcurrentHashMap
import org.gradle.util.GradleVersion;

import java.util.concurrent.ConcurrentHashMap

import static java.util.Objects.requireNonNull

// Ensure the Gradle version first of all.
Expand Down Expand Up @@ -150,3 +151,4 @@ static void afterProjectsWithFlags(Project project, Iterable<?> flags, Closure<S
// We add a "virtual project", with no source code, to control dependency management using Gradle's platform
// functionality.
includeWithFlags ':dependencyManagement', 'dependencyManagement'
project(':dependencyManagement').projectDir = file("${rootProject.projectDir}/build/dependencyManagement")

0 comments on commit 520184d

Please sign in to comment.