Create a Gradle task to run the test server (#192)

* Create a Gradle task to run the test server

As an artifact of the old build system, the test server relies on having
the built registrar_(bin|dbg)*(\.css)?.js in place (see ConsoleUiAction
among others). As a result, we create a Gradle task that puts those
files into the correct, readable, location before running the test
server.

* Depend on assemble rather than build

* refactor gitignores
This commit is contained in:
gbrodman 2019-07-29 11:03:29 -04:00 committed by GitHub
parent fc8aa9569f
commit d743bfb201
4 changed files with 24 additions and 4 deletions

6
.gitignore vendored
View file

@ -100,3 +100,9 @@ nomulus.iws
node_modules/**
!node_modules/soyutils_usegoog.js
/repos/
# Compiled JS/CSS code
core/**/registrar_bin*.js
core/**/registrar_dbg*.js
core/**/registrar_bin*.css
core/**/registrar_dbg*.css

View file

@ -78,7 +78,7 @@ PRESUBMITS = {
r".*Copyright 20\d{2} The Nomulus Authors\. All Rights Reserved\.",
("java", "js", "soy", "sql", "py", "sh", "gradle"), {
".git", "/build/", "/generated/", "node_modules/",
"JUnitBackports.java"
"JUnitBackports.java", "registrar_bin.", "registrar_dbg."
}, REQUIRED):
"File did not include the license header.",
@ -148,7 +148,7 @@ PRESUBMITS = {
PresubmitCheck(
r".*(innerHTML|outerHTML)\s*(=|[+]=)([^=]|$)",
"js",
{"/node_modules/"},
{"/node_modules/", "registrar_bin."},
):
"Do not assign directly to the dom. Use goog.dom.setTextContent to set"
" to plain text, goog.dom.removeChildren to clear, or "
@ -156,7 +156,7 @@ PRESUBMITS = {
PresubmitCheck(
r".*console\.(log|info|warn|error)",
"js",
{"/node_modules/", "google/registry/ui/js/util.js"},
{"/node_modules/", "google/registry/ui/js/util.js", "registrar_bin."},
):
"JavaScript files should not include console logging."
}

View file

@ -651,5 +651,19 @@ task buildToolImage(dependsOn: nomulus, type: Exec) {
commandLine 'docker', 'build', '-t', 'nomulus-tool', '.'
}
task copyJsFilesForTestServer(dependsOn: assemble, type: Copy) {
// Unfortunately the test server relies on having some compiled JS/CSS
// in place, so copy it over here
from "${resourcesDir}/google/registry/ui/"
include '**/*.js'
include '**/*.css'
into "${project.projectDir}/src/main/resources/google/registry/ui/"
}
task runTestServer(dependsOn: copyJsFilesForTestServer, type: JavaExec) {
main = 'google.registry.server.RegistryTestServerMain'
classpath = sourceSets.test.runtimeClasspath
}
project.build.dependsOn buildToolImage
project.build.dependsOn ':stage'

View file

@ -41,7 +41,7 @@ public final class RegistryTestServerMain {
@Parameter(
names = "--mode",
description = "UI console debug mode. RAW allows live editing; DEBUG allows rename testing.")
private ConsoleDebug mode = ConsoleDebug.RAW;
private ConsoleDebug mode = ConsoleDebug.PRODUCTION;
@Parameter(
names = "--address",