Commit fbc259b9 authored by Fred Eisele's avatar Fred Eisele
Browse files

preparing for gradle modules

parent 49500e8a
......@@ -8,10 +8,15 @@ doc/aqlmanual/aqlmanual.synctex.gz
doc/aqlmanual/aqlmanual.toc
/target/
buildSrc/build/
.classpath
.idea/
.project
.settings/
.vscode/
fql.iml
*.iml
*.ipr
*.iws
*.dvi
.gradle/
import org.babeloff.ProjectVersion
import org.babeloff.ReleaseVersionTask
import org.babeloff.SnapshotVersionTask
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'antlr'
......@@ -6,24 +10,129 @@ apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'net.catdata'
version = '0.9-SNAPSHOT-maven'
project.ext.versionFile = file('gradle/version.properties')
task loadVersion {
project.version = ProjectVersion.read(logger, versionFile)
}
task makeReleaseVersion (type: ReleaseVersionTask) {
release = version.release
propFile = versionFile
}
task makeSnapshotVersion (type: SnapshotVersionTask) {
propFile = versionFile
}
task showVersion {
group = 'versioning'
description = 'Prints project version.'
doLast {
logger.quiet "Version : ${project.version}"
}
}
task showDependencies {
doLast {
configurations.getByName('antlr').each{
dependency -> println dependency
}
}
}
description = "Categorical Data IDE"
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
configurations.all {
task createDistribution(type: Zip, dependsOn: makeReleaseVersion) {
from jar
from(sourceSets*.allSource) { into 'src' }
from(rootDir) { include versionFile.name }
}
task backupReleaseDistribution(type: Copy) {
from createDistribution.outputs.files
into "$buildDir/backup"
}
task release(dependsOn: backupReleaseDistribution) {
doLast { logger.quiet 'releasing the project...' }
}
configurations {
all { }
antlr { resolutionStrategy { failOnVersionConflict() } }
}
// https://github.com/babeloff/boot-antlr4/blob/master/src/babeloff/boot_antlr4.clj
//
// (deftask build
// [s show bool "show the arguments"]
// (comp
// (antlr/generate
// :grammar "AqlLexerRules.g4"
// :package "catdata.aql.grammar")
// (antlr/generate
// :grammar "AqlParser.g4"
// :package "catdata.aql.grammar"
// :visitor true
// :listener true)
// (javac)))
wrapper {
gradleVersion = '4.10'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
sourceSets {
main {
java {
srcDirs = ['src', 'build/generated-src/antlr']
}
antlr {
// srcDirs = ['src/main/antlr','src/main/antlr_imports']
}
}
test {
java {
srcDirs = ['test']
}
}
}
idea {
module {
generatedSourceDirs += file("${project.buildDir}/generated-src/antlr/main")
downloadJavadoc = true
downloadSources = false
}
}
generateGrammarSource {
// generateGrammarSource = "AqlParser"
maxHeapSize = "64m"
// arguments << "-lib" << "src/main/antlr/catdata/aql/grammer"
arguments << "-visitor" << "-listener"
arguments << "-long-messages"
// includes = ["${project.rootDir}/src/main/antlr4/imports"]
outputDirectory = file("${project.buildDir}/generated-src/antlr/main")
source = "${sourceSets.main.antlr}/"
arguments << '-lib' << 'src/main/antlr_imports/'
arguments << '-visitor'
arguments << '-listener'
arguments << '-long-messages'
arguments << '-package' << 'catdata.aql.grammar'
}
repositories {
......@@ -45,12 +154,12 @@ dependencies {
compile group: 'net.sf.jung', name: 'jung-api', version:'2.1.1'
compile group: 'net.sf.jung', name: 'jung-graph-impl', version:'2.1.1'
compile group: 'net.sf.jung', name: 'jung-visualization', version:'2.1.1'
compile group: 'org.antlr', name: 'antlr4', version:'4.7'
compile group: 'com.opencsv', name: 'opencsv', version:'4.1'
compile group: 'com.fifesoft', name: 'autocomplete', version:'2.6.1'
compile group: 'com.fifesoft', name: 'rstaui', version:'2.6.1'
compile group: 'com.fifesoft', name: 'rsyntaxtextarea', version:'2.6.1'
compile group: 'es.nitaur.markdown', name: 'txtmark', version:'0.16'
antlr group: 'org.antlr', name: 'antlr4', version: '4.7'
compile group: 'org.antlr', name: 'antlr4-runtime', version:'4.7.1'
antlr group: 'org.antlr', name: 'antlr4', version: '4.7.1'
testCompile group: 'junit', name: 'junit', version:'4.12'
}
package org.babeloff
import org.gradle.api.GradleException
import org.gradle.api.logging.Logger
class ProjectVersion {
Integer year
Integer month
Integer day
Boolean release
ProjectVersion(Integer year, Integer month, Integer day) {
this.year = year
this.month = month
this.day = day
this.release = Boolean.FALSE
}
ProjectVersion(Integer year, Integer month, Integer day, Boolean release) {
this.year = year
this.month = month
this.day = day
this.release = release
}
static ProjectVersion read(Logger logger, File versionFile) {
logger.quiet 'Reading the version file.'
if(!versionFile.exists()) {
throw new GradleException("Required version file does not exist: $versionFile.canonicalPath")
}
Properties versionProps = new Properties()
versionFile.withInputStream { stream -> versionProps.load(stream) }
new ProjectVersion(versionProps.year.toInteger(),
versionProps.month.toInteger(),
versionProps.day.toInteger(),
versionProps.release.toBoolean())
}
@Override
String toString() {
"$year.$month.$day${release ? '' : '-SNAPSHOT'}"
}
}
package org.babeloff
class ReleaseVersionTask {
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
class ReleaseVersionTask extends DefaultTask {
@Input Boolean release
@OutputFile File propFile
ReleaseVersionTask() {
group = 'versioning'
description = 'Makes project a release version.'
}
@TaskAction
void start() {
project.version.release = true
ant.propertyfile(file: propFile) {
entry(key: 'release', type: 'string', operation: '=', value: 'true')
}
}
}
package org.babeloff
import java.time.LocalDate
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
class ReleaseVersionTask extends DefaultTask {
@Input Boolean release
@OutputFile File destFile
class SnapshotVersionTask extends DefaultTask {
@OutputFile File propFile
ReleaseVersionTask() {
SnapshotVersionTask() {
group = 'versioning'
description = 'Makes project a release version.'
}
@TaskAction
void start() {
project.version.release = true
ant.propertyfile(file: destFile) {
entry(key: 'release', type: 'string', operation: '=', value: 'true')
def date = LocalDate.now()
ant.propertyfile(file: propFile) {
entry(key: 'year', type: 'string', operation: '=', value: date.getYear().toString())
entry(key: 'month', type: 'string', operation: '=', value: date.getMonthValue().toString())
entry(key: 'day', type: 'string', operation: '=', value: date.getDayOfMonth())
entry(key: 'release', type: 'string', operation: '=', value: 'false')
}
}
}
#Fri, 07 Sep 2018 15:15:28 -0500
#Fri, 07 Sep 2018 16:25:15 -0500
year=2018
month=9
day=10
day=7
release=false
#Wed Sep 05 08:42:09 CDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
......@@ -155,6 +155,7 @@
<configuration>
<listener>true</listener>
<visitor>true</visitor>
<outputDirectory>${project.build.directory}/generated-sources/antlr4</outputDirectory>
</configuration>
</execution>
</executions>
......
rootProject.name = 'fql'
// include 'aql'
// include 'aql_grammar'
// include 'fql'
// include 'fqlpp'
// include 'fpql'
// include 'graph'
// include 'fqlide' // ide
// include 'oql'
// include 'easik'
// include 'sql'
// include catlib // all objects directly under catdata package
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment