Skip to content

Commit

Permalink
Remove jar-with-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Jul 21, 2023
1 parent 79bbeac commit 74f3a2f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 76 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ jobs:
mkdir maven
cp pom.xml maven/${BUILD_ARTIFACT}.pom
cp target/${BUILD_ARTIFACT}.jar maven/
cp target/${BUILD_ARTIFACT}-jar-with-dependencies.jar maven/
cp target/${BUILD_ARTIFACT}-sources.jar maven/
cp target/${BUILD_ARTIFACT}-javadoc.jar maven/
[ -f "target/${BUILD_ARTIFACT}-jar-with-dependencies.jar" ] && cp target/${BUILD_ARTIFACT}-jar-with-dependencies.jar maven/
pushd maven
gpg -ab ${BUILD_ARTIFACT}.pom
gpg -ab ${BUILD_ARTIFACT}.jar
gpg -ab ${BUILD_ARTIFACT}-jar-with-dependencies.jar
gpg -ab ${BUILD_ARTIFACT}-sources.jar
gpg -ab ${BUILD_ARTIFACT}-javadoc.jar
[ -f "${BUILD_ARTIFACT}-jar-with-dependencies.jar" ] && gpg -ab ${BUILD_ARTIFACT}-jar-with-dependencies.jar
jar -cvf ${BUILD_ARTIFACT}-bundle.jar *
env:
Expand All @@ -79,7 +79,8 @@ jobs:
if: ${{ inputs.publish_github }}
run: |
gh release create "v${{ inputs.version }}" --draft --title "Version ${{ inputs.version }}" \
target/${BUILD_ARTIFACT}.jar target/${BUILD_ARTIFACT}-jar-with-dependencies.jar
target/${BUILD_ARTIFACT}.jar \
$([ -f "${BUILD_ARTIFACT}-jar-with-dependencies.jar" ] && echo "target/${BUILD_ARTIFACT}-jar-with-dependencies.jar" || echo "")
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifacts
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Add the following dependency to your `pom.xml`:
<dependency>
<groupId>org.moeaframework</groupId>
<artifactId>pisa-plugin</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</dependency>
```

Or copy the JAR into the MOEA Framework's `lib/` folder.
Or download the JAR from the [Releases](releases) into the MOEA Framework's `lib/` folder.

## Usage

Expand Down Expand Up @@ -61,7 +61,7 @@ To avoid this setup or to support running without an internet connection, you ca

```bash

java -cp "lib/*" org.moeaframework.algorithm.pisa.installer.PISAInstaller install
java -cp "lib/*" org.moeaframework.algorithm.pisa.PISAAlgorithms install
```

### Blocking Downloads
Expand Down
54 changes: 1 addition & 53 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.moeaframework</groupId>
<artifactId>pisa-plugin</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<packaging>jar</packaging>

<name>PISA Plugin for the MOEA Framework</name>
Expand Down Expand Up @@ -48,32 +48,6 @@
<version>4.13.2</version>
<scope>test</scope>
</dependency>

<!-- defining some transitive dependencies as provided so they're not included in jar-all-dependencies -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.10.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -103,32 +77,6 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jar-with-dependencies</shadedClassifierName>
<artifactSet>
<excludes>
<!-- exclude JUnit -->
<exclude>org.junit:junit</exclude>
<exclude>org.hamcrest:hamcrest</exclude>
</excludes>
</artifactSet>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
34 changes: 34 additions & 0 deletions src/main/java/org/moeaframework/algorithm/pisa/PISAAlgorithms.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
*/
package org.moeaframework.algorithm.pisa;

import java.io.IOException;
import java.util.function.BiFunction;

import org.moeaframework.algorithm.pisa.installer.PISAInstaller;
import org.moeaframework.algorithm.pisa.installer.SourceInstaller;
import org.moeaframework.core.Algorithm;
import org.moeaframework.core.Problem;
import org.moeaframework.core.Variation;
Expand Down Expand Up @@ -70,4 +73,35 @@ private BiFunction<TypedProperties, Problem, Algorithm> fromProblem(String name)
};
}

public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Invalid number of arguments");
showUsage();
System.exit(-1);
}

if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("-h") || args[0].equalsIgnoreCase("--help")) {
showUsage();
} else if (args[0].equalsIgnoreCase("clear")) {
PISAInstaller.getInstaller().clearAll();
} else if (args[0].equalsIgnoreCase("install")) {
PISAInstaller.getInstaller().installAll();
} else if (args[0].equalsIgnoreCase("install_source")) {
new SourceInstaller().installAll();
}

System.out.println();
System.out.println("Done!");
}

private static void showUsage() {
System.out.println("Usage: java -cp \"lib/*\" " + PISAAlgorithms.class.getName() + " <arg>");
System.out.println();
System.out.println("Arguments:");
System.out.println(" clear Removes all existing PISA selectors");
System.out.println(" help Displays this help message");
System.out.println(" install Downloads and installs all PISA selectors");
System.out.println(" install_source Downloads and compiles all PISA selectors from source code (experimental)");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,5 @@ public static PISAInstaller getInstaller() {
//return new SourceInstaller();
}
}

public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Requires one argument: clear, install, install_source");
}

if (args[0].equalsIgnoreCase("clear")) {
getInstaller().clearAll();
} else if (args[0].equalsIgnoreCase("install")) {
getInstaller().installAll();
} else if (args[0].equalsIgnoreCase("install_source")) {
new SourceInstaller().installAll();
}

System.out.println();
System.out.println("Done!");
}

}

0 comments on commit 74f3a2f

Please sign in to comment.