Skip to content
Snippets Groups Projects
Commit 636eca5b authored by René Schöne's avatar René Schöne
Browse files

Merge branch 'feature/maven-package' into 'develop'

Provide preprocessor as maven package

See merge request jastadd/relast-preprocessor!6
parents cee30f5c ea642ec5
Branches
No related tags found
No related merge requests found
...@@ -2,11 +2,10 @@ variables: ...@@ -2,11 +2,10 @@ variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
stages: stages:
- build
- test - test
- ragdoc_build - ragdoc_build
- ragdoc_view - ragdoc_view
- publish - deploy
before_script: before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle - export GRADLE_USER_HOME=`pwd`/.gradle
...@@ -16,24 +15,46 @@ cache: ...@@ -16,24 +15,46 @@ cache:
- .gradle/wrapper - .gradle/wrapper
- .gradle/caches - .gradle/caches
build: ## Hidden jobs, base configurations
image: openjdk:8 .test:
stage: build image: openjdk:11
stage: test
script: script:
- ./gradlew --console=plain --no-daemon assemble - ./gradlew --console=plain --no-daemon test
artifacts: artifacts:
reports:
junit: build/test-results/test/**/TEST-*.xml
paths: paths:
- "src/gen" - "src/gen"
expire_in: 1 week expire_in: 1 week
test: .publish_dev:
image: openjdk:8 image: openjdk:11
stage: test stage: deploy
script: script:
- ./gradlew --console=plain --no-daemon test - "./gradlew setDevVersionForCI"
artifacts: - "./gradlew publish"
reports:
junit: build/test-results/test/**/TEST-*.xml ## Real jobs
test8:
extends: .test
image: "openjdk:8"
test11:
extends: .test
image: "openjdk:11"
publish_dev8:
extends: .publish_dev
image: "openjdk:8"
needs:
- test8
publish_dev11:
extends: .publish_dev
image: "openjdk:11"
needs:
- test11
ragdoc_build: ragdoc_build:
image: image:
...@@ -41,7 +62,7 @@ ragdoc_build: ...@@ -41,7 +62,7 @@ ragdoc_build:
entrypoint: [""] entrypoint: [""]
stage: ragdoc_build stage: ragdoc_build
needs: needs:
- build - test8
script: script:
- JAVA_FILES=$(find src/ -name '*.java') - JAVA_FILES=$(find src/ -name '*.java')
- /ragdoc-builder/start-builder.sh -excludeGenerated -d data/ $JAVA_FILES - /ragdoc-builder/start-builder.sh -excludeGenerated -d data/ $JAVA_FILES
...@@ -72,10 +93,10 @@ ragdoc_view: ...@@ -72,10 +93,10 @@ ragdoc_view:
pages: pages:
image: python:3.8-buster image: python:3.8-buster
stage: publish stage: deploy
needs: needs:
- ragdoc_view - ragdoc_view
- test - test8
before_script: before_script:
- pip install -U mkdocs mkdocs-macros-plugin mkdocs-git-revision-date-localized-plugin - pip install -U mkdocs mkdocs-macros-plugin mkdocs-git-revision-date-localized-plugin
script: script:
......
plugins { plugins {
id 'com.github.ben-manes.versions' version '0.42.0'
id 'java-library' id 'java-library'
id 'application' id 'application'
id 'org.jastadd' id 'org.jastadd' version "${jastaddgradle_version}"
id 'java' id 'java'
id 'idea' id 'idea'
id 'maven-publish'
id 'java-test-fixtures' id 'java-test-fixtures'
} }
...@@ -11,14 +13,23 @@ ext { ...@@ -11,14 +13,23 @@ ext {
mainClassName = 'org.jastadd.relast.compiler.RelastSourceToSourceCompiler' mainClassName = 'org.jastadd.relast.compiler.RelastSourceToSourceCompiler'
} }
group = 'org.jastadd'
// set the main class name for `gradle run` // set the main class name for `gradle run`
application.mainClassName = "${mainClassName}" application.mainClassName = "${mainClassName}"
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories { repositories {
mavenCentral() mavenCentral()
maven {
name 'gitlab-maven'
url 'https://git-st.inf.tu-dresden.de/api/v4/groups/jastadd/-/packages/maven'
}
}
configurations {
grammar2uml
relast
jss
} }
sourceSets { sourceSets {
...@@ -27,56 +38,65 @@ sourceSets { ...@@ -27,56 +38,65 @@ sourceSets {
srcDir "src/gen/java" srcDir "src/gen/java"
} }
} }
main {
compileClasspath += sourceSets.model.output
resources {
srcDir "src/main/jastadd"
}
}
test {
runtimeClasspath += sourceSets.model.output
}
} }
def versionFile = 'src/main/resources/preprocessor.properties' File genSrc = file("src/gen/java")
def versionProps = new Properties() idea.module.generatedSourceDirs += genSrc
def versionFile = 'src/main/resources/RelASTPreprocessorVersion.properties'
def oldProps = new Properties()
try { try {
file(versionFile).withInputStream { stream -> versionProps.load(stream) } file(versionFile).withInputStream { stream -> oldProps.load(stream) }
version = versionProps['version'] version = oldProps['version']
} catch (e) { } catch (ignored) {
// this happens, if either the properties file is not present, or cannot be read from // 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) throw new GradleException("File ${versionFile} not found or unreadable. Aborting.")
} }
task fatJar(type: Jar) { task newVersion() {
group = "build" doFirst {
archiveAppendix = "fatjar" def props = new Properties()
from sourceSets.main.output props['version'] = value
from { props.store(file(versionFile).newWriter(), null)
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
manifest {
attributes "Main-Class": "${mainClassName}"
} }
} }
task modelJar(type: Jar) { task printVersion() {
group = "build" doLast {
archiveAppendix = "model" println(version)
from sourceSets.model.output }
} }
artifacts { task setDevVersionForCI() {
archives modelJar doFirst {
archives fatJar def props = new Properties()
props['version'] = version + "-$System.env.CI_PIPELINE_IID"
props.store(file(versionFile).newWriter(), null)
}
} }
dependencies { dependencies {
modelImplementation group: 'org.jastadd', name: 'jastadd', version: '2.3.5'
modelImplementation group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11' modelImplementation group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
implementation files(modelJar.archiveFile.get()) grammar2uml group: 'de.tudresden.inf.st', name: 'grammar2uml', version: "${grammar2uml_version}"
relast group: 'org.jastadd', name: 'relast', version: "${relast_version}"
api group: 'org.jastadd', name: 'jastadd', version: '2.3.5' api group: 'org.jastadd', name: 'jastadd', version: '2.3.5'
api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11' api group: 'net.sf.beaver', name: 'beaver-rt', version: '0.9.11'
implementation group: 'com.github.jknack', name: 'handlebars', version: '4.3.0' implementation group: 'com.github.jknack', name: 'handlebars', version: '4.3.0'
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.27' implementation group: 'org.yaml', name: 'snakeyaml', version: '1.27'
// test
testRuntimeClasspath files(modelJar.archiveFile.get())
// test fixtures // test fixtures
testFixturesApi group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.30' testFixturesApi group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.30'
testFixturesApi group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.0' testFixturesApi group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.0'
...@@ -110,8 +130,9 @@ def relastOutputFiles = [ ...@@ -110,8 +130,9 @@ def relastOutputFiles = [
] ]
task relast(type: JavaExec) { task relast(type: JavaExec) {
classpath = files("libs/relast.jar")
group = 'Build' group = 'Build'
classpath = configurations.relast
mainClass = 'org.jastadd.relast.compiler.Compiler'
doFirst { doFirst {
delete relastOutputFiles delete relastOutputFiles
...@@ -190,12 +211,34 @@ jastadd { ...@@ -190,12 +211,34 @@ jastadd {
jastaddOptions = ["--lineColumnNumbers", "--List=JastAddList", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"] jastaddOptions = ["--lineColumnNumbers", "--List=JastAddList", "--safeLazy", "--visitCheck=true", "--rewrite=cnta", "--cache=all"]
} }
generateAst.dependsOn relast // publish gitlab project
publishing {
publications {
maven(MavenPublication) {
artifactId = project.getName() + (JavaVersion.current() == JavaVersion.VERSION_1_8 ? '-java8' : '')
clean.dependsOn(cleanGen) from components.java
}
}
repositories {
maven {
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)
}
}
modelJar.dependsOn(generateAst, modelClasses) }
modelClasses.dependsOn(generateAst) }
compileJava.dependsOn(modelJar)
jar.dependsOn(modelJar) generateAst.dependsOn relast
clean.dependsOn cleanGen
relast_version = 0.4.0
relast2uml_version = 0.3.7-59
jupyter_version = 5.8.2
assertj_version = 3.22.0
grammar2uml_version = 0.2.1
jastaddgradle_version = 1.14.5
No preview for this file type
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
...@@ -82,6 +82,7 @@ esac ...@@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
...@@ -129,6 +130,7 @@ fi ...@@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
......
...@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. ...@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
...@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome ...@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
...@@ -51,7 +54,7 @@ goto fail ...@@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
...@@ -61,28 +64,14 @@ echo location of your Java installation. ...@@ -61,28 +64,14 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
......
File deleted
...@@ -44,8 +44,9 @@ def relastOutputFiles = [ ...@@ -44,8 +44,9 @@ def relastOutputFiles = [
] ]
task relast(type: JavaExec) { task relast(type: JavaExec) {
classpath = files("relast.preprocessor/libs/relast.jar")
group = 'Build' group = 'Build'
classpath = configurations.relast
mainClass = 'org.jastadd.relast.compiler.Compiler'
doFirst { doFirst {
delete relastOutputFiles delete relastOutputFiles
......
pluginManagement { rootProject.name = 'relast-preprocessor'
plugins { \ No newline at end of file
id 'org.jastadd' version '1.13.3'
}
}
version=0.1.0
version=1.0.0-pre-release
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment