| import static org.apache.tools.ant.taskdefs.condition.Os.* |
| |
| plugins { |
| id "c" |
| id "de.protos.source-publish" |
| } |
| |
| apply from: "$rootDir/gradle/publish.gradle" |
| |
| def platform = 'UNKNOWN' |
| if(isFamily(FAMILY_WINDOWS)) { platform = 'MT_WIN_MinGW' } |
| else if(isFamily(FAMILY_UNIX)) { platform = 'MT_POSIX_GENERIC_GCC' } |
| |
| model { |
| components { |
| etrice_runtime_c(NativeLibrarySpec) { |
| sources.c { |
| source { |
| srcDirs = ['src/common', 'src/config', "src/platforms/$platform", 'src/util'] |
| include '**/*.c' |
| } |
| exportedHeaders { |
| srcDirs = ['src/common', 'src/config', "src/platforms/$platform", 'src/util'] |
| } |
| } |
| binaries { |
| withType(SharedLibraryBinarySpec) { buildable = false } |
| all { |
| def std99 = (platform == 'MT_WIN_MinGW') ? '-std=c99' : '-std=gnu99' // others platform are not strict ansi |
| cCompiler.args '-g3', std99 |
| } |
| } |
| } |
| } |
| } |
| |
| zipSource { |
| from('src/common', 'src/config', 'src/util') |
| } |
| |
| publishing { |
| publications { |
| etrice(MavenPublication) { |
| from components.adhoc |
| } |
| } |
| repositories publishRepos |
| } |
| |
| // Configure publishing of platforms |
| subprojects { |
| buildDir = parent.layout.buildDirectory.dir("platforms/${project.name}") |
| |
| apply plugin: 'de.protos.source-publish' |
| apply from: "$rootDir/gradle/publish.gradle" |
| |
| zipSource { |
| from layout.projectDirectory |
| exclude '*Examples/' |
| } |
| |
| publishing { |
| publications { |
| etrice(MavenPublication) { |
| artifactId = "${parent.project.name}.${project.name}" |
| from components.adhoc |
| } |
| } |
| repositories publishRepos |
| } |
| } |
| |