Buck: Implicit manifest rule creation breaks buck project entirely

Created on 17 Nov 2017  ·  9Comments  ·  Source: facebook/buck

https://github.com/facebook/buck/commit/f79104819f0a5fc67f62d7c628aaacd354fe5516 breaks buck project even when the build command works fine

Generating project: finished in 12.6 sec
[2017-11-17 10:44:15.935][error][command:null][tid:145][com.facebook.buck.cli.Main] Uncaught exception at top level
java.lang.IllegalArgumentException: android_binary //app:bin_exo did not specify manifest or manifest_skeleton
    at com.facebook.buck.ide.intellij.DefaultIjModuleFactoryResolver.lambda$0(DefaultIjModuleFactoryResolver.java:85)
    at java.util.Optional.orElseThrow(Optional.java:290)
    at com.facebook.buck.ide.intellij.DefaultIjModuleFactoryResolver.getAndroidManifestPath(DefaultIjModuleFactoryResolver.java:83)
    at com.facebook.buck.ide.intellij.lang.android.AndroidBinaryModuleRule.apply(AndroidBinaryModuleRule.java:51)
    at com.facebook.buck.ide.intellij.DefaultIjModuleFactory.createModuleUsingSortedTargetNodes(DefaultIjModuleFactory.java:77)
    at com.facebook.buck.ide.intellij.DefaultIjModuleFactory.createModule(DefaultIjModuleFactory.java:54)
    at com.facebook.buck.ide.intellij.IjModuleGraphFactory.lambda$7(IjModuleGraphFactory.java:113)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at com.facebook.buck.ide.intellij.IjModuleGraphFactory.createModules(IjModuleGraphFactory.java:110)
    at com.facebook.buck.ide.intellij.IjModuleGraphFactory.from(IjModuleGraphFactory.java:227)
    at com.facebook.buck.ide.intellij.IjProject.write(IjProject.java:93)
    at com.facebook.buck.ide.intellij.IjProjectCommandHelper.writeProjectAndGetRequiredBuildTargets(IjProjectCommandHelper.java:269)
    at com.facebook.buck.ide.intellij.IjProjectCommandHelper.runIntellijProjectGenerator(IjProjectCommandHelper.java:233)
    at com.facebook.buck.ide.intellij.IjProjectCommandHelper.parseTargetsAndRunProjectGenerator(IjProjectCommandHelper.java:200)
    at com.facebook.buck.cli.ProjectCommand.runWithoutHelp(ProjectCommand.java:316)
    at com.facebook.buck.cli.AbstractCommand.run(AbstractCommand.java:232)
    at com.facebook.buck.cli.AbstractContainerCommand.run(AbstractContainerCommand.java:79)
    at com.facebook.buck.cli.BuckCommand.run(BuckCommand.java:82)
    at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:1101)
    at com.facebook.buck.cli.Main.runMainThenExit(Main.java:395)
    at com.facebook.buck.cli.Main.nailMain(Main.java:1855)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.martiansoftware.nailgun.NGSession.run(NGSession.java:329)

Most helpful comment

Yeah, I thought so too, which is why I felt confident landing the broken version.

The subexpression

arg.getManifestSkeleton()
    .orElseThrow(
        () ->
            new IllegalArgumentException(
                "android_binary "
                    + targetNode.getBuildTarget()
                    + " did not specify manifest or manifest_skeleton"));

is not a lambda. It's evaluated unconditionally, so we throw if manifest_skeleton is not specified.

All 9 comments

cc @dreiss

cc @styurin

Yep, we're getting exact same error.

I've tried to figure out the cause and current guess is that @BuckStyleImmutable doesn't support Optional and value continues to be null after BUCK file parsing which codegen version of AndroidBinaryDescriptionArg.java treats as absent Optional, but I might be wrong of course.

Trying to get this landed internally. Sorry for the breakage.

@dreiss hmmmmmm, I don't really see difference in behavior between problematic and fixed code in your diff…

Previous Optional method Chaining should have produced same result, no?

Yeah, I thought so too, which is why I felt confident landing the broken version.

The subexpression

arg.getManifestSkeleton()
    .orElseThrow(
        () ->
            new IllegalArgumentException(
                "android_binary "
                    + targetNode.getBuildTarget()
                    + " did not specify manifest or manifest_skeleton"));

is not a lambda. It's evaluated unconditionally, so we throw if manifest_skeleton is not specified.

Ahhh, yeah Java computes parameters before method call..

👍

On Fri, Nov 17, 2017, 12:25 PM David Reiss notifications@github.com wrote:

Yeah, I thought so too, which is why I felt confident landing the broken
version.

The subexpression

arg.getManifestSkeleton()
.orElseThrow(
() ->
new IllegalArgumentException(
"android_binary "
+ targetNode.getBuildTarget()
+ " did not specify manifest or manifest_skeleton"));

is not a lambda. It's evaluated unconditionally, so we throw if
manifest_skeleton is not specified.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/facebook/buck/issues/1633#issuecomment-345356403, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AA7B3FAva_VkZDAw5XzBLS46CCDKQQARks5s3eu5gaJpZM4Qidf7
.

Fix landed

Was this page helpful?
0 / 5 - 0 ratings