Questions tagged [source-sets]

A concept used by the Gradle build system, to divide the source code into parts for which the build process can be configured separately.

66 questions
1
vote
1 answer

sourceSets with awsconfiguration.json

I am using AWS Amplify and have two environments that I am switching between, therefore I have two awsconfiguration.json files, but need a way to switch between the two at runtime. I've heard you can use sourceSets, but can't figure out how. I tried…
1
vote
2 answers

Android: Programmatically change SourceSet based on user settings

I am creating an app that has admin and user modes, and each mode has its own layouts, strings, and drawable resource files. I want to know how to change the resources SourceSet based on the app mode which can be toggled by the user at…
Davi
  • 663
  • 6
  • 19
1
vote
1 answer

Ideal Gradle configuration what does create separate module per source set do?Will he change his dependency?

Ideal Gradle configuration what does create separate module per source set do?Will he change his dependency?I don't see any change when I don't check, except that there are two modules in the IDE.What does this mean?I'm a beginner.
FanMingYi
  • 11
  • 2
1
vote
1 answer

How to separate source files per test type in an Android library project?

I was following the gradle docs to separate source files per test type in a Java project and I wanted to do the same thing in an Android library project. By default Android plugin com.android.library supports two types of test directories test and…
Prudhvi
  • 2,108
  • 7
  • 31
  • 51
1
vote
2 answers

Intellij can not resolve Symbol in Gradle Project with multiple SourceSets

I am working on a Gradle Project that uses multiple Sourcesets to build different WARs. Everything works fine from command line. Gradle builds the WARs correctly. But in IntelliJ it says for every *.java file under src/k that it can not resolve the…
Tobias Nolte
  • 93
  • 1
  • 11
1
vote
1 answer

How to exclude generated sourceSet from jacoco plugin in Gradle

I have searched a lot and all the questions and answers were about excluding a specific package structure. I have a project with src/main/java and src/test/java and src/generated/java directories. Contents of main and generated are compiled into…
Amir Pashazadeh
  • 6,654
  • 2
  • 32
  • 59
1
vote
2 answers

language values usage in sourceSets

I make folder structure for my default values sourceSets in build.gradle sourceSets { main { res.srcDirs = [ 'src/main/res/layouts/activities', …
Arda
  • 1,272
  • 11
  • 16
1
vote
1 answer

gradle remove main source set

src main/java test/java The test does not depend on main for compiling. Tying to compile and run test on another library replacing main. sourceSets { remove main } gradle test It will always compile the main source set.
Sunnyday
  • 2,252
  • 1
  • 17
  • 46
1
vote
1 answer

Gradle sourceSets based on gradle.settings

I would like to have some features of my Java library conditionaly built based on custom settings defined in project's settings.gradle. Example: build.gradle apply plugin: 'java' sourceCompatibility = 1.7 repositories { …
Thibaut D.
  • 2,101
  • 3
  • 19
  • 29
1
vote
0 answers

Add a gradle sourceset with folders for java, groovy, and resources

I have a multi-module project where one of them adds a sourceSet in order to support 3 source folders apply plugin: 'groovy' apply plugin: 'java' configurations { componentTestCompile.extendsFrom compile, testCompile …
Martin Ahrer
  • 895
  • 2
  • 13
  • 26
1
vote
1 answer

Gradle with non-standard named source sets - how do I make them available to the test classes?

I have a (legacy) Java project which I'm re-configuring to build with Gradle. The build should, eventually, output a number of jar archives, so I've divided to split up the source into source sets that correspond to the subdivision of the output…
Tomas Aschan
  • 53,075
  • 51
  • 214
  • 362
0
votes
1 answer

What files Gradle packs into a jar archive?

What expression (in build.gradle file) evaluates to list of files that are packed into a jar archive by default (without adjusting "jar" task? I can't easily spot it in sources of org.gradle.jvm.tasks.Jar and org.gradle.api.tasks.bundling.Jar. This…
czerny
  • 11,433
  • 12
  • 57
  • 80
0
votes
0 answers

Gradle ignores module's custom sourceSets by default?

I have a project, that has multiple modules added through settings.gradle like: rootProject.name = 'myproject' include ':someModule' project(':someModule').projectDir = new File('./someModule') someModule has multiple sourceSets: sourceSets { …
kristyna
  • 1,240
  • 23
  • 40
0
votes
1 answer

How can one share the code between tests and benches in Rust?

I started writing benchmarks in Rust with "bench" and Rust nightly as written in the docs. In order to share the code between test and benchmarks i've added Option<&mut Bencher> and either run the code block directly or with bencher passed…
4ntoine
  • 17,607
  • 16
  • 70
  • 175
0
votes
0 answers

Debugging project with multiple build variants steps into the wrong source set

I have a project with multiple flavors, two of which are 'play' and 'amazon'. I set active build variant to 'playDebug', and AS builds and run the code correctly from the 'play' source set. However, if I set a debugging break point in code in the…
Steve M
  • 8,136
  • 8
  • 40
  • 84