uber / okbuck

OkBuck is a gradle plugin that lets developers utilize the Buck build system on a gradle project.
Other
1.54k stars 168 forks source link

Building problem in version 0.38.2 #663

Closed leandroBorgesFerreira closed 6 years ago

leandroBorgesFerreira commented 6 years ago

Hello folks,

I am having a problem in version 0.38.2:

BUILD FAILED: Buck wasn't able to parse /Users/leandrohome/Nubank/mini-meta-repo/android/android-foundation/foundation/BUCK:
ValueError: Duplicate rule definition 'res_debug_test' found.  Found {'buck.type': 'android_resource', 'within_view': None, 'labels': None, 'visibility': ['PUBLIC'], 'projectAssets': None, 'licenses': None, 'resourceUnion': True, 'assets': {'animation/test_animation.json': 'src/androidTest/assets/animation/test_animation.json', 'keys/meta': 'src/androidTest/assets/keys/meta', 'keys/1': 'src/androidTest/assets/keys/1'}, 'name': 'res_debug_test', 'package': 'com.nubank.android.foundation.test', 'res': {'values/strings.xml': 'src/androidTest/res/values/strings.xml', 'layout/activity_horizontal_buttons_view_with_default_text_test.xml': 'src/androidTest/res/layout/activity_horizontal_buttons_view_with_default_text_test.xml', 'layout/activity_cpf_edit_text_test.xml': 'src/androidTest/res/layout/activity_cpf_edit_text_test.xml', 'layout/activity_horizontal_buttons_view_test.xml': 'src/androidTest/res/layout/activity_horizontal_buttons_view_test.xml', 'layout/cui_layout_password_view_test.xml': 'src/androidTest/res/layout/cui_layout_password_view_test.xml', 'layout/activity_default_edit_text_test.xml': 'src/androidTest/res/layout/activity_default_edit_text_test.xml', 'layout/activity_email_edit_text_test.xml': 'src/androidTest/res/layout/activity_email_edit_text_test.xml'}, 'hasWhitelistedStrings': None, 'manifest': None, 'deps': ['//.okbuck/cache:com.airbnb.android--lottie--2.0.0-rc1.aar', '//.okbuck/cache:com.android.support--animated-vector-drawable--25.4.0.aar', '//.okbuck/cache:com.android.support--appcompat-v7--25.4.0.aar', '//.okbuck/cache:com.android.support--cardview-v7--25.4.0.aar', '//.okbuck/cache:com.android.support--design--25.4.0.aar', '//.okbuck/cache:com.android.support--multidex--1.0.2.aar', '//.okbuck/cache:com.android.support--multidex-instrumentation--1.0.2.aar', '//.okbuck/cache:com.android.support--recyclerview-v7--25.4.0.aar', '//.okbuck/cache:com.android.support--support-compat--25.4.0.aar', '//.okbuck/cache:com.android.support--support-core-ui--25.4.0.aar', '//.okbuck/cache:com.android.support--support-core-utils--25.4.0.aar', '//.okbuck/cache:com.android.support--support-fragment--25.4.0.aar', '//.okbuck/cache:com.android.support--support-media-compat--25.4.0.aar', '//.okbuck/cache:com.android.support--support-v4--25.4.0.aar', '//.okbuck/cache:com.android.support--support-vector-drawable--25.4.0.aar', '//.okbuck/cache:com.android.support--transition--25.4.0.aar', '//.okbuck/cache:com.android.support.constraint--constraint-layout--1.0.2.aar', '//.okbuck/cache:com.android.support.test--rules--1.0.1.aar', '//.okbuck/cache:com.android.support.test--runner--1.0.1.aar', '//.okbuck/cache:com.android.support.test.espresso--espresso-contrib--3.0.1.aar', '//.okbuck/cache:com.android.support.test.espresso--espresso-core--3.0.1.aar', '//.okbuck/cache:com.android.support.test.espresso--espresso-idling-resource--3.0.1.aar', '//.okbuck/cache:com.android.support.test.espresso--espresso-intents--3.0.1.aar', '//.okbuck/cache:com.crashlytics.sdk.android--answers--1.4.1.aar', '//.okbuck/cache:com.crashlytics.sdk.android--beta--1.2.7.aar', '//.okbuck/cache:com.crashlytics.sdk.android--crashlytics--2.8.0.aar', '//.okbuck/cache:com.crashlytics.sdk.android--crashlytics-core--2.5.0.aar', '//.okbuck/cache:com.facebook.android--facebook-core--4.32.0.aar', '//.okbuck/cache:com.google.dagger--dagger-android--2.15.aar', '//.okbuck/cache:com.google.dagger--dagger-android-support--2.15.aar', '//.okbuck/cache:com.jakewharton.rxbinding2--rxbinding--2.0.0.aar', '//.okbuck/cache:com.jakewharton.rxbinding2--rxbinding-support-v4--2.0.0.aar', '//.okbuck/cache:com.jakewharton.timber--timber--4.5.1.aar', '//.okbuck/cache:com.tbruyelle.rxpermissions2--rxpermissions--0.9.4.aar', '//.okbuck/cache:io.fabric.sdk.android--fabric--1.4.1.aar', '//.okbuck/cache:io.reactivex.rxjava2--rxandroid--2.0.1.aar', '//.okbuck/cache:uk.co.chrisjenx--calligraphy--2.3.0.aar', '//android/android-foundation/ui-test-helpers:res_debug'], 'projectRes': None} and {'buck.type': 'android_resource', 'within_view': None, 'labels': None, 'visibility': ['PUBLIC'], 'projectAssets': None, 'licenses': None, 'resourceUnion': True, 'assets': {'animation/test_animation.json': 'src/androidTest/assets/animation/test_animation.json', 'keys/meta': 'src/androidTest/assets/keys/meta', 'keys/1': 'src/androidTest/assets/keys/1'}, 'buck.base_path': 'android/android-foundation/foundation', 'name': 'res_debug_test', 'package': 'com.nubank.android.foundation.test', 'res': {'values/strings.xml': 'src/androidTest/res/values/strings.xml', 'layout/activity_horizontal_buttons_view_with_default_text_test.xml': 'src/androidTest/res/layout/activity_horizontal_buttons_view_with_default_text_test.xml', 'layout/activity_cpf_edit_text_test.xml': 'src/androidTest/res/layout/activity_cpf_edit_text_test.xml', 'layout/activity_horizontal_buttons_view_test.xml': 'src/androidTest/res/layout/activity_horizontal_buttons_view_test.xml', 'layout/cui_layout_password_view_test.xml': 'src/androidTest/res/layout/cui_layout_password_view_test.xml', 'layout/activity_default_edit_text_test.xml': 'src/androidTest/res/layout/activity_default_edit_text_test.xml', 'layout/activity_email_edit_text_test.xml': 'src/androidTest/res/layout/activity_email_edit_text_test.xml'}, 'hasWhitelistedStrings': None, 'manifest': None, 'deps': ['//.okbuck/cache:com.airbnb.android--lottie--2.0.0-rc1.aar', '//.okbuck/cache:com.android.support--animated-vector-drawable--25.4.0.aar', '//.okbuck/cache:com.android.support--appcompat-v7--25.4.0.aar', '//.okbuck/cache:com.android.support--cardview-v7--25.4.0.aar', '//.okbuck/cache:com.android.support--design--25.4.0.aar', '//.okbuck/cache:com.android.support--multidex--1.0.2.aar', '//.okbuck/cache:com.android.support--multidex-instrumentation--1.0.2.aar', '//.okbuck/cache:com.android.support--recyclerview-v7--25.4.0.aar', '//.okbuck/cache:com.android.support--support-compat--25.4.0.aar', '//.okbuck/cache:com.android.support--support-core-ui--25.4.0.aar', '//.okbuck/cache:com.android.support--support-core-utils--25.4.0.aar', '//.okbuck/cache:com.android.support--support-fragment--25.4.0.aar', '//.okbuck/cache:com.android.support--support-media-compat--25.4.0.aar', '//.okbuck/cache:com.android.support--support-v4--25.4.0.aar', '//.okbuck/cache:com.android.support--support-vector-drawable--25.4.0.aar', '//.okbuck/cache:com.android.support--transition--25.4.0.aar', '//.okbuck/cache:com.android.support.constraint--constraint-layout--1.0.2.aar', '//.okbuck/cache:com.android.support.test--rules--1.0.1.aar', '//.okbuck/cache:com.android.support.test--runner--1.0.1.aar', '//.okbuck/cache:com.android.support.test.espresso--espresso-contrib--3.0.1.aar', '//.okbuck/cache:com.android.support.test.espresso--espresso-core--3.0.1.aar', '//.okbuck/cache:com.android.support.test.espresso--espresso-idling-resource--3.0.1.aar', '//.okbuck/cache:com.android.support.test.espresso--espresso-intents--3.0.1.aar', '//.okbuck/cache:com.crashlytics.sdk.android--answers--1.4.1.aar', '//.okbuck/cache:com.crashlytics.sdk.android--beta--1.2.7.aar', '//.okbuck/cache:com.crashlytics.sdk.android--crashlytics--2.8.0.aar', '//.okbuck/cache:com.crashlytics.sdk.android--crashlytics-core--2.5.0.aar', '//.okbuck/cache:com.facebook.android--facebook-core--4.32.0.aar', '//.okbuck/cache:com.google.dagger--dagger-android--2.15.aar', '//.okbuck/cache:com.google.dagger--dagger-android-support--2.15.aar', '//.okbuck/cache:com.jakewharton.rxbinding2--rxbinding--2.0.0.aar', '//.okbuck/cache:com.jakewharton.rxbinding2--rxbinding-support-v4--2.0.0.aar', '//.okbuck/cache:com.jakewharton.timber--timber--4.5.1.aar', '//.okbuck/cache:com.tbruyelle.rxpermissions2--rxpermissions--0.9.4.aar', '//.okbuck/cache:io.fabric.sdk.android--fabric--1.4.1.aar', '//.okbuck/cache:io.reactivex.rxjava2--rxandroid--2.0.1.aar', '//.okbuck/cache:uk.co.chrisjenx--calligraphy--2.3.0.aar', '//android/android-foundation/ui-test-helpers:res_debug', ':res_debug'], 'projectRes': None}
Call stack:
  File "/Users/leandrohome/Nubank/mini-meta-repo/.buckd/resources/910226716ecd215a38f27bd3dcfd7da3793e6cff/buck_server/buck_parser/buck.py", line 1450, in process_with_diagnostics
    diagnostics=diagnostics)
  File "/Users/leandrohome/Nubank/mini-meta-repo/.buckd/resources/910226716ecd215a38f27bd3dcfd7da3793e6cff/buck_server/buck_parser/buck.py", line 1341, in process
    os.path.join(self._project_root, path))
  File "/Users/leandrohome/Nubank/mini-meta-repo/.buckd/resources/910226716ecd215a38f27bd3dcfd7da3793e6cff/buck_server/buck_parser/buck.py", line 1335, in _process_build_file
    return self._process(build_env, path, is_implicit_include=False)
  File "/Users/leandrohome/Nubank/mini-meta-repo/.buckd/resources/910226716ecd215a38f27bd3dcfd7da3793e6cff/buck_server/buck_parser/buck.py", line 1286, in _process
    exec(code, module.__dict__)
  File "/Users/leandrohome/Nubank/mini-meta-repo/android/android-foundation/foundation/BUCK", line 694
    'PUBLIC',
  File "/Users/leandrohome/Nubank/mini-meta-repo/.buckd/resources/910226716ecd215a38f27bd3dcfd7da3793e6cff/buck_server/buck_parser/buck.py", line 220, in invoke
    return self.func(*args, **updated_kwargs)
  File "/Users/leandrohome/Nubank/mini-meta-repo/.buckd/resources/910226716ecd215a38f27bd3dcfd7da3793e6cff/buck_server/buck_parser/buck.py", line 398, in add_rule
    (rule_name, rule, build_env.rules[rule_name]))

macOS High Sierra v 1.13.3

The problem is not present in version 0.38.0 and bellow

kageiit commented 6 years ago

Sry closed wrong issue by mistake :)

raviagarwal7 commented 6 years ago

@leandroBorgesFerreira could you share a code sample where this happens? I am not able to reproduce it in okBuck. would help in figure out the issue.

kageiit commented 6 years ago

0.39.0 is available. Please check if the problem still persists

leandroBorgesFerreira commented 6 years ago

Sorry for the delay. Yes, it is still there. It is hard to share a sample that reproduces this error, because I don't know how to reproduce it. Would our build.gradle help?

leandroBorgesFerreira commented 6 years ago

I found the issue. When the library was translated from Groovy to Java this bug was inserted. Now, to work with LinkedHashSet, Rule must implement hashCode(). I could see that some rules are generated again, but with small changes in the deps that may be a bug.

I am going to investigate it a little bit more in the next days.

thalescm commented 6 years ago

The error happened only when enabling espressoForLibraries. That's why it was hard to reproduce (and happened only to us). The PR above should fix it on the root cause of the error.