Commit 4620d93e authored by René Schöne's avatar René Schöne
Browse files

clean up

- remove buildSrc, integrate into build.gradle's of all modules
- update docs, remove grammar2uml
- add README
- prepare move from master to main
parent 21d946f4
Pipeline #12956 failed with stages
in 1 minute and 4 seconds
......@@ -45,6 +45,7 @@ publish_master:
script:
- "./gradlew publish"
only:
- main
- master
ragdoc_build:
......@@ -77,6 +78,7 @@ ragdoc_view:
only:
- dev
- main
- master
artifacts:
paths:
- "pages/docs/ragdoc"
......@@ -96,3 +98,4 @@ pages:
- public/
only:
- main
- master
# DumpAst
For documentation, please see https://jastadd.pages.st.inf.tu-dresden.de/relast2uml/
plugins {
id 'relast2uml.java-common-conventions'
id 'application'
}
plugins {
id 'java'
id 'idea'
id 'com.github.ben-manes.versions'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "${jupiter_version}"
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.18.1'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${jupiter_version}"
}
tasks.named('test') {
useJUnitPlatform()
}
plugins {
id 'relast2uml.java-common-conventions'
id 'java-library'
}
dependencies {
api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
}
File genSrc = file("src/gen/java")
sourceSets.main.java.srcDir genSrc
idea.module.generatedSourceDirs += genSrc
plugins {
id 'java'
id 'idea'
id 'com.github.ben-manes.versions'
id 'maven-publish'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "${jupiter_version}"
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.18.1'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${jupiter_version}"
}
jar {
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
def versionFile = "src/main/resources/${project.getName()}Version.properties"
def oldProps = new Properties()
try {
file(versionFile).withInputStream { stream -> oldProps.load(stream) }
version = oldProps['version']
} catch (e) {
// this happens, if either the properties file is not present, or cannot be read from
throw new GradleException("File ${versionFile} not found or unreadable. Aborting.", e)
}
task printVersion() {
doLast {
println(version)
}
}
task newVersion() {
doFirst {
def props = new Properties()
props['version'] = value
props.store(file(versionFile).newWriter(), null)
}
}
task setDevVersionForCI() {
doFirst {
def props = new Properties()
props['version'] = version + "-$System.env.CI_PIPELINE_IID"
props.store(file(versionFile).newWriter(), null)
}
}
//679
publishing {
publications {
maven(MavenPublication) {
groupId = 'de.tudresden.inf.st'
// from components.java
artifact("build/libs/${project.getName()}-${project.getVersion()}.jar") {
extension 'jar'
}
}
}
repositories {
maven {
url "https://git-st.inf.tu-dresden.de/api/v4/projects/679/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)
}
}
}
}
publish.dependsOn jar
// --- Buildscripts (must be at the top) ---
buildscript {
repositories.mavenLocal()
repositories.mavenCentral()
......@@ -6,20 +7,35 @@ buildscript {
}
}
// --- Plugin definitions ---
plugins {
id 'relast2uml.java-jastadd-conventions'
id 'relast2uml.java-publishing-conventions'
id 'java'
id 'idea'
id 'com.github.ben-manes.versions'
id 'java-library'
id 'maven-publish'
}
apply plugin: 'jastadd'
// --- Dependencies ---
repositories {
mavenCentral()
}
dependencies {
jastadd2 "org.jastadd:jastadd:2.3.5"
implementation fileTree(include: ['plantuml.jar'], dir: '../libs')
api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
implementation group: 'com.github.spullara.mustache.java', name: 'compiler', version: "0.9.10"
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.27'
}
// --- Preprocessors ---
File genSrc = file("src/gen/java")
sourceSets.main.java.srcDir genSrc
idea.module.generatedSourceDirs += genSrc
File dumpAstGrammar = file('./src/main/jastadd/DumpAst.relast')
File mustacheGrammar = file('./src/main/jastadd/mustache/Mustache.relast')
......@@ -56,6 +72,7 @@ task relast(type: JavaExec) {
file('./src/gen/jastadd/DumpAstResolverStubs.jrag'))
}
// --- JastAdd ---
jastadd {
configureModuleBuild()
modules {
......@@ -98,4 +115,70 @@ jastadd {
jastaddOptions = ["--lineColumnNumbers", "--List=JastAddList", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
}
// --- Tests ---
// --- Versioning and Publishing ---
group = 'de.tudresden.inf.st'
jar {
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
def versionFile = "src/main/resources/${project.getName()}Version.properties"
try {
def oldProps = new Properties()
file(versionFile).withInputStream { stream -> oldProps.load(stream) }
version = oldProps['version']
} catch (e) {
// this happens, if either the properties file is not present, or cannot be read from
throw new GradleException("File ${versionFile} not found or unreadable. Aborting.", e)
}
task printVersion() {
doLast {
println(version)
}
}
task newVersion() {
doFirst {
def props = new Properties()
props['version'] = value
props.store(file(versionFile).newWriter(), null)
}
}
task setDevVersionForCI() {
doFirst {
def props = new Properties()
props['version'] = version + "-$System.env.CI_PIPELINE_IID"
props.store(file(versionFile).newWriter(), null)
}
}
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
maven {
url "https://git-st.inf.tu-dresden.de/api/v4/projects/$System.env.CI_PROJECT_ID/packages/maven"
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
// --- Task order ---
generateAst.dependsOn relast
publish.dependsOn jar
// --- Buildscripts (must be at the top) ---
buildscript {
repositories.mavenCentral()
dependencies {
......@@ -5,30 +6,36 @@ buildscript {
}
}
// --- Plugin definitions ---
plugins {
id 'relast2uml.java-jastadd-conventions'
id 'relast2uml.java-application-conventions'
id 'java'
id 'java-library'
id 'idea'
id 'application'
id 'com.github.ben-manes.versions'
}
apply plugin: 'jastadd'
// --- Dependencies ---
repositories {
mavenCentral()
}
mainClassName = 'de.tudresden.inf.st.jastadd.featureTest.FeatureTestMain'
dependencies {
implementation project(":dumpAst")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
test {
useJUnitPlatform()
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "${jupiter_version}"
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.18.1'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${jupiter_version}"
}
// --- Preprocessors ---
File genSrc = file("src/gen/java")
sourceSets.main.java.srcDir genSrc
idea.module.generatedSourceDirs += genSrc
File testingGrammar = file('./src/main/jastadd/featureTest.relast')
......@@ -64,6 +71,7 @@ task relast(type: JavaExec) {
file('./src/gen/jastadd/featureTestResolverStubs.jrag'))
}
// --- JastAdd ---
jastadd {
configureModuleBuild()
modules {
......@@ -93,4 +101,11 @@ jastadd {
jastaddOptions = ["--lineColumnNumbers", "--List=JastAddList", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
}
// --- Tests ---
test.useJUnitPlatform()
// --- Versioning and Publishing ---
mainClassName = 'de.tudresden.inf.st.jastadd.featureTest.FeatureTestMain'
// --- Task order ---
generateAst.dependsOn relast
# Add relast2uml to your project
# Add DumpAst to your project
If you want to use `Relast2Uml`, either use the latest [pre-build version](#use-packaged-version) or clone the repository and [build it yourself](#build-from-source).
If you want to use `DumpAst`, either use the latest [pre-build version](#use-packaged-version) or clone the repository and [build it yourself](#build-from-source).
## Use packaged version
Check the [package overview page](https://git-st.inf.tu-dresden.de/jastadd/relast2uml/-/packages) to find the latest versions of the individual packages.
First add this GitLab as a repository in your `build.gradle`:
Add this GitLab as a repository, and `dumpAst` as a dependency in your `build.gradle`:
```
repositories {
......@@ -15,50 +15,15 @@ repositories {
url "https://git-st.inf.tu-dresden.de/api/v4/groups/jastadd/-/packages/maven"
}
}
```
### grammar2uml
To use `Grammar2uml`, add it as a dependency:
```
configurations {
grammar2umlClasspath
}
dependencies {
grammar2umlClasspath group: 'de.tudresden.inf.st', name: 'grammar2uml', version: '0.1.1'
}
```
Finally, add a task to create your visualization:
```
task grammar2uml(type: JavaExec) {
main = 'de.tudresden.inf.st.jastadd.grammar2uml.compiler.Compiler'
classpath = configurations.grammar2umlClasspath
args([
'--verbose',
'src/main/jastadd/GoalModel.relast'
])
}
```
### dumpAst
To use `DumpAst`, add it as a dependency:
```
dependencies {
implementation group: 'de.tudresden.inf.st', name: 'dumpAst', version: '0.3.7'
}
```
## Build from source
If you want to build the tools of `Relast2Uml` from source, first build the jar from the [Relast2Uml repository](https://git-st.inf.tu-dresden.de/jastadd/relast2uml):
If you want to build the tools of `DumpAst` from source, first build the jar from the [repository](https://git-st.inf.tu-dresden.de/jastadd/relast2uml):
```bash
git clone https://git-st.inf.tu-dresden.de/jastadd/relast2uml.git
......@@ -67,14 +32,15 @@ cd relast2uml
ls dumpAst/build/libs/
```
Those JARs can then be copied to your project.
This JAR can then be copied to your project.
```bash
cp dumpAst/build/libs/dumpAst-<version>.jar ../your-project/libs/dumpAst.jar
cd ../your-project/
```
Finally, this JAR has to be integrated into your build process. In case [Gradle](https://gradle.org/) is used, the JAR file needs to be added as dependency using:
Finally, this JAR has to be integrated into your build process.
In case [Gradle](https://gradle.org/) is used, the JAR file needs to be added as dependency using:
```groovy
dependencies {
......
// --- Buildscripts (must be at the top) ---
buildscript {
repositories.mavenLocal()
repositories.mavenCentral()
dependencies {
classpath group: 'org.jastadd', name: 'jastaddgradle', version: '1.13.3'
}
}
// --- Plugin definitions ---
plugins {
id 'relast2uml.java-jastadd-conventions'
id 'relast2uml.java-application-conventions'
id 'java'
id 'java-library'
id 'idea'
id 'application'
id 'com.github.ben-manes.versions'
}
apply plugin: 'jastadd'
// --- Dependencies ---
repositories {
mavenCentral()
}
dependencies {
implementation project(':dumpAst')
api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: "${jupiter_version}"
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.18.1'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${jupiter_version}"
}
mainClassName = 'de.tudresden.inf.st.jastadd.testDumper.TestDumperMain'
// --- Preprocessors ---
File testingGrammar = file('./src/main/jastadd/testDumper.relast')
task relast(type: JavaExec) {
......@@ -53,6 +68,7 @@ task relast(type: JavaExec) {
file('./src/gen/jastadd/testDumperResolverStubs.jrag'))
}
// --- JastAdd ---
jastadd {
configureModuleBuild()
modules {
......@@ -95,4 +111,11 @@ jastadd {
jastaddOptions = ["--lineColumnNumbers", "--List=JastAddList", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
}
// --- Tests ---
test.useJUnitPlatform()
// --- Versioning and Publishing ---
mainClassName = 'de.tudresden.inf.st.jastadd.testDumper.TestDumperMain'
// --- Task order ---
generateAst.dependsOn relast
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