mirror of
https://github.com/google/nomulus.git
synced 2025-05-17 01:47:14 +02:00
Integrate: Eclipse file generation script
This commit is contained in:
parent
d9875ea302
commit
fe9e69e06b
6 changed files with 39 additions and 49 deletions
|
@ -2,6 +2,8 @@ package(
|
|||
default_visibility = ["//java/google/registry:registry_project"],
|
||||
)
|
||||
|
||||
licenses(["notice"]) # Apache 2.0
|
||||
|
||||
java_binary(
|
||||
name = "annotation_processors_ide",
|
||||
create_executable = False,
|
||||
|
|
|
@ -19,6 +19,7 @@ java_library(
|
|||
"*.java",
|
||||
"**/*.java",
|
||||
]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//java/com/google/common/annotations",
|
||||
"//java/com/google/common/base",
|
||||
|
@ -48,5 +49,4 @@ java_library(
|
|||
"//java/google/registry/util",
|
||||
"//java/google/registry/xml",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -11,9 +11,9 @@ licenses(["notice"]) # Apache 2.0
|
|||
package_group(
|
||||
name = "allowed-tools",
|
||||
packages = [
|
||||
"//java/google/registry/eclipse",
|
||||
"//java/google/registry/testing",
|
||||
"//java/google/registry/tools",
|
||||
"//java/google/registry/eclipse",
|
||||
"//javatests/google/registry/tools",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -10,6 +10,7 @@ java_library(
|
|||
"//java/google/registry/ui/css:registrar_bin.css.js",
|
||||
"//java/google/registry/ui/css:registrar_dbg.css.js",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//java/com/google/common/annotations",
|
||||
"//java/com/google/common/base",
|
||||
|
@ -41,5 +42,4 @@ java_library(
|
|||
|
||||
"//third_party/closure/templates",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright 2016 Google Inc. All Rights Reserved.
|
||||
# Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -14,7 +14,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"Script for generating eclipse .project and .classpath files."
|
||||
"""Script for generating eclipse .project and .classpath files."""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
@ -34,17 +34,14 @@ def bazel_info(key):
|
|||
The output of the bazel info invocation as a string. If multiple lines
|
||||
are returned by bazel info, only the first line is returned.
|
||||
"""
|
||||
bazel_process = subprocess.Popen(
|
||||
["bazel", "info", key],
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
bazel_process = subprocess.Popen(["bazel", "info", key],
|
||||
stdout=subprocess.PIPE)
|
||||
result = [line.strip() for line in iter(bazel_process.stdout.readline, "")]
|
||||
return result[0]
|
||||
|
||||
|
||||
def classpath_entry_xml(kind, path):
|
||||
"""
|
||||
Generates an eclipse xml classpath entry.
|
||||
"""Generates an eclipse xml classpath entry.
|
||||
|
||||
Args:
|
||||
kind: Kind of classpath entry.
|
||||
|
@ -56,13 +53,11 @@ def classpath_entry_xml(kind, path):
|
|||
xml classpath entry element with the specified kind and path.
|
||||
"""
|
||||
return "<classpathentry kind=\"{kind}\" path=\"{path}\"/>".format(
|
||||
kind=kind, path=path,
|
||||
)
|
||||
kind=kind, path=path)
|
||||
|
||||
|
||||
def classpath_xml(entries):
|
||||
"""
|
||||
Produces the xml for an eclipse classpath file.
|
||||
"""Produces the xml for an eclipse classpath file.
|
||||
|
||||
Args:
|
||||
entries: list of dictionaries in the form of:
|
||||
|
@ -74,8 +69,8 @@ def classpath_xml(entries):
|
|||
Returns:
|
||||
Contents of the eclipse .classpath file.
|
||||
"""
|
||||
entries_xml = "\n".join([
|
||||
" " + classpath_entry_xml(**entry) for entry in entries])
|
||||
entries_xml = "\n".join(
|
||||
[" " + classpath_entry_xml(**entry) for entry in entries])
|
||||
return ('<?xml version="1.0" encoding="UTF-8"?>\n'
|
||||
"<classpath>\n"
|
||||
"{entries}"
|
||||
|
@ -83,8 +78,7 @@ def classpath_xml(entries):
|
|||
|
||||
|
||||
def build_classpath():
|
||||
"""
|
||||
Builds eclipse classpath file
|
||||
"""Builds eclipse classpath file.
|
||||
|
||||
Generates an eclipse .classpath file that has references to all of the
|
||||
project source folders, autogenerated source code, and external binary
|
||||
|
@ -108,13 +102,11 @@ def build_classpath():
|
|||
},
|
||||
{"kind": "output", "path": "bin"},
|
||||
]
|
||||
|
||||
return classpath_xml(classpath_entries)
|
||||
|
||||
|
||||
def build_project(project_name):
|
||||
"""
|
||||
Builds eclipse project file
|
||||
"""Builds eclipse project file.
|
||||
|
||||
Uses a very simple template to generate an eclipse .project file
|
||||
with a configurable project name.
|
||||
|
@ -153,8 +145,7 @@ def build_project(project_name):
|
|||
|
||||
|
||||
def factorypath_entry_xml(kind, entry_id):
|
||||
"""
|
||||
Generates an eclipse xml factorypath entry.
|
||||
"""Generates an eclipse xml factorypath entry.
|
||||
|
||||
Args:
|
||||
kind: Kind of factorypath entry.
|
||||
|
@ -168,9 +159,9 @@ def factorypath_entry_xml(kind, entry_id):
|
|||
"enabled=\"true\" runInBatchMode=\"false\"/>").format(
|
||||
kind=kind, entry_id=entry_id)
|
||||
|
||||
|
||||
def factorypath_xml(entries):
|
||||
"""
|
||||
Produces the xml for an eclipse factorypath file.
|
||||
"""Produces the xml for an eclipse factorypath file.
|
||||
|
||||
Args:
|
||||
entries: list of dictionaries in the form of:
|
||||
|
@ -182,16 +173,15 @@ def factorypath_xml(entries):
|
|||
Returns:
|
||||
Contents of the eclipse .factorypath file.
|
||||
"""
|
||||
entries_xml = "\n".join([
|
||||
" " + factorypath_entry_xml(**entry) for entry in entries])
|
||||
entries_xml = "\n".join(
|
||||
[" " + factorypath_entry_xml(**entry) for entry in entries])
|
||||
return ("<factorypath>\n"
|
||||
"{entries}"
|
||||
"\n</factorypath>").format(entries=entries_xml)
|
||||
|
||||
|
||||
def build_factorypath():
|
||||
"""
|
||||
Builds eclipse factorypath file
|
||||
"""Builds eclipse factorypath file.
|
||||
|
||||
Generates an eclipse .factorypath file that links to the jar containing
|
||||
all required annotation processors for the project.
|
||||
|
@ -203,8 +193,7 @@ def build_factorypath():
|
|||
annotations_jar = os.path.join(
|
||||
bazel_bin,
|
||||
"java/google/registry/eclipse"
|
||||
"/annotation_processors_ide_deploy.jar",
|
||||
)
|
||||
"/annotation_processors_ide_deploy.jar")
|
||||
factorypath_entries = [
|
||||
{
|
||||
"kind": "PLUGIN",
|
||||
|
@ -219,8 +208,7 @@ def build_factorypath():
|
|||
|
||||
|
||||
def build_dependencies():
|
||||
"""
|
||||
Builds dependencies for producing eclipse project files
|
||||
"""Builds dependencies for producing eclipse project files.
|
||||
|
||||
Runs bazel build for the entire project and builds a single jar with all
|
||||
binary dependencies for eclipse to compile the project.
|
||||
|
@ -233,7 +221,8 @@ def build_dependencies():
|
|||
"bazel",
|
||||
"build",
|
||||
"//java/google/registry/...",
|
||||
"//javatests/google/registry/..."])
|
||||
"//javatests/google/registry/...",
|
||||
])
|
||||
|
||||
# Builds a giant jar of all compile-time dependencies of the project
|
||||
subprocess.check_call([
|
||||
|
@ -247,12 +236,12 @@ def build_dependencies():
|
|||
"bazel",
|
||||
"build",
|
||||
"//java/google/registry/eclipse"
|
||||
":annotation_processors_ide_deploy.jar"
|
||||
":annotation_processors_ide_deploy.jar",
|
||||
])
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Builds eclipse project files
|
||||
"""Builds eclipse project files.
|
||||
|
||||
Before building the eclipse files, a working bazel build is required.
|
||||
After building the eclipse dependencies jar and the tests, eclipse
|
||||
|
@ -261,8 +250,8 @@ def main():
|
|||
build_dependencies()
|
||||
workspace_directory = bazel_info("workspace")
|
||||
classpath = build_classpath()
|
||||
with open(os.path.join(
|
||||
workspace_directory, ".classpath"), "w") as classpath_file:
|
||||
with open(os.path.join(workspace_directory, ".classpath"),
|
||||
"w") as classpath_file:
|
||||
classpath_file.write(classpath)
|
||||
if len(sys.argv) > 1:
|
||||
project_name = sys.argv[1]
|
||||
|
@ -279,18 +268,17 @@ def main():
|
|||
if not os.path.exists(".settings"):
|
||||
os.makedirs(".settings")
|
||||
# XXX: Avoid wiping out existing settings from org.eclipse.jdt.core.prefs
|
||||
with open(os.path.join(
|
||||
workspace_directory,
|
||||
".settings",
|
||||
"org.eclipse.jdt.core.prefs"), "w") as prefs_file:
|
||||
with open(os.path.join(workspace_directory,
|
||||
".settings",
|
||||
"org.eclipse.jdt.core.prefs"), "w") as prefs_file:
|
||||
prefs_file.write("\n".join([
|
||||
"eclipse.preferences.version=1",
|
||||
"org.eclipse.jdt.core.compiler.processAnnotations=enabled",
|
||||
]))
|
||||
with open(os.path.join(
|
||||
workspace_directory,
|
||||
".settings",
|
||||
"org.eclipse.jdt.apt.core.prefs"), "w") as prefs_file:
|
||||
with open(os.path.join(workspace_directory,
|
||||
".settings",
|
||||
"org.eclipse.jdt.apt.core.prefs"),
|
||||
"w") as prefs_file:
|
||||
prefs_file.write("\n".join([
|
||||
"eclipse.preferences.version=1",
|
||||
"org.eclipse.jdt.apt.aptEnabled=true",
|
||||
|
|
2
third_party/java/dagger/BUILD
vendored
2
third_party/java/dagger/BUILD
vendored
|
@ -26,8 +26,8 @@ java_library(
|
|||
|
||||
java_library(
|
||||
name = "dagger-compiler",
|
||||
exports = ["@dagger_compiler//jar"],
|
||||
visibility = ["//visibility:public"],
|
||||
exports = ["@dagger_compiler//jar"],
|
||||
runtime_deps = [
|
||||
"@gson//jar",
|
||||
"@guava//jar",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue