Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Unexpected internal error associated with src including subdirectory with .aidl file #29

Closed
jeromeernestgarcia opened this issue May 24, 2013 · 1 comment

Comments

@jeromeernestgarcia
Copy link

While trying to build a project in which the src includes a subdirectory containing a .aidl file, I got the following exception which says that it is probably a buck bug. Changing the srcs definition to limit the subdirectory files to ipc/*.java gets rid of this problem but, of course, causes compilation errors. My BUCK file contents and directory tree from which I ran the "buck build" command follow the stack trace.


FP143:trunk jeromegarcia$ buck build //java/com/fullpower/app:app
No Android platform target specified. Using default: Google Inc.:Google APIs:16
BUILDING //java/com/fullpower/app:app
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: All compilation units must be of SOURCE kind
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:306)
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:293)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
at com.facebook.buck.cli.BuildCommand.executeBuildAndPrintAnyFailuresToConsole(BuildCommand.java:181)
at com.facebook.buck.cli.BuildCommand.runCommandWithOptionsWithTracerRunning(BuildCommand.java:161)
at com.facebook.buck.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:98)
at com.facebook.buck.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:55)
at com.facebook.buck.cli.AbstractCommandRunner.runCommand(AbstractCommandRunner.java:92)
at com.facebook.buck.cli.Command.execute(Command.java:72)
at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:93)
at com.facebook.buck.cli.Main.tryRunMainWithExitCode(Main.java:124)
at com.facebook.buck.cli.Main.main(Main.java:134)
Caused by: java.lang.IllegalArgumentException: All compilation units must be of SOURCE kind
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:183)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68)
at com.facebook.buck.java.JavacInMemoryStep.buildWithClasspath(JavacInMemoryStep.java:139)
at com.facebook.buck.java.DependencyCheckingJavacStep.executeBuild(DependencyCheckingJavacStep.java:143)
at com.facebook.buck.java.JavacInMemoryStep.execute(JavacInMemoryStep.java:119)
at com.facebook.buck.step.DefaultStepRunner.runStepInternal(DefaultStepRunner.java:79)
at com.facebook.buck.step.DefaultStepRunner.runStepForBuildTarget(DefaultStepRunner.java:68)
at com.facebook.buck.rules.AbstractCachingBuildRule$3.call(AbstractCachingBuildRule.java:434)
at com.facebook.buck.rules.AbstractCachingBuildRule$3.call(AbstractCachingBuildRule.java:421)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
BUILD FAILED: Unexpected internal error (this is probably a buck bug).


The BUCK file contains:

FP143:app jeromegarcia$ cat BUCK
android_library(
name = 'app',
srcs = glob(['.java', 'ipc/.*']),
visibility = [ 'PUBLIC' ],
deps = [
'//res/com/fullpower/app:res',
],
)

project_config(
src_target = ':app',
)


The directory structure is:

FP143:trunk jeromegarcia$ pwd
/Users/jeromegarcia/experiments/buckExperiments/thewholething/trunk
FP143:trunk jeromegarcia$ tree
.
├── buck-bin
│   ├── build.log
│   ├── java
│   │   └── com
│   │   └── fullpower
│   │   ├── app
│   │   │   ├── app_rdotjava_bin
│   │   │   │   └── com
│   │   │   │   └── fullpower
│   │   │   │   └── app
│   │   │   │   ├── R$id.class
│   │   │   │   ├── R$layout.class
│   │   │   │   ├── R$string.class
│   │   │   │   └── R.class
│   │   │   ├── app_rdotjava_src
│   │   │   │   └── com.fullpower.app
│   │   │   │   └── R.java
│   │   │   └── lib__app__classes
│   │   └── support
│   │   └── lib__support__classes
│   │   └── com
│   │   └── fullpower
│   │   └── support
│   │   ├── ConsumerThread$1.class
│   │   ├── ConsumerThread$FlushNotification.class
│   │   ├── ConsumerThread.class
│   │   └── Queue.class
│   └── res
│   └── com
│   └── fullpower
│   └── app
│   └── res_text_symbols
│   ├── R.txt
│   └── com
│   └── fullpower
│   └── app
│   └── R.java
├── buck-gen
│   └── java
│   └── com
│   └── fullpower
│   └── support
│   └── lib__support__output
│   └── support.jar
├── java
│   └── com
│   └── fullpower
│   ├── app
│   │   ├── BUCK
│   │   ├── FPLogger.java
│   │   ├── Logger.java
│   │   └── ipc
│   │   ├── ILogger.aidl
│   │   ├── LoggerImpl.java
│   │   └── LoggerShim.java
│   └── support
│   ├── BUCK
│   ├── ConsumerThread.java
│   └── Queue.java
├── local.properties
└── res
└── com
└── fullpower
└── app
├── BUCK
└── res
├── layout
│   └── notes_dialog.xml
└── values
└── strings.xml

44 directories, 26 files

@bolinfest
Copy link
Contributor

This is the expected behavior: javac cannot process .aidl files on its own. For .aidl files, you should be using gen_aidl():

http://facebook.github.io/buck/rule/gen_aidl.html

As the documentation mentions, we plan to fix things so that android_library() handles .aidl files. I apologize, as the docs should have an example of how to use it. For now, I'll include one here:

# This creates IAnalyticsService.java as a genfile.
gen_aidl(
  name = 'IAnalyticsService',
  aidl = 'src/com/facebook/analytics/IAnalyticsService.aidl',
  import_path = 'src/com/facebook/analytics/',
)

android_library(
  name = 'analytics',
  srcs = glob(['src/**/*.java']) + \
      # Also include the generated .java files as sources.
      [genfile(f) for f in [
          'src/com/facebook/analytics/IAnalyticsService.java']],
  deps = [
    ':IAnalyticsService',
  ],
  visibility = [
    'PUBLIC',
  ],
)

cwoodwar6 pushed a commit to cwoodwar6/buck that referenced this issue Jul 23, 2018
…pstream to master

* commit 'e5941b394187f6db3e8fc1ccf2bb5e4e9e390fe0': (346 commits)
  cxx: make ranlib a `ToolProvider` (take 2)
  cxx: use `ArchiverProvider` for archiver (take 2)
  BuckConfig: resolve relative paths when parsing `ToolProvider`s
  Added fine grained stats to measure post distributed build steps
  Adding app modularity consistency checks
  Remove unused imports
  haskell: fix deps for `haskell_ghci` rule
  Removed duplicate BUCK_CONFIG_OVERRIDE_FILE_NAME
  Weakly cache the manifest RuleKeyAndInputs
  Distributed build slaves now use environment from CommandRunnerParams
  Run macOS integration tests on all platforms
  Show a warning when the wifi is blacklisted
  Make integration test work for all c compilers
  Move out macro definition to a separate file
  Revert "Support empty header_path_prefix"
  Allow the base executor to be retrieved from CommandThreadManager
  Capture stderr for failed targets in build report
  Add addEnclosedElement to ArtificialElement interface
  Revert "cxx: use `ArchiverProvider` for archiver"
  Revert "cxx: make ranlib a `ToolProvider`"
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants