Commit a92db0e6 authored by Johannes Mey's avatar Johannes Mey
Browse files

modernize build.gradle and add maven package build

parent 95929262
Pipeline #12860 passed with stages
in 3 minutes and 8 seconds
......@@ -12,7 +12,7 @@ cache:
- .gradle/caches
build:
image: openjdk:8
image: openjdk:11
stage: build
script:
- ./gradlew --console=plain --no-daemon assemble jar
......@@ -21,7 +21,7 @@ build:
- "/builds/jastadd/relational-rags/build/libs/relast-*.jar"
test:
image: openjdk:8
image: openjdk:11
stage: test
script:
- ./gradlew --console=plain --no-daemon --info test
......@@ -38,3 +38,11 @@ pages:
only:
- master
publish_dev:
image: openjdk:11
stage: deploy
needs:
- test
script:
- "./gradlew setDevVersionForCI"
- "./gradlew publish"
\ No newline at end of file
//file:noinspection HardCodedStringLiteral
plugins {
id 'java'
id 'java-library'
id 'application'
id 'idea'
id 'maven-publish'
id 'org.jastadd.relast.plugin'
id 'org.jastadd' version '1.14.5'
}
import org.jastadd.relast.plugin.RelastTest
apply plugin: "com.github.ben-manes.versions"
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'jastadd'
apply plugin: 'application'
apply plugin: "idea"
apply plugin: "org.jastadd.relast.plugin"
sourceCompatibility = 1.8
java.toolchain.languageVersion = JavaLanguageVersion.of(11)
mainClassName = 'org.jastadd.relast.compiler.Compiler'
ext {
mainClassName = 'org.jastadd.relast.compiler.Compiler'
}
repositories {
jcenter()
mavenCentral()
maven {
name 'gitlab-maven'
url 'https://git-st.inf.tu-dresden.de/api/v4/groups/jastadd/-/packages/maven'
}
}
group = 'org.jastadd'
apply plugin: 'maven-publish'
buildscript {
repositories.jcenter()
dependencies {
classpath 'org.jastadd:jastaddgradle:1.13.3'
classpath "com.github.ben-manes:gradle-versions-plugin:0.34.0"
}
}
dependencyUpdates.gradleReleaseChannel="current"
dependencyUpdates.revision="release"
// set the main class name for `gradle run`
application.mainClass = "${mainClassName}"
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
testImplementation 'org.assertj:assertj-core:3.18.0'
testImplementation 'com.fasterxml.jackson.core:jackson-core:2.11.3'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.11.3'
implementation group: 'org.jastadd', name: 'jastadd', version: '2.3.4'
api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.assertj:assertj-core:3.22.0'
testImplementation 'com.fasterxml.jackson.core:jackson-core:2.13.1'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.13.1'
implementation 'org.jastadd:jastadd:2.3.5'
api 'net.sf.beaver:beaver-rt:0.9.11'
}
File genSrc = file("src/gen/java")
File testGenSrc = file("src/test/java-gen")
File genSrc = file('src/gen/java')
File testGenSrc = file('src/test/java-gen')
sourceSets.main.java.srcDir genSrc
sourceSets.main.java.srcDir "buildSrc/gen/java"
sourceSets.test.java.srcDir testGenSrc
idea.module.generatedSourceDirs += genSrc
......@@ -68,9 +66,23 @@ task newVersion() {
}
}
task printVersion() {
doLast {
println(version)
}
}
task setDevVersionForCI() {
doFirst {
def props = new Properties()
props['version'] = version + "-$System.env.CI_PIPELINE_IID"
props.store(file(versionFile).newWriter(), null)
}
}
jar {
manifest {
attributes "Main-Class": 'org.jastadd.relast.compiler.Compiler'
attributes 'Main-Class': "${mainClassName}"
}
from {
......@@ -84,76 +96,77 @@ jastadd {
configureModuleBuild()
modules {
//noinspection GroovyAssignabilityCheck
module("RelAst") {
module('RelAst') {
java {
basedir "."
include "src/main/**/*.java"
include "src/gen/**/*.java"
basedir '.'
include 'src/main/**/*.java'
include 'src/gen/**/*.java'
}
jastadd {
basedir "src/main/jastadd/"
include "**/*.ast"
include "**/*.jadd"
include "**/*.jrag"
basedir 'src/main/jastadd/'
include '**/*.ast'
include '**/*.jadd'
include '**/*.jrag'
}
scanner {
include "src/main/jastadd/RelAst.flex"
include 'src/main/jastadd/RelAst.flex'
}
parser {
include "src/main/jastadd/Preamble.parser"
include "src/main/jastadd/RelAst.parser"
include 'src/main/jastadd/Preamble.parser'
include 'src/main/jastadd/RelAst.parser'
}
}
}
cleanGen.doFirst {
delete "src/gen/java/org"
delete "src/gen-res/BuildInfo.properties"
delete 'src/gen/'
delete 'src/gen-res/'
}
preprocessParser.doFirst {
args += ["--no-beaver-symbol"]
}
module = "RelAst"
module = 'RelAst'
astPackage = 'org.jastadd.relast.ast'
parser.name = 'RelAstParser'
genDir = 'src/gen/java'
buildInfoDir = 'src/gen-res'
scanner.genDir = 'src/gen/java/org/jastadd/relast/scanner'
parser.genDir = 'src/gen/java/org/jastadd/relast/parser'
scanner.genDir = "src/gen/java/org/jastadd/relast/scanner"
parser.genDir = "src/gen/java/org/jastadd/relast/parser"
jastaddOptions = ["--lineColumnNumbers", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
jastaddOptions = ['--lineColumnNumbers', '--safeLazy', '--visitCheck=true', '--rewrite=cnta', '--cache=all']
}
// publish gitlab project
publishing {
publications {
maven(MavenPublication) {
artifact("build/libs/relast-${version}.jar") {
extension 'jar'
}
artifactId = 'relast'
from components.java
}
}
repositories {
maven {
name 'nexus'
url "http://172.22.1.152:8081/repository/" + (project.hasProperty('asSnapshot') ? "maven-snapshots" : "maven-releases/")
credentials {
username project.ext.properties.repoUser
password project.ext.properties.repoPassword
url "https://git-st.inf.tu-dresden.de/api/v4/projects/$System.env.CI_PROJECT_ID/packages/maven"
// Uncomment the following lines to publish manually (and comment out the other credentials section)
// credentials(HttpHeaderCredentials) {
// name = "Private-Token"
// value = gitLabPrivateToken // the variable resides in ~/.gradle/gradle.properties
// }
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv('CI_JOB_TOKEN')
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
......@@ -199,8 +212,8 @@ task compileDefaultNamesResolverTest(type: RelastTest) {
resolverHelper = true
packageName = 'defaultnames.resolver.ast'
moreInputFiles 'src/test/jastadd/Utils.jadd',
'src/test/jastadd/resolver/ResolverUtils.jadd',
'src/test/jastadd/resolver/MyRefResolver.jadd'
'src/test/jastadd/resolver/ResolverUtils.jadd',
'src/test/jastadd/resolver/MyRefResolver.jadd'
}
task compileLowerBoundsTest(type: RelastTest) {
......@@ -213,8 +226,8 @@ task compileLowerBoundsTest(type: RelastTest) {
task compileMultipleTest(type: RelastTest) {
relastFiles 'src/test/jastadd/multiple/Part1.relast',
'src/test/jastadd/multiple/Part2.relast',
'src/test/jastadd/multiple/Part3.relast'
'src/test/jastadd/multiple/Part2.relast',
'src/test/jastadd/multiple/Part3.relast'
grammarName = 'src/test/jastadd/multiple/Multiple'
useJastAddNames = true
packageName = 'multiple.ast'
......
rootProject.name = 'relast2uml'
rootProject.name = 'RelAST'
include 'relast.preprocessor'
include 'dumpAst'
include 'testDumper'
include 'featureTest'
Supports Markdown
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