diff --git a/docs/admin-tool.md b/docs/admin-tool.md index 131eae088..466b3eaa1 100644 --- a/docs/admin-tool.md +++ b/docs/admin-tool.md @@ -76,7 +76,7 @@ server-side command otherwise. ## Common tool patterns All tools ultimately implement the `Command` interface located in the `tools` -package. If you use an integrated development environment (IDE) such as Eclipse +package. If you use an integrated development environment (IDE) such as IntelliJ to view the type hierarchy of that interface, you'll see all of the commands that exist, as well as how a lot of them are grouped using sub-interfaces or abstract classes that provide additional functionality. The most common patterns diff --git a/java/google/registry/eclipse/BUILD b/java/google/registry/eclipse/BUILD deleted file mode 100644 index d5d8c0c5d..000000000 --- a/java/google/registry/eclipse/BUILD +++ /dev/null @@ -1,71 +0,0 @@ -package( - default_visibility = ["//java/google/registry:registry_project"], -) - -licenses(["notice"]) # Apache 2.0 - -java_binary( - name = "annotation_processors_ide", - create_executable = False, - runtime_deps = [ - "@com_google_auto_common", - "@com_google_auto_factory//:processor", - "@com_google_auto_service//:processor", - "@com_google_auto_value//:processor", - "@com_google_dagger_compiler", - "@com_squareup_javawriter", - ], -) - -java_binary( - name = "registry_deps", - testonly = 1, - create_executable = 0, - runtime_deps = [ - "//java/google/registry/module/backend", - "//java/google/registry/module/frontend", - "//java/google/registry/module/tools", - "//java/google/registry/tools", - "@com_google_apis_google_api_services_cloudkms", - "@com_google_appengine_api_1_0_sdk//:link", - "@com_google_appengine_api_stubs", - "@com_google_appengine_remote_api//:link", - "@com_google_appengine_testing", - "@com_google_appengine_tools_sdk", - "@com_google_guava_testlib", - "@com_google_truth", - "@com_google_truth_extensions_truth_java8_extension", - "@junit", - "@org_apache_ftpserver_core", - "@org_apache_sshd_core", - "@org_hamcrest_library", - "@org_mockito_all", - "@org_mortbay_jetty", - ], -) - -# This rule creates a copy of the registry_deps_deploy.jar with all of the -# domain-registry code removed. This is to avoid having duplicate instances -# of domain-registry classes on the eclipse build path. -genrule( - name = "eclipse_deps", - srcs = ["//java/google/registry/eclipse:registry_deps_deploy.jar"], - outs = ["eclipse_deps.jar"], - cmd = " && ".join([ - "JAR=$$(pwd)/$(location @local_jdk//:bin/jar)", - "IN=$$(pwd)/$(SRCS)", - "OUT=$$(pwd)/$@", - "TMP=$$(mktemp -d $${TMPDIR:-/tmp}/eclipse_deps.XXXXXXXX)", - "cd $$TMP", - "$$JAR -xf $$IN", - "rm -rf google/registry", - "$$JAR -cmf META-INF/MANIFEST.MF eclipse_deps.jar .", - "mv eclipse_deps.jar $$OUT", - "rm -rf $$TMP", - ]), - tools = [ - "@local_jdk//:bin/jar", - "@local_jdk//:jdk-lib", - "@local_jdk//:jre-default", - ], -) diff --git a/java/google/registry/tools/BUILD b/java/google/registry/tools/BUILD index c65b96d92..0260ee1d5 100644 --- a/java/google/registry/tools/BUILD +++ b/java/google/registry/tools/BUILD @@ -10,7 +10,6 @@ licenses(["notice"]) # Apache 2.0 package_group( name = "allowed-tools", packages = [ - "//java/google/registry/eclipse", "//java/google/registry/testing", "//java/google/registry/tools", "//javatests/google/registry/testing", diff --git a/javatests/google/registry/rde/RdeTestSuite.java b/javatests/google/registry/rde/RdeTestSuite.java index 4d2723345..94bfd762d 100644 --- a/javatests/google/registry/rde/RdeTestSuite.java +++ b/javatests/google/registry/rde/RdeTestSuite.java @@ -18,7 +18,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -/** Convenience class for jart@ so she can run all RDE tests inside Eclipse with one keystroke. */ +/** Convenience class to run all RDE tests inside IDE with one keystroke. */ @RunWith(Suite.class) @SuiteClasses({ DomainResourceToXjcConverterTest.class, diff --git a/javatests/google/registry/testing/InjectRule.java b/javatests/google/registry/testing/InjectRule.java index a1629f70e..d8dccd097 100644 --- a/javatests/google/registry/testing/InjectRule.java +++ b/javatests/google/registry/testing/InjectRule.java @@ -27,30 +27,26 @@ import org.junit.rules.ExternalResource; /** * JUnit Rule for overriding {@code private static} fields during a test. * - *

This rule uses reflection to change the value of a field while your test - * is running and then restore it to its original value after it's done (even - * if the test fails). The injection will work even if the field is marked - * {@code private} (but not if it's {@code final}). The downside is that if you - * rename the field in the future, Eclipse refactoring won't be smart enough to - * update the injection site. + *

This rule uses reflection to change the value of a field while your test is running and then + * restore it to its original value after it's done (even if the test fails). The injection will + * work even if the field is marked {@code private} (but not if it's {@code final}). The downside is + * that if you rename the field in the future, IDE refactoring won't be smart enough to update the + * injection site. * - *

We encourage you to consider using - * {@link google.registry.util.NonFinalForTesting @NonFinalForTesting} - * to document your injected fields. + *

We encourage you to consider using {@link google.registry.util.NonFinalForTesting + * @NonFinalForTesting} to document your injected fields. * - *

This class is a horrible evil hack, but it alleviates you of the toil of - * having to break encapsulation by making your fields non-{@code private}, using - * the {@link com.google.common.annotations.VisibleForTesting @VisibleForTesting} - * annotation to document why you've reduced visibility, creating a temporary field - * to store the old value, and then writing an {@link org.junit.After @After} - * method to restore it. So sometimes it feels good to be evil; but hopefully one - * day we'll be able to delete this class and do things properly with - * Dagger dependency injection. + *

This class is a horrible evil hack, but it alleviates you of the toil of having to break + * encapsulation by making your fields non-{@code private}, using the {@link + * com.google.common.annotations.VisibleForTesting @VisibleForTesting} annotation to document + * why you've reduced visibility, creating a temporary field to store the old value, and then + * writing an {@link org.junit.After @After} method to restore it. So sometimes it feels good + * to be evil; but hopefully one day we'll be able to delete this class and do things + * properly with Dagger dependency injection. * - *

You use this class by declaring it as a {@link org.junit.Rule @Rule} - * field and then calling {@link #setStaticField} from either your {@link - * org.junit.Test @Test} or {@link org.junit.Before @Before} methods. For - * example: + *

You use this class by declaring it as a {@link org.junit.Rule @Rule} field and then + * calling {@link #setStaticField} from either your {@link org.junit.Test @Test} or {@link + * org.junit.Before @Before} methods. For example: * *

  * // Doomsday.java
diff --git a/javatests/google/registry/tmch/TmchTestSuite.java b/javatests/google/registry/tmch/TmchTestSuite.java
index 630b057b1..9917ca32d 100644
--- a/javatests/google/registry/tmch/TmchTestSuite.java
+++ b/javatests/google/registry/tmch/TmchTestSuite.java
@@ -18,7 +18,7 @@ import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
 
-/** Convenience class to run all TMCH tests inside Eclipse with one keystroke. */
+/** Convenience class to run all TMCH tests inside IDE with one keystroke. */
 @RunWith(Suite.class)
 @SuiteClasses({
   LordnTaskTest.class,
diff --git a/scripts/setup_eclipse.py b/scripts/setup_eclipse.py
deleted file mode 100644
index 8e6f9d936..000000000
--- a/scripts/setup_eclipse.py
+++ /dev/null
@@ -1,290 +0,0 @@
-#!/usr/bin/python
-# Copyright 2017 The Nomulus 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.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Script for generating eclipse .project and .classpath files."""
-
-import os
-import subprocess
-import sys
-
-
-def bazel_info(key):
-    """Invokes the bazel info subcommand.
-
-    Invokes bazel info on the command line, parses the output and returns it
-
-    Args:
-        key: The argument that is passed to bazel info. See
-           http://bazel.io/docs/bazel-user-manual.html#info for example values.
-
-    Returns:
-        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)
-    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.
-
-    Args:
-        kind: Kind of classpath entry.
-            Example values are 'lib', 'src', and 'con'
-        path: Absolute or relative path to the referenced resource.
-            Paths that are not absolute are relative to the project root.
-
-    Returns:
-        xml classpath entry element with the specified kind and path.
-    """
-    return "".format(
-        kind=kind, path=path)
-
-
-def classpath_xml(entries):
-    """Produces the xml for an eclipse classpath file.
-
-    Args:
-        entries: list of dictionaries in the form of:
-            {
-                "kind": (str),
-                "path": (str)
-            }
-
-    Returns:
-        Contents of the eclipse .classpath file.
-    """
-    entries_xml = "\n".join(
-        ["  " + classpath_entry_xml(**entry) for entry in entries])
-    return ('\n'
-            "\n"
-            "{entries}"
-            "\n").format(entries=entries_xml)
-
-
-def build_classpath():
-    """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
-    dependencies.
-
-    Returns:
-        Contents of the eclipse .classpath file.
-    """
-    # source folder for autogenerated files must reference
-    # symlinked bazel-genfiles folder inside of the project.
-    bazel_genfiles = bazel_info("bazel-genfiles")
-    classpath_entries = [
-        {"kind": "con", "path": "org.eclipse.jdt.launching.JRE_CONTAINER"},
-        {"kind": "src", "path": "java"},
-        {"kind": "src", "path": "javatests"},
-        {"kind": "src", "path": "bazel-genfiles/java"},
-        {
-            "kind": "lib",
-            "path": ("%s/java/google/"
-                     "registry/eclipse/eclipse_deps.jar" % bazel_genfiles)
-        },
-        {"kind": "output", "path": "bin"},
-    ]
-    return classpath_xml(classpath_entries)
-
-
-def build_project(project_name):
-    """Builds eclipse project file.
-
-    Uses a very simple template to generate an eclipse .project file
-    with a configurable project name.
-
-    Args:
-        project_name: Name of the eclipse project. When importing the project
-            into an eclipse workspace, this is the name that will be shown.
-    Returns:
-        Contents of the eclipse .project file.
-    """
-    template = """
-
-    {project_name}
-    
-    
-    
-    
-    
-        
-            org.python.pydev.PyDevBuilder
-            
-            
-        
-        
-            org.eclipse.jdt.core.javabuilder
-            
-            
-        
-    
-    
-        org.eclipse.jdt.core.javanature
-        org.python.pydev.pythonNature
-    
-"""
-    return template.format(project_name=project_name)
-
-
-def factorypath_entry_xml(kind, entry_id):
-    """Generates an eclipse xml factorypath entry.
-
-    Args:
-        kind: Kind of factorypath entry.
-            Example values are 'PLUGIN', 'WKSPJAR'
-        entry_id: Unique identifier for the factorypath entry
-
-    Returns:
-        xml factorypath entry element with the specified kind and id.
-    """
-    return ("").format(
-                kind=kind, entry_id=entry_id)
-
-
-def factorypath_xml(entries):
-    """Produces the xml for an eclipse factorypath file.
-
-    Args:
-        entries: list of dictionaries in the form of:
-            {
-                "kind": (str),
-                "entry_id": (str)
-            }
-
-    Returns:
-        Contents of the eclipse .factorypath file.
-    """
-    entries_xml = "\n".join(
-        ["  " + factorypath_entry_xml(**entry) for entry in entries])
-    return ("\n"
-            "{entries}"
-            "\n").format(entries=entries_xml)
-
-
-def build_factorypath():
-    """Builds eclipse factorypath file.
-
-    Generates an eclipse .factorypath file that links to the jar containing
-    all required annotation processors for the project.
-
-    Returns:
-        Contents of the eclipse .factorypath file.
-    """
-    bazel_bin = bazel_info("bazel-bin")
-    annotations_jar = os.path.join(
-        bazel_bin,
-        "java/google/registry/eclipse"
-        "/annotation_processors_ide_deploy.jar")
-    factorypath_entries = [
-        {
-            "kind": "PLUGIN",
-            "entry_id": "org.eclipse.jst.ws.annotations.core",
-        },
-        {
-            "kind": "EXTJAR",
-            "entry_id": annotations_jar,
-        }
-    ]
-    return factorypath_xml(factorypath_entries)
-
-
-def build_dependencies():
-    """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.
-
-    Raises:
-        subprocess.CalledProcessError: A bazel build failed
-    """
-    # Build entire project first
-    subprocess.check_call([
-        "bazel",
-        "build",
-        "//java/google/registry/...",
-        "//javatests/google/registry/...",
-    ])
-
-    # Builds a giant jar of all compile-time dependencies of the project
-    subprocess.check_call([
-        "bazel",
-        "build",
-        "//java/google/registry/eclipse:eclipse_deps",
-    ])
-
-    # Builds a jar with all annotation processors
-    subprocess.check_call([
-        "bazel",
-        "build",
-        "//java/google/registry/eclipse"
-        ":annotation_processors_ide_deploy.jar",
-    ])
-
-
-def main():
-    """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
-    project files are produced.
-    """
-    build_dependencies()
-    workspace_directory = bazel_info("workspace")
-    classpath = build_classpath()
-    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]
-    else:
-        project_name = "domain-registry"
-    project = build_project(project_name)
-    with open(os.path.join(workspace_directory, ".project"),
-              "w") as project_file:
-        project_file.write(project)
-    factorypath = build_factorypath()
-    with open(os.path.join(workspace_directory, ".factorypath"),
-              "w") as factorypath_file:
-        factorypath_file.write(factorypath)
-    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:
-        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:
-        prefs_file.write("\n".join([
-            "eclipse.preferences.version=1",
-            "org.eclipse.jdt.apt.aptEnabled=true",
-            "org.eclipse.jdt.apt.genSrcDir=autogenerated",
-            "org.eclipse.jdt.apt.reconcileEnabled=true",
-        ]))
-
-
-if __name__ == "__main__":
-    main()