Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

272 lines (224 sloc) 7.32 KB
/*
Copyright (C) 2015 - 2019 Electronic Arts Inc. All rights reserved.
This file is part of the Orbit Project <https://www.orbit.cloud>.
See license in LICENSE.
*/
def configureProject(final String projectName, final List<List<Project>> toAdd) {
toAdd.each {
it.add(project(projectName))
}
}
def withKotlin = []
def withJava = []
def withTests = []
def publish = []
def localPublish = []
// Framework
configureProject(":src:orbit-commons", [withKotlin, withTests, publish])
configureProject(":src:orbit-server", [withKotlin, withTests, publish])
configureProject(":src:orbit-application", [withKotlin])
configureProject(":src:orbit-proto", [withJava])
buildscript {
ext {
kotlinVersion = "1.3.41"
// TODO: Upgrade once bug is fixed with orbit-core doc generation - https://github.com/Kotlin/dokka/issues/455
dokkaVersion = "0.9.17"
dokkaRepo = "https://dl.bintray.com/kotlin/dokka"
protobufVersion = "3.9.1"
protobufPluginVersion = "0.8.10"
grpcVersion = "1.22.1"
}
repositories {
mavenCentral()
maven { url(dokkaRepo) }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
}
}
ext {
orbitGroup = "cloud.orbit"
orbitVersion = project.properties["orbit.version"]
orbitCodename = project.properties["orbit.codename"]
orbitCompatVersion = project.properties["orbit.compatVersion"]
orbitUrl = "https://www.orbit.cloud"
orbitScmUrl = "https://github.com/orbit/orbit.git"
orbitDescription = "Orbit"
orgName = "Electronic Arts"
orgUrl = "https://www.ea.com"
orgEmail = "orbit@ea.com"
licenseName = "The BSD 3-Clause License"
licenseUrl = "http://opensource.org/licenses/BSD-3-Clause"
javaTargetVersion = "1.8"
javaSourceVersion = "1.8"
kotlinTargetVersion = "1.8"
coroutinesVersion = "1.2.2"
junitJupiterVersion = "5.5.1"
slf4jVersion = "1.7.26"
}
allprojects {
group = orbitGroup
version = orbitVersion
description = orbitDescription
repositories {
mavenCentral()
jcenter()
maven { url(dokkaRepo) }
}
}
configure(withKotlin) {
apply plugin: "kotlin"
compileKotlin {
kotlinOptions {
jvmTarget = kotlinTargetVersion
freeCompilerArgs = ["-Xjvm-default=enable", "-Xuse-experimental=kotlin.Experimental"]
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = kotlinTargetVersion
}
}
dependencies {
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
}
}
configure(withJava + withKotlin) {
apply plugin: "java-library"
compileJava {
sourceCompatibility = javaSourceVersion
targetCompatibility = javaTargetVersion
}
compileTestJava {
sourceCompatibility = javaSourceVersion
targetCompatibility = javaTargetVersion
}
}
configure(withTests) {
dependencies {
testImplementation("org.assertj:assertj-core:3.12.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
testRuntimeOnly("org.slf4j:slf4j-simple:$slf4jVersion")
}
test {
useJUnitPlatform {
includeEngines("junit-jupiter")
}
}
}
configure(publish) {
apply plugin: "maven-publish"
apply plugin: "signing"
apply plugin: "org.jetbrains.dokka"
Boolean canRemotePublish = JavaVersion.current() == JavaVersion.VERSION_1_8
jar {
manifest {
attributes(
"Name": project.name,
"Automatic-Module-Name": project.name.replace('-', '.'),
"Implementation-Title": "$orbitCodename Orbit",
"Implementation-Version": orbitVersion,
"Implementation-Vendor": orgName,
"Specification-Title": "$orbitCodename Orbit",
"Specification-Version": orbitCompatVersion,
"Specification-Vendor": orgName
)
}
}
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = "javadoc"
outputDirectory = "$buildDir/docs/javadoc"
reportUndocumented = false
}
task dokkaHtml(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = "html"
outputDirectory = "$buildDir/docs/html"
reportUndocumented = false
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = "sources"
}
task dokkaJavadocJar(type: Jar) {
dependsOn("dokkaJavadoc")
from dokkaJavadoc.outputDirectory
classifier = "javadoc"
}
task dokkaHtmlJar(type: Jar) {
dependsOn("dokkaHtml")
from dokkaHtml.outputDirectory
classifier = "htmldoc"
}
publishing {
repositories {
maven {
String publishUrl = "$buildDir/repo"
if (project.properties["remotePublish"]) {
if (!canRemotePublish) throw new GradleException("Cannot remote publish with this JDK")
publishUrl = project.properties["publish.url"] ?: publishUrl
credentials {
username(project.properties["publish.username"] ?: "")
password(project.properties["publish.password"] ?: "")
}
}
url(publishUrl)
}
}
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact dokkaHtmlJar
if (canRemotePublish) {
artifact dokkaJavadocJar
}
groupId = project.group
version = project.version
artifactId = project.name
pom {
name = project.name
description = project.description
url = orbitUrl
licenses {
license {
name = licenseName
url = licenseUrl
}
}
scm {
url = orbitUrl
connection = orbitScmUrl
developerConnection = orbitScmUrl
}
organization {
name = orgName
url = orgUrl
}
developers {
developer {
name = orgName
email = orgEmail
}
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
}
configure(localPublish) {
apply plugin: "maven-publish"
publishing {
repositories {
maven {
url("$buildDir/repo")
}
}
}
}
You can’t perform that action at this time.