Обновлена конфигурация сборки, обновлены библиотеки

This commit is contained in:
Victor 2018-03-09 17:12:43 +02:00
parent d58bf6f271
commit a4d5b43003
3 changed files with 48 additions and 25 deletions

View File

@ -1,4 +1,20 @@
apply plugin: 'java' buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.sf.proguard:proguard-gradle:6.0.1'
}
}
plugins {
id "java"
id "com.github.johnrengelman.shadow" version "2.0.2"
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import proguard.gradle.ProGuardTask
sourceCompatibility = '1.8' sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
@ -14,15 +30,6 @@ repositories {
jcenter() jcenter()
} }
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.sf.proguard:proguard-gradle:5.2.1'
}
}
task generateJavaSources() { task generateJavaSources() {
doLast { doLast {
def source = """ def source = """
@ -53,22 +60,38 @@ task runOptimizing(dependsOn: classes, type: JavaExec) {
args '-o 9 -m -a -f program.own'.split(' ') args '-o 9 -m -a -f program.own'.split(' ')
} }
task dist(dependsOn: classes, type: Jar) { task dist(type: ShadowJar) {
from files(sourceSets.main.output.classesDir) from sourceSets.main.output
from files(sourceSets.main.output.resourcesDir) configurations = [project.configurations.runtime]
from {configurations.compile.collect {zipTree(it)}}
destinationDir file("$rootProject.projectDir/dist") destinationDir file("$rootProject.projectDir/dist")
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
exclude 'META-INF/maven/**'
exclude 'LICENSE*'
manifest.attributes( manifest.attributes(
'Main-Class': project.mainClass, 'Main-Class': project.mainClass,
'Build-Date': new Date().format('YYMMdd') 'Build-Date': new Date().format('YYMMdd')
) )
} }
task proguard(dependsOn: dist, type: proguard.gradle.ProGuardTask) { task proguard(dependsOn: dist, type: ProGuardTask) {
configuration "$rootProject.projectDir/proguard.properties" configuration "$rootProject.projectDir/proguard.properties"
injars "$rootProject.projectDir/dist/OwnLang.jar" injars "$rootProject.projectDir/dist/OwnLang.jar"
outjars "$rootProject.projectDir/store/OwnLang.jar" outjars "$rootProject.projectDir/store/OwnLang.jar"
// Automatically handle the Java version of this build.
if (System.getProperty('java.version').startsWith('1.')) {
// Before Java 9, the runtime classes were packaged in a single jar file.
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
} else {
// As of Java 9, the runtime classes are packaged in modular jmod files.
def jmods = files { file("${System.getProperty('java.home')}/jmods").listFiles() }
jmods.each {
libraryjars it, jarfilter: '!**.jar', filter: '!module-info.class'
}
}
} }
task sandbox(dependsOn: proguard, type: Jar) { task sandbox(dependsOn: proguard, type: Jar) {
@ -80,7 +103,8 @@ task sandbox(dependsOn: proguard, type: Jar) {
"**/modules/java/**", "**/modules/jdbc/**", "**/modules/robot/**", "**/modules/java/**", "**/modules/jdbc/**", "**/modules/robot/**",
"**/modules/socket/**", "io/**", "**/modules/socket/**", "io/**",
"**/modules/aimp/**", "aimpremote/**", "**/modules/aimp/**", "aimpremote/**",
"**/modules/downloader/**" "**/modules/downloader/**",
"jline/**", "org/fusesource/**", "META-INF/native/**"
manifest { manifest {
attributes 'Main-Class': project.mainClass attributes 'Main-Class': project.mainClass
@ -88,14 +112,14 @@ task sandbox(dependsOn: proguard, type: Jar) {
} }
dependencies { dependencies {
compile ('io.socket:socket.io-client:0.7.0') { compile ('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json' exclude group: 'org.json', module: 'json'
} }
compile 'org.json:json:20160212' compile 'org.json:json:20180130'
compile 'org.yaml:snakeyaml:1.17' compile 'org.yaml:snakeyaml:1.20'
compile 'jline:jline:2.14.5' compile 'jline:jline:2.14.5'
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testCompile 'org.openjdk.jmh:jmh-core:1.13' testImplementation 'org.openjdk.jmh:jmh-core:1.13'
testCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.13' testImplementation 'org.openjdk.jmh:jmh-generator-annprocess:1.13'
} }

View File

@ -1,6 +1,4 @@
-target 1.8 -target 1.8
-libraryjars <java.home>/lib/rt.jar
-libraryjars <java.home>/lib/ext/jfxrt.jar
-printmapping store/out.map -printmapping store/out.map
-printusage store/out.txt -printusage store/out.txt
@ -9,6 +7,7 @@
-dontwarn okio.** -dontwarn okio.**
-dontwarn okhttp3.** -dontwarn okhttp3.**
-dontwarn org.fusesource.jansi.internal.**
-keepclasseswithmembers public class * { -keepclasseswithmembers public class * {
public static void main(java.lang.String[]); public static void main(java.lang.String[]);

View File

@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
*/ */
public final class Main { public final class Main {
public static final String VERSION = "1.3.0_" + Gen.BUILD_DATE; public static final String VERSION = "1.3.1_" + Gen.BUILD_DATE;
private static String[] ownlangArgs = new String[0]; private static String[] ownlangArgs = new String[0];