-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from bazel-distribution to rules_jvm_external for Maven distr…
…ibution (#39) * swap to maven_export for distribution * swap to maven_publish for staged-maven-deploy.sh * distribution kwargs * deploy_env and excluded_workspaces * remove kt_android as it's not yet ready * --experimental_google_legacy_api for sync & build * use embedded jdk * remove unused kt_jvm params * add pom_template to kt_jvm * common rc flags * only load js rules for js test
- Loading branch information
Showing
8 changed files
with
60 additions
and
120 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,3 @@ | ||
# Use embedded JDK | ||
common --repo_env=JAVA_HOME=../bazel_tools/jdk | ||
common --experimental_google_legacy_api |
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
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
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
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 |
---|---|---|
@@ -1,67 +1,15 @@ | ||
load("@vaticle_bazel_distribution//maven:rules.bzl", "assemble_maven", "deploy_maven", "MavenDeploymentInfo") | ||
load("@rules_jvm_external//:defs.bzl", "maven_export") | ||
load("//internal:scope_name.bzl", "scope_name") | ||
|
||
def distribution( | ||
*, | ||
name, | ||
|
||
release_repo, | ||
snapshot_repo, | ||
version_file, | ||
|
||
# (optional) | ||
project_name = None, | ||
project_description = None, | ||
project_url = None, | ||
scm_url = None, | ||
developers = None, | ||
|
||
workspace_refs = None, | ||
): | ||
assemble_name = scope_name(name, "assemble") | ||
assemble_maven( | ||
name = assemble_name, | ||
target = ":%s" % name, | ||
project_name = project_name, | ||
project_description = project_description, | ||
project_url = project_url, | ||
scm_url = scm_url, | ||
developers = developers, | ||
version_file = version_file, | ||
workspace_refs = workspace_refs, | ||
maven_coordinates, | ||
lib_name = None, | ||
**kwargs): | ||
maven_export( | ||
name = scope_name(name, "export"), | ||
lib_name = lib_name if lib_name else name, | ||
maven_coordinates = maven_coordinates, | ||
**kwargs | ||
) | ||
|
||
install_maven( | ||
name = scope_name(name, "install"), | ||
target = ":%s" % assemble_name, | ||
) | ||
|
||
deploy_maven( | ||
name = scope_name(name, "deploy"), | ||
target = ":%s" % assemble_name, | ||
release = release_repo, | ||
snapshot = snapshot_repo, | ||
) | ||
|
||
def _install_maven_impl(ctx): | ||
deployment_info = ctx.attr.target[MavenDeploymentInfo] | ||
file = deployment_info.jar | ||
|
||
script = ctx.actions.declare_file("%s-install" % ctx.label.name) | ||
script_content = "mvn install:install-file -Dfile={}".format(file.short_path,) | ||
ctx.actions.write(script, script_content, is_executable = True) | ||
|
||
runfiles = ctx.runfiles(files = [file]) | ||
return [DefaultInfo(executable = script, runfiles = runfiles)] | ||
|
||
install_maven = rule( | ||
implementation = _install_maven_impl, | ||
attrs = { | ||
"target": attr.label( | ||
mandatory = True, | ||
providers = [MavenDeploymentInfo], | ||
doc = "assemble_maven target to install", | ||
), | ||
}, | ||
executable = True, | ||
) |
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
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 |
---|---|---|
@@ -1,11 +1,25 @@ | ||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") | ||
load("//internal:maybe.bzl", "maybe") | ||
|
||
def maven(tag = "3.3", sha = "d85951a92c0908c80bd8551002d66cb23c3434409c814179c0ff026b53544dab"): | ||
def maven(tag = "5.3", sha = "d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac"): | ||
maybe( | ||
http_archive, | ||
name = "rules_jvm_external", | ||
strip_prefix = "rules_jvm_external-%s" % tag, | ||
sha256 = sha, | ||
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % tag, | ||
) | ||
|
||
# Load maven rules from git | ||
def maven_repository( | ||
remote = "https://github.com/sugarmanz/rules_jvm_external.git", | ||
branch = "maven-export-aar", | ||
**kwargs): | ||
maybe( | ||
git_repository, | ||
name = "rules_jvm_external", | ||
remote = remote, | ||
branch = branch, | ||
**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