Hello
In a submodule, I am running a gradle script that defines PrebuiltLibraries only for the Windows platfom, and on a Linux box, got the error below: What’s wrong with that script displayed by the end?
fandre@ubuntu-trusty-64:~/poco/poco-1.9.1/Data/MySQL$ ../../gradle/bin/gradle poco --scan
FAILURE: Build failed with an exception.
* Where:
Build file '/home/fandre/poco/poco-1.9.1/Data/MySQL/build.gradle' line: 38
* What went wrong:
Could not determine the dependencies of task ':Data:MySQL:linkDataMySQLLinux64DebugSharedLibrary'.
> Cannot convert URL 'C:/mysql-5.6.37-win32/lib/libmysqld.dll' to a file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? [yes, no]
yes
Gradle Terms of Service accepted.
Publishing build scan...
https://gradle.com/s/vpgamortbp3we
fandre@ubuntu-trusty-64:~/poco/poco-1.9.1$ gradle/bin/gradle -version
------------------------------------------------------------
Gradle 4.6-20180305160001+0000
------------------------------------------------------------
Build time: 2018-03-05 16:00:01 UTC
Revision: 00f88a6a45da46f9f58f93e26d1998acd6c7e223
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_161 (Oracle Corporation 25.161-b12)
OS: Linux 4.4.0-101-generic amd64
Here the script
model {
repositories {
libs(PrebuiltLibraries) {
mysql {
binaries.withType(StaticLibraryBinary) {
def libName = "foobar"
if (buildType == buildTypes.debug) {
libName = 'libmysqld.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir "$mysql32Home/include"
staticLibraryFile = file("$mysql32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir "$mysql64Home/include"
staticLibraryFile = file("$mysql64Home/lib/$libName")
}
} else
if (buildType == buildTypes.release) {
libName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir "$mysql32Home/include"
staticLibraryFile = file("$mysql32Home/lib/$libName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir "$mysql64Home/include"
staticLibraryFile = file("$mysql64Home/lib/$libName")
}
}
}
binaries.withType(SharedLibraryBinary) {
def dllName
def linkName
if (buildType == buildTypes.debug) {
dllName = 'libmysqld.dll'
linkName = 'libmysqld.lib'
if (targetPlatform.name == 'win32') {
linkName = 'libmysqld.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir "$mysql32Home/include"
sharedLibraryFile = file("$mysql32Home/lib/$dllName")
sharedLibraryLinkFile = file("$mysql32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir "$mysql64Home/include"
sharedLibraryFile = file("$mysql64Home/lib/$dllName")
sharedLibraryLinkFile = file("$mysql64Home/lib/$linkName")
}
} else
if (buildType == buildTypes.release) {
dllName = 'libmysql.dll'
linkName = 'libmysql.lib'
if (targetPlatform.name == 'win32') {
headers.srcDir "$mysql32Home/include"
sharedLibraryFile = file("$mysql32Home/lib/$dllName")
sharedLibraryLinkFile = file("$mysql32Home/lib/$linkName")
} else
if (targetPlatform.name == 'win64') {
headers.srcDir "$mysql64Home/include"
sharedLibraryFile = file("$mysql64Home/lib/$dllName")
sharedLibraryLinkFile = file("$mysql64Home/lib/$linkName")
}
}
}
}
}
}
components {
DataMySQL(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir 'src'
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
lib library: 'mysql'
lib project: ':Data', library: 'Data'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
binaries {
all {
cppCompiler.define "THREADSAFE"
cppCompiler.define "__LCC__"
if (toolChain in VisualCpp) {
cppCompiler.define "WINVER=0x0600"
}
}
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "MySQL_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
}
}
}
task poco { dependsOn "assemble" }