Skip to content

Commit

Permalink
move trec_eval to top level
Browse files Browse the repository at this point in the history
  • Loading branch information
jasper-xian committed Jan 8, 2024
1 parent 7cc55ea commit e5e465b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
35 changes: 26 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@
<mainClass>io.anserini.util.ExtractTopDfTerms</mainClass>
<id>ExtractTopDfTerms</id>
</program>
<program>
<mainClass>io.anserini.eval.TrecEval</mainClass>
<id>TrecEval</id>
</program>
</programs>
</configuration>
</plugin>
Expand Down Expand Up @@ -283,6 +279,32 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<mainClass>trec_eval</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>trec_eval</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -477,10 +499,5 @@
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>uk.ac.gla.dcs.terrierteam</groupId>
<artifactId>jtreceval</artifactId>
<version>0.0.5</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.anserini.eval;


import java.io.BufferedOutputStream;
import java.io.File;
Expand Down Expand Up @@ -48,7 +48,7 @@
* </ul>
* @author Craig Macdonald
*/
public class TrecEval
public class trec_eval
{
static boolean DELETE = true;
static File trec_eval_temp = null;

Check warning on line 54 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L53-L54

Added lines #L53 - L54 were not covered by tests
Expand Down Expand Up @@ -79,7 +79,7 @@ static String getOSShort()
public static boolean isPlatformSupported()
{
final String execName = getExecName();

Check warning on line 81 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L81

Added line #L81 was not covered by tests
if (! (TrecEval.class.getClassLoader().getResource(execName) != null))
if (! (trec_eval.class.getClassLoader().getResource(execName) != null))
return false;

Check warning on line 83 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L83

Added line #L83 was not covered by tests
for(String f : FILE_DEPENDENCIES.getOrDefault(execName, new String[0]))
if (! new File(f).exists())
Expand All @@ -92,7 +92,7 @@ static File getTrecEvalBinary()
if (trec_eval_temp != null)
return trec_eval_temp;
final String resName = getExecName();

Check warning on line 94 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L93-L94

Added lines #L93 - L94 were not covered by tests
if (TrecEval.class.getClassLoader().getResource(resName) == null)
if (trec_eval.class.getClassLoader().getResource(resName) == null)
throw new UnsupportedOperationException("Unsupported os/arch: " + resName);

Check warning on line 96 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L96

Added line #L96 was not covered by tests

File tempExec = null;

Check warning on line 98 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L98

Added line #L98 was not covered by tests
Expand All @@ -102,7 +102,7 @@ static File getTrecEvalBinary()
tempExecDir.toFile().deleteOnExit();

Check warning on line 102 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L102

Added line #L102 was not covered by tests

tempExec = File.createTempFile( "trec_eval", ".exe", tempExecDir.toFile());
InputStream in = TrecEval.class.getClassLoader().getResourceAsStream(resName);
InputStream in = trec_eval.class.getClassLoader().getResourceAsStream(resName);
OutputStream out = new BufferedOutputStream(new FileOutputStream(tempExec));
IOUtils.copy(in, out);
in.close();
Expand All @@ -116,7 +116,7 @@ static File getTrecEvalBinary()
// for(String lib : libs)
// {
// File tmpLib = new File(tempExecDir.toFile(), lib);
// in = TrecEval.class.getClassLoader().getResourceAsStream(lib);
// in = trec_eval.class.getClassLoader().getResourceAsStream(lib);
// out = new BufferedOutputStream(
// new FileOutputStream(tmpLib));
// IOUtils.copy(in, out);
Expand All @@ -141,7 +141,7 @@ protected static String getExecName() {
File ourTE;
int exit = Integer.MAX_VALUE;

Check warning on line 142 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L142

Added line #L142 was not covered by tests

public TrecEval()
public trec_eval()
{
ourTE = getTrecEvalBinary();

Check warning on line 146 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L145-L146

Added lines #L145 - L146 were not covered by tests
//System.err.println(ourTE.toString());
Expand Down Expand Up @@ -275,6 +275,6 @@ public static void main( String[] args )
System.out.println("Platform supported: " + isPlatformSupported());
return;

Check warning on line 276 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L275-L276

Added lines #L275 - L276 were not covered by tests
}
System.exit(new TrecEval().run(args));
System.exit(new trec_eval().run(args));
}

Check warning on line 279 in src/main/java/trec_eval.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/trec_eval.java#L278-L279

Added lines #L278 - L279 were not covered by tests
}

0 comments on commit e5e465b

Please sign in to comment.