Merge pull request #90 from google/gb/refactorGradle

Refactor to be more in line with a standard Gradle project structure
This commit is contained in:
gbrodman 2019-06-13 13:01:45 -04:00 committed by GitHub
commit 454dcb9b0e
3141 changed files with 85 additions and 90 deletions

13
.gitignore vendored
View file

@ -74,6 +74,9 @@ local.properties
# Auto-generated java files # Auto-generated java files
autogenerated/ autogenerated/
# IDEA
nomulus.iml
###################################################################### ######################################################################
# Python Ignores # Python Ignores
@ -83,11 +86,9 @@ autogenerated/
# Gradle Ignores # Gradle Ignores
# We don't want to ignore the gradle jar files # We don't want to ignore the gradle jar files
!/gradle/gradle/wrapper/**/*.jar !/gradle/wrapper/**/*.jar
.gradle/ .gradle/
/gradle/.gradle **/build
/gradle/**/WEB-INF node_modules/**
/gradle/**/build !node_modules/soyutils_usegoog.js
/gradle/node_modules/**
!/gradle/node_modules/soyutils_usegoog.js
/repos/ /repos/

View file

@ -55,4 +55,4 @@ env:
# output, instead of the default 10. # output, instead of the default 10.
# See notes on the CREDZ and REPORT_GCS_BUCKET environment variable in the # See notes on the CREDZ and REPORT_GCS_BUCKET environment variable in the
# comments at the top of the file. # comments at the top of the file.
script: cd gradle && echo "$CREDZ" >credz.json && chmod 755 ./gradlew && travis_wait 45 ./gradlew build --continue -P uploaderDestination="$REPORT_GCS_DESTINATION" -P uploaderCredentialsFile=credz.json -P uploaderMultithreadedUpload=yes -P mavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven -P pluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins script: echo "$CREDZ" >credz.json && chmod 755 ./gradlew && travis_wait 45 ./gradlew build --continue -P uploaderDestination="$REPORT_GCS_DESTINATION" -P uploaderCredentialsFile=credz.json -P uploaderMultithreadedUpload=yes -P mavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven -P pluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins

View file

@ -21,14 +21,14 @@ apply plugin: 'war'
// plugin will recognize this as an app-engine standard app (and also // plugin will recognize this as an app-engine standard app (and also
// obtains the appengine-web.xml from the correct location) // obtains the appengine-web.xml from the correct location)
project.convention.plugins['war'].webAppDirName = project.convention.plugins['war'].webAppDirName =
"../../../java/google/registry/env/${environment}/${project.name}" "../../java/google/registry/env/${environment}/${project.name}"
apply plugin: 'com.google.cloud.tools.appengine' apply plugin: 'com.google.cloud.tools.appengine'
// Get the web.xml file for the service. // Get the web.xml file for the service.
war { war {
webInf { webInf {
from "../../../java/google/registry/env/common/${project.name}/WEB-INF" from "../../java/google/registry/env/common/${project.name}/WEB-INF"
} }
} }

View file

@ -65,9 +65,7 @@ if (!project.hasProperty('showAllOutput')) {
gradleLint.autoLintAfterFailure = false gradleLint.autoLintAfterFailure = false
// Paths to main and test sources. // Paths to main and test sources.
ext.projectRootDir = "${rootDir}/.." ext.projectRootDir = "${rootDir}"
ext.javaDir = "${rootDir}/../java"
ext.javatestsDir = "${rootDir}/../javatests"
// Tasks to deploy/stage all App Engine services // Tasks to deploy/stage all App Engine services
task deploy { task deploy {
@ -161,43 +159,42 @@ subprojects {
def commonlyExcludedResources = ['**/*.java', '**/BUILD'] def commonlyExcludedResources = ['**/*.java', '**/BUILD']
project.ext.javaDir = "${project.projectDir}/src/main/java"
project.ext.javaTestDir = "${project.projectDir}/src/test/java"
sourceSets { sourceSets {
main { main {
java { java {
srcDirs = [ srcDirs += aptGeneratedDir
rootProject.javaDir,
aptGeneratedDir
]
} }
resources { resources {
srcDirs = [ srcDirs = [
rootProject.javaDir project.ext.javaDir
] ]
exclude commonlyExcludedResources exclude commonlyExcludedResources
} }
} }
test { test {
java { java {
srcDirs = [ srcDirs += aptGeneratedTestDir
rootProject.javatestsDir,
aptGeneratedTestDir
]
} }
resources { resources {
srcDirs = [ srcDirs = [
rootProject.javatestsDir, project.ext.javaTestDir
] ]
exclude commonlyExcludedResources exclude commonlyExcludedResources
} }
} }
} }
if (project.name == 'util') return
if (project.name == 'proxy') return
if (project.name == 'core') return
test { test {
testLogging.showStandardStreams = Boolean.parseBoolean(showAllOutput) testLogging.showStandardStreams = Boolean.parseBoolean(showAllOutput)
} }
if (project.name == 'core') return
ext.relativePath = "google/registry/${project.name}" ext.relativePath = "google/registry/${project.name}"
sourceSets.each { sourceSets.each {
@ -208,13 +205,5 @@ subprojects {
include "${project.relativePath}/" include "${project.relativePath}/"
} }
} }
project(':core').sourceSets.each {
it.java {
exclude "${project.relativePath}/"
}
it.resources {
exclude "${project.relativePath}/"
}
}
} }

View file

@ -41,6 +41,14 @@ repositories {
apply from: '../dependencies.gradle' apply from: '../dependencies.gradle'
apply from: '../java_common.gradle' apply from: '../java_common.gradle'
sourceSets {
main {
java {
srcDirs += "${project.buildDir}/generated/source/apt/main"
}
}
}
checkstyle { checkstyle {
configDir file('../config/checkstyle') configDir file('../config/checkstyle')
} }
@ -50,6 +58,10 @@ checkstyle {
// - Format in place: ../gradlew spotlessApply // - Format in place: ../gradlew spotlessApply
spotless { spotless {
java { java {
target project.fileTree("${project.rootDir}/") {
include "src/main/java/**/*.java"
include "src/test/java/**/*.java"
}
googleJavaFormat('1.7') googleJavaFormat('1.7')
} }
format 'misc', { format 'misc', {

View file

@ -8,5 +8,5 @@
<!-- Ignore generated files in Checkstyle --> <!-- Ignore generated files in Checkstyle -->
<suppress files="[/\\].*[/\\]generated.*[/\\]" checks="."/> <suppress files="[/\\].*[/\\]generated.*[/\\]" checks="."/>
<!-- Ignore Javadoc checks in test files --> <!-- Ignore Javadoc checks in test files -->
<suppress files="[/\\].*[/\\]javatests.*[/\\]" checks="JavadocType"/> <suppress files="[/\\].*[/\\]src/test/java/.*[/\\]" checks="JavadocType"/>
</suppressions> </suppressions>

1
core/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
out/

View file

@ -10,7 +10,7 @@ def screenshotsDir = "${project.buildDir}/screenshots"
def screenshotsForGoldensDir = "${project.buildDir}/screenshots_for_goldens" def screenshotsForGoldensDir = "${project.buildDir}/screenshots_for_goldens"
def newGoldensDir = "${project.buildDir}/new_golden_images" def newGoldensDir = "${project.buildDir}/new_golden_images"
def goldensDir = def goldensDir =
"${javatestsDir}/google/registry/webdriver/goldens/chrome-linux" "${javaTestDir}/google/registry/webdriver/goldens/chrome-linux"
// Tests that conflict with (mostly unidentified) members of the main test // Tests that conflict with (mostly unidentified) members of the main test
// suite. It is unclear if they are offenders (i.e., those that pollute global // suite. It is unclear if they are offenders (i.e., those that pollute global
@ -110,7 +110,7 @@ dependencies {
// Custom-built objectify jar at commit ecd5165, included in Nomulus // Custom-built objectify jar at commit ecd5165, included in Nomulus
// release. // release.
implementation files( implementation files(
"${rootDir}/../third_party/objectify/v4_1/objectify-4.1.3.jar") "${rootDir}/third_party/objectify/v4_1/objectify-4.1.3.jar")
testImplementation project(':third_party') testImplementation project(':third_party')
compile deps['com.beust:jcommander'] compile deps['com.beust:jcommander']

Some files were not shown because too many files have changed in this diff Show more