Brian Silverman | 41cdd3e | 2019-01-19 19:48:58 -0800 | [diff] [blame^] | 1 | plugins { |
| 2 | id 'base' |
| 3 | id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '2.3' |
| 4 | id 'edu.wpi.first.NativeUtils' version '2.1.2' |
| 5 | id 'edu.wpi.first.GradleJni' version '0.3.1' |
| 6 | id 'edu.wpi.first.GradleVsCode' version '0.7.1' |
| 7 | id 'idea' |
| 8 | id 'visual-studio' |
| 9 | id 'com.gradle.build-scan' version '2.0.2' |
| 10 | id 'net.ltgt.errorprone' version '0.6' apply false |
| 11 | id 'com.github.johnrengelman.shadow' version '4.0.3' apply false |
| 12 | } |
| 13 | |
| 14 | repositories { |
| 15 | mavenCentral() |
| 16 | } |
| 17 | |
| 18 | buildScan { |
| 19 | termsOfServiceUrl = 'https://gradle.com/terms-of-service' |
| 20 | termsOfServiceAgree = 'yes' |
| 21 | |
| 22 | publishAlways() |
| 23 | } |
| 24 | |
| 25 | ext.licenseFile = files("$rootDir/LICENSE.txt", "$rootDir/ThirdPartyNotices.txt") |
| 26 | |
| 27 | // Ensure that the WPILibVersioningPlugin is setup by setting the release type, if releaseType wasn't |
| 28 | // already specified on the command line |
| 29 | if (!hasProperty('releaseType')) { |
| 30 | WPILibVersion { |
| 31 | releaseType = 'dev' |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | def pubVersion |
| 36 | if (project.hasProperty("publishVersion")) { |
| 37 | pubVersion = project.publishVersion |
| 38 | } else { |
| 39 | pubVersion = WPILibVersion.version |
| 40 | } |
| 41 | |
| 42 | def outputsFolder = file("$buildDir/allOutputs") |
| 43 | |
| 44 | def versionFile = file("$outputsFolder/version.txt") |
| 45 | |
| 46 | task outputVersions() { |
| 47 | description = 'Prints the versions of wpilib to a file for use by the downstream packaging project' |
| 48 | group = 'Build' |
| 49 | outputs.files(versionFile) |
| 50 | |
| 51 | doFirst { |
| 52 | buildDir.mkdir() |
| 53 | outputsFolder.mkdir() |
| 54 | } |
| 55 | |
| 56 | doLast { |
| 57 | versionFile.write pubVersion |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | task libraryBuild() {} |
| 62 | |
| 63 | build.dependsOn outputVersions |
| 64 | |
| 65 | task copyAllOutputs(type: Copy) { |
| 66 | destinationDir outputsFolder |
| 67 | } |
| 68 | |
| 69 | build.dependsOn copyAllOutputs |
| 70 | copyAllOutputs.dependsOn outputVersions |
| 71 | |
| 72 | ext.addTaskToCopyAllOutputs = { task -> |
| 73 | copyAllOutputs.dependsOn task |
| 74 | copyAllOutputs.inputs.file task.archivePath |
| 75 | copyAllOutputs.from task.archivePath |
| 76 | } |
| 77 | |
| 78 | subprojects { |
| 79 | apply plugin: 'eclipse' |
| 80 | apply plugin: 'idea' |
| 81 | |
| 82 | def subproj = it |
| 83 | |
| 84 | plugins.withType(NativeComponentPlugin) { |
| 85 | subproj.apply plugin: MultiBuilds |
| 86 | } |
| 87 | |
| 88 | apply from: "${rootDir}/shared/java/javastyle.gradle" |
| 89 | |
| 90 | repositories { |
| 91 | mavenCentral() |
| 92 | } |
| 93 | |
| 94 | // Disables doclint in java 8. |
| 95 | if (JavaVersion.current().isJava8Compatible()) { |
| 96 | tasks.withType(Javadoc) { |
| 97 | options.addStringOption('Xdoclint:none', '-quiet') |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | wrapper { |
| 103 | gradleVersion = '5.0' |
| 104 | } |