-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI build is failing.
Could you provide more context about why you need that and update the documentation?
This is similar to @classpath macro but gives the corresponding class-abi jar for the classpath entries. This is useful for genrules which only depends on the dependencies abi’s. For eg: android lint where it need not run the lint checks again if the dependent’s abi doesn’t change. Usage: `$(@classpath_abi :<target_path>)`
60eea03
to
9ae8a09
Compare
@raviagarwal7 has updated the pull request. |
Added more context in the description and also added to the macros soy. |
@@ -43,18 +43,18 @@ | |||
Flavor SOURCE_ONLY_ABI_FLAVOR = InternalFlavor.of("source-only-abi"); | |||
Flavor VERIFIED_SOURCE_ABI_FLAVOR = InternalFlavor.of("verified-source-abi"); | |||
|
|||
static BuildTarget getClassAbiJar(BuildTarget libraryTarget) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any changes in this file? Why do you need to move this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just moved the method to be in accordance with others, but will revert back
@@ -85,7 +85,7 @@ protected Arg expand(SourcePathResolver resolver, ClasspathMacro ignored, BuildR | |||
// The # characters that might be present in classpaths due to flavoring would be read as | |||
// comments. As a simple workaround, we quote the entire classpath. | |||
private static class ClassPathWriteToFileArg extends WriteToFileArg { | |||
public ClassPathWriteToFileArg(BuildTarget target, String prefix, Arg delegate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file look unrelated, could you revert them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intellij was showing suggestions that this is not needed, will revert back.
|
||
ImmutableList<SourcePath> jarPaths = | ||
getHasClasspathEntries(inputRule) | ||
.getTransitiveClasspathDeps() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getTransitiveClasspathDeps
returns both #aar_prebuilt_jar,class-abi
and #class-abi
flavours. I verified that both the output jars are same, just on different paths.
//cache:com.support-compat-27.0.2.aar#aar_prebuilt_jar,class-abi
buck-out/gen/cache/com.support-27.0.2.aar#aar_prebuilt_jar,class-abi/com.support-27.0.2.aar-abi.jar
//cache:com.support-compat-27.0.2.aar#class-abi
buck-out/gen/cache/com.support-27.0.2.aar#class-abi/com.support-27.0.2.aar-abi.jar
How can I filter and keep only the #class-abi
deps? Also is there a scenario where the output of the two flavours will differ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @jkeljo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a filter to only include rules which have non-null sourcePathToOutput
, same behaviour is in ClasspathMacro
.
@raviagarwal7 has updated the pull request. View: changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@styurin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
For android lint genrule, dependencies class-abi is enough. classpath_abi was added in facebook/buck#1780
* @param ruleResolver BuildRuleResolver | ||
* @return class abi jar or output jar if not found | ||
*/ | ||
private SourcePath getJarPath(BuildRule rule, BuildRuleResolver ruleResolver) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be annotated with @Nullable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
String.format( | ||
"%s" + File.separator + "%s", | ||
filesystem.getRootPath(), | ||
"buck-out/gen/cheese/cake#class-abi/cake-abi.jar")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are failing on Windows. Our CI doesn't run these tests for some reason (we're investigating), but it looks like it's failing because of the path separators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using new File.("file-path-string")toPath()
now, hopefully this would work fine on windows.
Running android lint on a target only needs dependent libraries class-abi, i.e doesn’t need to rerun lint if there are no api changes in the dependent libraries. Using classpath_abi returns class-abi jars of the dependencies instead of the class jar. (Buck pr - facebook/buck#1780) Usage: $(@classpath_abi :<target_path>)
@raviagarwal7 has updated the pull request. View: changes, changes since last import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@styurin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
private ProjectFilesystem filesystem; | ||
|
||
@Before | ||
public void createMacroExpander() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is usually called setUp
. It also does more than creating macro expander.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
@Test | ||
public void shouldIncludeARuleIfNothingIsGiven() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test methods usually start with test
so that the method name is a verb, right now it's a statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@raviagarwal7 has updated the pull request. View: changes, changes since last import |
cc @styurin the comments are addressed. Any update on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@styurin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Running android lint on a target only needs dependent libraries class-abi, i.e doesn’t need to rerun lint if there are no api changes in the dependent libraries. Using classpath_abi returns class-abi jars of the dependencies instead of the class jar. (Buck pr - facebook/buck#1780) Usage: $(@classpath_abi :<target_path>)
Running android lint on a target only needs dependent libraries class-abi, i.e doesn’t need to rerun lint if there are no api changes in the dependent libraries. Using classpath_abi returns class-abi jars of the dependencies instead of the class jar. (Buck pr - facebook/buck#1780) Usage: $(@classpath_abi :<target_path>) To enable using classpath_abi, add the experimental extension ``` okbuck { experimental { lintWithClasspathAbi = true } } ```
* Use classpath_abi macro instead of classpath in the lint genrule. Running android lint on a target only needs dependent libraries class-abi, i.e doesn’t need to rerun lint if there are no api changes in the dependent libraries. Using classpath_abi returns class-abi jars of the dependencies instead of the class jar. (Buck pr - facebook/buck#1780) Usage: $(@classpath_abi :<target_path>) To enable using classpath_abi, add the experimental extension ``` okbuck { experimental { lintWithClasspathAbi = true } } ```
This is similar to @classpath macro but gives the corresponding
class-abi jar for the classpath entries.
This is useful for genrules which only depends on the dependencies abi’s.
For eg: android lint where it need not run the lint checks again if
the dependent’s abi doesn’t change.
Usage:
$(@classpath_abi :<target_path>)