Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
load("@io_bazel_rules_scala//scala:scala_toolchain.bzl", "scala_toolchain") | ||
load( | ||
"@io_bazel_rules_scala//scala:providers.bzl", | ||
_declare_scalac_provider = "declare_scalac_provider", | ||
) | ||
|
||
scala_toolchain( | ||
name = "global_toolchain_impl", | ||
scalac_provider_attr = "//:scalac_default", | ||
scalacopts = [ | ||
"-unchecked", | ||
"-deprecation", | ||
"-feature", | ||
"-Xmax-classfile-name", | ||
"240", | ||
"-Ywarn-unused-import", | ||
"-Ywarn-unused", | ||
], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
toolchain( | ||
name = "global_toolchain", | ||
toolchain = "global_toolchain_impl", | ||
toolchain_type = "@io_bazel_rules_scala//scala:toolchain_type", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
_declare_scalac_provider( | ||
name = "scalac_default", | ||
default_classpath = [ | ||
"@org_scala_lang_scala_library", | ||
"@org_scala_lang_scala_reflect", | ||
], | ||
default_macro_classpath = [ | ||
"@org_scala_lang_scala_library", | ||
"@org_scala_lang_scala_reflect", | ||
], | ||
default_repl_classpath = [ | ||
"@org_scala_lang_scala_library", | ||
"@org_scala_lang_scala_reflect", | ||
"@org_scala_lang_scala_compiler", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# EXODUS | ||
|
||
Easily migrate your JVM code from Maven to Bazel. | ||
|
||
See the documentation [here](https://wix-incubator.github.io/exodus/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
workspace(name = "exodus") | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("@bazel_tools//tools/build_defs/repo:git.bzl","git_repository") | ||
|
||
protobuf_version="66dc42d891a4fc8e9190c524fd67961688a37bbe" | ||
protobuf_version_sha256="983975ab66113cbaabea4b8ec9f3a73406d89ed74db9ae75c74888e685f956f8" | ||
|
||
http_archive( | ||
name = "com_google_protobuf", | ||
url = "https://github.com/protocolbuffers/protobuf/archive/%s.tar.gz" % protobuf_version, | ||
strip_prefix = "protobuf-%s" % protobuf_version, | ||
sha256 = protobuf_version_sha256, | ||
) | ||
|
||
scala_version = "2.12.4" | ||
rules_scala_version="c904132da6bb421a9106c79dd02bb31f228994b9" # update this as needed | ||
rules_scala_version_sha256="1f287926bab41b95ef6757a3f4d5c935c8f0dbfcdd82c8e8e209859115385a3a" | ||
http_archive( | ||
name = "io_bazel_rules_scala", | ||
url = "https://github.com/bazelbuild/rules_scala/archive/%s.zip"%rules_scala_version, | ||
type = "zip", | ||
strip_prefix= "rules_scala-%s" % rules_scala_version, | ||
sha256 = rules_scala_version_sha256, | ||
) | ||
|
||
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") | ||
scala_repositories((scala_version, { | ||
"scala_compiler": "3023b07cc02f2b0217b2c04f8e636b396130b3a8544a8dfad498a19c3e57a863", | ||
"scala_library": "f81d7144f0ce1b8123335b72ba39003c4be2870767aca15dd0888ba3dab65e98", | ||
"scala_reflect": "ffa70d522fc9f9deec14358aa674e6dd75c9dfa39d4668ef15bb52f002ce99fa" | ||
})) | ||
|
||
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains") | ||
scala_register_toolchains() | ||
|
||
load("@io_bazel_rules_scala//specs2:specs2_junit.bzl", "specs2_junit_repositories") | ||
specs2_junit_repositories(scala_version) | ||
|
||
register_toolchains("//:global_toolchain") | ||
|
||
load("//:third_party.bzl", "third_party_dependencies") | ||
third_party_dependencies() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "scala_maven_import_external", "scala_import_external") | ||
|
||
_default_server_urls = ["http://repo.dev.wixpress.com/artifactory/libs-snapshots", | ||
"http://repo.dev.wixpress.com/artifactory/libs-releases",] | ||
|
||
def safe_wix_scala_maven_import_external(name, artifact, **kwargs): | ||
if native.existing_rule(name) == None: | ||
wix_scala_maven_import_external( | ||
name = name, | ||
artifact = artifact, | ||
**kwargs | ||
) | ||
|
||
|
||
def wix_scala_maven_import_external(name, artifact, **kwargs): | ||
fetch_sources = kwargs.get("srcjar_sha256") != None | ||
wix_scala_maven_import_external_sources(name, artifact, fetch_sources, **kwargs) | ||
|
||
def wix_snapshot_scala_maven_import_external(name, artifact, **kwargs): | ||
wix_scala_maven_import_external_sources(name, artifact, True, **kwargs) | ||
|
||
def wix_scala_maven_import_external_sources(name, artifact, fetch_sources, **kwargs): | ||
scala_maven_import_external( | ||
name = name, | ||
artifact = artifact, | ||
licenses = ["notice"], # Apache 2.0 | ||
fetch_sources = fetch_sources, | ||
server_urls = _default_server_urls, | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
load("@build_bazel_integration_testing//tools:import.bzl", "bazel_external_dependency_archive") | ||
|
||
def bazel_external_dependencies(rules_scala_version, rules_scala_version_sha256): | ||
bazel_external_dependency_archive( | ||
name = "io_bazel_rules_scala_test", | ||
srcs = { | ||
rules_scala_version_sha256: [ | ||
"https://github.com/wix/rules_scala/archive/%s.zip" % rules_scala_version, | ||
], | ||
"3023b07cc02f2b0217b2c04f8e636b396130b3a8544a8dfad498a19c3e57a863": [ | ||
"https://repo.maven.apache.org/maven2/org/scala-lang/scala-compiler/2.12.6/scala-compiler-2.12.6.jar" | ||
], | ||
"f81d7144f0ce1b8123335b72ba39003c4be2870767aca15dd0888ba3dab65e98": [ | ||
"https://repo.maven.apache.org/maven2/org/scala-lang/scala-library/2.12.6/scala-library-2.12.6.jar" | ||
], | ||
"ffa70d522fc9f9deec14358aa674e6dd75c9dfa39d4668ef15bb52f002ce99fa": [ | ||
"https://repo.maven.apache.org/maven2/org/scala-lang/scala-reflect/2.12.6/scala-reflect-2.12.6.jar" | ||
], | ||
"b416b5bcef6720da469a8d8a5726e457fc2d1cd5d316e1bc283aa75a2ae005e5": [ | ||
"http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.5/scalatest_2.12-3.0.5.jar" | ||
], | ||
"57e25b4fd969b1758fe042595112c874dfea99dca5cc48eebe07ac38772a0c41": [ | ||
"http://central.maven.org/maven2/org/scalactic/scalactic_2.12/3.0.5/scalactic_2.12-3.0.5.jar" | ||
], | ||
"f877d304660ac2a142f3865badfc971dec7ed73c747c7f8d5d2f5139ca736513": [ | ||
"http://central.maven.org/maven2/commons/io/commons-io/2.6/commons-io-2.6.jar" | ||
], | ||
"8d7ec605ca105747653e002bfe67bddba90ab964da697aaa5daa1060923585db": [ | ||
"http://central.maven.org/maven2/com/google/protobuf/protobuf-java/3.1.0/protobuf-java-3.1.0.jar" | ||
], | ||
"39097bdc47407232e0fe7eed4f2c175c067b7eda95873cb76ffa76f1b4c18895": [ | ||
"https://mirror.bazel.build/raw.githubusercontent.com/bazelbuild/bazel/0.17.1" + | ||
"/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt" | ||
], | ||
} | ||
) | ||
bazel_external_dependency_archive( | ||
name = "com_google_guava_guava_test", | ||
srcs = { | ||
"36a666e3b71ae7f0f0dca23654b67e086e6c93d192f60ba5dfd5519db6c288c8": [ | ||
"http://central.maven.org/maven2/com/google/guava/guava/20.0/guava-20.0.jar", | ||
], | ||
} | ||
) | ||
bazel_external_dependency_archive( | ||
name = "bazel_toolchains_test", | ||
srcs = { | ||
"f08758b646beea3b37dc9e07d63020cecd5f9d29f42de1cd60e9325e047c7103": [ | ||
"https://github.com/bazelbuild/bazel-toolchains/archive/719f8035a20997289727e16693acdebc8e918e28.tar.gz", | ||
], | ||
} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
def resources(name = "resources", runtime_deps=[], testonly = 0, visibility=None): | ||
native.java_library( | ||
name = name, | ||
resources = native.glob(["**"],exclude=["BUILD"]), | ||
resource_strip_prefix = "%s/" % native.package_name(), | ||
runtime_deps = runtime_deps, | ||
testonly = testonly, | ||
visibility = visibility | ||
) | ||
|
||
|
||
def maven_archive(name, artifact): | ||
http_archive( | ||
name = name, | ||
url = _convert_to_url(artifact), | ||
build_file_content = """filegroup(name = "unpacked", srcs = glob(["**/*"],exclude=["BUILD.bazel","WORKSPACE","*.zip","*.tar.gz"]), visibility = ["//visibility:public"]) | ||
filegroup(name = "archive", srcs = glob(["*.zip","*.tar.gz"]), visibility = ["//visibility:public"]) | ||
""" | ||
) | ||
|
||
def maven_proto(name, artifact, deps = []): | ||
http_archive( | ||
name = name, | ||
url = _convert_to_url(artifact), | ||
build_file_content = """load("@server_infra//framework/grpc/generator-bazel/src/main/rules:wix_scala_proto_repositories.bzl", "WIX_PROTOS") | ||
proto_library(name = "proto", srcs = glob(["**/*.proto"]), deps = {deps} + WIX_PROTOS, visibility = ["//visibility:public"])""".format(deps = deps) | ||
) | ||
|
||
def _convert_to_url(artifact): | ||
parts = artifact.split(":") | ||
group_id_part = parts[0].replace(".","/") | ||
artifact_id = parts[1] | ||
version = parts[2] | ||
packaging = "jar" | ||
classifier_part = "" | ||
if len(parts) == 4: | ||
packaging = parts[2] | ||
version = parts[3] | ||
elif len(parts) == 5: | ||
packaging = parts[2] | ||
classifier_part = "-"+parts[3] | ||
version = parts[4] | ||
|
||
final_name = artifact_id + "-" + version + classifier_part + "." + packaging | ||
url_suffix = group_id_part+"/"+artifact_id + "/" + version + "/" + final_name | ||
url_prefix = "https://repo.dev.wixpress.com/artifactory/libs-snapshots/" | ||
return url_prefix + url_suffix | ||
|
||
|
||
def _package_visibility(pacakge_name): | ||
return ["//{p}:__pkg__".format(p=pacakge_name)] | ||
|
||
|
||
def sources(visibility = None): | ||
if visibility == None: | ||
visibility = _package_visibility(native.package_name()) | ||
native.filegroup( | ||
name = "sources", | ||
srcs = native.glob(["*.java"]) + native.glob(["*.scala"]), | ||
visibility = visibility, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<packaging>pom</packaging> | ||
<version>1.10.0-SNAPSHOT</version> | ||
|
||
<modules> | ||
<module>dependency-resolver</module> | ||
<module>dependency-synchronizer</module> | ||
<module>migrator</module> | ||
<module>models</module> | ||
<module>repo-analyzer</module> | ||
<module>test-utils</module> | ||
</modules> | ||
|
||
<groupId>com.wixpress.build</groupId> | ||
<artifactId>next-gen-build-modules</artifactId> | ||
<developers> | ||
<developer> | ||
<name>Or Shachar</name> | ||
<email>ors@wix.com</email> | ||
<roles> | ||
<role>owner</role> | ||
</roles> | ||
</developer> | ||
<developer> | ||
<name>Ittai Zeidman</name> | ||
<email>ittaiz@wix.com</email> | ||
<roles> | ||
<role>maintainer</role> | ||
</roles> | ||
</developer> | ||
<developer> | ||
<name>Natan Silintsky</name> | ||
<email>natans@wix.com</email> | ||
<roles> | ||
<role>maintainer</role> | ||
</roles> | ||
</developer> | ||
<developer> | ||
<name>Elad Urson</name> | ||
<email>eladu@wix.com</email> | ||
<roles> | ||
<role>maintainer</role> | ||
</roles> | ||
</developer> | ||
</developers> | ||
</project> |
Oops, something went wrong.