Restructure project to use maven.

main
Nic0Nic0Nii 3 years ago
parent 0062508db7
commit d7327456e9
  1. 9
      .gitpod.yml
  2. 1
      LLSIG/.gitignore
  3. 11
      LLSIG/.project
  4. BIN
      LLSIG/LLSIG.jar
  5. 40
      LLSIG/coauthors.sh
  6. 103
      LLSIG/pom.xml
  7. 2
      LLSIG/run
  8. 13
      LLSIG/src/main/java/LLSIG/App.java
  9. 7
      LLSIG/src/main/java/LLSIG/Canvas.java
  10. 1
      LLSIG/src/main/java/LLSIG/JLayerPlayerPausable.java
  11. 3
      LLSIG/src/main/java/LLSIG/LLSIG.java
  12. 1
      LLSIG/src/main/java/LLSIG/Lane.java
  13. 1
      LLSIG/src/main/java/LLSIG/Note.java
  14. 1
      LLSIG/src/main/java/LLSIG/NoteType.java
  15. 1
      LLSIG/src/main/java/LLSIG/Player.java
  16. 2
      LLSIG/src/main/java/sig/utils/FileUtils.java
  17. 20
      LLSIG/src/test/java/LLSIG/AppTest.java

@ -0,0 +1,9 @@
---
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
tasks:
- init: sh ./coauthors.sh
vscode:
extensions:
- redhat.java
- mhutchie.git-graph
- vscjava.vscode-maven

1
LLSIG/.gitignore vendored

@ -1,2 +1,3 @@
/bin/
/music/
/target/

@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1633501545997</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

Binary file not shown.

@ -0,0 +1,40 @@
npm i -g git-mob
cat <<-EOF > ~/.git-coauthors
{
"coauthors": {
"sig": {
"name": "sigonasr2",
"email": "sigonasr2@gmail.com"
}
}
}
EOF
git mob sig
cat <<-EOF > .git/hooks/prepare-commit-msg
#!/usr/bin/env node
let exec = require('child_process').exec,
fs = require('fs');
const commitMessage = process.argv[2];
// expect .git/COMMIT_EDITMSG
if(/COMMIT_EDITMSG/g.test(commitMessage)){
let contents = "";
exec("git mob-print",
function (err, stdout) {
if(err) {
process.exit(0);
}
// opens .git/COMMIT_EDITMSG
contents = fs.readFileSync(commitMessage);
if(contents.indexOf(stdout.trim()) !== -1) {
process.exit(0);
}
const commentPos = contents.indexOf('# ');
const gitMessage = contents.slice(0, commentPos);
const gitComments = contents.slice(commentPos)
fs.writeFileSync(commitMessage, gitMessage + stdout + gitComments);
process.exit(0);
});
}
EOF
chmod +x .git/hooks/prepare-commit-msg
echo "Environment is setup!"

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>LLSIG</groupId>
<artifactId>LLSIG</artifactId>
<version>1.0-SNAPSHOT</version>
<name>LLSIG</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javazoom/jlayer -->
<dependency>
<groupId>javazoom</groupId>
<artifactId>jlayer</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>main.java.LLSIG.LLSIG</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</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>
</pluginManagement>
</build>
</project>

@ -0,0 +1,2 @@
mvn compile assembly:single
java -jar target/LLSIG-1.0-SNAPSHOT-jar-with-dependencies.jar

@ -0,0 +1,13 @@
package main.java.LLSIG;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

@ -1,3 +1,4 @@
package main.java.LLSIG;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
@ -15,7 +16,8 @@ public class Canvas extends JPanel{
public void paintComponent(Graphics g) {
final int MIDDLE_X = this.getWidth()/2;
final int MIDDLE_Y = this.getHeight()/2;
final int MIDDLE_Y = this.getHeight()/8;
final int NOTE_DISTANCE = 128;
final int JUDGEMENT_LINE_WIDTH = 64;
final int JUDGEMENT_LINE_HEIGHT = 4;
final int NOTE_SIZE = 16;
@ -32,7 +34,8 @@ public class Canvas extends JPanel{
int LANE_X_OFFSET = (i-5)*LANE_SPACING_X+LANE_SPACING_X/2+JUDGEMENT_LINE_WIDTH/2;
g.setColor(Color.GRAY);
g.fillRect(MIDDLE_X-JUDGEMENT_LINE_WIDTH/2+LANE_X_OFFSET,MIDDLE_Y-JUDGEMENT_LINE_HEIGHT/2,JUDGEMENT_LINE_WIDTH,JUDGEMENT_LINE_HEIGHT);
//g.fillRect(MIDDLE_X-JUDGEMENT_LINE_WIDTH/2+LANE_X_OFFSET,MIDDLE_Y-JUDGEMENT_LINE_HEIGHT/2,JUDGEMENT_LINE_WIDTH,JUDGEMENT_LINE_HEIGHT);
g.fillOval((int)(MIDDLE_X-Math.cos(Math.toRadians(22.5*i))-16),(int)(MIDDLE_Y+Math.sin(Math.toRadians(22.5*i))-16),32,32);
g.setColor(NOTE_COLOR);
Lane lane = LLSIG.game.lanes.get(i);

@ -1,3 +1,4 @@
package main.java.LLSIG;
/* *-----------------------------------------------------------------------
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published

@ -1,3 +1,4 @@
package main.java.LLSIG;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
@ -15,7 +16,7 @@ import java.util.regex.Pattern;
import javax.swing.JFrame;
import javazoom.jl.decoder.JavaLayerException;
import sig.utils.FileUtils;
import main.java.sig.utils.FileUtils;
public class LLSIG implements KeyListener{
Player musicPlayer;

@ -1,3 +1,4 @@
package main.java.LLSIG;
import java.util.ArrayList;
import java.util.List;

@ -1,3 +1,4 @@
package main.java.LLSIG;
public class Note {
NoteType type;

@ -1,3 +1,4 @@
package main.java.LLSIG;
public enum NoteType {
NORMAL,

@ -1,3 +1,4 @@
package main.java.LLSIG;
import javazoom.jl.decoder.JavaLayerException;
public class Player {

@ -1,4 +1,4 @@
package sig.utils;
package main.java.sig.utils;
import java.io.BufferedReader;
import java.io.File;

@ -0,0 +1,20 @@
package LLSIG;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
Loading…
Cancel
Save