Skip to content

Commit

Permalink
chore: upgrade gradle and dependencies. (halo-dev#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby authored Mar 17, 2020
1 parent d4cfc3a commit fc989c9
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 115 deletions.
137 changes: 70 additions & 67 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id "io.freefair.lombok" version "3.6.6"
id 'org.springframework.boot' version '2.2.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'checkstyle'
id 'java'
}

apply plugin: 'io.spring.dependency-management'

group = 'run.halo.app'
archivesBaseName = 'halo'
version = '1.3.0-beta.2'
sourceCompatibility = '1.8'
description = 'Halo, personal blog system developed in Java.'
description = 'Halo, An excellent open source blog publishing application.'

repositories {
maven {
Expand All @@ -32,36 +30,39 @@ configurations {
runtimeClasspath {
extendsFrom developmentOnly
}

compileOnly {
extendsFrom annotationProcessor
}
}

bootJar {
manifest {
attributes('Implementation-Title': 'Halo Application',
'Implementation-Version': version)
'Implementation-Version': archiveVersion)
}
}

ext {
hutoolVersion = '5.0.3'
upyunSdkVersion = '4.0.1'
qiniuSdkVersion = '7.2.18'
aliyunSdkVersion = '3.4.2'
baiduSdkVersion = '0.10.36'
qcloudSdkVersion = '5.5.7'
swaggerVersion = '2.9.2'
commonsLangVersion = '3.8.1'
httpclientVersion = '4.5.7'
dataformatYamlVersion = '2.9.2'
jgitVersion = '5.3.0.201903130848-r'
flexmarkVersion = '0.42.12'
thumbnailatorVersion = '0.4.8'
image4jVersion = '0.7zensight1'
flywayVersion = '6.1.0'
h2Version = '1.4.196'
levelDbVersion = '0.12'
jsonVersion = '20190722'
fastJsonVersion = '1.2.56'
templateInheritance = "0.4.RELEASE"
set('hutoolVersion', "5.2.3")
set('upyunSdkVersion', "4.2.0")
set('qiniuSdkVersion', "7.2.28")
set('aliyunSdkVersion', "3.8.1")
set('baiduSdkVersion', "0.10.36")
set('qcloudSdkVersion', "5.6.18")
set('swaggerVersion', "2.9.2")
set('commonsLangVersion', "3.9")
set('httpclientVersion', "4.5.12")
set('dataformatYamlVersion', "2.10.3")
set('jgitVersion', "5.7.0.202003110725-r")
set('flexmarkVersion', "0.42.12")
set('thumbnailatorVersion', "0.4.11")
set('image4jVersion', "0.7zensight1")
set('flywayVersion', "6.3.1")
set('h2Version', "1.4.196")
set('levelDbVersion', "0.12")
set('jsonVersion', "20190722")
set('fastJsonVersion', "1.2.66")
}

dependencies {
Expand All @@ -70,55 +71,57 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-undertow'
implementation 'org.springframework.boot:spring-boot-starter-freemarker'
implementation "kr.pe.kwonnam.freemarker:freemarker-template-inheritance:$templateInheritance"
implementation "com.sun.mail:jakarta.mail"

implementation "cn.hutool:hutool-core:$hutoolVersion"
implementation "cn.hutool:hutool-crypto:$hutoolVersion"
implementation "cn.hutool:hutool-extra:$hutoolVersion"
implementation "com.upyun:java-sdk:$upyunSdkVersion"
implementation "com.qiniu:qiniu-java-sdk:$qiniuSdkVersion"
implementation "com.aliyun.oss:aliyun-sdk-oss:$aliyunSdkVersion"
implementation "com.baidubce:bce-java-sdk:$baiduSdkVersion"
implementation "com.qcloud:cos_api:$qcloudSdkVersion"
implementation "io.springfox:springfox-swagger2:$swaggerVersion"
implementation "io.springfox:springfox-swagger-ui:$swaggerVersion"
implementation "org.apache.commons:commons-lang3:$commonsLangVersion"
implementation "org.apache.httpcomponents:httpclient:$httpclientVersion"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$dataformatYamlVersion"
implementation "org.eclipse.jgit:org.eclipse.jgit:$jgitVersion"

implementation "com.vladsch.flexmark:flexmark:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-attributes:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-autolink:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-emoji:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-escaped-character:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-tasklist:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-ins:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-media-tags:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-tables:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-toc:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-ext-gitlab:$flexmarkVersion"
implementation "com.vladsch.flexmark:flexmark-html-parser:$flexmarkVersion"

implementation "net.coobird:thumbnailator:$thumbnailatorVersion"
implementation "net.sf.image4j:image4j:$image4jVersion"
implementation "org.flywaydb:flyway-core:$flywayVersion"

implementation "org.json:json:$jsonVersion"
implementation "com.alibaba:fastjson:$fastJsonVersion"

implementation "org.iq80.leveldb:leveldb:$levelDbVersion"
runtimeOnly "com.h2database:h2:$h2Version"
implementation "cn.hutool:hutool-core:${hutoolVersion}"
implementation "cn.hutool:hutool-crypto:${hutoolVersion}"
implementation "cn.hutool:hutool-extra:${hutoolVersion}"
implementation "com.upyun:java-sdk:${upyunSdkVersion}"
implementation "com.qiniu:qiniu-java-sdk:${qiniuSdkVersion}"
implementation "com.aliyun.oss:aliyun-sdk-oss:${aliyunSdkVersion}"
implementation "com.baidubce:bce-java-sdk:${baiduSdkVersion}"
implementation "com.qcloud:cos_api:${qcloudSdkVersion}"
implementation "io.springfox:springfox-swagger2:${swaggerVersion}"
implementation "io.springfox:springfox-swagger-ui:${swaggerVersion}"
implementation "org.apache.commons:commons-lang3:${commonsLangVersion}"
implementation "org.apache.httpcomponents:httpclient:${httpclientVersion}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${dataformatYamlVersion}"
implementation "org.eclipse.jgit:org.eclipse.jgit:${jgitVersion}"

implementation "com.vladsch.flexmark:flexmark:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-attributes:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-autolink:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-emoji:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-escaped-character:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-tasklist:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-ins:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-media-tags:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-tables:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-toc:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-ext-gitlab:${flexmarkVersion}"
implementation "com.vladsch.flexmark:flexmark-html-parser:${flexmarkVersion}"

implementation "net.coobird:thumbnailator:${thumbnailatorVersion}"
implementation "net.sf.image4j:image4j:${image4jVersion}"
implementation "org.flywaydb:flyway-core:${flywayVersion}"

implementation "org.json:json:${jsonVersion}"
implementation "com.alibaba:fastjson:${fastJsonVersion}"

implementation "org.iq80.leveldb:leveldb:${levelDbVersion}"
runtimeOnly "com.h2database:h2:${h2Version}"
runtimeOnly 'mysql:mysql-connector-java'


compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

testImplementation 'org.springframework.boot:spring-boot-starter-test'

developmentOnly 'org.springframework.boot:spring-boot-devtools'
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Sep 09 12:27:59 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
22 changes: 19 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@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"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
2 changes: 0 additions & 2 deletions lombok.config

This file was deleted.

26 changes: 4 additions & 22 deletions src/main/java/run/halo/app/config/WebMvcAutoConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
import freemarker.core.TemplateClassResolver;
import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler;
import freemarker.template.TemplateModel;
import kr.pe.kwonnam.freemarker.inheritance.BlockDirective;
import kr.pe.kwonnam.freemarker.inheritance.ExtendsDirective;
import kr.pe.kwonnam.freemarker.inheritance.PutDirective;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.jackson.JsonComponentModule;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -39,7 +35,10 @@

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;

import static run.halo.app.model.support.HaloConst.FILE_SEPARATOR;
import static run.halo.app.utils.HaloUtils.*;
Expand Down Expand Up @@ -135,16 +134,6 @@ public void addFormatters(FormatterRegistry registry) {
registry.addConverterFactory(new StringToEnumConverterFactory());
}

@Bean
public Map<String, TemplateModel> freemarkerLayoutDirectives() {
Map<String, TemplateModel> freemarkerLayoutDirectives = new HashMap<>(5);
freemarkerLayoutDirectives.put("extends", new ExtendsDirective());
freemarkerLayoutDirectives.put("block", new BlockDirective());
freemarkerLayoutDirectives.put("put", new PutDirective());

return freemarkerLayoutDirectives;
}

/**
* Configuring freemarker template file path.
*
Expand Down Expand Up @@ -173,13 +162,6 @@ public FreeMarkerConfigurer freemarkerConfig(HaloProperties haloProperties) thro
// Set predefined freemarker configuration
configurer.setConfiguration(configuration);

// Set layout variable
Map<String, Object> freemarkerVariables = new HashMap<>(3);

freemarkerVariables.put("layout", freemarkerLayoutDirectives());

configurer.setFreemarkerVariables(freemarkerVariables);

return configurer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public UploadResult upload(MultipartFile file) {
// Handle thumbnail
if (FileHandler.isImageType(uploadResult.getMediaType())) {
ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension);
assert image != null;
uploadResult.setWidth(image.getWidth(0));
uploadResult.setHeight(image.getHeight(0));
if (ImageUtils.EXTENSION_ICO.equals(extension)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public UploadResult upload(MultipartFile file) {
// Handle thumbnail
if (FileHandler.isImageType(uploadResult.getMediaType())) {
ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension);
assert image != null;
uploadResult.setWidth(image.getWidth(0));
uploadResult.setHeight(image.getHeight(0));
if (ImageUtils.EXTENSION_ICO.equals(extension)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public UploadResult upload(MultipartFile file) {
// Handle thumbnail
if (FileHandler.isImageType(uploadResult.getMediaType())) {
ImageReader image = ImageUtils.getImageReaderFromFile(file.getInputStream(), extension);
assert image != null;
uploadResult.setWidth(image.getWidth(0));
uploadResult.setHeight(image.getHeight(0));
if (ImageUtils.EXTENSION_ICO.equals(extension)) {
Expand Down
Loading

0 comments on commit fc989c9

Please sign in to comment.