cache: extract cache to working directory based on cache version
This commit is contained in:
10
cache/pom.xml
vendored
10
cache/pom.xml
vendored
@@ -37,6 +37,8 @@
|
||||
<name>Cache</name>
|
||||
|
||||
<properties>
|
||||
<cache.version>140</cache.version>
|
||||
|
||||
<antlr4.version>4.6</antlr4.version>
|
||||
</properties>
|
||||
|
||||
@@ -102,12 +104,18 @@
|
||||
<dependency>
|
||||
<groupId>net.runelite.rs</groupId>
|
||||
<artifactId>cache</artifactId>
|
||||
<version>140</version>
|
||||
<version>${cache.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Properties;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -61,9 +62,17 @@ public class StoreLocation
|
||||
}
|
||||
}
|
||||
|
||||
private static Properties getProperies() throws IOException
|
||||
{
|
||||
Properties properties = new Properties();
|
||||
InputStream resourceAsStream = StoreLocation.class.getResourceAsStream("/cache.properties");
|
||||
properties.load(resourceAsStream);
|
||||
return properties;
|
||||
}
|
||||
|
||||
private static File setupCacheDir() throws IOException
|
||||
{
|
||||
File file = new File(System.getProperty("java.io.tmpdir"), "cache-work");
|
||||
File file = new File(System.getProperty("java.io.tmpdir"), "cache-" + getProperies().getProperty("cache.version"));
|
||||
|
||||
if (file.exists())
|
||||
{
|
||||
|
||||
2
cache/src/test/resources/cache.properties
vendored
Normal file
2
cache/src/test/resources/cache.properties
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
cache.version=${cache.version}
|
||||
|
||||
Reference in New Issue
Block a user