# HG changeset patch # User Jan Vrany # Date 1443254351 -3600 # Node ID e2168260b75aa99d4d90dd6bd3e1bb03dce0a62b # Parent ee807ff2f897855019a0366df0000240c7ff3fe9 CLI: Initialize package path for in-build-tree execution To allow for testing of CLI without need to deploy whole compiler toolchain. diff -r ee807ff2f897 -r e2168260b75a compiler/cli/TCompilerCommand.st --- a/compiler/cli/TCompilerCommand.st Fri Sep 25 21:58:10 2015 +0100 +++ b/compiler/cli/TCompilerCommand.st Sat Sep 26 08:59:11 2015 +0100 @@ -57,9 +57,10 @@ super initialize. debugging := Transcript notNil and:[Transcript isView]. self setupSignalHandlers. + self setupPackagePath. "Created: / 06-11-2011 / 22:07:14 / Jan Vrany " - "Modified: / 01-09-2015 / 18:42:09 / Jan Vrany " + "Modified: / 26-09-2015 / 08:09:44 / Jan Vrany " ! ! !TCompilerCommand class methodsFor:'compiling'! @@ -69,6 +70,13 @@ | env ctx compiler units | + debugging ifTrue:[ + Stderr nextPutLine: 'Package path:'. + Smalltalk packagePath do:[:each | + Stderr space; space; nextPutLine: each. + ]. + ]. + env := TEnvironment new. env provider classpath addAll: includes. @@ -112,7 +120,7 @@ ]. "Created: / 24-09-2015 / 16:46:48 / Jan Vrany " - "Modified: / 24-09-2015 / 18:45:53 / Jan Vrany " + "Modified: / 26-09-2015 / 07:52:50 / Jan Vrany " ! write: anLLVMModule as: aString @@ -265,6 +273,22 @@ "Created: / 27-06-2013 / 23:10:48 / Jan Vrany " ! +setupPackagePath + | current | + "/ Search for package path in case of in-build (non-deployed) execution + current := OperatingSystem pathOfSTXExecutable asFilename directory. + [ current isRootDirectory ] whileFalse:[ + (current / 'jv' / 'tea' / 'compiler' / 'cli') exists ifTrue:[ + Smalltalk packagePath: + (Smalltalk packagePath copyWith: current pathName). + ^ self + ]. + current := current directory. + ] + + "Created: / 26-09-2015 / 08:09:21 / Jan Vrany " +! + setupSignalHandlers "On UNIX, this sets up a custom signal handler on SIGUSR2 and SIGTERM that dumps stacks on all threads"