Skip to content

Commit d8bda5e

Browse files
committed
Some updates to mac+linux packaging
1 parent b561495 commit d8bda5e

File tree

2 files changed

+61
-14
lines changed

2 files changed

+61
-14
lines changed

release-processing/finish-release.py

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os
55
import sys
6+
import enum
67
import shutil
78
import subprocess
89

@@ -17,19 +18,27 @@
1718
'../src/CHANGELOG.md',
1819
]
1920

21+
# Pure-Java Archive Types
22+
class ArchiveType(enum.Enum):
23+
ZIP = enum.auto()
24+
TAR = enum.auto()
25+
2026
class PureJava:
2127
"""
2228
Class to contain a bunch of info about "pure" Java releases. These are
2329
all handled pretty similarly, and lets us do various looping.
2430
"""
2531

26-
def __init__(self, os_name, files, launch_text,
32+
def __init__(self, os_name, archive_type,
33+
files,
34+
launch_text,
2735
do_header=True,
2836
java_text='We recommend [Adoptium Temurin](https://adoptium.net/)',
2937
extra_points=None,
3038
redirect_files=None,
3139
):
3240
self.os_name = os_name
41+
self.archive_type = archive_type
3342
self.files = files
3443
self.launch_text = launch_text
3544
self.do_header = do_header
@@ -47,6 +56,7 @@ def __init__(self, os_name, files, launch_text,
4756
# Construct a list of "pure" Java zips that we'll construct.
4857
pure_javas = [
4958
PureJava('Windows',
59+
ArchiveType.ZIP,
5060
files=included_files_base + [
5161
f'{app_name}.jar',
5262
'../release-processing/launch_openblcmm.bat',
@@ -55,6 +65,7 @@ def __init__(self, os_name, files, launch_text,
5565
do_header=False,
5666
),
5767
PureJava('Linux',
68+
ArchiveType.TAR,
5869
files=included_files_base + [
5970
f'{app_name}.jar',
6071
'../release-processing/launch_openblcmm.sh',
@@ -63,18 +74,27 @@ def __init__(self, os_name, files, launch_text,
6374
java_text="Just install via your distro's package manager",
6475
),
6576
PureJava('Mac',
77+
ArchiveType.TAR,
6678
files=included_files_base + [
67-
'../release-processing/osx-app/__MACOSX',
68-
'../release-processing/osx-app/OpenBLCMM.app',
69-
],
70-
redirect_files={
71-
# Current app bundling wants the jarfile *inside* the .app bundle
72-
f'{app_name}.jar': 'OpenBLCMM.app',
73-
},
74-
launch_text="Launch by doubleclicking on `OpenBLCMM.app`",
75-
extra_points=[
76-
"**Note:** This launcher is slightly experimental! Feedback on how well it works is appreciated!",
79+
f'{app_name}.jar',
80+
'../release-processing/launch_openblcmm.command',
7781
],
82+
launch_text="Launch by doubleclicking on `launch_openblcmm.command`",
83+
84+
# "Old" parameters from trying to figure out Automator-wrapped .app
85+
# distribution. This seems rather finnicky, so at the *moment*
86+
# we're not doing that.
87+
#files=included_files_base + [
88+
# '../release-processing/osx-app/__MACOSX',
89+
# '../release-processing/osx-app/OpenBLCMM.app',
90+
# ],
91+
#redirect_files={
92+
# # Current app bundling wants the jarfile *inside* the .app bundle
93+
# f'{app_name}.jar': 'OpenBLCMM.app',
94+
# },
95+
#extra_points=[
96+
# "**Note:** This launcher is slightly experimental! Feedback on how well it works is appreciated!",
97+
# ],
7898
),
7999
]
80100

@@ -151,9 +171,21 @@ def __init__(self, os_name, files, launch_text,
151171

152172
# Zip up the "native" Java Jar versions
153173
for pj in pure_javas:
154-
print(f'Creating {pj.os_name} Java Zip...')
174+
match pj.archive_type:
175+
case ArchiveType.ZIP:
176+
label = 'Zip'
177+
ext = 'zip'
178+
command = ['zip', '-r']
179+
case ArchiveType.TAR:
180+
label = 'TGZ'
181+
ext = 'tgz'
182+
command = ['tar', '-zcvf']
183+
case _:
184+
raise RuntimeError(f'Unknown archive type: {pj.archive_type}')
185+
186+
print(f'Creating {pj.os_name} Java {label}...')
155187
base_java_zip = f'{app_name}-{version}-Java-{pj.os_name}'
156-
pj.zipfile = f'{base_java_zip}.zip'
188+
pj.zipfile = f'{base_java_zip}.{ext}'
157189
os.makedirs(base_java_zip)
158190
for filename in pj.files:
159191
if os.path.isdir(filename):
@@ -163,7 +195,7 @@ def __init__(self, os_name, files, launch_text,
163195
shutil.copy2(filename, base_java_zip)
164196
for orig_filename, new_location in pj.redirect_files.items():
165197
shutil.copy2(orig_filename, os.path.join(base_java_zip, new_location))
166-
subprocess.run(['zip', '-r',
198+
subprocess.run([*command,
167199
pj.zipfile,
168200
base_java_zip,
169201
])
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# vim: set expandtab tabstop=4 shiftwidth=4:
3+
4+
# Head into the dir containing the shell script (OSX will otherwise
5+
# start out in the user's homedir)
6+
cd -- "$(dirname "$BASH_SOURCE")"
7+
8+
# To change how much RAM OpenBLCMM is using, change the -Xmx argument, or
9+
# create your own launch script with a different parameter. The default
10+
# in here allocates 2GB. You can also use "M" as a suffix to supply more
11+
# precise values. Note that due to some peculiarities of Java memory
12+
# allocation, setting this value too high might result in the app not
13+
# launching properly, even if you technically have enough RAM free.
14+
15+
java -Xmx2G -jar OpenBLCMM.jar

0 commit comments

Comments
 (0)