Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ allprojects {
if (!mavenUrl.isEmpty()) {
maven {
println "Java dependencies: Using repo ${mavenUrl}..."
url mavenUrl
url = mavenUrl
allowInsecureProtocol = allowInsecure == "true"
}
} else {
println "Java dependencies: Using Maven Central..."
mavenCentral()
google()
maven {
url "https://packages.confluent.io/maven/"
url = "https://packages.confluent.io/maven/"
content {
includeGroup "io.confluent"
}
Expand Down Expand Up @@ -291,7 +291,7 @@ subprojects {
// We do seem to get duplicates when constructing uber-jars, either
// this is a product of something in gradle 7 or a product of gradle 7
// now giving an error about them when it didn't previously.
duplicatesStrategy DuplicatesStrategy.WARN
duplicatesStrategy = DuplicatesStrategy.WARN
}
}

Expand Down Expand Up @@ -341,8 +341,10 @@ subprojects {
// search for `flex-template-base-image` and update the parameter value.
// There are at least two instances, one in core/build.gradle, one in
// release/stage_beam_pipeline.sh
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

project.tasks.test.dependsOn runPresubmits

Expand All @@ -369,11 +371,16 @@ subprojects {

// No need to produce javadoc for the jetty subproject, which has no APIs to
// expose to users.
if (project.name != 'jetty') {
if (project.name != 'jetty' && !services.contains(project.path)) {
javadocSource << project.sourceSets.main.allJava
javadocClasspath << project.sourceSets.main.runtimeClasspath
javadocClasspath << { project.sourceSets.main.runtimeClasspath.files }
javadocClasspath << "${buildDir}/generated/sources/annotationProcessor/java/main"
javadocDependentTasks << project.tasks.compileJava
if (project.tasks.findByName('compileJava')) {
javadocDependentTasks << project.tasks.compileJava
}
if (project.tasks.findByName('processResources')) {
javadocDependentTasks << project.tasks.processResources
}
}
}

Expand Down
51 changes: 32 additions & 19 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,15 @@ configurations {
// Published jars that are used for server/schema compatibility tests.
// See <a href="../integration/README.md">the integration project</a>
// for details.
nomulus_test
nomulus_test {
canBeConsumed = true
canBeResolved = false
}
testRuntimeElements {
canBeConsumed = true
canBeResolved = false
extendsFrom testRuntimeOnly
}

// Exclude non-canonical servlet-api jars. Our deployment uses
// javax.servlet:servlet-api:2.5
Expand Down Expand Up @@ -339,7 +347,7 @@ task jaxbToJava {
destdir: "${generatedDir}",
binding: "${xjcTempSourceDir}/bindings.xjb",
removeOldOutput: 'yes', extension: 'true') {
project.fileTree(
fileTree(
dir: new File("$xjcTempSourceDir"),
include: ['**/*.xsd'])
.addToAntBuilder(ant, 'schema', FileCollection.AntType.FileSet)
Expand Down Expand Up @@ -377,13 +385,13 @@ task soyToJava {
}

ext.soyToJava = { javaPackage, outputDirectory, soyFiles ->
javaexec {
main = "com.google.template.soy.SoyParseInfoGenerator"
classpath configurations.soy
args "--javaPackage", "${javaPackage}",
project.services.get(ExecOperations).javaexec {
mainClass = "com.google.template.soy.SoyParseInfoGenerator"
classpath = configurations.soy
args = ["--javaPackage", "${javaPackage}",
"--outputDirectory", "${outputDirectory}",
"--javaClassNameSource", "filename",
"--srcs", "${soyFiles.join(',')}"
"--srcs", "${soyFiles.join(',')}"]
}

// Replace the "@link" tags after the "@deprecated" tags in the generated
Expand All @@ -397,8 +405,8 @@ task soyToJava {
}

outputs.each { file ->
exec {
commandLine 'sed', '-i""', '-e', 's/@link/LINK/g', file.getCanonicalPath()
project.services.get(ExecOperations).exec {
commandLine = ['sed', '-i""', '-e', 's/@link/LINK/g', file.getCanonicalPath()]
}
}
}
Expand Down Expand Up @@ -429,12 +437,12 @@ task testJar(type: Jar) {
}

artifacts {
testRuntimeOnly testJar
add('testRuntimeElements', testJar)
}

task findGoldenImages(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
main = 'google.registry.webdriver.GoldenImageFinder'
mainClass = 'google.registry.webdriver.GoldenImageFinder'

def arguments = []
arguments << "--screenshots_for_goldens_dir=${screenshotsForGoldensDir}"
Expand Down Expand Up @@ -481,11 +489,11 @@ Optional<List<String>> getToolArgsList() {
// parameter.
ext.createToolTask = {
taskName,
mainClass,
mainClassName,
sourceSet = sourceSets.main ->
project.tasks.create(taskName, JavaExec) {
classpath = sourceSet.runtimeClasspath
main = mainClass
mainClass = mainClassName

doFirst {
getToolArgsList().ifPresent {
Expand All @@ -502,7 +510,7 @@ createToolTask(

project.tasks.create('generateSqlSchema', JavaExec) {
classpath = sourceSets.nonprod.runtimeClasspath
main = 'google.registry.tools.DevTool'
mainClass = 'google.registry.tools.DevTool'
args = [
'-e', 'alpha',
'generate_sql_schema', '--start_postgresql', '-o',
Expand All @@ -515,7 +523,7 @@ task generateGoldenImages(type: FilteringTest) {
tests = ["**/webdriver/*"]

// Sets the maximum number of test executors that may exist at the same time.
maxParallelForks 5
maxParallelForks = 5

systemProperty 'test.screenshot.dir', screenshotsForGoldensDir
systemProperty 'test.screenshot.runAllAttempts', 'true'
Expand Down Expand Up @@ -659,7 +667,7 @@ artifacts {
}

task runTestServer(type: JavaExec) {
main = 'google.registry.server.RegistryTestServerMain'
mainClass = 'google.registry.server.RegistryTestServerMain'
classpath = sourceSets.test.runtimeClasspath
dependsOn(rootProject.project('console-webapp').tasks.named('buildConsoleWebapp'))
}
Expand All @@ -685,6 +693,8 @@ abstract class FilteringTest extends Test {

FilteringTest() {
useJUnitPlatform();
testClassesDirs = project.sourceSets.test.output.classesDirs
classpath = project.sourceSets.test.runtimeClasspath
}

private void applyTestFilter() {
Expand Down Expand Up @@ -739,7 +749,7 @@ task fragileTest(type: FilteringTest) {
}

// Run every test class in a freshly started process.
forkEvery 1
forkEvery = 1

doFirst {
new File(screenshotsDir).deleteDir()
Expand All @@ -754,6 +764,9 @@ task sqlIntegrationTest(type: FilteringTest) {
useJUnit()
excludeTestCases = false
tests = ['google/registry/schema/integration/SqlIntegrationTestSuite.*']

testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
}

// Verifies that RegistryTool can be instantiated:
Expand All @@ -779,13 +792,13 @@ task standardTest(type: FilteringTest) {
// Run every test class in its own process.
// Uncomment to unblock build while troubleshooting inexplicable test errors.
// This setting makes the build take 35 minutes, without it it takes about 10.
// forkEvery 1
// forkEvery = 1

// Sets the maximum number of test executors that may exist at the same time.
// Also, Gradle executes tests in 1 thread and some of our test infrastructures
// depend on that, e.g. DualDatabaseTestInvocationContextProvider injects
// different implementation of TransactionManager into TransactionManagerFactory.
maxParallelForks 64
maxParallelForks = 64

systemProperty 'test.projectRoot', rootProject.projectRootDir
systemProperty 'test.resourcesDir', resourcesDir
Expand Down
2 changes: 1 addition & 1 deletion dependency_lic.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
url = 'https://plugins.gradle.org/m2/'
}
}
dependencies {
Expand Down
12 changes: 7 additions & 5 deletions networking/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ task testJar(type: Jar) {
from sourceSets.test.output
}

artifacts {
testRuntimeOnly testJar
}

configurations {
testRuntimeOnly {
testRuntimeElements {
canBeConsumed = true
canBeResolved = false
extendsFrom testRuntimeOnly
}
}

artifacts {
add('testRuntimeElements', testJar)
}
2 changes: 1 addition & 1 deletion prober/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {
testImplementation deps['org.mockito:mockito-core']
testImplementation deps['org.testcontainers:junit-jupiter']
testImplementation project(path: ':common', configuration: 'testing')
testImplementation project(path: ':networking', configuration: 'testRuntimeOnly')
testImplementation project(path: ':networking', configuration: 'testRuntimeElements')

// Include auto-value in compile until nebula-lint understands
// annotationProcessor
Expand Down
2 changes: 1 addition & 1 deletion proxy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dependencies {
testImplementation deps['org.testcontainers:junit-jupiter']
testImplementation deps['org.yaml:snakeyaml']
testImplementation project(path: ':common', configuration: 'testing')
testImplementation project(path: ':networking', configuration: 'testRuntimeOnly')
testImplementation project(path: ':networking', configuration: 'testRuntimeElements')

// Include auto-value in compile until nebula-lint understands
// annotationProcessor
Expand Down
8 changes: 4 additions & 4 deletions utils.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ rootProject.ext {
// to stdout as a string. This method allows pipes in shell command.
execInBash = { shellCommand, bashWorkingDir ->
return new ByteArrayOutputStream().withStream { os ->
exec {
workingDir bashWorkingDir
commandLine 'bash', '-c', "${shellCommand}"
standardOutput os
project.services.get(ExecOperations).exec {
workingDir = bashWorkingDir
commandLine = ['bash', '-c', "${shellCommand}"]
standardOutput = os
}.assertNormalExitValue()
return os
}.toString().trim()
Expand Down
Loading