Skip to content
Permalink
Browse files

Application entry point

  • Loading branch information...
JoeHegarty committed Aug 2, 2019
1 parent 6af3af7 commit 95b27928bfacc7f4bebc3f2bb2d7de2373b496a5
@@ -0,0 +1,260 @@
/*
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-application", [withKotlin])

buildscript {
ext.kotlinVersion = "1.3.41"
// TODO: Upgrade once bug is fixed with orbit-core doc generation - https://github.com/Kotlin/dokka/issues/455
ext.dokkaVersion = "0.9.17"
ext.dokkaRepo = "https://dl.bintray.com/kotlin/dokka"

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()
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")
}
}
}
}
@@ -0,0 +1,9 @@
#
# 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.
#
orbit.version=2.0.0-SNAPSHOT
orbit.compatVersion=2.0
orbit.codename=Mesh
kotlin.code.style=official
@@ -1 +1,9 @@
/*
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.
*/

rootProject.name = "orbit"

include(":src:orbit-application")
@@ -0,0 +1,9 @@
/*
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.
*/

apply plugin: "application"

mainClassName = "orbit.application.AppKt"
@@ -0,0 +1,11 @@
/*
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.
*/

package orbit.application

fun main() {

}

0 comments on commit 95b2792

Please sign in to comment.
You can’t perform that action at this time.