Class FileHandling
java.lang.Object
org.ek9lang.core.FileHandling
Designed to abstract out all file handling for the compiler.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTHE file-name prefix of every cached runtime jar in<projectDir>/.ek9/runtime/; the extractor removes any entry under it that is not the current one. -
Constructor Summary
ConstructorsConstructorDescriptionFileHandling(OsSupport osSupport) Create File Handling with the appropriately configured OS support. -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanEk9DirectoryStructureFor(File ek9File, TargetArchitecture targetArchitecture) voidcleanEk9DirectoryStructureFor(String ek9FullPathToFileName, TargetArchitecture targetArchitecture) booleanCopy a file to a new destination.booleanCopy a named file from a source directory to a destination directory.booleanCreate a Java jar file with a list of zip sets.booleanCreate a Java jar file with a list of zip sets and optional Main-Class manifest.voidcreateOrRecreateFile(File file) createSha256Of(String fileName) Create a sha256 hash of a file and save it in fileName".sha256"booleanTo be used for making the zip when publishing ek9 source to artefact server.voiddeleteContentsAndBelow(File dir, boolean includeDirectoryRoot) Does a recursive delete from this directory and below.voiddeleteFileIfExists(File file) Deletes a file if it exists.voiddeleteMatchingFiles(File dir, String fileNamePattern) deletes matching files.voiddeleteStalePackages(String ek9FileNameDirectory, String moduleName) getDevFinalOutputDirectory(String fromEk9BaseDirectory, TargetArchitecture targetArchitecture) getDevGeneratedOutputDirectory(String fromEk9BaseDirectory, TargetArchitecture targetArchitecture) getDotEk9Directory(File directory) getDotEk9Directory(String fromDirectory) getMainFinalOutputDirectory(String fromEk9BaseDirectory, TargetArchitecture targetArchitecture) getMainGeneratedOutputDirectory(String fromEk9BaseDirectory, TargetArchitecture targetArchitecture) getRuntimeDirectory(String projectDir) Get the per-project runtime cache directory.getRuntimeJarFile(String projectDir, String version, String contentHash) Get the cached runtime JAR file path, keyed on the compiler version AND the content hash of the runtime classes - a development build keeps its version while its runtime changes, so the version alone let a stale runtime be packaged (seeRuntimeClassExtractor.runtimeContentHash()).getTargetExecutableArtefact(String ek9FullPathToFileName, TargetArchitecture targetArchitecture) getTargetPropertiesArtefact(String ek9FullPathToFileName) booleanmakeDependencyVector(String moduleName, String version) Create a full dependency vector out of module name and version.voidmakeDirectoryIfNotExists(File directory) Create a directory.makePackagedModuleZipFileName(String dependencyVector) makePackagedModuleZipFileName(String moduleName, String version) booleansaveToHomeEk9Directory(SigningKeyPair keyPair) booleansaveToOutput(File file, String value) Save some text to a file.booleanunZipFileTo(File zipFile, File unpackedDir) Unzips a zip file into a directory, the directory will be created if it does not exist.booleanunZipFileTo(File zipFile, String unpackedDir) voidvalidateEk9Directory(String directoryName, TargetArchitecture targetArchitecture) voidvalidateHomeEk9Directory(TargetArchitecture targetArchitecture)
-
Field Details
-
RUNTIME_JAR_PREFIX
THE file-name prefix of every cached runtime jar in<projectDir>/.ek9/runtime/; the extractor removes any entry under it that is not the current one.- See Also:
-
-
Constructor Details
-
FileHandling
Create File Handling with the appropriately configured OS support. Quite a few of these methods just delegate to OsSupport and the Packager.
-
-
Method Details
-
getTempDirectory
-
getUsersHomeDirectory
-
getUsersHomeEk9LibDirectory
-
getUsersHomeEk9Directory
-
getDotEk9Directory
-
getDotEk9Directory
-
makePackagedModuleZipFileName
-
makePackagedModuleZipFileName
-
makeDependencyVector
-
copy
-
copy
-
saveToOutput
-
deleteFileIfExists
Deletes a file if it exists. -
makeDirectoryIfNotExists
Create a directory. -
createOrRecreateFile
-
deleteMatchingFiles
-
deleteContentsAndBelow
Does a recursive delete from this directory and below. If includeDirectoryRoot is true then it will delete that directory as well -
createSha256Of
Create a sha256 hash of a file and save it in fileName".sha256" -
createJar
-
createJar
Create a Java jar file with a list of zip sets and optional Main-Class manifest.- Parameters:
fileName- The name of the JAR file to createsets- The list of ZipSets to includemainClass- The fully-qualified main class name for manifest (null for no Main-Class)- Returns:
- true if JAR creation successful
-
unZipFileTo
-
unZipFileTo
-
createZip
To be used for making the zip when publishing ek9 source to artefact server.- Parameters:
fileName- The name of the zip to createsourcePropertiesFile- The properties file that describes the package.- Returns:
- true if all OK.
-
getTargetExecutableArtefact
public File getTargetExecutableArtefact(String ek9FullPathToFileName, TargetArchitecture targetArchitecture) -
getTargetPropertiesArtefact
-
getRuntimeDirectory
-
getRuntimeJarFile
Get the cached runtime JAR file path, keyed on the compiler version AND the content hash of the runtime classes - a development build keeps its version while its runtime changes, so the version alone let a stale runtime be packaged (seeRuntimeClassExtractor.runtimeContentHash()). Pattern:<projectDir>/.ek9/runtime/ek9-runtime-<version>-<contentHash>.jar -
validateHomeEk9Directory
-
validateEk9Directory
-
cleanEk9DirectoryStructureFor
-
cleanEk9DirectoryStructureFor
public void cleanEk9DirectoryStructureFor(String ek9FullPathToFileName, TargetArchitecture targetArchitecture) -
getMainGeneratedOutputDirectory
public File getMainGeneratedOutputDirectory(String fromEk9BaseDirectory, TargetArchitecture targetArchitecture) -
getMainFinalOutputDirectory
public File getMainFinalOutputDirectory(String fromEk9BaseDirectory, TargetArchitecture targetArchitecture) -
getDevGeneratedOutputDirectory
public File getDevGeneratedOutputDirectory(String fromEk9BaseDirectory, TargetArchitecture targetArchitecture) -
getDevFinalOutputDirectory
public File getDevFinalOutputDirectory(String fromEk9BaseDirectory, TargetArchitecture targetArchitecture) -
deleteStalePackages
-
isUsersSigningKeyPairPresent
public boolean isUsersSigningKeyPairPresent() -
getUsersSigningKeyPair
-
saveToHomeEk9Directory
-