154 lines
4.6 KiB
Groovy
Executable File
154 lines
4.6 KiB
Groovy
Executable File
/*
|
|
* Hello Minecraft! Launcher.
|
|
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
*/
|
|
plugins {
|
|
id "edu.sc.seis.macAppBundle" version "2.1.6"
|
|
id "me.tatarka.retrolambda" version "3.5.0"
|
|
id 'edu.sc.seis.launch4j' version '2.3.0'
|
|
}
|
|
|
|
import java.util.jar.JarOutputStream
|
|
import java.util.zip.ZipEntry
|
|
import java.util.zip.ZipFile
|
|
|
|
if (!hasProperty('mainClass')) {
|
|
ext.mainClass = 'org.jackhuang.hellominecraft.launcher.Main'
|
|
}
|
|
|
|
def buildnumber = System.getenv("TRAVIS_BUILD_NUMBER")
|
|
if (buildnumber == null)
|
|
buildnumber = System.getenv("BUILD_NUMBER")
|
|
if (buildnumber == null)
|
|
buildnumber = "5"
|
|
|
|
def versionroot = System.getenv("VERSION_ROOT")
|
|
if (versionroot == null)
|
|
versionroot = "2.6.0"
|
|
|
|
String mavenGroupId = 'HMCL'
|
|
String mavenVersion = versionroot + '.' + buildnumber
|
|
String bundleName = "Hello Minecraft! Launcher"
|
|
|
|
group = mavenGroupId
|
|
version = mavenVersion
|
|
|
|
String mavenArtifactId = name
|
|
|
|
task generateSources(type: Copy) {
|
|
from 'src/main/java'
|
|
from 'src/core/java'
|
|
into "$buildDir/generated-src"
|
|
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
|
|
'HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING': mavenVersion
|
|
])
|
|
}
|
|
compileJava.setSource "$buildDir/generated-src"
|
|
compileJava.dependsOn generateSources
|
|
|
|
task macAppCompressed(type: Zip, dependsOn: createApp) {
|
|
archiveName "HMCL-$mavenVersion-MacOSApp.zip"
|
|
include '**'
|
|
destinationDir file("$buildDir/libs/")
|
|
from "$buildDir/macApp"
|
|
}
|
|
|
|
macAppBundle {
|
|
mainClassName = mainClass
|
|
icon = "src/main/icon.icns"
|
|
javaProperties.put("apple.laf.useScreenMenuBar", "true")
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDirs = [
|
|
'src/core/java/',
|
|
'src/main/java/'
|
|
]
|
|
}
|
|
resources {
|
|
srcDirs = ['src/main/resources/']
|
|
}
|
|
}
|
|
core {
|
|
java {
|
|
compileClasspath += main.compileClasspath
|
|
runtimeClasspath += main.runtimeClasspath
|
|
srcDirs 'src/core/java/'
|
|
}
|
|
resources {
|
|
srcDirs 'src/main/resources/'
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
coreCompile.extendsFrom compile
|
|
coreRuntime.extendsFrom runtime
|
|
}
|
|
|
|
configure(install.repositories.mavenInstaller) {
|
|
pom.project {
|
|
groupId = mavenGroupId
|
|
artifactId = mavenArtifactId
|
|
version = mavenVersion
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile project(":HMCLaF")
|
|
compile project(":HMCUtils")
|
|
compile group: "org.commonjava.googlecode.markdown4j", name: "markdown4j", version: "2.2-cj-1.0"
|
|
}
|
|
|
|
retrolambda {
|
|
javaVersion = JavaVersion.VERSION_1_6
|
|
}
|
|
|
|
jar {
|
|
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
|
|
manifest {
|
|
attributes 'Created-By' : 'Copyright(c) 2013-2016 huangyuhui.',
|
|
'Main-Class' : mainClass
|
|
}
|
|
}
|
|
|
|
launch4j {
|
|
supportUrl = 'http://www.mcbbs.net/thread-142335-1-1.html'
|
|
jreMinVersion = '1.6.0'
|
|
|
|
mainClassName = mainClass
|
|
icon = new File(project.buildDir, '../icon.ico').absolutePath
|
|
version = mavenVersion
|
|
downloadUrl = 'http://java.com/download'
|
|
copyright = "Copyright(c) 2013-2015 huangyuhui."
|
|
|
|
jar = new File(project.buildDir, 'libs/' + mavenGroupId + '-' + mavenVersion + '.jar').absolutePath
|
|
outfile = mavenGroupId + '-' + mavenVersion + '.exe'
|
|
messagesJreVersionError = 'This application requires a Java Runtime Environment installation, or the runtime is corrupted.\n\u6ca1\u6709\u627e\u5230\u004a\u0061\u0076\u0061\u8fd0\u884c\u65f6\uff0c\u8bf7\u4e0d\u8981\u4f7f\u7528\u7eff\u8272\u004a\u0061\u0076\u0061\uff0c\u8bf7\u4f7f\u7528\u5b89\u88c5\u7248\u7684\u004a\u0061\u0076\u0061\uff0c\u70b9\u51fb\u786e\u5b9a\u8fdb\u5165\u004a\u0061\u0076\u0061\u5b89\u88c5\u9875\u9762\u3002'
|
|
}
|
|
|
|
processResources {
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
exclude 'icon.icns'
|
|
}
|
|
}
|
|
|
|
build.dependsOn makeExecutable
|
|
build.dependsOn makePackGZ
|
|
build.dependsOn macAppCompressed |