Skip to content

Commit

Permalink
Merge branch 'pharo-project:feature/cmd-line' into feature/cmd-line
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajger authored Jan 16, 2024
2 parents 85e53a3 + 3ff6afa commit 82c3ffc
Show file tree
Hide file tree
Showing 54 changed files with 364 additions and 1,016 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:
workflow_dispatch:

env:
PHARO: 100
PHARO: 110
ARCHITECTURE: 64
VM: vm
isRelease: ${{ startsWith(github.ref, 'refs/tags/') }}
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Prepare files
shell: pwsh
run: |
Invoke-WebRequest -OutFile pharo-win-stable-signed.zip -Uri http://files.pharo.org/get-files/110/pharo-win-stable-signed.zip
Invoke-WebRequest -OutFile pharo-win-stable-signed.zip -Uri http://files.pharo.org/get-files/${{ env.PHARO }}/pharo-win-stable-signed.zip
Expand-Archive -LiteralPath .\pharo-win-stable-signed.zip -DestinationPath $Env:PACKAGE_DIR
$Env:IMAGES_DIR = "${Env:PACKAGE_DIR}\images"
mkdir "$Env:IMAGES_DIR"
Expand Down
9 changes: 5 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function prepare_image() {
esac
wget --quiet -O - get.pharo.org/$ARCH_PATH$PHARO | bash
wget --quiet -O - get.pharo.org/$ARCH_PATH$VM$PHARO | bash
echo $PHARO > 'pharo.version'
echo "$PHARO" > 'pharo.version'

./pharo Pharo.image save PharoLauncher --delete-old
./pharo PharoLauncher.image --version > version.txt
Expand Down Expand Up @@ -104,7 +104,8 @@ function package_mac_version() {
cp scripts/pharo-launcher.sh $BIN_PATH/pharo-launcher && chmod +x $BIN_PATH/pharo-launcher

VERSION=$VERSION_NUMBER APP_NAME=PharoLauncher SHOULD_SIGN=false ./mac/build-dmg.sh
local generated_dmg=$(echo *.dmg)
local generated_dmg
generated_dmg=$(echo *.dmg)
mv "$generated_dmg" "PharoLauncher-$VERSION_NUMBER.dmg"
generated_dmg=$(echo *.dmg)
md5 "$generated_dmg" > "$generated_dmg.md5sum"
Expand All @@ -130,7 +131,7 @@ function copy_current_stable_image_to() {
local DEST_PATH=${1:-.} # If no argument given, use current working dir
local IMAGES_PATH=$DEST_PATH/images
mkdir "$IMAGES_PATH"
wget --progress=dot:mega -P $IMAGES_PATH https://files.pharo.org/image/stable/stable-64.zip
wget --progress=dot:mega -P "$IMAGES_PATH" https://files.pharo.org/image/stable/stable-64.zip
mv "$IMAGES_PATH/stable-64.zip" "$IMAGES_PATH/pharo-stable.zip"
}

Expand Down Expand Up @@ -224,7 +225,7 @@ linux-package)
package_linux_version
;;
mac-package)
package_mac_version $SHOULD_SIGN
package_mac_version "$SHOULD_SIGN"
;;
*)
echo "No valid target specified! Exiting"
Expand Down
4 changes: 2 additions & 2 deletions linux/pharo-launcher-ui
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

# path
DIR=`readlink -f $0` #resolve symlink
ROOT=`dirname "$DIR"` #obtain dir of the resolved path
DIR=$(readlink -f "$0") #resolve symlink
ROOT=$(dirname "$DIR") #obtain dir of the resolved path
LINUX="$ROOT/pharo-vm"
RESOURCES="$ROOT/shared"
ICONS="$ROOT/icons"
Expand Down
2 changes: 1 addition & 1 deletion mac/Info.plist.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<key>PharoImageFile</key>
<string>PharoLauncher.image</string>
<key>PharoLogLevel</key>
<integer>4</integer>
<integer>1</integer>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
Expand Down
6 changes: 3 additions & 3 deletions mac/build-dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ readonly DMG_FINAL="${VOL_NAME/ /_}.dmg" # final DMG name will be "Super
readonly STAGING_DIR="./Install" # we copy all our stuff into this dir

check_background_image_DPI_and_convert_it_if_not_72_by_72() {
local _BACKGROUND_IMAGE_DPI_H=`sips -g dpiHeight ${DMG_BACKGROUND_IMG} | grep -Eo '[0-9]+\.[0-9]+'`
local _BACKGROUND_IMAGE_DPI_W=`sips -g dpiWidth ${DMG_BACKGROUND_IMG} | grep -Eo '[0-9]+\.[0-9]+'`
local _BACKGROUND_IMAGE_DPI_H=$(sips -g dpiHeight ${DMG_BACKGROUND_IMG} | grep -Eo '[0-9]+\.[0-9]+')
local _BACKGROUND_IMAGE_DPI_W=$(sips -g dpiWidth ${DMG_BACKGROUND_IMG} | grep -Eo '[0-9]+\.[0-9]+')

if [ $(echo " $_BACKGROUND_IMAGE_DPI_H != 72.0 " | bc) -eq 1 -o $(echo " $_BACKGROUND_IMAGE_DPI_W != 72.0 " | bc) -eq 1 ]; then
echo "WARNING: The background image's DPI is not 72. This will result in distorted backgrounds on Mac OS X 10.7+."
Expand Down Expand Up @@ -102,7 +102,7 @@ function sign_mac_app() {
# See https://code-examples.net/en/q/1344e6a
security set-key-partition-list -S apple-tool:,apple: -s -k ${keychain_password} "${keychain_name}"
# debug
echo ${sign_identity} >> "id.txt"
echo "${sign_identity}" >> "id.txt"
# Invoke codesign
if [[ -d "${app_dir}/Contents/MacOS/Plugins" ]]; then # Pharo.app does not (yet) have its plugins in Resources dir
rm -rf "${app_dir}/Contents/MacOS/Plugins/pkgconfig" # Should be fixed in VM build
Expand Down
34 changes: 2 additions & 32 deletions sources.list
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,9 @@ OrderedCollection [
},
PhLTemplateSource {
#type : #URL,
#name : 'Moose Suite 11 (development) - Pharo 11',
#name : 'Moose Suite 11 (development)',
#url : 'https://github.com/moosetechnology/Moose/releases/download/continuous/Moose11-development-Pharo64-11.zip'
},
PhLTemplateSource {
#type : #URL,
#name : 'Moose Suite 11 (development) - Pharo 10',
#url : 'https://github.com/moosetechnology/Moose/releases/download/continuous/Moose11-development-Pharo64-10.zip'
},
PhLTemplateSource {
#type : #URL,
#name : 'Moose Suite 10 (stable)',
Expand Down Expand Up @@ -139,32 +134,7 @@ OrderedCollection [
#type : #URL,
#name : 'Moose Suite 8.0 (old stable)',
#url : 'https://github.com/moosetechnology/Moose/releases/download/v8.x.x/Moose8-old-stable-Pharo64-8.0.zip'
},
PhLTemplateSource {
#type : #URL,
#name : 'Moose Suite 7.0 (old stable)',
#url : 'https://ci.inria.fr/moose/job/moose-7.0-64bit/lastSuccessfulBuild/artifact/moose-7.0-64bit.zip'
},
PhLTemplateSource {
#type : #URL,
#name : 'Moose Suite 6.1',
#url : 'https://ci.inria.fr/moose/job/moose-6.1/lastSuccessfulBuild/artifact/moose-6.1.zip'
},
PhLTemplateSource {
#type : #URL,
#name : 'Moose Suite 6.0',
#url : 'https://ci.inria.fr/moose/job/moose-6.0/lastSuccessfulBuild/artifact/moose-6.0.zip'
},
PhLTemplateSource {
#type : #URL,
#name : 'Moose Suite 5.1',
#url : 'https://ci.inria.fr/moose/job/moose-5.1/lastSuccessfulBuild/artifact/moose-5.1.zip'
},
PhLTemplateSource {
#type : #URL,
#name : 'Moose Suite 5.0',
#url : 'https://moosetechnology.org/res/download/moose_image_5_0.zip'
}
}
]
},
PhLTemplateSource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ BaselineOfPharoLauncher >> clap: spec [

spec
baseline: #Clap
with: [ spec repository: 'github://demarey/clap-st:refactoring/src' ]
with: [ spec repository: 'github://pharo-contributions/clap-st:master/src' ]
]

{ #category : #'external projects' }
Expand Down
2 changes: 1 addition & 1 deletion src/PharoLauncher-CLI-Tests/PhLCliTestClapContext.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PhLCliTestClapContext >> command [
PhLCliTestClapContext >> initialize [

super initialize.
launcherModel := PharoLauncherCLIModel new.
launcherModel := PharoLauncherCLIModel fromDefaultConfiguration.
]

{ #category : #accessing }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Class {
#superclass : #TestCase,
#instVars : [
'root',
'errorStream'
'errorStream',
'outStream'
],
#category : #'PharoLauncher-CLI-Tests'
}
Expand All @@ -22,8 +23,11 @@ PharoLauncherCLIConfigurationTest >> createPreferencesFileWith: aConfiguration [
PharoLauncherCLIConfigurationTest >> setUp [
super setUp.
root := FileSystem memory root.
outStream := WriteStream on: (String new).
errorStream := WriteStream on: (String new).
PhLNotificationCenter default errorStream: errorStream
PhLNotificationCenter default
errorStream: errorStream;
outStream: outStream.

]

Expand Down Expand Up @@ -74,7 +78,7 @@ PharoLauncherCLIConfigurationTest >> testGetConfigurationWhenConfigurationFileAb
config := PharoLauncherCLIConfiguration configurationFromFile: (root / 'launcherSettings.ston') asFileReference .

self assert: (config isKindOf: PharoLauncherCLIConfiguration).
self assert: ( PhLNotificationCenter default errorStream contents includesSubstring: 'Config' )
self assert: (PhLNotificationCenter default outStream contents includesSubstring: 'Config')


]
Expand Down
2 changes: 1 addition & 1 deletion src/PharoLauncher-CLI/ClapContext.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ ClapContext >> initializeLauncherNotificationCenter [

{ #category : #'*PharoLauncher-CLI' }
ClapContext >> pharoLauncherModel [
^ PharoLauncherCLIModel new
^ PharoLauncherCLIModel fromDefaultConfiguration
]
30 changes: 29 additions & 1 deletion src/PharoLauncher-CLI/PhLNotificationCenter.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"
This represents singleton object for accessing errorStream, outStream in methods used by CLI, that do not have any reference to streams of CLI command (or CLI context) object.
I represent an object to manage notifications to user when ran in CLI mode.
I can act as the PharoLauncher default application (see PharoLauncherApplication class>>#default).
I only have a minimal set of methods to provide some polymorphism with an SpApplication and avoid UI interactions.
"
Class {
#name : #PhLNotificationCenter,
Expand Down Expand Up @@ -54,3 +57,28 @@ PhLNotificationCenter >> outStream [
PhLNotificationCenter >> outStream: anOutStream [
outStream := anOutStream
]

{ #category : #ui }
PhLNotificationCenter >> pushProgress: aString with: aFullBlockClosure [
"do not display progress, only evaluate the block"
aFullBlockClosure value: DummySystemProgressItem new
]

{ #category : #polymorphism }
PhLNotificationCenter >> reset [

"This method is not a 'real' reset but is there for polymorphism with `PharoLauncherApplication`.
It is called by `PhLStartupManager class>>#startUp:`.
One should not reset my streams as they are initialized by clap at image startup."
]

{ #category : #ui }
PhLNotificationCenter >> showError: anError [

self errorStream
nextPutAll: 'Error: ';
nextPutAll: anError name;
nextPutAll: ' - ';
nextPutAll: anError longDescription;
cr
]
14 changes: 6 additions & 8 deletions src/PharoLauncher-CLI/PharoLauncherCLIConfiguration.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Class {

{ #category : #'error signalling' }
PharoLauncherCLIConfiguration class >> configFileNotFound: aFile [
PhLNotificationCenter default errorStream
PhLNotificationCenter default outStream
nextPutAll:
'Config file not found, creating a new one at '
, self preferencesFile fullName;
'Config file not found, creating a new one at ';
nextPutAll: self preferencesFile fullName;
newLine.
^ self createConfigurationFile: aFile
]
Expand Down Expand Up @@ -119,12 +119,10 @@ PharoLauncherCLIConfiguration >> initScriptsDirectory: aFileReference [
PharoLauncherCLIConfiguration >> initialize [
super initialize.
imagesDirectory := PhLDirectoryBasedImageRepository defaultLocation asFileReference .
vmsDirectory := FileLocator launcherUserFilesLocation / 'vms'.
vmsDirectory := vmsDirectory asFileReference.
initScriptsDirectory := PharoLauncherApplication
vmsDirectory := (FileLocator launcherUserFilesLocation / 'vms') asFileReference.
initScriptsDirectory := PharoLauncherApplication
defaultInitializationScriptLocation asFileReference.
launchImageFromALoginShell := PhLLaunchConfiguration
launchInALoginShell
launchImageFromALoginShell := PhLLaunchConfiguration launchInALoginShell
]

{ #category : #accessing }
Expand Down
31 changes: 24 additions & 7 deletions src/PharoLauncher-CLI/PharoLauncherCLIModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,36 @@ Class {
#instVars : [
'imageRepository',
'templateRepository',
'vmManager'
'vmManager',
'configuration'
],
#category : #'PharoLauncher-CLI-Model'
}

{ #category : #'instance creation' }
PharoLauncherCLIModel class >> fromConfiguration: aPharoLauncherConfiguration [

^ self new
configuration: aPharoLauncherConfiguration;
yourself
]

{ #category : #'instance creation' }
PharoLauncherCLIModel class >> fromDefaultConfiguration [

^ self fromConfiguration: PharoLauncherCLIConfiguration defaultConfiguration
]

{ #category : #accessing }
PharoLauncherCLIModel >> configuration: aPharoLauncherConfiguration [

configuration := aPharoLauncherConfiguration
]

{ #category : #accessing }
PharoLauncherCLIModel >> imageRepository [
^ imageRepository
ifNil: [ | configuration |
configuration := PharoLauncherCLIConfiguration defaultConfiguration.
self
ifNil: [ self
imageRepository:
(PhLDirectoryBasedImageRepository
forDirectory: configuration imagesDirectory).
Expand All @@ -46,9 +65,7 @@ PharoLauncherCLIModel >> templateRepository: aPathString [
{ #category : #accessing }
PharoLauncherCLIModel >> vmManager [
^ vmManager
ifNil: [ | configuration |
configuration := PharoLauncherCLIConfiguration defaultConfiguration.
PhLVirtualMachineManager vmStore: configuration vmsDirectory.
ifNil: [ PhLVirtualMachineManager vmStore: configuration vmsDirectory.
self vmManager: PhLVirtualMachineManager new.
vmManager ]
]
Expand Down
9 changes: 9 additions & 0 deletions src/PharoLauncher-Core/OmSessionStore.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Extension { #name : #OmSessionStore }

{ #category : #'*PharoLauncher-Core' }
OmSessionStore class >> startUp [

PharoLauncherApplication isDeployed ifTrue: [ ^ self ].

registry do: [ :each | each store ]
]
2 changes: 0 additions & 2 deletions src/PharoLauncher-Core/PhLDownloadManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ PhLDownloadManager >> basicDownload: url toFile: destinationFile [
{ #category : #private }
PhLDownloadManager >> displayProgress: aTitle during: workBlock [
"Inform user about download progression"
| bar |
bar := ConsoleProgressBar on: PhLNotificationCenter default outStream.

PharoLauncherApplication default
pushProgress: aTitle
Expand Down
4 changes: 1 addition & 3 deletions src/PharoLauncher-Core/PhLImage.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,10 @@ PhLImage >> launchWithConfiguration: aPhLLaunchConfiguration [
^ self ].
architectureWarningEnabled := true.
continue := true.
[ [ | processWrapper|
[ | processWrapper|
processWrapper := (aPhLLaunchConfiguration launchProcess) runUnwatch.
self doNotRunInitializationScript. "Just run, image already initialized"
^ processWrapper ]
on: PhLImageVersionDeterminationError
do: [ :error | error uiAlert ] ]
on: PhLArchitectureMismatchWarning
do: [ :warning |
architectureWarningEnabled ifTrue: [
Expand Down
5 changes: 4 additions & 1 deletion src/PharoLauncher-Core/PhLImageDescriptionUpdater.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ PhLImageDescriptionUpdater >> newProcess [

{ #category : #private }
PhLImageDescriptionUpdater >> terminateProcess [
process ifNotNil: [ process terminate ]
(process isNil or: [ process isTerminated ])
ifTrue: [ ^ self ].

process terminate.
]

{ #category : #accessing }
Expand Down
Loading

0 comments on commit 82c3ffc

Please sign in to comment.