build: improve build scripts
This commit is contained in:
parent
b460b87318
commit
46136e77e2
4
.gitignore
vendored
4
.gitignore
vendored
@ -17,4 +17,6 @@
|
|||||||
!/build.js
|
!/build.js
|
||||||
!/LICENSE
|
!/LICENSE
|
||||||
!/README.md
|
!/README.md
|
||||||
!/?*.gradle
|
!/settings.gradle
|
||||||
|
!/build.gradle
|
||||||
|
!/gradle.properties
|
||||||
|
33
build.gradle
33
build.gradle
@ -1,26 +1,29 @@
|
|||||||
|
|
||||||
|
|
||||||
java {
|
|
||||||
// toolchain {
|
|
||||||
// languageVersion = JavaLanguageVersion.of(11)
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'application'
|
id 'application'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
java {
|
||||||
mavenCentral()
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
sourceSets {
|
||||||
sourceSets {
|
main.java.srcDirs = [ 'src/java' ]
|
||||||
main.java.srcDirs = [ 'src/java' ]
|
main.resources.srcDirs = [ 'src/assets' ]
|
||||||
main.resources.srcDirs = [ 'src/assets' ]
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
filesMatching('metadata.json') {
|
||||||
|
expand (
|
||||||
|
'version': project.project_version,
|
||||||
|
'name': project.project_name
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClass = 'me.topchetoeu.jscript.utils.JScriptRepl'
|
mainClass = project.main_class
|
||||||
}
|
}
|
||||||
|
|
||||||
|
archivesBaseName = project.project_name
|
||||||
|
version = project.project_version
|
3
gradle.properties
Normal file
3
gradle.properties
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
project_name = jscript
|
||||||
|
project_version = 0.8.4-beta
|
||||||
|
main_class = me.topchetoeu.jscript.utils.JScriptRepl
|
@ -1 +0,0 @@
|
|||||||
rootProject.name = 'jscript'
|
|
5
src/assets/metadata.json
Normal file
5
src/assets/metadata.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"version": "${version}",
|
||||||
|
"name": "${name}",
|
||||||
|
"author": "TopchetoEU"
|
||||||
|
}
|
@ -1,9 +1,18 @@
|
|||||||
package me.topchetoeu.jscript.common;
|
package me.topchetoeu.jscript.common;
|
||||||
|
|
||||||
|
import me.topchetoeu.jscript.common.json.JSON;
|
||||||
|
|
||||||
public class Metadata {
|
public class Metadata {
|
||||||
private static final String VERSION = "${VERSION}";
|
private static final String VERSION;
|
||||||
private static final String AUTHOR = "${AUTHOR}";
|
private static final String AUTHOR;
|
||||||
private static final String NAME = "${NAME}";
|
private static final String NAME;
|
||||||
|
|
||||||
|
static {
|
||||||
|
var data = JSON.parse(null, Reading.resourceToString("metadata.json")).map();
|
||||||
|
VERSION = data.string("version");
|
||||||
|
AUTHOR = data.string("author");
|
||||||
|
NAME = data.string("name");
|
||||||
|
}
|
||||||
|
|
||||||
public static String version() {
|
public static String version() {
|
||||||
if (VERSION.equals("$" + "{VERSION}")) return "1337-devel";
|
if (VERSION.equals("$" + "{VERSION}")) return "1337-devel";
|
||||||
|
Loading…
Reference in New Issue
Block a user