Skip to content

Commit

Permalink
Merge pull request #82 from menny/fix-runtime-deps-for-java-plugin
Browse files Browse the repository at this point in the history
Providing runtime-deps and deps for java-plugin
  • Loading branch information
menny authored May 17, 2021
2 parents 86b4387 + 94367c8 commit 4acfe64
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 109 deletions.
14 changes: 1 addition & 13 deletions examples/android/program/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@build_bazel_rules_android//android:rules.bzl", "android_binary")
load("@mabel//rules/maven_deps:mabel.bzl", "artifact", "mabel_rule")
load("@mabel//rules/maven_deps:mabel.bzl", "mabel_rule")
load("//program/main_deps:dependencies.bzl", "generate_transitive_dependency_targets")

#here is an example of using a replacement implementation for aar_import
Expand All @@ -15,17 +15,6 @@ mabel_rule(
g_artifact("androidx.fragment:fragment:1.1.0-alpha02"),
g_artifact("androidx.appcompat:appcompat:1.0.2"),
g_artifact("androidx.annotation:annotation:1.0.0"),
artifact(
"com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406",
maven_exclude_deps = [
"com.android.support",
],
repositories = [
"https://jitpack.io/",
"https://maven.google.com/",
"https://repo1.maven.org/maven2/",
],
),
],
)

Expand All @@ -47,6 +36,5 @@ android_binary(
"//program:androidx_fragment__fragment",
"//program/main_deps/androidx/annotation/annotation",
"//program/main_deps/androidx/appcompat/appcompat",
"//program/main_deps/com/github/menny/Chauffeur/permissions",
],
)

This file was deleted.

This file was deleted.

74 changes: 0 additions & 74 deletions examples/android/program/main_deps/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,6 @@ def generate_workspace_rules(name = "generate_workspace_rules"):
downloaded_file_path = "viewpager-1.0.0.aar",
)

# from com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406
http_file(
name = "com_github_menny_Chauffeur__lib__90e703256785b7baf9cd37370b62b1d7d3830406",
urls = ["https://jitpack.io/com/github/menny/Chauffeur/lib/90e703256785b7baf9cd37370b62b1d7d3830406/lib-90e703256785b7baf9cd37370b62b1d7d3830406.aar"],
downloaded_file_path = "lib-90e703256785b7baf9cd37370b62b1d7d3830406.aar",
)

# from com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406
http_file(
name = "com_github_menny_Chauffeur__permissions__90e703256785b7baf9cd37370b62b1d7d3830406",
urls = ["https://jitpack.io/com/github/menny/Chauffeur/permissions/90e703256785b7baf9cd37370b62b1d7d3830406/permissions-90e703256785b7baf9cd37370b62b1d7d3830406.aar"],
downloaded_file_path = "permissions-90e703256785b7baf9cd37370b62b1d7d3830406.aar",
)

def _no_op_missing_aar_impl(name, **kwargs):
"""
This is a help macro for missing concrete rule implementation.
Expand Down Expand Up @@ -393,8 +379,6 @@ def generate_transitive_dependency_targets(
# This is a dependency of 'androidx.vectordrawable:vectordrawable:1.0.1'.
# This is a dependency of 'androidx.versionedparcelable:versionedparcelable:1.1.0-alpha01'.
# This is a dependency of 'androidx.viewpager:viewpager:1.0.0'.
# This is a dependency of 'com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406'.
# This is a dependency of 'com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406'.
native.alias(
name = "androidx_annotation__annotation",
actual = ":androidx_annotation__annotation__1_0_0",
Expand Down Expand Up @@ -430,8 +414,6 @@ def generate_transitive_dependency_targets(
# This is a dependency of 'androidx.vectordrawable:vectordrawable:1.0.1'.
# This is a dependency of 'androidx.versionedparcelable:versionedparcelable:1.1.0-alpha01'.
# This is a dependency of 'androidx.viewpager:viewpager:1.0.0'.
# This is a dependency of 'com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406'.
# This is a dependency of 'com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406'.
java_import(
name = "androidx_annotation__annotation__1_0_0",
jars = ["@androidx_annotation__annotation__1_0_0//file"],
Expand All @@ -449,8 +431,6 @@ def generate_transitive_dependency_targets(

# from androidx.appcompat:appcompat:1.0.2
# This is a root requested Maven artifact.
# This is a dependency of 'com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406'.
# This is a dependency of 'com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406'.
native.alias(
name = "androidx_appcompat__appcompat",
actual = ":androidx_appcompat__appcompat__1_0_2",
Expand All @@ -459,8 +439,6 @@ def generate_transitive_dependency_targets(

# from androidx.appcompat:appcompat:1.0.2
# This is a root requested Maven artifact.
# This is a dependency of 'com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406'.
# This is a dependency of 'com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406'.
aar_import(
name = "androidx_appcompat__appcompat__1_0_2",
aar = "@androidx_appcompat__appcompat__1_0_2//file",
Expand Down Expand Up @@ -776,8 +754,6 @@ def generate_transitive_dependency_targets(
# from androidx.fragment:fragment:1.1.0-alpha02
# This is a root requested Maven artifact.
# This is a dependency of 'androidx.appcompat:appcompat:1.0.2'.
# This is a dependency of 'com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406'.
# This is a dependency of 'com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406'.
native.alias(
name = "androidx_fragment__fragment",
actual = ":androidx_fragment__fragment__1_1_0_alpha02",
Expand All @@ -787,8 +763,6 @@ def generate_transitive_dependency_targets(
# from androidx.fragment:fragment:1.1.0-alpha02
# This is a root requested Maven artifact.
# This is a dependency of 'androidx.appcompat:appcompat:1.0.2'.
# This is a dependency of 'com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406'.
# This is a dependency of 'com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406'.
aar_import(
name = "androidx_fragment__fragment__1_1_0_alpha02",
aar = "@androidx_fragment__fragment__1_1_0_alpha02//file",
Expand Down Expand Up @@ -1257,51 +1231,3 @@ def generate_transitive_dependency_targets(
":androidx_customview__customview",
],
)

# from com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406
# This is a dependency of 'com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406'.
native.alias(
name = "com_github_menny_Chauffeur__lib",
actual = ":com_github_menny_Chauffeur__lib__90e703256785b7baf9cd37370b62b1d7d3830406",
visibility = ["//visibility:public"],
)

# from com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406
# This is a dependency of 'com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406'.
aar_import(
name = "com_github_menny_Chauffeur__lib__90e703256785b7baf9cd37370b62b1d7d3830406",
aar = "@com_github_menny_Chauffeur__lib__90e703256785b7baf9cd37370b62b1d7d3830406//file",
tags = ["maven_coordinates=com.github.menny.Chauffeur:lib:90e703256785b7baf9cd37370b62b1d7d3830406"],
deps = [
":androidx_annotation__annotation",
":androidx_appcompat__appcompat",
":androidx_fragment__fragment",
],
exports = [":androidx_annotation__annotation"],
)

# from com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406
# This is a root requested Maven artifact.
native.alias(
name = "com_github_menny_Chauffeur__permissions",
actual = ":com_github_menny_Chauffeur__permissions__90e703256785b7baf9cd37370b62b1d7d3830406",
visibility = ["//visibility:public"],
)

# from com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406
# This is a root requested Maven artifact.
aar_import(
name = "com_github_menny_Chauffeur__permissions__90e703256785b7baf9cd37370b62b1d7d3830406",
aar = "@com_github_menny_Chauffeur__permissions__90e703256785b7baf9cd37370b62b1d7d3830406//file",
tags = ["maven_coordinates=com.github.menny.Chauffeur:permissions:90e703256785b7baf9cd37370b62b1d7d3830406"],
deps = [
":androidx_annotation__annotation",
":androidx_appcompat__appcompat",
":androidx_fragment__fragment",
":com_github_menny_Chauffeur__lib",
],
exports = [
":androidx_annotation__annotation",
":com_github_menny_Chauffeur__lib",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ public List<Target> buildTargets(Dependency dependency, DependencyTools dependen

Collection<String> deps =
convertRulesToStrings(dependency.dependencies(), dependencyTools);
//runtime-deps should be a dep for the java-plugin
deps.addAll(convertRulesToStrings(dependency.runtimeDependencies(), dependencyTools));
deps.add(":" + dependencyTools.repositoryRuleName(dependency));
// as java_plugins
List<String> noApiPlugins = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ public class FormattersTests {
+ " \":aar__lib__\",\n"
+ " \":safe_mvn__dep1\",\n"
+ " \":safe_mvn__dep2\",\n"
+ " \":safe_mvn__runtime1\",\n"
+ " \":safe_mvn__runtime2\",\n"
+ " ],\n"
+ " )\n"
+ " native.alias(\n"
Expand All @@ -315,6 +317,8 @@ public class FormattersTests {
+ " \":aar__lib__\",\n"
+ " \":safe_mvn__dep1\",\n"
+ " \":safe_mvn__dep2\",\n"
+ " \":safe_mvn__runtime1\",\n"
+ " \":safe_mvn__runtime2\",\n"
+ " ],\n"
+ " )\n"
+ " native.alias(\n"
Expand All @@ -330,6 +334,8 @@ public class FormattersTests {
+ " \":aar__lib__\",\n"
+ " \":safe_mvn__dep1\",\n"
+ " \":safe_mvn__dep2\",\n"
+ " \":safe_mvn__runtime1\",\n"
+ " \":safe_mvn__runtime2\",\n"
+ " ],\n"
+ " )\n"
+ " native.alias(\n"
Expand All @@ -345,6 +351,8 @@ public class FormattersTests {
+ " \":aar__lib__\",\n"
+ " \":safe_mvn__dep1\",\n"
+ " \":safe_mvn__dep2\",\n"
+ " \":safe_mvn__runtime1\",\n"
+ " \":safe_mvn__runtime2\",\n"
+ " ],\n"
+ " )\n"
+ " native.alias(\n"
Expand Down

0 comments on commit 4acfe64

Please sign in to comment.