Skip to content

Commit a4d5b43

Browse files
committed
Обновлена конфигурация сборки, обновлены библиотеки
1 parent d58bf6f commit a4d5b43

File tree

3 files changed

+48
-25
lines changed

3 files changed

+48
-25
lines changed

build.gradle

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
apply plugin: 'java'
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath 'net.sf.proguard:proguard-gradle:6.0.1'
7+
}
8+
}
9+
10+
plugins {
11+
id "java"
12+
id "com.github.johnrengelman.shadow" version "2.0.2"
13+
}
14+
15+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
16+
import proguard.gradle.ProGuardTask
17+
218

319
sourceCompatibility = '1.8'
420
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
@@ -14,15 +30,6 @@ repositories {
1430
jcenter()
1531
}
1632

17-
buildscript {
18-
repositories {
19-
mavenCentral()
20-
}
21-
dependencies {
22-
classpath 'net.sf.proguard:proguard-gradle:5.2.1'
23-
}
24-
}
25-
2633
task generateJavaSources() {
2734
doLast {
2835
def source = """
@@ -53,22 +60,38 @@ task runOptimizing(dependsOn: classes, type: JavaExec) {
5360
args '-o 9 -m -a -f program.own'.split(' ')
5461
}
5562

56-
task dist(dependsOn: classes, type: Jar) {
57-
from files(sourceSets.main.output.classesDir)
58-
from files(sourceSets.main.output.resourcesDir)
59-
from {configurations.compile.collect {zipTree(it)}}
63+
task dist(type: ShadowJar) {
64+
from sourceSets.main.output
65+
configurations = [project.configurations.runtime]
6066
destinationDir file("$rootProject.projectDir/dist")
6167

68+
exclude 'META-INF/*.DSA'
69+
exclude 'META-INF/*.RSA'
70+
exclude 'META-INF/maven/**'
71+
exclude 'LICENSE*'
72+
6273
manifest.attributes(
6374
'Main-Class': project.mainClass,
6475
'Build-Date': new Date().format('YYMMdd')
6576
)
6677
}
6778

68-
task proguard(dependsOn: dist, type: proguard.gradle.ProGuardTask) {
79+
task proguard(dependsOn: dist, type: ProGuardTask) {
6980
configuration "$rootProject.projectDir/proguard.properties"
7081
injars "$rootProject.projectDir/dist/OwnLang.jar"
7182
outjars "$rootProject.projectDir/store/OwnLang.jar"
83+
84+
// Automatically handle the Java version of this build.
85+
if (System.getProperty('java.version').startsWith('1.')) {
86+
// Before Java 9, the runtime classes were packaged in a single jar file.
87+
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
88+
} else {
89+
// As of Java 9, the runtime classes are packaged in modular jmod files.
90+
def jmods = files { file("${System.getProperty('java.home')}/jmods").listFiles() }
91+
jmods.each {
92+
libraryjars it, jarfilter: '!**.jar', filter: '!module-info.class'
93+
}
94+
}
7295
}
7396

7497
task sandbox(dependsOn: proguard, type: Jar) {
@@ -80,22 +103,23 @@ task sandbox(dependsOn: proguard, type: Jar) {
80103
"**/modules/java/**", "**/modules/jdbc/**", "**/modules/robot/**",
81104
"**/modules/socket/**", "io/**",
82105
"**/modules/aimp/**", "aimpremote/**",
83-
"**/modules/downloader/**"
106+
"**/modules/downloader/**",
107+
"jline/**", "org/fusesource/**", "META-INF/native/**"
84108

85109
manifest {
86110
attributes 'Main-Class': project.mainClass
87111
}
88112
}
89113

90114
dependencies {
91-
compile ('io.socket:socket.io-client:0.7.0') {
115+
compile ('io.socket:socket.io-client:1.0.0') {
92116
exclude group: 'org.json', module: 'json'
93117
}
94-
compile 'org.json:json:20160212'
95-
compile 'org.yaml:snakeyaml:1.17'
118+
compile 'org.json:json:20180130'
119+
compile 'org.yaml:snakeyaml:1.20'
96120
compile 'jline:jline:2.14.5'
97121

98-
testCompile 'junit:junit:4.12'
99-
testCompile 'org.openjdk.jmh:jmh-core:1.13'
100-
testCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.13'
122+
testImplementation 'junit:junit:4.12'
123+
testImplementation 'org.openjdk.jmh:jmh-core:1.13'
124+
testImplementation 'org.openjdk.jmh:jmh-generator-annprocess:1.13'
101125
}

proguard.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
-target 1.8
2-
-libraryjars <java.home>/lib/rt.jar
3-
-libraryjars <java.home>/lib/ext/jfxrt.jar
42

53
-printmapping store/out.map
64
-printusage store/out.txt
@@ -9,6 +7,7 @@
97

108
-dontwarn okio.**
119
-dontwarn okhttp3.**
10+
-dontwarn org.fusesource.jansi.internal.**
1211

1312
-keepclasseswithmembers public class * {
1413
public static void main(java.lang.String[]);

src/main/java/com/annimon/ownlang/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
public final class Main {
2424

25-
public static final String VERSION = "1.3.0_" + Gen.BUILD_DATE;
25+
public static final String VERSION = "1.3.1_" + Gen.BUILD_DATE;
2626

2727
private static String[] ownlangArgs = new String[0];
2828

0 commit comments

Comments
 (0)