Skip to content

Commit

Permalink
Migrate to Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
marianobarrios committed Oct 17, 2023
1 parent 099d71f commit e1a1ab9
Show file tree
Hide file tree
Showing 11 changed files with 466 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 11, 17, 20 ]
java-version: [ 11, 17, 21 ]
steps:
- uses: actions/checkout@v4

Expand All @@ -15,7 +15,7 @@ jobs:
java-version: ${{ matrix.java-version }}

- name: build
run: sbt -v +test
run: ./gradlew check

- uses: actions/upload-artifact@v3
if: always()
Expand Down
15 changes: 4 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
target/
.project
.classpath
.cache
.cache-main
.cache-tests
/bin/
*.log
.settings
.idea/
/.bsp/
/build/
/*.log
/.idea/
/.gradle
109 changes: 109 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
plugins {
id 'java'
id 'scala'
id 'signing'
id 'maven-publish'
}

compileJava {
options.compilerArgs.addAll(['--source', '11', '--target', '11', '-Xlint'])
}

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
// regex parser
implementation 'org.jparsec:jparsec:3.1'

// log
implementation 'org.slf4j:slf4j-api:2.0.6'
testRuntimeOnly 'ch.qos.logback:logback-classic:1.3.4'

// tests are in Scala
testImplementation 'org.scala-lang:scala-library:2.13.10'

// test framework
testImplementation 'org.scalatest:scalatest-funsuite_2.13:3.2.15'

// required by ScalaTest
testRuntimeOnly 'com.vladsch.flexmark:flexmark-all:0.64.8'
}

compileScala {
options.compilerArgs = [
"-language:implicitConversions",
"-Xlint",
"-deprecation",
"-Xfatal-warnings"
]
}

task scalaTest(dependsOn: ['testClasses'], type: JavaExec) {
// override security properties enabling all options
mainClass = 'org.scalatest.tools.Runner'
args = ['-R', 'build/classes/scala/test', '-o']
args += ['-h', file("$buildDir/reports/test")]
classpath = sourceSets.test.runtimeClasspath
}

test.enabled = false
check.dependsOn scalaTest

javadoc {
exclude "dregex/impl"
}

java {
withSourcesJar()
withJavadocJar()
}

publishing {
publications {
dregex(MavenPublication) {
groupId = 'com.github.marianobarrios'
artifactId = 'dregex'
version = '0.8.0-SNAPSHOT'
from components.java
pom {
name = 'dregex'
description = 'Dregex is a Java library that implements a regular expression engine using deterministic ' +
'finite automata (DFA). It supports some Perl-style features and yet retains linear matching time, and ' +
'also offers set operations.'
url = 'https://github.com/marianobarrios/dregex'
licenses {
license {
name = 'BSD 2-Clause "Simplified" License'
url = 'https://opensource.org/license/bsd-2-clause/'
}
}
developers {
developer {
name = 'Mariano Barrios'
email = 'marbar@gmail.com'
}
}
scm {
connection = 'scm:git@github.com:marianobarrios/dregex.git'
url = 'scm:git@github.com:marianobarrios/dregex.git'
}
}
}
}
repositories {
maven {
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username = project.findProperty('sonatypeUsername')
password = project.findProperty('sonatypePassword')
}
}
}
}

signing {
sign publishing.publications.dregex
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit e1a1ab9

Please sign in to comment.