Skip to content
Closed

qw #27

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
dafeb58
Add Sun's webservice lib for atujplag and admintool
Mar 22, 2015
369d125
Add initial version of README
Mar 22, 2015
15959ff
Add license
Mar 27, 2015
2fb26d3
Ignore generated files from Java 1.5 parser
Mar 27, 2015
016976c
Update copyright notice
Mar 27, 2015
be74633
Change order of supported languages
Mar 27, 2015
67abccc
Manage versions of dependencies in parent pom
Mar 27, 2015
b59f9de
Set issue management to github
Mar 27, 2015
07be0bd
Set project name and URL
Mar 27, 2015
01720b5
Reomve old developer connection
Mar 27, 2015
5cfe597
Use try-with-resources when loading properties
Mar 27, 2015
d2c7f8b
Add type safety and remove warnings in text frontend
Mar 27, 2015
68a16a9
Use generated serialID to remove warning
Mar 27, 2015
917238d
Remove dead assignment
Mar 27, 2015
02e3d1e
Improve readme
Mar 30, 2015
4433ae5
Fix jplag.frontend.java-1.5/pom.xml.
erikmd Apr 2, 2015
1250cbe
Merge pull request #10 from erikmd/fix-java15-pom
lama0206 Apr 2, 2015
ef3ea6f
Fixed bug with string parsing in C/C++
rogerhub Oct 22, 2015
a9c71ae
Merge pull request #11 from rogerhub/master
lama0206 Oct 27, 2015
69305b8
Improve README.md
Oct 29, 2015
e772a15
Added a few common c++ suffixes
Dec 9, 2015
23f14a4
Merge pull request #12 from arneboe/master
lama0206 Dec 9, 2015
c88a097
Set the correct relativePath to project parent POMs.
khumba Jan 29, 2016
0721d25
Fix the configuration of the ProGuard plugin.
khumba Jan 29, 2016
50c152c
Merge pull request #13 from khumba/build-fixes
lama0206 Jan 30, 2016
882ed53
Add note to README.md about language selection
Feb 29, 2016
3934c8c
Add command line options to README
Feb 29, 2016
6849bfb
Fix two small typos in README.md
glmax Apr 14, 2016
01d5023
Merge pull request #15 from glmax/master
lama0206 Apr 14, 2016
69f7709
Ensure percentA() and percentB() don't truncate the floating-point di…
erikmd Apr 27, 2016
7e0efe9
Merge pull request #17 from erikmd/fix-rounding
lama0206 Apr 29, 2016
4d5141b
Extend readme
Sep 27, 2016
e27b040
Add support for python3 (Issue #6)
waynetee Oct 24, 2016
98d3897
Minor changes
waynetee Nov 10, 2016
6b42ab8
Fix Scheme suffixes
waynetee Nov 21, 2016
cc2b6a8
Python tokenisation improvements
waynetee Jan 8, 2017
08d2e84
Small update to Readme.md (Typo)
GSORF Feb 7, 2017
a81354f
Merge pull request #28 from GSORF/patch-1
lama0206 Feb 22, 2017
1c8959e
Merge pull request #26 from waynetee/master
lama0206 Feb 22, 2017
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
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Download and Run JPlag
Download a released version - all releases are single-JAR releases.

Type `java -jar jplag-yourVersion.jar` in a console to see the command line options.
The options as of 2016/02/29 are:

```
JPlag (Version 2.11.8-SNAPSHOT), Copyright (c) 2004-2015 KIT - IPD Tichy, Guido Malpohl, and others.
Usage: JPlag [ options ] <root-dir>
<root-dir> The root-directory that contains all submissions

options are:
-v[qlpd] (Verbose)
q: (Quiet) no output
l: (Long) detailed output
p: print all (p)arser messages
d: print (d)etails about each submission
-d (Debug) parser. Non-parsable files will be stored.
-S <dir> Look in directories <root-dir>/*/<dir> for programs.
(default: <root-dir>/*)
-s (Subdirs) Look at files in subdirs too (default: deactivated)

-p <suffixes> <suffixes> is a comma-separated list of all filename suffixes
that are included. ("-p ?" for defaults)

-o <file> (Output) The Parserlog will be saved to <file>
-x <file> (eXclude) All files named in <file> will be ignored
-t <n> (Token) Tune the sensitivity of the comparison. A smaller
<n> increases the sensitivity.
-m <n> (Matches) Number of matches that will be saved (default:20)
-m <p>% All matches with more than <p>% similarity will be saved.
-r <dir> (Result) Name of directory in which the web pages will be
stored (default: result)
-bc <dir> Name of the directory which contains the basecode (common framework)
-l <language> (Language) Supported Languages:
java17 (default), java15, java15dm, java12, java11, c/c++, c#-1.2, char, text, scheme
```

## Example
Assume that we want to check students' solutions that are written in Java 1.7.

Each student solution is in its own directory, say `student1`, `student2`, and so on.
All solutions are in a common directory, say `exercise1`.

To run JPlag, simply type `java -jar jplag-yourVersion.jar -l java17 -r /tmp/jplag_results_exercise1/ -s /path/to/exercise1`

- `-l java17` tells JPlag to use the frontend for Java 1.7
- `-s` tells JPlag to recurse into subdirectories; as we assume Java projects, we'll very likely encounter subdirectories such as `student1/src/`
- `-r /tmp/jplag_results_exercise1` tells JPlag to store the results in the directory `/tmp/jplag_results_exercise1`

**Note:** You have to specify the language exactly as they are printed by JPlag (running JPlag without command line arguments prints all available languages - and other options).
E.g., if you want to process C++ files, you have specify `-l c/c++` as language option.

## Options
### `-x <file>` (eXclude) All files named in `<file>` will be ignored
The option `-x` requires an exclusion list saved as `<file>`.
The exclusion list contains a number of suffixes.
JPlag will ignore all files that end with one of the suffixes.


# Building JPlag
To build and run a local installation of JPlag, you can use the pom.xml in this directory (aggregator). It builds JPlag and the available frontends.

To generate single modules run `mvn clean generate-sources package` in the base directory; if you want a single file then run `mvn clean generate-sources assembly:assembly` inside the `jplag` directory. You will find the JARs in the respective `target` directories. If you build a single JAR, it will be generated in `jplag/target`.

## Web Service
Installing, running and maintaining a local web service is not recommended as the web service uses outdated libraries and (really) needs polishing.

If you want to do it anyway: `atujplag` is the client, `webservice` is the - yepp - web service.

# Improving JPlag
We're happy to incorporate all improvements to JPlag into this code base. Feel free to fork the project and send pull requests.

## Adding new languages
Adding a new language frontend is quite simple. Have a look at one of the `jplag.frontend` projects. All you need is a parser for the language (e.g., for ANTLR or for JavaCC) and a few lines of code that sends the tokens (that are generated by the parser) to JPlag.
3 changes: 2 additions & 1 deletion jplag.adminTool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>

<repositories>
Expand All @@ -19,7 +20,7 @@
<repository>
<id>projectLocal</id>
<name>Local Repository</name>
<url>file://${project.basedir}/../../maven-libs</url>
<url>file://${project.basedir}/../maven-libs</url>
</repository>
</repositories>

Expand Down
3 changes: 2 additions & 1 deletion jplag.atujplag/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>

<repositories>
Expand All @@ -19,7 +20,7 @@
<repository>
<id>projectLocal</id>
<name>Local Repository</name>
<url>file://${project.basedir}/../../maven-libs</url>
<url>file://${project.basedir}/../maven-libs</url>
</repository>
</repositories>

Expand Down
1 change: 1 addition & 0 deletions jplag.frontend-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>

<repositories>
Expand Down
1 change: 1 addition & 0 deletions jplag.frontend.chars/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>
<artifactId>chars</artifactId>
</project>
1 change: 1 addition & 0 deletions jplag.frontend.cpp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>
</project>
4 changes: 2 additions & 2 deletions jplag.frontend.cpp/src/main/java/jplag/cpp/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public int errorsCount() {
}

public String[] suffixes() {
String[] res = { ".cpp", ".CPP", "c++", "C++", ".c", ".C", ".h", ".H",
".hpp", ".HPP" };
String[] res = { ".cpp", ".CPP", ".cxx", ".CXX", ".c++", ".C++", ".c", ".C", ".cc", ".CC", ".h", ".H",
".hpp", ".HPP", ".hh", ".HH" };
return res;
}

Expand Down
2 changes: 1 addition & 1 deletion jplag.frontend.cpp/src/main/java/jplag/cpp/Scanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void main(String args[]) {
Scanner scanner = new Scanner();
scanner.setProgram(new StrippedProgram());

jplag.Structure s = scanner.scan(new File("."), args);
scanner.scan(new File("."), args);
}

public jplag.Structure scan(File dir, String files[]) {
Expand Down
4 changes: 2 additions & 2 deletions jplag.frontend.cpp/src/main/javacc/CPP.jj
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ TOKEN :
["n","t","v","b","r","f","a","\\","?","'","\""]
| "0" (["0"-"7"])*
| ["1"-"9"] (["0"-"9"])*
| ("0x" | "0X") (["0"-"9","a"-"f","A"-"F"])+
| ("X" | "x" | "U" | "u") (["0"-"9","a"-"f","A"-"F"])+
)
)
)
Expand All @@ -260,7 +260,7 @@ TOKEN :
["n","t","v","b","r","f","a","\\","?","'","\""]
| "0" (["0"-"7"])*
| ["1"-"9"] (["0"-"9"])*
| ("0")? ("X" | "x" | "u") (["0"-"9","a"-"f","A"-"F"])+
| ("X" | "x" | "U" | "u") (["0"-"9","a"-"f","A"-"F"])+
| "\n"
)
)
Expand Down
1 change: 1 addition & 0 deletions jplag.frontend.csharp-1.2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,6 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>
</project>
1 change: 1 addition & 0 deletions jplag.frontend.java-1.1exp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>
</project>
1 change: 1 addition & 0 deletions jplag.frontend.java-1.2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>
</project>
6 changes: 6 additions & 0 deletions jplag.frontend.java-1.5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
src/main/java/jplag/java15/grammar/CharStream.java
src/main/java/jplag/java15/grammar/JavaParser.java
src/main/java/jplag/java15/grammar/JavaParserConstants.java
src/main/java/jplag/java15/grammar/JavaParserTokenManager.java
src/main/java/jplag/java15/grammar/ParseException.java
src/main/java/jplag/java15/grammar/TokenMgrError.java
3 changes: 2 additions & 1 deletion jplag.frontend.java-1.5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<grammarEncoding>${project.build.sourceEncoding}</grammarEncoding>
<debugparser>false</debugparser>
<isStatic>false</isStatic>
<outputDirectory>src/main/java/jplag/java15/grammar</outputDirectory>
<outputDirectory>${project.basedir}/src/main/java/jplag/java15/grammar</outputDirectory>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -78,6 +78,7 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>
<artifactId>java-1.5</artifactId>
</project>
1 change: 1 addition & 0 deletions jplag.frontend.java-1.7/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public boolean errors() {
}

public boolean supportsColumns() {
return false; // was true - should be true :/
return true;
}

public boolean isPreformated() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
import org.antlr.v4.runtime.tree.ParseTreeWalker;

public class Parser extends jplag.Parser implements JavaTokenConstants {
private Structure struct = new Structure();;
private Structure struct = new Structure();
private String currentFile;

public static void main(String args[]) {
if (args.length < 1) {
System.out.println("Only one ore more files as parameter allowed.");
System.out.println("Only one or more files as parameter allowed.");
System.exit(-1);
}
Parser parser = new Parser();
Expand Down Expand Up @@ -113,7 +113,7 @@ public boolean parseFile(File dir, String file) {
// }

public void add(int type, org.antlr.v4.runtime.Token tok) {
struct.addToken(new JavaToken(type, (currentFile == null ? "null" : currentFile), tok.getLine(), tok.getStartIndex(),
struct.addToken(new JavaToken(type, (currentFile == null ? "null" : currentFile), tok.getLine(), tok.getCharPositionInLine() + 1,
tok.getText().length()));
}
}
94 changes: 94 additions & 0 deletions jplag.frontend.python-3/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<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>
<artifactId>python-3</artifactId>
<version>0.0.1-SNAPSHOT</version>

<repositories>
<repository>
<id>ipdNexus</id>
<name>Recaa Repository</name>
<url>http://bob.ipd.kit.edu/nexus/content/repositories/public/</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<configuration>
<sources>
<source>target/generated-sources/antlr4</source>
</sources>
</configuration>
<executions>
<execution>
<id>generate-antlr-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
</execution>
<execution>
<id>compile-with-antlr-sources</id>
<phase>compile</phase>
<goals>
<goal>add-source</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.2</version>
<configuration>
<!-- Comma separated list of grammar files or pattern grammar files
By default, grammar file(s) is in ${basedir}/src/main/antlr -->
<!-- <grammars>*.g</grammars> -->
<grammars>Python3.g4</grammars>
</configuration>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>jplag.python3.Parser</mainClass>
<packageName>jplag.python3</packageName>
</manifest>
</archive>
</configuration>
</plugin>

</plugins>
</build>

<dependencies>
<dependency>
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>frontend-utils</artifactId>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
</dependency>
</dependencies>
<parent>
<groupId>edu.kit.ipd.jplag</groupId>
<artifactId>parent</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../jplag.parent/pom.xml</relativePath>
</parent>
</project>
Loading