pinchbv / android-analyzer

Android Gradle plugin for faster Sonarqube integration in Android projects. Supports Detekt and Jacoco out of the box.
http://pinch.nl
GNU General Public License v3.0
91 stars 16 forks source link

inclusion/exclusion patterns #26

Open dinhthaidaica opened 4 years ago

dinhthaidaica commented 4 years ago

I'm trying to integrate this plug in to my existing project but seems I still miss some things.

I got this message when execute Gradle command :

File tests/instrumentationTest/assets/scenarios/longclickshift.feature can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

I even tried with customExclusions but seems doesn't help. Still get the same message. Here is my setup:

customExclusions = ['tests/instrumentationTest/**', 'tests/unitTest/**','libs/**', '*.feature', "tests/instrumentationTest/assets/scenarios/longclickshift.feature"]

Did I do something wrong or miss somethings else?

AndroideRob-zz commented 4 years ago

Could you please show your androidAnalyzer { .. } block? Didn't see this happen before. Perhaps you are importing Jacoco yourself, that's causing double indexing?

dinhthaidaica commented 4 years ago

you can see it by the image below

Screen Shot 2019-12-18 at 12 55 25

And please be notice that longclickshift.feature is my cucumber file.

AndroideRob-zz commented 4 years ago

I have a feeling you are trying to execute androidAnalyzer on a test config.

Could you try running the following command: ./gradlew {module}:androidAnalyzer, where {module} = your target module name (probably app)?

If that doesn't work, could you still share how you invoke the task? I'm looking into Cucumber atm.

josinaldobarbosa commented 4 years ago

@AndroideRob a have a similar problem:

Execution failed for task ':app:sonarqube'.
> File src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

adding customExclusions = ['src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker'] was solved, but I didn't understand why it was necessary

dinhthaidaica commented 4 years ago

@AndroideRob I tried with both solutions(adding customExclusions = ['src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker'] or run ./gradlew {module}:androidAnalyzer ) but got no luck.

Even though, when I added a list of json files for mocking data in testing then got an other same error:

tests/unitTest/resources/punchclockapproval/punchClockApprovalNonDefaultShiftType.json can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

My updated config: customExclusions = ['tests/instrumentationTest/**', 'tests/unitTest/**', 'tests/unitTest/resources/**', 'src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker', 'libs/**', '*.feature', '*.json', "tests/instrumentationTest/assets/scenarios/longclickshift.feature"]