-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from frc5024/bundlejars
- Loading branch information
Showing
17 changed files
with
242 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,133 +1,200 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This is a general purpose Gradle build. | ||
* Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds/ | ||
*/ | ||
|
||
|
||
// This is the main build script. This mostly contains the gradle tasks for building the library JAR files and documentation | ||
|
||
// This injects the gradlerio version info into all projects | ||
buildscript { | ||
repositories { | ||
jcenter() | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
} | ||
|
||
dependencies { | ||
classpath 'com.netflix.nebula:gradle-aggregate-javadocs-plugin:2.2.+' | ||
classpath "edu.wpi.first:GradleRIO:2020.+" | ||
// Update this version number to update GradleRIO | ||
classpath "edu.wpi.first:GradleRIO:2020.+" | ||
} | ||
} | ||
|
||
// All plugins used by the buildscript | ||
plugins { | ||
id "com.gradle.build-scan" version "3.3.4" | ||
id "java-library" | ||
} | ||
|
||
apply plugin: 'nebula-aggregate-javadocs' | ||
apply plugin: "java-library" | ||
// Load project dependancy configurations | ||
apply from: "gradle_utils/libversions.gradle" | ||
apply from: "gradle_utils/mavenrepos.gradle" | ||
|
||
// LIB VERSION | ||
project.version = "1.2.1" | ||
|
||
// Enable Java support for all projects | ||
allprojects{ | ||
apply plugin: "java" | ||
} | ||
|
||
// This enables some fancy gradle enterprise features for us | ||
gradleEnterprise { | ||
buildScan { | ||
termsOfServiceUrl = 'https://gradle.com/terms-of-service' | ||
termsOfServiceAgree = 'yes' | ||
} | ||
} | ||
|
||
// This will automatically pull in everything that isnt the "examples" project | ||
dependencies{ | ||
rootProject.subprojects.each{ | ||
if ( it.name != "examples"){ | ||
api it | ||
} | ||
} | ||
} | ||
|
||
// task document { | ||
// dependsOn "aggregateJavadocs" | ||
// doLast { | ||
// file("$rootProject.buildDir/docs/javadoc").renameTo(file("docs")) | ||
// } | ||
// } | ||
// This task takes every subproject's Javadoc, and merges it into one | ||
task combineJavadoc(type: Javadoc, description: 'Generate javadocs from all child projects as if it was a single project', group: 'Documentation') { | ||
|
||
task document(type: Javadoc, description: 'Generate javadocs from all child projects as if it was a single project', group: 'Documentation') { | ||
// Set the jars to be generated into the build directory | ||
destinationDir = file("$buildDir/docs/javadoc") | ||
|
||
// Set the JavaDoc webpage title | ||
title = "$project.name $version API" | ||
|
||
// Set the custom CSS file containing our logo and theme | ||
options.setStylesheetFile(file("javadoc.css")) | ||
|
||
// These fix a JavaDoc bug | ||
options.addBooleanOption('-no-module-directories', true) | ||
options.author true | ||
|
||
// If you add a new dependancy to the project, add its javadoc URL to this list | ||
options.links 'http://docs.spring.io/spring/docs/4.3.x/javadoc-api/', 'http://docs.oracle.com/javase/8/docs/api/', 'http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/', 'http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/', 'https://first.wpi.edu/FRC/roborio/release/docs/java/', 'https://www.revrobotics.com/content/sw/max/sw-docs/java/', 'https://www.kauailabs.com/public_files/navx-mxp/apidocs/java/', 'https://knowm.org/javadocs/xchart/' | ||
options.addStringOption 'Xdoclint:none', '-quiet' | ||
println "Building recursive JavaDoc" | ||
|
||
// Any JavaDoc options should go here | ||
options.addStringOption 'Xdoclint:none', '-quiet' | ||
|
||
// source subprojects.collect { proj -> proj.sourceSets.main.allJava } | ||
// Load the configuraation from every subproject | ||
subprojects.each { proj -> | ||
|
||
// Don't document the "examples" project | ||
if (proj.name != "examples"){ | ||
println 'Adding ' + proj.projectDir + "/src/main/java" | ||
|
||
// Read form every JavaDoc task in the subproject | ||
proj.tasks.withType(Javadoc).each { javadocTask -> | ||
println 'Found JavaDoc task' | ||
|
||
// Add the task sources to the main JavaDoc | ||
source += javadocTask.source | ||
classpath += javadocTask.classpath | ||
excludes += javadocTask.excludes | ||
includes += javadocTask.includes | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
doLast { | ||
println "Copying javadoc to docs folder" | ||
delete "docs" | ||
file("$rootProject.buildDir/docs/javadoc").renameTo(file("docs")) | ||
} | ||
} | ||
|
||
// This task is used to make the "clean" task clean out the docs directory | ||
task _cleanDocs(type: Delete){ | ||
delete "docs" | ||
} | ||
tasks.clean.dependsOn(tasks._cleanDocs) | ||
|
||
// This is just a compatibility thing | ||
subprojects.each { subproject -> | ||
evaluationDependsOn(subproject.path) | ||
} | ||
task mmJar(type: Jar, dependsOn: subprojects.jar) { | ||
subprojects.each { subproject -> | ||
from subproject.configurations.archives.artifacts.files.collect { | ||
zipTree(it) | ||
} | ||
|
||
// This gets run by our CI pipeline to generate https://frc5024.github.io/lib5k | ||
task document(dependsOn: combineJavadoc){ | ||
// Clear out the docs folder, and move the JavaDoc into it | ||
dependsOn _cleanDocs | ||
doLast{ | ||
file("$rootProject.buildDir/docs/javadoc").renameTo(file("docs")) | ||
} | ||
} | ||
|
||
task copyPyLogReader(type: Copy){ | ||
from "scripts/logreader.py" | ||
into "_release" | ||
/* Build all the required JARs */ | ||
|
||
// This will take every JavaDoc and pack it into a single JAR | ||
task _buildJavaDocJar(type: Jar, dependsOn: document){ | ||
classifier = "javadoc" | ||
from file("docs") | ||
} | ||
|
||
task copyPySim(type: Copy){ | ||
from "scripts/simulate.py" | ||
into "_release" | ||
// This will create a Jar file containing all the source code. This isn't used on-robot, but is just used by IDEs to generate the 'F12' info | ||
task _buildAllSourcesJar(type: Jar){ | ||
classifier = "sources" | ||
|
||
// Iterate through each project, and add it's source code | ||
from allprojects.collect { it.sourceSets.main.allSource } | ||
} | ||
|
||
task packModules(type: Zip){ | ||
archiveFileName = "modules.zip" | ||
destinationDirectory = file("_release") | ||
from "_release/modules" | ||
// This task bundles together all the .class files into a single JAR | ||
task _buildAllClassesJar(type: Jar){ | ||
classifier = "classes" | ||
|
||
// Needs to build the project | ||
dependsOn build | ||
|
||
// Disable support for 64-bit JARs (The RoboRIO is a 32-bit system) | ||
zip64 = false | ||
|
||
// Load all class files | ||
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } | ||
|
||
} | ||
|
||
// This will bundle EVERYTHING into one Jar | ||
task _buildAllJar(type: Jar){ | ||
classifier = "all" | ||
|
||
// Needs to build the project | ||
dependsOn build | ||
dependsOn document | ||
|
||
// Load all files for the bug JAR | ||
from file("docs"), allprojects.collect { it.sourceSets.main.allSource }, { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } | ||
} | ||
|
||
// This task is used to copy all python scripts from scripts/ to _release/python/ | ||
task _copyPy(type: Copy){ | ||
from "scripts" | ||
into "_release/python" | ||
include "*.py" | ||
} | ||
|
||
task buildRelease(type: Jar){ | ||
delete file("_release") | ||
delete file("$rootProject.buildDir/libs") | ||
dependsOn subprojects.fatJar | ||
dependsOn subprojects.jar | ||
dependsOn project(":bundle").buildBundle | ||
dependsOn copyPyLogReader | ||
dependsOn copyPySim | ||
dependsOn packModules | ||
// doLast{ | ||
// subprojects.each { subproject -> | ||
// from subproject.configurations.archives.artifacts.files.collect { | ||
// zipTree(it) | ||
// } | ||
// } | ||
// // fileTree("_release/modules").each { | ||
// // from it | ||
// // } | ||
|
||
// // from fileTree("_release/modules").files.collect | ||
// println "$rootProject.buildDir/libs/lib5k-"+project.version+".jar" | ||
// file("$rootProject.buildDir/libs/lib5k-"+project.version+".jar").renameTo(file("_release/lib5k-"+project.version+"-monolithic.jar")) | ||
// } | ||
// This task is used to copy all jar files from build/libs/ to _release/jar/ | ||
task _copyJar(type: Copy){ | ||
|
||
// Copy dependancies | ||
dependsOn _buildJavaDocJar | ||
dependsOn _buildAllSourcesJar | ||
dependsOn _buildAllClassesJar | ||
dependsOn _buildAllJar | ||
|
||
// Where and how to copy | ||
from "build/libs" | ||
into "_release/jar" | ||
include project.name + "-" + project.version +"-*.jar" | ||
} | ||
|
||
// This task is used to clean out the _release directory | ||
task _cleanRelease(type: Delete){ | ||
delete "_release" | ||
} | ||
tasks.clean.dependsOn(tasks._cleanRelease) | ||
|
||
// This will build everything needed for release | ||
task buildRelease { | ||
dependsOn _copyPy | ||
dependsOn _copyJar | ||
} | ||
|
||
// This will build only a JAR file to be used for beta testing | ||
task buildBeta(type: Copy) { | ||
dependsOn _buildAllJar | ||
|
||
from "build/libs" | ||
into "_release/jar" | ||
include project.name + "-" + project.version +"-all.jar" | ||
} |
Oops, something went wrong.