mirror of
https://github.com/google/nomulus.git
synced 2025-06-09 05:54:55 +02:00
Add the Closure Compiler/Library/Templates dependencies
This CL does a few things: - Adds the template Soy-to-JS compilation (note: this requires the extra soyutils_usegoog.js file separately so that the compiled *.soy.js files work - Adds the Closure Compiler to compile and check our JS - Adds an NPM task to allow us to download dependencies - Adds the Closure library as an NPM package Note: this probably won't compile until we fix the test JS files ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=233059414
This commit is contained in:
parent
71d65ed73a
commit
a995fc09cb
5 changed files with 2583 additions and 15 deletions
|
@ -26,6 +26,7 @@ plugins {
|
||||||
id 'com.bmuschko.docker-java-application' version '4.0.4' apply false
|
id 'com.bmuschko.docker-java-application' version '4.0.4' apply false
|
||||||
id 'net.ltgt.errorprone' version '0.6.1'
|
id 'net.ltgt.errorprone' version '0.6.1'
|
||||||
id 'checkstyle'
|
id 'checkstyle'
|
||||||
|
id "com.moowork.node" version "1.2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: 'dependencies.gradle'
|
apply from: 'dependencies.gradle'
|
||||||
|
@ -211,6 +212,32 @@ subprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (project.path.contains("default")) {
|
||||||
|
def coreResourcesDir = "${rootDir}/core/build/resources/main"
|
||||||
|
war {
|
||||||
|
from("${coreResourcesDir}/google/registry/ui") {
|
||||||
|
include "registrar_bin*"
|
||||||
|
into("assets/js")
|
||||||
|
rename { String filename -> filename.replace("bin", "dbg")}
|
||||||
|
}
|
||||||
|
from("${coreResourcesDir}/google/registry/ui") {
|
||||||
|
include "registrar_bin*"
|
||||||
|
into("assets/js")
|
||||||
|
}
|
||||||
|
from("${coreResourcesDir}/google/registry/ui/css") {
|
||||||
|
include "registrar*"
|
||||||
|
into("assets/css")
|
||||||
|
}
|
||||||
|
from("${coreResourcesDir}/google/registry/ui/assets/images") {
|
||||||
|
include "**/*"
|
||||||
|
into("assets/images")
|
||||||
|
}
|
||||||
|
from("${coreResourcesDir}/google/registry/ui/html") {
|
||||||
|
include "*.html"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
appengine {
|
appengine {
|
||||||
deploy {
|
deploy {
|
||||||
// TODO: change this to a variable.
|
// TODO: change this to a variable.
|
||||||
|
|
|
@ -5,6 +5,7 @@ plugins {
|
||||||
// Path to code generated by ad hoc tasks in this project. A separate path is
|
// Path to code generated by ad hoc tasks in this project. A separate path is
|
||||||
// used for easy inspection.
|
// used for easy inspection.
|
||||||
def generatedDir = "${project.buildDir}/generated/source/custom/main"
|
def generatedDir = "${project.buildDir}/generated/source/custom/main"
|
||||||
|
def resourcesDir = "${project.buildDir}/resources/main"
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -59,6 +60,7 @@ configurations {
|
||||||
// either compile or testRuntime. However, they may be needed at runtime.
|
// either compile or testRuntime. However, they may be needed at runtime.
|
||||||
// TODO(weiminyu): identify runtime dependencies and remove the rest.
|
// TODO(weiminyu): identify runtime dependencies and remove the rest.
|
||||||
maybeRuntime
|
maybeRuntime
|
||||||
|
closureCompiler
|
||||||
}
|
}
|
||||||
|
|
||||||
// Known issues:
|
// Known issues:
|
||||||
|
@ -269,6 +271,8 @@ dependencies {
|
||||||
|
|
||||||
// Tool dependencies. used for doc generation.
|
// Tool dependencies. used for doc generation.
|
||||||
compile files("${System.properties['java.home']}/../lib/tools.jar")
|
compile files("${System.properties['java.home']}/../lib/tools.jar")
|
||||||
|
|
||||||
|
closureCompiler deps['com.google.javascript:closure-compiler']
|
||||||
}
|
}
|
||||||
|
|
||||||
task jaxbToJava {
|
task jaxbToJava {
|
||||||
|
@ -384,9 +388,43 @@ task soyToJava {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task soyToJS {
|
||||||
|
ext.soyToJS = { outputDirectory, soyFiles , deps->
|
||||||
|
javaexec {
|
||||||
|
main = "com.google.template.soy.SoyToJsSrcCompiler"
|
||||||
|
classpath configurations.soy
|
||||||
|
|
||||||
|
args "--outputPathFormat", "${outputDirectory}/{INPUT_FILE_NAME}.js",
|
||||||
|
"--allowExternalCalls", "false",
|
||||||
|
"--srcs", "${soyFiles.join(',')}",
|
||||||
|
"--shouldProvideRequireSoyNamespaces", "true",
|
||||||
|
"--compileTimeGlobalsFile", "${javaDir}/google/registry/ui/globals.txt",
|
||||||
|
"--deps", "${deps.join(',')}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
def rootSoyFiles =
|
||||||
|
fileTree(
|
||||||
|
dir: "${javaDir}/google/registry/ui/soy",
|
||||||
|
include: ['*.soy'])
|
||||||
|
|
||||||
|
soyToJS("${generatedDir}/google/registry/ui/soy", rootSoyFiles, "")
|
||||||
|
soyToJS("${generatedDir}/google/registry/ui/soy/registrar",
|
||||||
|
files {
|
||||||
|
file("${javaDir}/google/registry/ui/soy/registrar").listFiles()
|
||||||
|
}.filter {
|
||||||
|
it.name.endsWith(".soy")
|
||||||
|
}.filter{
|
||||||
|
// TODO(b/123653579): add this back in when it compiles
|
||||||
|
!it.name.equals("OteSetupConsole.soy")
|
||||||
|
}, rootSoyFiles)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task stylesheetsToJavascript {
|
task stylesheetsToJavascript {
|
||||||
def cssSourceDir = "${javaDir}/google/registry/ui/css"
|
def cssSourceDir = "${javaDir}/google/registry/ui/css"
|
||||||
def outputDir = "${project.buildDir}/resources/main/google/registry/ui/css"
|
def outputDir = "${resourcesDir}/google/registry/ui/css"
|
||||||
inputs.dir cssSourceDir
|
inputs.dir cssSourceDir
|
||||||
outputs.dir outputDir
|
outputs.dir outputDir
|
||||||
|
|
||||||
|
@ -416,21 +454,38 @@ task stylesheetsToJavascript {
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
file("${outputDir}").mkdirs()
|
file("${outputDir}").mkdirs()
|
||||||
def srcFiles = [
|
def ignoredFiles = ["demo_css.css", "registrar_imports_raw.css"]
|
||||||
"${cssSourceDir}/console.css",
|
def sourceFiles = []
|
||||||
"${cssSourceDir}/contact-settings.css",
|
// include all CSS files that we find except for the ones explicitly ignored
|
||||||
"${cssSourceDir}/contact-us.css",
|
fileTree(cssSourceDir).each {
|
||||||
"${cssSourceDir}/dashboard.css",
|
if (it.name.endsWith(".css") && !ignoredFiles.contains(it.name)) {
|
||||||
"${cssSourceDir}/epp.css",
|
sourceFiles << (cssSourceDir + "/" + it.name)
|
||||||
"${cssSourceDir}/forms.css",
|
|
||||||
"${cssSourceDir}/kd_components.css",
|
|
||||||
"${cssSourceDir}/registry.css",
|
|
||||||
"${cssSourceDir}/resources.css",
|
|
||||||
"${cssSourceDir}/security-settings.css"
|
|
||||||
]
|
|
||||||
cssCompile("${outputDir}/registrar_bin", false, srcFiles)
|
|
||||||
cssCompile("${outputDir}/registrar_dbg", true, srcFiles)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
cssCompile("${outputDir}/registrar_bin", false, sourceFiles)
|
||||||
|
cssCompile("${outputDir}/registrar_dbg", true, sourceFiles)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task compileProdJS(type: JavaExec) {
|
||||||
|
// TODO(b/123647609) clean this up in general
|
||||||
|
// - have two separate tasks for dev/prod
|
||||||
|
// - the prod task uses the ADVANCED_OPTIMIZATION flag.
|
||||||
|
// - have this be a configurable task so we can change the inputs/outputs
|
||||||
|
classpath configurations.closureCompiler
|
||||||
|
main = 'com.google.javascript.jscomp.CommandLineRunner'
|
||||||
|
|
||||||
|
def closureArgs = []
|
||||||
|
closureArgs << "--compilation_level=SIMPLE_OPTIMIZATIONS"
|
||||||
|
closureArgs << "--js_output_file=${resourcesDir}/google/registry/ui/registrar_bin.js"
|
||||||
|
closureArgs << "--js=${rootDir}/node_modules/google-closure-library/**.js"
|
||||||
|
closureArgs << "--js=${rootDir}/node_modules/soyutils_usegoog.js"
|
||||||
|
closureArgs << "--entry_point=goog:registry.registrar.main"
|
||||||
|
closureArgs << "--externs=${javaDir}/google/registry/ui/externs/json.js"
|
||||||
|
closureArgs << "--js=${resourcesDir}/google/registry/ui/css/registrar_bin.css.js"
|
||||||
|
closureArgs << "--js=${javaDir}/google/registry/ui/js/**.js"
|
||||||
|
closureArgs << "--js=${generatedDir}/google/registry/ui/soy/**.js"
|
||||||
|
args closureArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.dependsOn jaxbToJava
|
compileJava.dependsOn jaxbToJava
|
||||||
|
@ -440,6 +495,12 @@ compileJava.dependsOn soyToJava
|
||||||
// resources folder before copying data into it.
|
// resources folder before copying data into it.
|
||||||
stylesheetsToJavascript.dependsOn processResources
|
stylesheetsToJavascript.dependsOn processResources
|
||||||
classes.dependsOn stylesheetsToJavascript
|
classes.dependsOn stylesheetsToJavascript
|
||||||
|
compileProdJS.dependsOn stylesheetsToJavascript
|
||||||
|
compileProdJS.dependsOn rootProject.npmInstall
|
||||||
|
compileProdJS.dependsOn processResources
|
||||||
|
compileProdJS.dependsOn processTestResources
|
||||||
|
compileProdJS.dependsOn soyToJS
|
||||||
|
assemble.dependsOn compileProdJS
|
||||||
|
|
||||||
// Make testing artifacts available to be depended up on by other projects.
|
// Make testing artifacts available to be depended up on by other projects.
|
||||||
// TODO: factor out google.registry.testing to be a separate project.
|
// TODO: factor out google.registry.testing to be a separate project.
|
||||||
|
|
|
@ -57,6 +57,7 @@ ext {
|
||||||
'com.google.http-client:google-http-client:1.28.0',
|
'com.google.http-client:google-http-client:1.28.0',
|
||||||
'com.google.http-client:google-http-client-appengine:1.22.0',
|
'com.google.http-client:google-http-client-appengine:1.22.0',
|
||||||
'com.google.http-client:google-http-client-jackson2:1.25.0',
|
'com.google.http-client:google-http-client-jackson2:1.25.0',
|
||||||
|
'com.google.javascript:closure-compiler:v20190121',
|
||||||
'com.google.monitoring-client:contrib:1.0.4',
|
'com.google.monitoring-client:contrib:1.0.4',
|
||||||
'com.google.monitoring-client:metrics:1.0.4',
|
'com.google.monitoring-client:metrics:1.0.4',
|
||||||
'com.google.monitoring-client:stackdriver:1.0.4',
|
'com.google.monitoring-client:stackdriver:1.0.4',
|
||||||
|
|
2457
gradle/node_modules/soyutils_usegoog.js
generated
vendored
Normal file
2457
gradle/node_modules/soyutils_usegoog.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
22
gradle/package.json
Normal file
22
gradle/package.json
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "nomulus",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Top-level domain name registry service on Google App Engine https://registry.google",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/google/nomulus.git"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/google/nomulus/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/google/nomulus#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"google-closure-library": "20190121.0.0"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue