question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for multiple dirs in project_res and project_assets args in android_resource rule

See original GitHub issue

The newly added project_res and project_assets arguments on the android_resouce rule only support one directory but there are cases where you would want to specify multiple, such as in a top level application module that has multiple buildTypes or flavors.

cc @kageiit

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
k21commented, Jan 31, 2017

Did you try not specifying those attributes? In that case Buck should generate appropriate symlink trees based on the res and assets attributes which support an arbitrary number of source directories. The project_* attributes should only be useful if artifact building during project generation is disabled.

0reactions
kageiitcommented, Jan 31, 2017

For a project with gradle like strcuture, This snippet of change made all the symbols resolve work correctly again.

diff --git a/src/com/facebook/buck/jvm/java/intellij/IjProjectTemplateDataPreparer.java b/src/com/facebook/buck/jvm/java/intellij/IjProjectTemplateDataPreparer.java
index dfa588a4c..10682a8ab 100644
--- a/src/com/facebook/buck/jvm/java/intellij/IjProjectTemplateDataPreparer.java
+++ b/src/com/facebook/buck/jvm/java/intellij/IjProjectTemplateDataPreparer.java
@@ -240,7 +240,10 @@ public class IjProjectTemplateDataPreparer {
     ImmutableSortedSet<IjSourceFolder> sourceFolders = simplifiedFolders
         .stream()
         .map(transformToFolder::apply)
+        .filter(folder -> !(folder.getType().equals("excludeFolder")
+            && (folder.getUrl().endsWith("/res") || folder.getUrl().endsWith("/assets"))))
         .collect(MoreCollectors.toImmutableSortedSet(Ordering.natural()));
+
     return ContentRoot.builder()
         .setUrl(url)
         .setFolders(sourceFolders)
diff --git a/src/com/facebook/buck/jvm/java/intellij/ij-module.st b/src/com/facebook/buck/jvm/java/intellij/ij-module.st
index 48f442413..fcc138839 100644
--- a/src/com/facebook/buck/jvm/java/intellij/ij-module.st
+++ b/src/com/facebook/buck/jvm/java/intellij/ij-module.st
@@ -8,6 +8,7 @@
         <option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="%androidFacet.module_gen_path%" />
         <option name="MANIFEST_FILE_RELATIVE_PATH" value="%androidFacet.android_manifest%" />
         <option name="RES_FOLDERS_RELATIVE_PATH" value="%androidFacet.res%" />
+        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
         <option name="ASSETS_FOLDER_RELATIVE_PATH" value="%androidFacet.asset_folder%" />
         <option name="LIBS_FOLDER_RELATIVE_PATH" value="%androidFacet.libs_path%" />
         <option name="APK_PATH" value="%androidFacet.apk_path%" />

There still seem to be many general issues with buck project file generation for projects that have a gradle like structure. Missing paths or paths pointing to the filesystem where there are no generated files (like the MANIFEST_FILE_RELATIVE_PATH for a project which is not a library is always set to a file that does not exist yet) even when buck project is invoked with building.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App resources overview - Android Developers
Android supports several configuration qualifiers and you can add multiple qualifiers to one directory name, by separating each qualifier with a ...
Read more >
Makefile pattern rules on multiple subdirectories - c++
You can create multiple pattern rules, one for each source directory (it's easier to avoid static pattern rules in this situation):
Read more >
copy multiple directories into one folder from a variable or loop ...
I want to be able to edit this script in the future and easily add additional directories later. Some directories have spaces in...
Read more >
Dir Function - Microsoft Support
Returns a String representing the name of a file, directory, or folder that matches a specified pattern or file attribute, or the volume...
Read more >
Ignoring files, folders, or code - Semgrep
This documents various methods to skip or ignore files, folders, or code that are not relevant to a Semgrep scan.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found