Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/bin
/lib/*
!/lib/dependencies.txt
/target
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CreateSRG
=========

### Building
You can build with Ant or Maven; they are mutually compatible.
The ant build script is very simple but requires you manually retrieve dependencies.
The maven build automatically downloads dependencies from the central repository.
Both place the resulting jars in `target/`.

##### Ant
- Download the necessary jars, listed in `lib/dependencies.txt`
- Run `ant`

##### Maven
- Run `mvn package`
44 changes: 44 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<project name="CreateSRG" default="main" basedir=".">
<property name="src.dir" location="src/main/java" />
<property name="build.dir" location="bin" />
<property name="dist.dir" location="target" />
<property name="dist.jarname" value="CreateSRG.jar" />
<property name="lib.dir" location="lib" />
<property name="manifest.mainclass" value="Main" />

<path id="build.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>

<target name="clean">
<delete dir="${build.dir}" failonerror="false" />
<delete file="${dist.dir}/${dist.jarname}" failonerror="false" />
</target>

<target name="prepare" depends="clean">
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>

<target name="compile" depends="prepare" description="Compile">
<javac destdir="${build.dir}" classpathref="build.classpath" target="1.7" source="1.7" includeantruntime="false">
<src path="${src.dir}" />
</javac>
</target>

<target name="package" depends="compile" description="Package">
<jar destfile="${dist.dir}/${dist.jarname}" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="${manifest.mainclass}" />
</manifest>
<zipgroupfileset dir="${lib.dir}" includes="*.jar" />
<zipfileset dir="${src.dir}" includes="1.7.2.txt" fullpath="1.7.2.txt" />
</jar>
</target>

<target name="main" depends="package" description="Main task">
</target>
</project>
7 changes: 7 additions & 0 deletions lib/dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Dependencies
- Google guava
- ObjectWeb asm
- GNU trove

### Other notes
- Make sure to compile trove; the jar in the download I found only included the sources
90 changes: 90 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>immibis.bon</groupId>
<artifactId>create-srg</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>

<name>create-srg</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-tree</artifactId>
<version>4.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>15.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>1.7.2.txt</include>
</includes>
</resource>
</resources>
</build>
</project>
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/Main.java → src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ private static void getExceptions(URLClassLoader loader, MethodIdentifier method
// exception table entries are generated for a single catch block?
Map<LabelNode, TryBlock> tryCatchData = new HashMap<>();

for(TryCatchBlockNode tcbn : mn.tryCatchBlocks) {
for(TryCatchBlockNode tcbn : (List<TryCatchBlockNode>) mn.tryCatchBlocks) {
if(tcbn.type == null) continue; // ignore finally blocks

if(tryCatchData.containsKey(tcbn.handler))
Expand All @@ -589,11 +589,11 @@ private static void getExceptions(URLClassLoader loader, MethodIdentifier method
}

analyzer.visitCode();
for(TryCatchBlockNode tcbn : mn.tryCatchBlocks)
for(TryCatchBlockNode tcbn : (List<TryCatchBlockNode>) mn.tryCatchBlocks)
tcbn.accept(analyzer);
analyzer.visitMaxs(mn.maxStack, mn.maxLocals);
if(mn.localVariables != null)
for(LocalVariableNode lvn : mn.localVariables)
for(LocalVariableNode lvn : (List<LocalVariableNode>) mn.localVariables)
lvn.accept(analyzer);

for(AbstractInsnNode in = mn.instructions.getFirst(); in != null; in = in.getNext()) {
Expand Down
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions src/main/java/immibis/bon/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package immibis.bon;

/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
38 changes: 38 additions & 0 deletions src/test/java/immibis/bon/AppTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package immibis.bon;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}

/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}

/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}