本文整理汇总了Python中pants.backend.jvm.subsystems.shader.Shading.create_relocate方法的典型用法代码示例。如果您正苦于以下问题:Python Shading.create_relocate方法的具体用法?Python Shading.create_relocate怎么用?Python Shading.create_relocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pants.backend.jvm.subsystems.shader.Shading
的用法示例。
在下文中一共展示了Shading.create_relocate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_relocate
# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
def test_relocate(self):
self.assertEqual(('com.foo.bar.**', '{}[email protected]'.format(Shading.SHADE_PREFIX)),
Shading.create_relocate(from_pattern='com.foo.bar.**'))
self.assertEqual(('com.foo.bar.**', '{}[email protected]'.format('__my_prefix__.')),
Shading.create_relocate(from_pattern='com.foo.bar.**',
shade_prefix='__my_prefix__.'))
self.assertEqual(('com.foo.bar.**', '[email protected]'.format('__my_prefix__.')),
Shading.create_relocate(from_pattern='com.foo.bar.**',
shade_prefix='__my_prefix__.',
shade_pattern='[email protected]'))
示例2: test_relocate
# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
def test_relocate(self):
self.assertEqual(
("com.foo.bar.**", "{}[email protected]".format(Shading.SHADE_PREFIX)),
Shading.create_relocate(from_pattern="com.foo.bar.**"),
)
self.assertEqual(
("com.foo.bar.**", "{}[email protected]".format("__my_prefix__.")),
Shading.create_relocate(from_pattern="com.foo.bar.**", shade_prefix="__my_prefix__."),
)
self.assertEqual(
("com.foo.bar.**", "[email protected]".format("__my_prefix__.")),
Shading.create_relocate(
from_pattern="com.foo.bar.**", shade_prefix="__my_prefix__.", shade_pattern="[email protected]"
),
)
示例3: test_assemble_classes_in_meta_inf
# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
def test_assemble_classes_in_meta_inf(self):
input_jar = self.populate_input_jar('org/pantsbuild/tools/fake/Main.class',
'META-INF/versions/9/javax/xml/bind/ModuleInfo.class')
rules = self.shader.assemble_binary_rules('org.pantsbuild.tools.fake.Main', input_jar)
self.assertEqual(Shader.exclude_package('org.pantsbuild.tools.fake'), rules[0])
self.assertIn(Shader.exclude_package('javax', recursive=True), rules[1:])
self.assertNotIn(Shading.create_relocate('META-INF.versions.9.javax.xml.bind.*'), rules[1:])
示例4: test_rules_file
# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
def test_rules_file(self):
expected = [
'rule a.b.c.** [email protected]\n',
'rule a.*.b [email protected]\n',
'rule x.y.z.** [email protected]\n',
'zap com.foo.bar.Main\n',
'zap com.baz.*\n',
'keep org.foobar.vegetable.Potato\n',
'keep org.foobar.fruit.**\n',
]
rules = [
Shading.create_relocate('a.b.c.**', '[email protected]'),
Shading.create_relocate('a.*.b', shade_prefix='shaded.'),
Shading.create_relocate_package('x.y.z', shade_prefix='shaded.'),
Shading.create_zap('com.foo.bar.Main'),
Shading.create_zap_package('com.baz', recursive=False),
Shading.create_keep('org.foobar.vegetable.Potato'),
Shading.create_keep_package('org.foobar.fruit'),
]
with self.shader.temporary_rules_file(rules) as fname:
with open(fname, 'r') as f:
received = f.readlines()
self.assertEqual(received, expected)
示例5: test_rules_file
# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
def test_rules_file(self):
expected = [
"rule a.b.c.** [email protected]\n",
"rule a.*.b [email protected]\n",
"rule x.y.z.** [email protected]\n",
"zap com.foo.bar.Main\n",
"zap com.baz.*\n",
"keep org.foobar.vegetable.Potato\n",
"keep org.foobar.fruit.**\n",
]
rules = [
Shading.create_relocate("a.b.c.**", "[email protected]"),
Shading.create_relocate("a.*.b", shade_prefix="shaded."),
Shading.create_relocate_package("x.y.z", shade_prefix="shaded."),
Shading.create_zap("com.foo.bar.Main"),
Shading.create_zap_package("com.baz", recursive=False),
Shading.create_keep("org.foobar.vegetable.Potato"),
Shading.create_keep_package("org.foobar.fruit"),
]
with self.shader.temporary_rules_file(rules) as fname:
with open(fname, "r") as f:
received = f.readlines()
self.assertEqual(received, expected)