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