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