Skip to content

Commit

Permalink
Update dist tasks for win64.
Browse files Browse the repository at this point in the history
Fix find mc executable in windows.

Fix enable/disable in mods table.
  • Loading branch information
yeoupooh committed Jan 16, 2016
1 parent cbf286c commit c4b63cd
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
32 changes: 26 additions & 6 deletions mc-launcher-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,23 @@ launch4j {

Properties properties = new Properties()
properties.load(project.file("local.properties").newDataInputStream())
def jreZipFile = properties.getProperty('jre.zip.file')

def releasesDir = properties.getProperty('releases.dir')
def thisReleaseDir = "$releasesDir/$project.version"
def thisReleaseName = project.name + "-" + project.version
def distsDir = "$buildDir/distributions"

task unzipJre(type: Copy) {
destinationDir = file(project.buildDir)
def jreZipFile = properties.getProperty('jre.zip.file')
from(zipTree(jreZipFile)) {
include "**/**"
}
}

task distWin64WithJRE(dependsOn: ['distZip', 'launch4j', 'unzipJre'], type: Zip) {
destinationDir file("$buildDir/distributions")
archiveName "$project.name-$project.version-win64-jre.zip"
destinationDir file(distsDir)
archiveName "$thisReleaseName-win64-jre.zip"

into("jre") {
from("$buildDir/jre")
Expand All @@ -105,8 +110,8 @@ task distWin64WithJRE(dependsOn: ['distZip', 'launch4j', 'unzipJre'], type: Zip)
}

task distWin64WithoutJRE(dependsOn: ['distZip', 'launch4j'], type: Zip) {
destinationDir file("$buildDir/distributions")
archiveName "$project.name-$project.version-win64.zip"
destinationDir file(distsDir)
archiveName "$thisReleaseName-win64.zip"
into("lib") {
from("$buildDir/launch4j/lib")
}
Expand All @@ -118,6 +123,13 @@ task distWin64WithoutJRE(dependsOn: ['distZip', 'launch4j'], type: Zip) {
}
}

task copyWin64DistsToReleasesDir(type: Copy) {
destinationDir file(thisReleaseDir)
from distsDir
include "*-win64*.zip"
duplicatesStrategy 'exclude'
}

macAppBundle {
appName = appDisplayName
// appCategory = "public.app-category.utilities"
Expand Down Expand Up @@ -152,4 +164,12 @@ macAppBundle {
//// tmplGetdownTxt = tmplGetdownTxt + '\nallow_offline = true'
//// platforms = [Platform.LINUX_I586, Platform.LINUX_X64, Platform.WINDOWS_I586]
// platforms = [Platform.WINDOWS_I586]
//}
//}

task copyMacosxDistsToReleasesDir(type: Copy) {
destinationDir file(thisReleaseDir)
from distsDir
include "*.dmg"
duplicatesStrategy 'exclude'
}

3 changes: 2 additions & 1 deletion mc-launcher-app/local.properties.sample
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
jre.zip.file=c:/mclauncher/jre8_64bit.zip
jre.zip.file=c:/mclauncher/jre8_64bit.zip
releases.dir=c:/mclauncher/releases
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ class MinecraftUtils {

switch (PlatformUtils.os) {
case PlatformUtils.OS.Windows:
mcExecutable = new File(File(System.getenv('ProgramFiles'), 'Minecraft'), 'Minecraft.exe')
def mcFolder = new File(System.getenv('ProgramFiles(X86)'), 'Minecraft')
mcExecutable = new File(mcFolder, 'Minecraft.exe')
if (!mcExecutable.exists()) {
mcExecutable = new File(mcFolder, 'MinecraftLauncher.exe')
}
break

case PlatformUtils.OS.Mac:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@ public void unselectleAllMods() {
@Override
public void setEnabledAllMods(boolean enabled) {
for (int i = 0; i < modsTable.getRowCount(); i++) {
modsTableModel.setValueAt(enabled, i, 1);
modsTableModel.setValueAt(enabled, i, ModsTableModel.COL_IS_ENABLED);
}
}

@Override
public void setEnabledSelectedMods(boolean enabled) {
int[] selected = modsTable.getSelectedRows();
for (int i = 0; i < selected.length; i++) {
modsTableModel.setValueAt(enabled, selected[i], 1);
modsTableModel.setValueAt(enabled, selected[i], ModsTableModel.COL_IS_ENABLED);
}
}

Expand Down

0 comments on commit c4b63cd

Please sign in to comment.