mirror of
https://github.com/ethauvin/rife2.git
synced 2025-04-30 10:38:12 -07:00
Added upgrading the bld.xml IDEA library file when the wrapper is upgraded.
This commit is contained in:
parent
d1de87b542
commit
b12d50b7c1
2 changed files with 24 additions and 1 deletions
|
@ -3,6 +3,7 @@ package rife.bld.operations;
|
|||
import rife.Version;
|
||||
import rife.bld.wrapper.Wrapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
@ -34,8 +35,8 @@ public class UpgradeOperation extends AbstractOperation<UpgradeOperation> {
|
|||
*/
|
||||
public void execute()
|
||||
throws IOException {
|
||||
// create the wrapper files
|
||||
new Wrapper().createWrapperFiles(Path.of("lib", "bld").toFile(), Version.getVersion());
|
||||
new Wrapper().upgradeIdeaBldLibrary(new File(".idea"), Version.getVersion());
|
||||
if (!silent()) {
|
||||
System.out.println("The wrapper was successfully upgraded.");
|
||||
}
|
||||
|
|
|
@ -68,6 +68,28 @@ public class Wrapper {
|
|||
createWrapperJar(destinationDirectory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgraded the IDEA bld files that were generated with a preview version.
|
||||
*
|
||||
* @param destinationDirectory the directory with the IDEA files
|
||||
* @param version the RIFE2 version they should be using
|
||||
* @throws IOException when an error occurred during the upgrade of the IDEA files
|
||||
* @since 1.5.2
|
||||
*/
|
||||
public void upgradeIdeaBldLibrary(File destinationDirectory, String version)
|
||||
throws IOException {
|
||||
var file = new File(destinationDirectory, Path.of("libraries", "bld.xml").toString());
|
||||
if (file.exists()) {
|
||||
try {
|
||||
var content = FileUtils.readString(file);
|
||||
content = content.replaceAll("rife2-[^\"/!]+\\.jar", "rife2-" + version + ".jar");
|
||||
FileUtils.writeString(content, file);
|
||||
} catch (FileUtilsErrorException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createWrapperProperties(File destinationDirectory, String version)
|
||||
throws IOException {
|
||||
var file = new File(destinationDirectory, WRAPPER_PROPERTIES);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue