Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Migration #21

Closed
wants to merge 16 commits into from
Closed
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
8 changes: 7 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Auto detect text files and perform LF normalization
* text=auto

# Explicitly declare gradlew to always have LF endings on checkout
gradlew text eol=lf

# Denote all files that are truly binary and should not be modified.
*.jpg binary
*.png binary
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
19 changes: 19 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Validate Gradle Wrapper"

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
validation:
name: Validation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ diagram
.classpath
.settings/
src/main/MainTest.java
.gradle/**
build/**
17 changes: 0 additions & 17 deletions .project

This file was deleted.

25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# Project-Diagram-Generator
Program that takes the root folder of a programming project and automatically generates a UML diagram for that entire project; will only process .java files for now as that is what I am familiar with.

Requires Graphviz to work, so grab it here: https://graphviz.org/download/

Just run the "Project Diagram Generator 1.8.jar" to get things started, direct the prompt towards your graphviz/bin/dot.exe file (wherever you downloaded Graphviz to), and you can get started! The default image in there is the UML diagram for the program itself. More thorough description below.

Note: To run this program fresh (not through the .jar but compiling it yourself), it requires my graphics library Software Visual Interface. The version that this uses is embedded in the assets folder inside the project, so just add that to your libraries when building it and you should be good to go.
Program that takes the root folder of a programming project and automatically generates a UML diagram for that entire project; will only process .java files for now as that is what I am familiar with.

## How to use this
- If you're code-aware and want rapid construction of the same project, download this project and find the Main.java class in the Main package; there's a function called 'runLoose()' that takes a path and output name directly to automatically construct the same project's UML every time you run it, which is faster than doing it through the UI, although you could change the project while the UI and its settings were open and do rapid reconstruction that way as well.
## Build

### Requirements

- To use it normally, download the 'Project Diagram Generator 1.8.jar' file; this is a runnable .jar (basically an .exe) that gives you a GUI for viewing and generating the diagrams you generate (they are really pleasing to look at when it's a good design). It uses Java v.1.8 so you don't need the newest jdk to run it (for some reason user-end java releases are only in version 1.8).
- Java 11 or later
- A local copy of [SoftwareVisualInterface](https://github.com/syoon2/SoftwareVisualInterface)
- [Graphviz](https://graphviz.org/) (optional)

- You will need to download Graphviz, as that is the software used to make the graphs after your project has been converted into a generic UML format. The first time you run the program, it will configure itself by asking you to direct it to the graphviz/bin/dot.exe file, which it saves in a folder beside the .jar alongside folders to hold the images you generate and the graphviz source files to replicate or edit them manually.
### Instructions

- Upon configuring the program, you will see a default image that is the UML Diagram I generated of this project, so you can see the class architecture that produced this!
1. Get a copy of [SoftwareVisualInterface](https://github.com/syoon2/SoftwareVisualInterface) and install it in
your local Maven repository (run `./gradlew publishToMavenLocal`).
2. Clone this repository.
3. Run `./gradlew run` (if you just want to run this) or `./gradlew uberJar` (if you want an all-in-one JAR file)

## How to use this

- You need to provide three things for the program to run: the directory of the root path for your project (either manual entry or using the + button next to it that pops open a FileChooser browser to navigate your file system), any packages you want to ignore (please just use the + button to get a popout interface for selecting this, you can click on the packages to open and close them which translate to whether or not the contents of that package will be interpreted for the UML), and a name for the output image.

Expand Down
Binary file removed UML Diagram Generator 1.8.jar
Binary file not shown.
104 changes: 104 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
apply plugin: 'java'
apply plugin: 'application'

// Assume Java 11
sourceCompatibility = 11
targetCompatibility = 11

repositories {
mavenLocal()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/syoon2/SoftwareVisualInterface")
}
}

dependencies {
// JUnit 5 / Jupiter
testImplementation('org.junit.jupiter:junit-jupiter:5.10.0')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.10.0')

// Apache Commons
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.13.0'
implementation group: 'commons-cli', name: 'commons-cli', version: '1.5.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.13.0'

// Apache Log4j2
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.20.0'
runtimeOnly group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.20.0'

// SoftwareVisualInterface
implementation group: 'com.github.softwarevisualinterface', name: 'svi', version: '2.0-SNAPSHOT'

// graphviz-java
implementation group: 'guru.nidi', name: 'graphviz-java', version: '0.18.1'
runtimeOnly group: 'org.graalvm.js', name: 'js', version: '23.0.1'
runtimeOnly group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.20.0'
}

ext {
javaMainClass = 'main.Main'
}

test {
dependsOn cleanTest
testLogging.showStandardStreams = true
}

tasks.named('test', Test) {
useJUnitPlatform()
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs += [
'-Xlint:unchecked',
'-Xlint:deprecation'
]
}

// Options when compiling tests
compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs += [
'-Xlint:unchecked',
'-Xlint:deprecation'
]
}

task buildDependenciesFolder(type: Copy) {
from configurations.implementation
into './dependencies'
}

application {
mainClassName = javaMainClass
}

jar {
manifest {
attributes(
"Main-Class": javaMainClass
)
}
}

task uberJar(type: Jar) {
manifest {
attributes(
"Main-Class": javaMainClass,
'Multi-Release': 'true'
)
}

archiveClassifier = 'uber'

from sourceSets.main.output

duplicatesStrategy(DuplicatesStrategy.EXCLUDE)

dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading