forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix built-in macros for the mutable ParseContext (pantsbuild#4583)
### Problem The `v2` engine mutates the `ParseContext` in order to avoid re-creating all macros and context object factories for every build file path. But some built in macros without adequate integration test coverage (or which are instantiated via different codepaths in `v2`, as is the case with file globs and bundles) escaped being updated. ### Solution Update the remaining macros that attempted to inspect the `parse_context.rel_path` during construction rather than during usage. Add tests/examples to cover two of the broken macros.
- Loading branch information
Stu Hood
authored
May 13, 2017
1 parent
df19f57
commit 7b8500e
Showing
10 changed files
with
55 additions
and
11 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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
jar_library( | ||
jars = [ | ||
# An example of a relative jar URL referring to the current directory. | ||
jar( | ||
org='org.pantsbuild.testprojects', | ||
name='relative-jar-url-example', | ||
rev='0.0.1', | ||
url='file:relative-jar-url-example.jar', | ||
), | ||
] | ||
) |
Binary file added
BIN
+186 Bytes
testprojects/3rdparty/org/pantsbuild/testprojects/relative-jar-url-example.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
testprojects/src/resources/org/pantsbuild/testproject/buildfile_path/BUILD
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,6 @@ | ||
target( | ||
dependencies=[ | ||
'testprojects/src/resources/org/pantsbuild/testproject/ordering' | ||
], | ||
description='''This target exists at path {}.'''.format(buildfile_path()), | ||
) |
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
18 changes: 18 additions & 0 deletions
18
tests/python/pants_test/backend/jvm/targets/test_jar_dependency_integration.py
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,18 @@ | ||
# coding=utf-8 | ||
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
import os | ||
import unittest | ||
|
||
from pants_test.pants_run_integration_test import PantsRunIntegrationTest | ||
|
||
|
||
class JarDependencyIntegrationTest(PantsRunIntegrationTest): | ||
|
||
def test_resolve_relative(self): | ||
pants_run = self.run_pants(['resolve', 'testprojects/3rdparty/org/pantsbuild/testprojects']) | ||
self.assert_success(pants_run) |
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