Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java][Bazel] Refine auto-generated pom files #4780

Merged
merged 3 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bazel/ray.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ def define_java_module(name, additional_srcs = [], additional_resources = [], de
size = "small",
tags = ["checkstyle"],
)

def gen_java_pom_file(name):
pom_file(
name = "org_ray_ray_" + name + "_pom",
targets = [
":org_ray_ray_" + name,
],
template_file = name + "/pom_template.xml",
substitutions = {
"{auto_gen_header}": "<!-- This file is auto-generated by Bazel from pom_template.xml, do not modify it. -->",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like that this header caused the test failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the failure is because this comment cannot be the first line. fixed.

}
)
51 changes: 17 additions & 34 deletions java/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//bazel:ray.bzl", "flatbuffer_java_library", "define_java_module", "gen_java_pom_file")
load("//bazel:ray.bzl", "flatbuffer_java_library", "define_java_module")

exports_files([
"testng.xml",
Expand All @@ -7,27 +7,29 @@ exports_files([
"streaming/testng.xml",
])

all_modules = [
"api",
"runtime",
"test",
"tutorial",
"streaming",
]

java_import(
name = "all_modules",
jars = [
"liborg_ray_ray_api.jar",
"liborg_ray_ray_api-src.jar",
"liborg_ray_ray_runtime.jar",
"liborg_ray_ray_runtime-src.jar",
"liborg_ray_ray_tutorial.jar",
"liborg_ray_ray_tutorial-src.jar",
"liborg_ray_ray_streaming.jar",
"liborg_ray_ray_streaming-src.jar",
"liborg_ray_ray_" + module + ".jar" for module in all_modules
] + [
"liborg_ray_ray_" + module + "-src.jar" for module in all_modules
] + [
"all_tests_deploy.jar",
"all_tests_deploy-src.jar",
"streaming_tests_deploy.jar",
"streaming_tests_deploy-src.jar",
],
deps = [
":org_ray_ray_api",
":org_ray_ray_runtime",
":org_ray_ray_tutorial",
":org_ray_ray_streaming",
":org_ray_ray_" + module for module in all_modules
] + [
":all_tests",
":streaming_tests",
],
Expand Down Expand Up @@ -247,30 +249,10 @@ genrule(
local = 1,
)

# generate pom.xml file for maven compile
gen_java_pom_file(
name = "api",
)

gen_java_pom_file(
name = "runtime",
)

gen_java_pom_file(
name = "tutorial",
)

gen_java_pom_file(
name = "test",
)

genrule(
name = "copy_pom_file",
srcs = [
"//java:org_ray_ray_api_pom",
"//java:org_ray_ray_runtime_pom",
"//java:org_ray_ray_tutorial_pom",
"//java:org_ray_ray_test_pom",
"//java:org_ray_ray_" + module + "_pom" for module in all_modules
],
outs = ["copy_pom_file.out"],
cmd = """
Expand All @@ -280,6 +262,7 @@ genrule(
cp -f $(location //java:org_ray_ray_runtime_pom) $$WORK_DIR/java/runtime/pom.xml
cp -f $(location //java:org_ray_ray_tutorial_pom) $$WORK_DIR/java/tutorial/pom.xml
cp -f $(location //java:org_ray_ray_test_pom) $$WORK_DIR/java/test/pom.xml
cp -f $(location //java:org_ray_ray_streaming_pom) $$WORK_DIR/java/streaming/pom.xml
echo $$(date) > $@
""",
local = 1,
Expand Down
42 changes: 26 additions & 16 deletions java/api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This file is auto-generated by Bazel from pom_template.xml, do not modify it. -->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
Expand All @@ -16,21 +17,30 @@
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
</dependencies>
</project>
3 changes: 2 additions & 1 deletion java/api/pom_template.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{auto_gen_header}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
Expand All @@ -16,6 +17,6 @@
<packaging>jar</packaging>

<dependencies>
{generated_bzl_deps}
{generated_bzl_deps}
</dependencies>
</project>
82 changes: 0 additions & 82 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,90 +20,8 @@
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<projetct.version>0.1-SNAPSHOT</projetct.version>
<slf4j.version>1.7.25</slf4j.version>
<jaxb.version>2.3.0</jaxb.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-plasma</artifactId>
<version>0.13.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>2.47</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>flatbuffers-java</artifactId>
<version>1.9.0.1</version>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.72</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.9</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<pluginManagement>
<plugins>
Expand Down
94 changes: 51 additions & 43 deletions java/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This file is auto-generated by Bazel from pom_template.xml, do not modify it. -->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
Expand All @@ -21,53 +22,60 @@
<artifactId>ray-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
</dependency>
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>flatbuffers-java</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These dependency items should have the same indentation as those you changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The below ones are not indented, because the tool doesn't support that.

<artifactId>arrow-plasma</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>flatbuffers-java</artifactId>
<version>1.9.0.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>2.47</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>

<build>
Expand Down
3 changes: 2 additions & 1 deletion java/runtime/pom_template.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{auto_gen_header}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
Expand Down Expand Up @@ -25,7 +26,7 @@
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-plasma</artifactId>
</dependency>
{generated_bzl_deps}
{generated_bzl_deps}
</dependencies>

<build>
Expand Down
Loading