Is it possible to change gradle's runtime dependencies according to the what the operation system it is on?
I'm using the SWT in my application which has jars that are platform dependent. I want to only distribute the right SWT jar for each platform it is running. Something like:
dependencies {
runtime fileTree(dir: 'swt', include: 'swt_win_32.jar') if windows.
runtime fileTree(dir: 'swt', include: 'swt_linux_x86.jar') if linux.
}
Hope this question make sense. Thanks.
String jarName;
switch(System.getProperty('os.name').toLowerCase().split()[0]) {
case 'windows':
jarName = 'swt_win_32.jar'
break
case 'linux':
jarName = 'swt_linux_x86.jar'
break
default:
throw new Exception('Unknown OS')
}
dependencies {
runtime fileTree(dir: 'swt', include: jarName)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With