Skip to content

Commit

Permalink
Merge pull request #16 from UniVE-SSV/modularization
Browse files Browse the repository at this point in the history
Modularization
  • Loading branch information
VincenzoArceri authored Sep 24, 2021
2 parents 5fa6108 + 29cfb35 commit 576056c
Show file tree
Hide file tree
Showing 560 changed files with 2,364 additions and 737 deletions.
8 changes: 4 additions & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
LICENSE @lucaneg
*.md @lucaneg
logo.png @lucaneg
/lisa/*.gradle @lucaneg
/lisa/checkstyle-config.xml @lucaneg
/lisa/spotless-formatting.xml @lucaneg
/lisa/gradle/* @lucaneg
*.gradle @lucaneg
checkstyle-config.xml @lucaneg
spotless-formatting.xml @lucaneg
**/gradle/* @lucaneg
* @lucaneg @VincenzoArceri
2 changes: 1 addition & 1 deletion .github/workflows/cron-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: 'Cron Test Results'
files: lisa/build/test-results/**/TEST-*.xml
files: lisa/lisa-*/build/test-results/**/TEST-*.xml
2 changes: 0 additions & 2 deletions .github/workflows/docs-links-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
uses: actions/checkout@v2
with:
ref: 'gh-pages'
- name: 'Grant execute permission for check-links.sh'
run: chmod +x .github/scripts/check-links.sh
- name: 'Execute the script'
shell: '/bin/bash {0}'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: lisa/build/test-results/**/TEST-*.xml
files: lisa/lisa-*/build/test-results/**/TEST-*.xml
2 changes: 1 addition & 1 deletion .github/workflows/gradle-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: 'All Test Results (unit + cron)'
files: lisa/build/test-results/**/TEST-*.xml
files: lisa/lisa-*/build/test-results/**/TEST-*.xml
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: 'All Test Results (unit + cron)'
files: lisa/build/test-results/**/TEST-*.xml
files: lisa/lisa-*/build/test-results/**/TEST-*.xml
3 changes: 0 additions & 3 deletions lisa/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
# These are explicitly windows files and should use crlf
*.bat text eol=crlf


* text eol=lf
*.jar -text
3 changes: 2 additions & 1 deletion lisa/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ local.properties
diagrams/

# tests
test-outputs/
test-outputs/
/bin/
13 changes: 0 additions & 13 deletions lisa/antlr.gradle

This file was deleted.

154 changes: 71 additions & 83 deletions lisa/build.gradle
Original file line number Diff line number Diff line change
@@ -1,96 +1,84 @@
/*
* This file contains the general configuration of the build script and the list of plugins to apply.
* Anything else, with very few exceptions, should be placed into a separate gradle file that has to
* be applied at the end of this file.
* be applied at the end of this file, or in project-specific build files.
*
* When defining a custom task, use 'tasks.register("taskname")', specifying also group and description,
* When defining a custom task, use 'tasks.register('taskname')', specifying also group and description,
* to help others understand the purpose of that task.
*/
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar.grgit:grgit-core:4.0.2'
classpath 'org.ajoberstar.grgit:grgit-gradle:4.0.2'
}
}

plugins {
// telling gradle that we are building a library
id 'java-library'

// magic for getting eclipse to work with gradle
id 'eclipse'

// antlr plugin for the generation of the IMP parser
id 'antlr'

// automatic generation of plantuml files from the source code
// for visualizing them: https://www.planttext.com/
id 'com.github.roroche.plantuml' version '1.0.2'

// this can generate images from plantuml files
// it requires graphviz to be installed
id "org.fmiw.plantuml" version "0.1"

// parse git information during the build
id 'org.ajoberstar.grgit' version '4.0.2'

// code formatting task -- spotlessCheck for checking, spotlessApply for applying
id "com.diffplug.spotless" version "5.8.2"

// javadoc checking - coding conventions
id 'checkstyle'
allprojects {
repositories {
mavenCentral()
}

// this enables './gradlew <task> taskTree' to show task dependencies
id "com.dorongold.task-tree" version "1.5"

// publication on maven central
id 'maven-publish'
id 'signing'

// coverage reports
id 'jacoco'
}
group = 'it.unive'
version = '0.1b1'

// the code reading data from the git repo has to be placed in the same file where its
// plugin is applied, otherwise it will fail to load the classes from it. We export the
// properties that we read for using them later in the appropriate gradle files
def ready = false
def cid = ''
def tag = ''
def branch = ''
def is_clean = ''
try {
def repo = org.ajoberstar.grgit.Grgit.open(dir: rootProject.projectDir.getParent())
ready = true
cid = repo.head().abbreviatedId
tag = repo.describe(tags: true, always: true)
branch = repo.branch.current().getName()
is_clean = repo.status().isClean()
} catch (Exception e) {
// this means we are building from outside of LiSA, probably from an outer model
// we can skip the manifest attributes injection here
println("Skipping manifest attriubtes injection because we are not directly building LiSA")
println(e)
// the code reading data from the git repo has to be placed in the same file where its
// plugin is applied, otherwise it will fail to load the classes from it. We export the
// properties that we read for using them later in the appropriate gradle files
def ready = false
def cid = ''
def tag = ''
def branch = ''
def is_clean = ''
try {
def repo = org.ajoberstar.grgit.Grgit.open(dir: rootProject.projectDir.getParent())
ready = true
cid = repo.head().abbreviatedId
tag = repo.describe(tags: true, always: true)
branch = repo.branch.current().getName()
is_clean = repo.status().isClean()
} catch (Exception e) {
// this means we are building from outside of LiSA, probably from an outer model
// we can skip the manifest attributes injection here
println('Skipping manifest attriubtes injection because we are not directly building LiSA')
println(e)
}

ext {
git_ready = ready
git_cid = cid
git_tag = tag
git_branch = branch
git_is_clean = is_clean
}
}

ext {
git_ready = ready
git_cid = cid
git_tag = tag
git_branch = branch
git_is_clean = is_clean
buildscript {
repositories {
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}

dependencies {
classpath 'org.ajoberstar.grgit:grgit-core:4.0.2'
classpath 'org.ajoberstar.grgit:grgit-gradle:4.0.2'

classpath 'com.github.roroche:plantuml-gradle-plugin:1.0.2'
classpath 'gradle.plugin.org.fmiw:plantuml-gradle-plugin:0.1'

classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.15.0'
}
}

group = 'it.unive'
version = '0.1b1'

apply from: 'dependencies.gradle'
apply from: 'java.gradle'
apply from: 'code-style.gradle'
apply from: 'doc-extra.gradle'
apply from: 'antlr.gradle'
apply from: 'publishing.gradle'
subprojects {
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'com.github.roroche.plantuml' // generation of plantuml from source code (visualization: https://www.planttext.com/)
apply plugin: 'org.fmiw.plantuml' // plantuml to png
apply plugin: 'org.ajoberstar.grgit' // parse git information during the build
apply plugin: 'com.diffplug.spotless' // code formatting task
apply plugin: 'checkstyle' // javadoc checking - coding conventions
apply plugin: 'maven-publish' // publication on maven central
apply plugin: 'signing' // artifact signing
apply plugin: 'jacoco' // coverage reports

apply from: "${project.rootDir}/code-style.gradle"
apply from: "${project.rootDir}/doc-extra.gradle"
apply from: "${project.rootDir}/java.gradle"
apply from: "${project.rootDir}/publishing.gradle"
}
115 changes: 55 additions & 60 deletions lisa/code-style.gradle
Original file line number Diff line number Diff line change
@@ -1,90 +1,85 @@
checkstyle {
configFile = file("checkstyle-config.xml")
sourceSets = []
showViolations = true
toolVersion '8.38'
configFile = file(new File(rootProject.projectDir, 'checkstyle-config.xml'))
sourceSets = []
showViolations = true
toolVersion '8.38'
}

checkstyleMain {
finalizedBy 'checkstyleErrorMessage'
reports {
xml.enabled false
html.enabled false
}
}
checkstyleTest.enabled = false

checkstyleTest {
finalizedBy 'checkstyleErrorMessage'
checkstyleMain {
finalizedBy 'checkstyleErrorMessage'
reports {
xml.enabled false
html.enabled false
xml.required = false
html.required = false
}

// only included files will be checked
include 'it/unive/lisa/test/imp/**/*.java'
exclude '**/*Test.java'
}

task checkstyleErrorMessage {
onlyIf {
checkstyleMain.state.failure != null || checkstyleTest.state.failure != null
}
doLast {
logger.error('Checkstyle plugin thrown an error. This means that the javadoc is not correctly setup. Inspect console output to find problematic javadocs.')
logger.error('To reproduce locally, execute \'./gradlew checkstyleMain checkstyleTest\'')
}
onlyIf {
checkstyleMain.state.failure != null
}
doLast {
logger.error('Checkstyle plugin thrown an error. This means that the javadoc is not correctly setup. Inspect console output to find problematic javadocs.')
logger.error('To reproduce locally, execute \'./gradlew checkstyleMain\'')
}
}

spotless {
enforceCheck = false
encoding 'UTF-8'
lineEndings 'UNIX'
java {
// tabs, no spaces
indentWithTabs()
enforceCheck = false
encoding 'UTF-8'
lineEndings 'UNIX'
java {
// tabs, no spaces
indentWithTabs()

// keep imports clean
importOrder()
removeUnusedImports()
// keep imports clean
importOrder()
removeUnusedImports()

// use the eclipse formatting with the one provided with the project
eclipse().configFile('spotless-formatting.xml')
// use the eclipse formatting with the one provided with the project
eclipse().configFile(new File(rootProject.projectDir, 'spotless-formatting.xml'))

// ignore generated code
target project.fileTree(project.projectDir) {
include '**/*.java'
exclude '**/build/generated/**'
exclude '**/build/generated-src/**'
exclude '**/target/generated-sources/**'
}
}
antlr4 {
target 'src/*/antlr/**/*.g4'
antlr4Formatter()
}
// ignore generated code
target project.fileTree(project.projectDir) {
include '**/*.java'
exclude '**/build/generated/**'
exclude '**/build/generated-src/**'
exclude '**/target/generated-sources/**'
}
}
antlr4 {
target 'src/*/antlr/**/*.g4'
antlr4Formatter()
}
}

spotlessJava {
// declaring explicit dependencies
dependsOn 'compileJava', 'compileTestJava', 'processTestResources', 'spotlessAntlr4'
}

spotlessJavaCheck {
finalizedBy 'spotlessErrorMessage'
finalizedBy 'spotlessErrorMessage'
}

spotlessAntlr4Check {
finalizedBy 'spotlessErrorMessage'
finalizedBy 'spotlessErrorMessage'
}

task spotlessErrorMessage {
onlyIf {
spotlessJavaCheck.state.failure != null || spotlessAntlr4Check.state.failure != null
}
doLast {
logger.error('Spotless plugin thrown an error. This means that the code is not correctly formatted.')
logger.error('To reproduce locally, execute \'./gradlew spotlessCheck\'')
logger.error('To automatically fix all the problems, execute \'./gradlew spotlessApply\'')
}
onlyIf {
spotlessJavaCheck.state.failure != null || spotlessAntlr4Check.state.failure != null
}
doLast {
logger.error('Spotless plugin thrown an error. This means that the code is not correctly formatted.')
logger.error('To reproduce locally, execute \'./gradlew spotlessCheck\'')
logger.error('To automatically fix all the problems, execute \'./gradlew spotlessApply\'')
}
}

tasks.register('checkCodeStyle') {
group = 'verification'
description = 'Execute spotless and checkstyle to ensure code and javadoc formatting'
dependsOn 'spotlessCheck', 'checkstyleMain', 'checkstyleTest'
dependsOn 'spotlessCheck', 'checkstyleMain', 'checkstyleTest'
}
Loading

0 comments on commit 576056c

Please sign in to comment.