Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Gradle 7 to build the project #79

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'temurin'
cache: 'gradle'
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build and analyze
uses: eskatos/gradle-command-action@v1
with:
Expand Down
23 changes: 13 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
plugins {
id 'java-library'
id 'org.sonarqube' version '3.0'
id 'org.sonarqube' version '3.3'
id 'jacoco'
}

group = 'com.worksap.nlp'
archivesBaseName = 'analysis-sudachi'
version = '2.1.1-SNAPSHOT'

sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.release = 8
}

repositories {
mavenCentral()
Expand All @@ -21,28 +22,30 @@ dependencies {
testRuntimeOnly "org.apache.logging.log4j:log4j-core:2.11.1"
}

task buildTestDict(dependsOn: 'processTestResources', type: JavaExec) {
main = 'com.worksap.nlp.sudachi.dictionary.DictionaryBuilder'
def buildTestDict = tasks.register('buildTestDict', JavaExec) {
dependsOn processTestResources
mainClass = 'com.worksap.nlp.sudachi.dictionary.DictionaryBuilder'
classpath = sourceSets.main.runtimeClasspath
args('-o', 'build/resources/test/com/worksap/nlp/lucene/sudachi/ja/system_core.dic', '-m', 'src/test/dict/matrix.def', 'src/test/dict/lex.csv')
}
test.dependsOn buildTestDict

task embedVersion(type: Copy) {
def embedVersion = tasks.register('embedVersion', Copy) {
from 'src/main/extras/plugin-descriptor.properties'
into 'build/descriptor'
expand([version: version, elasticsearchVersion: elasticsearchVersion])
}

task copyDependencies(type: Copy) {
def copyDependencies = tasks.register('copyDependencies', Copy) {
def libs = ['sudachi', 'javax.json', 'jdartsclone']
from configurations.runtimeClasspath.collect { f -> (libs.any { f.name.startsWith(it) }) ? f : null }
into 'build/libs'
}

task distZip(dependsOn: ['jar', 'embedVersion', 'copyDependencies'], type: Zip) {
def distZip = tasks.register('distZip', Zip) {
dependsOn 'jar', embedVersion, copyDependencies
archiveBaseName = archivesBaseName
appendix = elasticsearchVersion
archiveAppendix = elasticsearchVersion
from 'build/libs/', 'build/descriptor', 'LICENSE', 'README.md'
}

Expand All @@ -60,7 +63,7 @@ sonarqube {

jacocoTestReport {
reports {
xml.enabled true
xml.required = true
}
dependsOn test
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "elasticsearch-sudachi"