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

refactor: Put MIMA in action #1604

Merged
merged 31 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c7065eb
Put MIMA in action
cstamas Mar 31, 2023
b7b470a
Fix shading
cstamas Mar 31, 2023
8a7a037
A bit bigger commit
cstamas Mar 31, 2023
40f77e0
Use released, fix tests
cstamas Apr 3, 2023
85f5c5d
Revert "A bit bigger commit"
quintesse May 3, 2023
52b2ad9
refactor: created alternative way for getting local maven repo path
quintesse May 3, 2023
106ef1b
Update and use static-uber runtime
cstamas May 4, 2023
773257d
Use 1.1.2 MIMA
cstamas May 5, 2023
107c3e7
Remove as it is unneeded
cstamas May 5, 2023
5faaf4e
LoggingEnabled was still false
cstamas May 6, 2023
0075479
Disable shaded jar minimization
cstamas May 6, 2023
eaee8f8
Simplify
cstamas May 6, 2023
2de7385
Use MIMA 2.0.0
cstamas May 6, 2023
48f084a
Add --verbose to 1st invocation
cstamas May 9, 2023
f544fa5
Use MIMA 2.1.0
cstamas May 11, 2023
5c7605c
fix: explicit exclude standalone static from minimization
maxandersen Jul 1, 2023
528ab5b
Update MIMA, add required dep (httpClient)
cstamas Aug 7, 2023
547e449
By default non-HTTPS reposes are disabled so assertions failed.
cstamas Aug 7, 2023
3f75b7d
One more http->https
cstamas Aug 7, 2023
e29e979
Move off from deprecated methods
cstamas Aug 7, 2023
8d51d1d
Align minimize config w/ changes
cstamas Aug 7, 2023
c0da467
Merge remote-tracking branch 'origin/main' into mima
cstamas Oct 20, 2023
b324672
Up to Mima 2.3.5
cstamas Oct 20, 2023
3ee04d1
Upgrade to MIMA 2.4.0
cstamas Oct 24, 2023
072b13b
Merge remote-tracking branch 'origin/main' into mima
cstamas Nov 18, 2023
43a2fdf
Upgrade MIMA to 2.4.2
cstamas Nov 18, 2023
d0a9b86
Use default it no repo given
cstamas Nov 18, 2023
778b98a
Simplify and better express intenty
cstamas Nov 18, 2023
2b5e563
Merge remote-tracking branch 'origin/main' into mima
cstamas Dec 6, 2023
ff51b8a
Ignore settings.xml discovered repositories, JBang drives this
cstamas Dec 6, 2023
bd5add1
Update ot MIMA 2.4.3
cstamas Dec 6, 2023
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
15 changes: 5 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,11 @@ dependencies {
implementation 'org.codejive:java-properties:0.0.5'

implementation "org.slf4j:slf4j-nop:1.7.30"
implementation "org.slf4j:jcl-over-slf4j:1.7.30"
implementation "org.jboss:jandex:2.2.3.Final"

implementation "org.apache.maven:maven-model:3.8.6"
implementation "org.apache.maven:maven-settings:3.8.6"
implementation "org.apache.maven:maven-settings-builder:3.8.6"
implementation "org.apache.maven:maven-resolver-provider:3.8.6"
implementation "org.apache.maven.resolver:maven-resolver-api:1.8.2"
implementation "org.apache.maven.resolver:maven-resolver-spi:1.8.2"
implementation "org.apache.maven.resolver:maven-resolver-impl:1.8.2"
implementation "org.apache.maven.resolver:maven-resolver-connector-basic:1.8.2"
implementation "org.apache.maven.resolver:maven-resolver-transport-file:1.8.2"
implementation "org.apache.maven.resolver:maven-resolver-transport-http:1.8.2"
implementation "eu.maveniverse.maven.mima:context:2.4.3"
runtimeOnly "eu.maveniverse.maven.mima.runtime:standalone-static:2.4.3"

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.0"
testImplementation "org.junit.jupiter:junit-jupiter:5.9.0"
Expand Down Expand Up @@ -242,6 +235,8 @@ compileJava9Java {
shadowJar {
minimize() {
//exclude(dependency('org.slf4j:slf4j-api:.*'))
exclude(dependency('eu.maveniverse.maven.mima.runtime:standalone-static:.*'))
exclude(dependency('org.slf4j:jcl-over-slf4j:.*'))
exclude(dependency('org.slf4j:slf4j-nop:.*'))
exclude(dependency('org.jboss.logging:jboss-logging:.*'))
}
Expand Down
2 changes: 1 addition & 1 deletion itests/test_suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ rm -rf ~/.jbang/cache
echo Testing with `which jbang`

## init ##
assert "jbang init $SCRATCH/test.java"
assert "jbang --verbose init $SCRATCH/test.java"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO can be undone, I think that was done early in this PR, probably had some issue so needed debug logs for resolver?

assert_raises "test -f $SCRATCH/test.java" 0

assert "jbang $SCRATCH/test.java" "Hello World"
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/dev/jbang/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ public class Settings {
final public static String CONFIG_CACHE_EVICT = "cache-evict";
final public static String DEFAULT_CACHE_EVICT = "PT12H";

public static Path getLocalMavenRepo() {
return Paths.get(System .getenv()
.getOrDefault(JBANG_REPO,
(String) System .getProperties()
.getOrDefault("maven.repo.local",
System.getProperty("user.home")
+ File.separator + ".m2" + File.separator
+ "repository")))
.toAbsolutePath();
public static Path getJBangLocalMavenRepoOverride() {
String jbangRepo = System.getenv().get(JBANG_REPO);
if (jbangRepo != null) {
return Paths.get(jbangRepo);
} else {
return null;
}
}

public static Path getCacheDependencyFile() {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/jbang/cli/Export.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;

import dev.jbang.Settings;
import dev.jbang.catalog.Alias;
import dev.jbang.catalog.CatalogUtil;
import dev.jbang.dependencies.ArtifactInfo;
import dev.jbang.dependencies.ArtifactResolver;
import dev.jbang.dependencies.MavenCoordinate;
import dev.jbang.source.BuildContext;
import dev.jbang.source.Project;
Expand Down Expand Up @@ -203,7 +203,7 @@ int apply(BuildContext ctx) throws IOException {
Path outputPath = exportMixin.outputFile;

if (outputPath == null) {
outputPath = Settings.getLocalMavenRepo();
outputPath = ArtifactResolver.getLocalMavenRepo();
}
// Copy the JAR
Path source = ctx.getJarFile();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/dev/jbang/cli/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.PrintWriter;

import dev.jbang.Settings;
import dev.jbang.dependencies.ArtifactResolver;
import dev.jbang.util.Util;
import dev.jbang.util.VersionChecker;

Expand Down Expand Up @@ -39,7 +40,7 @@ public Integer doCall() {
PrintWriter out = spec.commandLine().getOut();
out.println("Cache: " + Settings.getCacheDir());
out.println("Config: " + Settings.getConfigDir());
out.println("Repository:" + Settings.getLocalMavenRepo());
out.println("Repository: " + ArtifactResolver.getLocalMavenRepo());
}

return EXIT_OK;
Expand Down
Loading
Loading