google-nomulus/gradle/build.gradle
shicong b84fb004c8 Add source code and JAR file to internal repository
This CL made the following changes to achieve the purpose:

1. Modified HttpProxy.java to generate a file containing Maven
   coordinates for all requested JAR files. This is to replace
   Gradle task "generateMavenCoordinateForDependency" which served
   for the same purpose before. The reason is during the course
   of the build, Gradle may request some POM file of a artifact
   for some reason but it doesn't actually need the JAR file.
   However, task "generateMavenCoordinateForDependency" cannot
   identify this use case so it added more JARs to the dependency
   which are not necessary and are not consistent with what we
   get from HttpProxy.java. Going forward, we will use HttpProxy.java
   as the single source to provide dependency.

2. Updated update_deps_metadata.py to retrieve *-sources.jar for each
   dependency for obvious reason.

3. Improved update_dependency.sh by removing 1 unnecessary build.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=247607871
2019-05-13 12:41:31 -04:00

194 lines
4.9 KiB
Groovy

buildscript {
// Lock buildscript dependencies.
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.6.1"
classpath 'org.sonatype.aether:aether-api:1.13.1'
classpath 'org.sonatype.aether:aether-impl:1.13.1'
}
}
plugins {
// Java static analysis plugins. Keep versions consistent with
// ./buildSrc/build.gradle
id 'nebula.lint' version '10.4.2'
// TODO(weiminyu): consider remove net.ltgt.apt. Gradle 5.2+
// has similar functionalities.
id 'net.ltgt.apt' version '0.19' apply false
id 'net.ltgt.errorprone' version '0.6.1'
id 'checkstyle'
// NodeJs plugin
id "com.moowork.node" version "1.2.0"
}
apply plugin: google.registry.gradle.plugin.ReportUploaderPlugin
reportUploader {
// Set the location where we want to upload the build results.
// e.g. -P uploaderDestination=gcs://domain-registry-alpha-build-result-test
//
// If not set - the upload will be skipped
destination = uploaderDestination
// The location of the file containing the OAuth2 Google Cloud credentials.
//
// The file can contain a Service Account key file in JSON format from the
// Google Developers Console or a stored user credential using the format
// supported by the Cloud SDK.
//
// If no file is given - the default credentials are used.
credentialsFile = uploaderCredentialsFile
// If set to 'yes', each file will be uploaded to GCS in a separate thread.
// This is MUCH faster.
multithreadedUpload = uploaderMultithreadedUpload
}
apply from: 'dependencies.gradle'
// Provide defaults for all of the project properties.
// showAllOutput: boolean. If true, dump all test output during the build.
if (!project.hasProperty('showAllOutput')) {
ext.showAllOutput = 'false'
}
// Only do linting if the build is successful.
gradleLint.autoLintAfterFailure = false
// Paths to main and test sources.
ext.projectRootDir = "${rootDir}/.."
ext.javaDir = "${rootDir}/../java"
ext.javatestsDir = "${rootDir}/../javatests"
// Tasks to deploy/stage all App Engine services
task deploy {
group = 'deployment'
description = 'Deploys all services to App Engine.'
}
task stage {
group = 'deployment'
description = 'Generates application directories for all services.'
}
allprojects {
// Skip no-op project
if (project.name == 'services') return
repositories {
if (rootProject.mavenUrl) {
maven {
println "Java dependencies: Using repo $pluginsUrl..."
url rootProject.mavenUrl
}
} else {
println "Java dependencies: Using Maven Central..."
mavenCentral()
}
}
}
subprojects {
// Skip no-op project
if (project.name == 'services') return
buildscript {
// Lock buildscript dependencies.
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
// Lock application dependencies.
dependencyLocking {
lockAllConfigurations()
}
def services = [':services:default',
':services:backend',
':services:tools',
':services:pubapi']
// Set up all of the deployment projects.
if (services.contains(project.path)) {
apply from: "${rootDir.path}/appengine_war.gradle"
// Return early, do not apply the settings below.
return
}
apply from: "${rootDir.path}/java_common.gradle"
if (project.name == 'third_party') return
// Path to code generated with annotation processors. Note that this path is
// chosen by the 'net.ltgt.apt' plugin, and may change if IDE-specific plugins
// are applied, e.g., 'idea' or 'eclipse'
def aptGeneratedDir = "${project.buildDir}/generated/source/apt/main"
def aptGeneratedTestDir = "${project.buildDir}/generated/source/apt/test"
def commonlyExcludedResources = ['**/*.java', '**/BUILD']
sourceSets {
main {
java {
srcDirs = [
rootProject.javaDir,
aptGeneratedDir
]
}
resources {
srcDirs = [
rootProject.javaDir
]
exclude commonlyExcludedResources
}
}
test {
java {
srcDirs = [
rootProject.javatestsDir,
aptGeneratedTestDir
]
}
resources {
srcDirs = [
rootProject.javatestsDir,
]
exclude commonlyExcludedResources
}
}
}
test {
testLogging.showStandardStreams = Boolean.parseBoolean(showAllOutput)
}
if (project.name == 'core') return
ext.relativePath = "google/registry/${project.name}"
sourceSets.each {
it.java {
include "${project.relativePath}/"
}
it.resources {
include "${project.relativePath}/"
}
}
project(':core').sourceSets.each {
it.java {
exclude "${project.relativePath}/"
}
it.resources {
exclude "${project.relativePath}/"
}
}
}