Skip to content

Commit

Permalink
Upgraded build to Gradle 4.9
Browse files Browse the repository at this point in the history
Added diagrams project
Update specification document with more information on
 - resource management
 - internationalization
 - threading
  • Loading branch information
aalmiray committed Aug 10, 2018
1 parent d4613bc commit 9a33677
Show file tree
Hide file tree
Showing 15 changed files with 737 additions and 69 deletions.
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,28 @@
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
44 changes: 44 additions & 0 deletions diagrams/diagrams.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2015-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.8.1'
classpath 'org.asciidoctor:asciidoctorj-diagram:1.5.9'
}
}

apply plugin: 'org.asciidoctor.convert'


asciidoctor {
options doctype: 'book'

backends = ['html5']
requires = ['asciidoctor-diagram']

attributes 'source-highlighter' : 'coderay',
'coderay-linenums-mode' : 'table',
imagesdir : 'images',
toc : 'left',
icon : 'font',
linkattrs : true,
encoding : 'utf-8'
}
32 changes: 32 additions & 0 deletions diagrams/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
= Document Title

[ditaa,target="javax/application/application-phases"]
----
+------------+
| |
| Initialize |--------------+
| | |
+------------+ |
| |
v |
+------------+ |
| | |
| Startup |--------------+
| | |
+------------+ |
| |
v |
+------------+ |
| | |
| Ready |--------------+
| | |
+------------+ |
| |
v v
+------------+ +------------+
| | | |
| Main |------->| Shutdown |
| | | |
+------------+ +------------+
----

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ project_scm=https://github.com/jsr377/jsr377-api.git
project_issues=https://github.com/jsr377/jsr377-api/issues
project_bintray_repo=maven
project_bintray_org=jsr377
javadocFooter=Copyright © 2015-2017 JSR-377 Specification. All rights reserved.
javadocFooter=Copyright © 2015-2018 JSR-377 Specification. All rights reserved.

125 changes: 92 additions & 33 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,72 @@
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

task generateMinPom {
doLast {
String pomHeader = """<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>${project.group}</groupId>
<artifactId>${project.name}</artifactId>
<version>${project.version}</version>
""".stripIndent(12)

def dependencyTemplate = { dep -> """
<dependency>
<groupId>$dep.group</groupId>
<artifactId>$dep.name</artifactId>
<version>$dep.version</version>
</dependency>
""".stripIndent(4)
}

String deps = configurations.runtime.allDependencies.findAll({it.name!= 'unspecified'})
.collect({ dep -> dependencyTemplate(dep)}).join('')

String pom = pomHeader
if (deps) {
pom += " <dependencies>\n$deps\n </dependencies>\n"
}
pom += "</project>"

project.file("$buildDir/tmp/maven").mkdirs()
project.file("$buildDir/tmp/maven/pom.xml").text = pom
}
}

jar {
dependsOn 'generateMinPom'
manifest {
attributes(
'Built-By': project.buildBy,
'Created-By': project.buildCreatedBy,
'Build-Date': project.buildDate,
'Build-Time': project.buildTime,
'Build-Revision': project.buildRevision,
'X-Built-By': project.buildBy,
'X-Build-Date': project.buildDate,
'X-Build-Time': project.buildTime,
'X-Build-Revision': project.buildRevision,
'Specification-Title': project.name,
'Specification-Version': project.version,
'Specification-Vendor': project.project_vendor,
'Automatic-Module-Name': 'javax.application'
)
}
}

def pomConfig = {
name project.name
description project.project_description
url project.project_url
inceptionYear '2015'
licenses {
license([:]) {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
metaInf {
from(rootProject.file('.')) {
include 'LICENSE'
}
}
scm {
url project.project_scm
}
developers {
[
aalmiray : 'Andres Almiray'
].each { devId, devName ->
developer {
id devId
name devName
roles {
role 'JSR-377 Spec lead'
}
}
from(rootProject.file('src/maven')) {
into "maven/${project.group}/${project.name}"
expand(
'gradle_version': gradle.gradleVersion,
'project_version': project.version,
'project_group': project.group,
'project_name': project.name,
)
}
from(rootProject.file("$buildDir/tmp/maven")) {
into "maven/${project.group}/${project.name}"
}
}
}
Expand All @@ -70,16 +94,41 @@ publishing {
artifact sourcesJar
artifact javadocJar

pom.withXml {
asNode().children().last() + pomConfig
asNode().appendNode('description', project.project_description)
pom {
name = project.name
description = project.project_description
url = project.project_url
inceptionYear = '2015'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
url = project.project_scm
}
developers {
[
aalmiray : 'Andres Almiray'
].each { devId, devName ->
developer {
id = devId
name = devName
roles = ['JSR-377 Spec lead']
}
}
}
}
}
}
}

if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = ''
if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = ''
if (!project.hasProperty('mavenUsername')) ext.mavenUsername = ''
if (!project.hasProperty('mavenPassword')) ext.mavenPassword = ''

bintray {
user = project.bintrayUsername
Expand All @@ -96,5 +145,15 @@ bintray {
issueTrackerUrl = project.project_issues
vcsUrl = project.project_scm
publicDownloadNumbers = true
githubRepo = 'jsr377/jsr377-api'
version {
name = project.version
vcsTag = "${project.name}-${project.version}"
mavenCentralSync {
sync = true
user = project.mavenUsername
password = project.mavenPassword
}
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 11 additions & 1 deletion jsr377-api/jsr377-api.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ repositories {

dependencies {
compile 'javax.inject:javax.inject:1'
}
}

evaluationDependsOn(':diagrams')

task copyDiagrams(type: Copy) {
dependsOn project(':diagrams').asciidoctor
from project(':diagrams').file('build/asciidoc/html5/images')
into javadoc.destinationDir
}

javadoc.finalizedBy copyDiagrams
21 changes: 21 additions & 0 deletions jsr377-api/src/main/java/javax/application/ApplicationPhase.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,33 @@
package javax.application;

/**
* Defines the application's life-cycle phases.<p>
* <p>Every instance of {@code javax.application.Application} must follow this life-cycle.</p>
* The life-cycle has few transitions between phases, as shown by the following diagram.
*
* <img src="application-phases.png" alt="application-phases"/>
*
* @author Andres Almiray
*/
public enum ApplicationPhase {
/**
* 1st phase. All applications start with this one
*/
INITIALIZE,
/**
* 2nd phase. This is where MVC groups are created
*/
STARTUP,
/**
* 3rd phase. Called after main window is shown
*/
READY,
/**
* Main phase.
*/
MAIN,
/**
* Last phase.
*/
SHUTDOWN
}
15 changes: 15 additions & 0 deletions jsr377-spec/jsr377-spec.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,35 @@ buildscript {
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.8.1'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16'
classpath 'org.asciidoctor:asciidoctorj-diagram:1.5.9'
}
}

apply plugin: 'org.asciidoctor.convert'

asciidoctor {
dependsOn project(':diagrams').asciidoctor
options doctype: 'book'

backends = ['html5'] //, 'pdf']
requires = ['asciidoctor-diagram']

attributes 'source-highlighter' : 'coderay',
'coderay-linenums-mode' : 'table',
imagesdir : 'images',
toc : 'left',
icon : 'font',
linkattrs : true,
encoding : 'utf-8'

sources {
include 'index.adoc'
}

resources {
from file('src/resources')
from(project(':diagrams').file('build/asciidoc/html5/images')) {
into 'images'
}
}
}
4 changes: 4 additions & 0 deletions jsr377-spec/src/docs/asciidoc/_links.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

:link_jsr330: link:https://jcp.org/en/jsr/detail?id=330[JSR-300, window="_blank"]
:link_resource_bundle: link:https://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html[ResourceBundle, window="_blank"]
:link_message_format: link:http://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html[MessageFormat, window="_blank"]
Loading

0 comments on commit 9a33677

Please sign in to comment.