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

[EXPERIMENT] Try out MIMA 3.0.0-alpha-2 #1716

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
11 changes: 8 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,15 @@ sourceSets.main.compileClasspath += sourceSets.java9.output.classesDirs;

dependencies {
implementation 'com.offbytwo:docopt:0.6.0.20150202'
implementation 'com.google.code.findbugs:jsr305:3.0.2'

implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'org.apache.commons:commons-compress:1.20'
implementation 'info.picocli:picocli:4.6.3'
implementation 'io.quarkus.qute:qute-core:1.12.2.Final'
implementation 'kr.motd.maven:os-maven-plugin:1.7.1'
// dep on maven-plugin is no-no, wait for https://github.com/trustin/os-maven-plugin/issues/70
// esp as code compiled against annos and maven internals brought in by this artifact!
// implementation 'kr.motd.maven:os-maven-plugin:1.7.1'
implementation 'org.codehaus.plexus:plexus-java:1.0.6'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'org.jsoup:jsoup:1.13.1'
Expand All @@ -103,8 +106,9 @@ dependencies {
implementation "org.slf4j:jcl-over-slf4j:1.7.30"
implementation "org.jboss:jandex:2.2.3.Final"

implementation "eu.maveniverse.maven.mima:context:2.4.3"
runtimeOnly "eu.maveniverse.maven.mima.runtime:standalone-static:2.4.3"
implementation "eu.maveniverse.maven.mima:context:3.0.0-alpha-2"
// this should be runtime, but JBang uses some Maven bits like model as well
implementation "eu.maveniverse.maven.mima.runtime:standalone-static:3.0.0-alpha-2"

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.0"
testImplementation "org.junit.jupiter:junit-jupiter:5.9.0"
Expand Down Expand Up @@ -235,6 +239,7 @@ compileJava9Java {
shadowJar {
minimize() {
//exclude(dependency('org.slf4j:slf4j-api:.*'))
exclude(dependency('eu.maveniverse.maven.mima:context:.*'))
exclude(dependency('eu.maveniverse.maven.mima.runtime:standalone-static:.*'))
exclude(dependency('org.slf4j:jcl-over-slf4j:.*'))
exclude(dependency('org.slf4j:slf4j-nop:.*'))
Expand Down
25 changes: 8 additions & 17 deletions src/main/java/dev/jbang/dependencies/Detector.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
package dev.jbang.dependencies;

import java.util.List;
import java.util.Locale;
import java.util.Properties;

public class Detector extends kr.motd.maven.os.Detector {

public Detector() {
super();
}

@Override
protected void log(String message) {

}

@Override
protected void logProperty(String name, String value) {

}
public class Detector {

public void detect(Properties properties, List<String> classiferWithLikes) {
super.detect(properties, classiferWithLikes);

// "hack" to expose a property that works with javafx mac classifers
String os = properties.getProperty("os.detected.name");
String os = System.getProperty("os.name", "unknown").toLowerCase(Locale.ROOT);
if (os.contains("mac")) {
os = "osx";
} else if (os.contains("win")) {
os = "windows";
}
if (os.equals("osx")) {
os = "mac";
if ("aarch64".equals(System.getProperty("os.arch"))) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/dev/jbang/cli/TestRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -2110,8 +2110,8 @@ void testGAVCliReposAndDepsSingleRepo(@TempDir File output) throws IOException {
} catch (ExitException ex) {
StringWriter sw = new StringWriter();
ex.printStackTrace(new PrintWriter(sw));
assertThat(sw.toString(), containsString(
"Could not transfer artifact info.picocli:picocli-codegen:pom:4.6.3 from/to https://dummyrepo"));
// message MAY change based on transport used, assert only the minimum
assertThat(sw.toString(), containsString("info.picocli:picocli-codegen:pom:4.6.3"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ void testResolveDependenciesAltRepo(@TempDir File altrepo) {
.build()
.resolve(deps);
assertEquals(2, artifacts.size());
assertThat(altrepo.listFiles(), arrayWithSize(4));
// "com", "log4j" and "org". What is expected as 4th?
assertThat(altrepo.listFiles(), arrayWithSize(3));
// assertThat(altrepo.listFiles(), arrayWithSize(4));
}

@Test
Expand Down
Loading