An attempt at a basis for an updater
This commit is contained in:
parent
cdfdcd12b4
commit
5fdf6fb416
|
@ -6,14 +6,18 @@ variables:
|
|||
before_script:
|
||||
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
build_test:
|
||||
stage: deploy
|
||||
stage: build
|
||||
script:
|
||||
- gradle --build-cache build -Pflavor=nogui
|
||||
- gradle --build-cache build -Pflavor=fat
|
||||
- gradle --build-cache build -Pflavor=windows
|
||||
- gradle --build-cache build -Pflavor=linux
|
||||
- gradle --build-cache build -Pflavor=macos
|
||||
- gradle --build-cache build publish -Pflavor=nogui -PpublicMaven -Ppipeline=$CI_PIPELINE_ID
|
||||
- gradle --build-cache build publish -Pflavor=fat -PpublicMaven -Ppipeline=$CI_PIPELINE_ID
|
||||
- gradle --build-cache build publish -Pflavor=windows -PpublicMaven -Ppipeline=$CI_PIPELINE_ID
|
||||
- gradle --build-cache build publish -Pflavor=linux -PpublicMaven -Ppipeline=$CI_PIPELINE_ID
|
||||
- gradle --build-cache build publish -Pflavor=macos -PpublicMaven -Ppipeline=$CI_PIPELINE_ID
|
||||
- cp build/libs/*-*-*.jar ./
|
||||
- cp build/libs/*.exe ./
|
||||
- for f in *-*-*.jar; do mv "$f" "latest-${f##*-}";done
|
||||
|
@ -29,3 +33,10 @@ build_test:
|
|||
- latest-windows.jar
|
||||
only:
|
||||
- master
|
||||
|
||||
deploy:
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG && '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^master/'
|
||||
stage: deploy
|
||||
script:
|
||||
- gradle --build-cache build publish modrinth curseforge -PpublicMaven
|
||||
|
|
39
build.gradle
39
build.gradle
|
@ -4,11 +4,12 @@ plugins {
|
|||
id 'java'
|
||||
id 'application'
|
||||
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
||||
id "maven-publish"
|
||||
id "de.undercouch.download" version "4.1.1"
|
||||
}
|
||||
|
||||
group 'io.gitlab.jfronny'
|
||||
version '1.0'
|
||||
version '0.1' + (project.hasProperty('pipeline') ? "+" + project.getProperty('pipeline') : "")
|
||||
|
||||
application {
|
||||
mainClass = 'io.gitlab.jfronny.inceptum.Inceptum'
|
||||
|
@ -22,10 +23,12 @@ ext {
|
|||
lwjglVersion = '3.2.3'
|
||||
imguiVersion = '1.84.1.3'
|
||||
log4jVersion = '2.14.1'
|
||||
flavor = project.hasProperty('flavor') ? project.getProperty('flavor') : 'auto'
|
||||
flavorProp = project.hasProperty('flavor') ? project.getProperty('flavor') : 'custom'
|
||||
flavor = flavorProp
|
||||
isPublicMaven = project.hasProperty('publicMaven')
|
||||
}
|
||||
|
||||
if (flavor == 'auto') {
|
||||
if (flavor == 'custom') {
|
||||
switch (OperatingSystem.current()) {
|
||||
case OperatingSystem.WINDOWS:
|
||||
project.ext.flavor = 'windows'
|
||||
|
@ -69,11 +72,12 @@ processResources {
|
|||
|
||||
filesMatching("version.json") {
|
||||
expand "version": project.version
|
||||
filter { line -> line.replace("@flavor@", project.ext.flavorProp) }
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveClassifier.set(flavor)
|
||||
archiveClassifier.set(flavorProp)
|
||||
}
|
||||
|
||||
class FileOutput extends DefaultTask {
|
||||
|
@ -103,4 +107,29 @@ task nativeExe(dependsOn: [downloadBootstrap, shadowJar], type: FileOutput) {
|
|||
output.append shadowJar.archiveFile.get().getAsFile().readBytes()
|
||||
}
|
||||
}
|
||||
if (flavor == 'windows') build.dependsOn nativeExe
|
||||
if (flavor == 'windows') build.dependsOn nativeExe
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact(shadowJar) {
|
||||
builtBy shadowJar
|
||||
}
|
||||
}
|
||||
}
|
||||
if (project.ext.isPublicMaven) {
|
||||
repositories.maven {
|
||||
url = "https://gitlab.com/api/v4/projects/30862253/packages/maven"
|
||||
name = "gitlab"
|
||||
|
||||
credentials(HttpHeaderCredentials) {
|
||||
name = "Job-Token"
|
||||
value = System.getenv().CI_JOB_TOKEN
|
||||
}
|
||||
authentication {
|
||||
header(HttpHeaderAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories.mavenLocal()
|
||||
}
|
|
@ -70,7 +70,7 @@ public class Inceptum {
|
|||
return;
|
||||
}
|
||||
if (cmd.enableLog()) {
|
||||
LOGGER.info("Launching Inceptum v" + VERSION.version);
|
||||
LOGGER.info("Launching Inceptum v" + VERSION.version + " (" + VERSION.flavor + ")");
|
||||
LOGGER.info("Setting up cache dir");
|
||||
}
|
||||
if (!Files.exists(CONFIG_PATH.getParent())) Files.createDirectories(CONFIG_PATH.getParent());
|
||||
|
|
|
@ -8,7 +8,7 @@ public class HelpCommand extends Command {
|
|||
}
|
||||
@Override
|
||||
public void invoke(String[] args) {
|
||||
System.out.println("Inceptum v" + Inceptum.VERSION.version + "\n\nCommands:");
|
||||
System.out.println("Inceptum v" + Inceptum.VERSION.version + " (" + Inceptum.VERSION.flavor + ")\n\nCommands:");
|
||||
for (Command command : Inceptum.COMMANDS) {
|
||||
System.out.println(" " + command.getName() + " - " + command.getHelp());
|
||||
}
|
||||
|
|
|
@ -2,4 +2,5 @@ package io.gitlab.jfronny.inceptum.model.inceptum;
|
|||
|
||||
public class InceptumVersion {
|
||||
public String version;
|
||||
public String flavor;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{
|
||||
"version": "${version}"
|
||||
"version": "${version}",
|
||||
"flavor": "@flavor@"
|
||||
}
|
Loading…
Reference in New Issue