Skip to content

Commit

Permalink
Split core and model, fix publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
NebelNidas committed Mar 10, 2024
1 parent 6545ecc commit 0df97c6
Show file tree
Hide file tree
Showing 99 changed files with 545 additions and 469 deletions.
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ subprojects {
}
}

group = 'net.fabricmc'
group = 'net.fabricmc.matcher'
version = rootProject.version

checkstyle {
Expand Down Expand Up @@ -57,4 +57,12 @@ subprojects {
// disable 'missing' warnings
options.addStringOption('Xdoclint:all,-missing', '-quiet')
}

publishing {
publications {
"$project.name"(MavenPublication) {
from components.java
}
}
}
}
3 changes: 2 additions & 1 deletion matcher-cli/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
plugins {
id 'application'
id 'org.gradlex.extra-java-module-info'
}

archivesBaseName = 'matcher-cli'

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
2 changes: 1 addition & 1 deletion matcher-cli/src/main/java/matcher/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import matcher.cli.provider.builtin.AdditionalPluginsCliParameterProvider;
import matcher.cli.provider.builtin.AutomatchCliCommandProvider;
import matcher.config.Config;
import matcher.model.config.Config;

public class Main {
public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import matcher.Matcher;
import matcher.cli.MatcherCli;
import matcher.cli.provider.CliCommandProvider;
import matcher.config.Config;
import matcher.config.ProjectConfig;
import matcher.mapping.MappingField;
import matcher.mapping.Mappings;
import matcher.model.config.Config;
import matcher.model.config.ProjectConfig;
import matcher.model.mapping.MappingField;
import matcher.model.mapping.Mappings;
import matcher.model.type.ClassEnvironment;
import matcher.serdes.MatchesIo;
import matcher.type.ClassEnvironment;

/**
* Provides the default {@code automatch} command.
Expand Down
11 changes: 2 additions & 9 deletions matcher-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
plugins {
id 'java-library'
}
archivesBaseName = 'matcher-core'

java {
sourceCompatibility = JavaVersion.VERSION_11
Expand All @@ -18,10 +16,5 @@ tasks.withType(JavaCompile).configureEach {
}

dependencies {
api "net.fabricmc:mapping-io:${mappingio_version}"
api "org.ow2.asm:asm:${asm_version}"
api "org.ow2.asm:asm-tree:${asm_version}"
api "org.slf4j:slf4j-api:${slf4j_version}"
implementation "org.ow2.asm:asm-commons:${asm_version}"
implementation "org.ow2.asm:asm-util:${asm_version}"
api project(':matcher-model')
}
35 changes: 18 additions & 17 deletions matcher-core/src/main/java/matcher/Matcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,24 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import matcher.classifier.ClassClassifier;
import matcher.classifier.ClassifierLevel;
import matcher.classifier.FieldClassifier;
import matcher.classifier.IRanker;
import matcher.classifier.MethodClassifier;
import matcher.classifier.MethodVarClassifier;
import matcher.classifier.RankResult;
import matcher.config.Config;
import matcher.config.ProjectConfig;
import matcher.type.ClassEnv;
import matcher.type.ClassEnvironment;
import matcher.type.ClassInstance;
import matcher.type.FieldInstance;
import matcher.type.InputFile;
import matcher.type.MemberInstance;
import matcher.type.MethodInstance;
import matcher.type.MethodVarInstance;
import matcher.model.NameType;
import matcher.model.classifier.ClassClassifier;
import matcher.model.classifier.ClassifierLevel;
import matcher.model.classifier.FieldClassifier;
import matcher.model.classifier.IRanker;
import matcher.model.classifier.MethodClassifier;
import matcher.model.classifier.MethodVarClassifier;
import matcher.model.classifier.RankResult;
import matcher.model.config.Config;
import matcher.model.config.ProjectConfig;
import matcher.model.type.ClassEnv;
import matcher.model.type.ClassEnvironment;
import matcher.model.type.ClassInstance;
import matcher.model.type.FieldInstance;
import matcher.model.type.InputFile;
import matcher.model.type.MemberInstance;
import matcher.model.type.MethodInstance;
import matcher.model.type.MethodVarInstance;

public class Matcher {
public static void init() {
Expand Down
20 changes: 10 additions & 10 deletions matcher-core/src/main/java/matcher/serdes/MatchesIo.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
import java.util.function.DoubleConsumer;

import matcher.Matcher;
import matcher.config.Config;
import matcher.type.ClassEnvironment;
import matcher.type.ClassInstance;
import matcher.type.FieldInstance;
import matcher.type.InputFile;
import matcher.type.InputFile.HashType;
import matcher.type.LocalClassEnv;
import matcher.type.MemberInstance;
import matcher.type.MethodInstance;
import matcher.type.MethodVarInstance;
import matcher.model.config.Config;
import matcher.model.type.ClassEnvironment;
import matcher.model.type.ClassInstance;
import matcher.model.type.FieldInstance;
import matcher.model.type.InputFile;
import matcher.model.type.InputFile.HashType;
import matcher.model.type.LocalClassEnv;
import matcher.model.type.MemberInstance;
import matcher.model.type.MethodInstance;
import matcher.model.type.MethodVarInstance;

public class MatchesIo {
public static void read(Path path, List<Path> inputDirs, boolean verifyInputs, Matcher matcher, DoubleConsumer progressReceiver) {
Expand Down
14 changes: 1 addition & 13 deletions matcher-core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
module matcher.core {
requires java.prefs;
requires org.objectweb.asm.commons;
requires org.objectweb.asm.tree.analysis;
requires org.objectweb.asm.util;
requires transitive net.fabricmc.mappingio;
requires transitive org.objectweb.asm;
requires transitive org.objectweb.asm.tree;
requires transitive org.slf4j;
requires transitive matcher.model;

uses matcher.Plugin;

exports matcher;
exports matcher.bcremap;
exports matcher.classifier;
exports matcher.config;
exports matcher.mapping;
exports matcher.serdes;
exports matcher.type;
}
3 changes: 2 additions & 1 deletion matcher-gui/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin'
id 'org.gradlex.extra-java-module-info'
}

archivesBaseName = 'matcher-gui'

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
2 changes: 1 addition & 1 deletion matcher-gui/src/main/java/matcher/gui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import matcher.PluginLoader;
import matcher.cli.MatcherCli;
import matcher.cli.provider.builtin.AdditionalPluginsCliParameterProvider;
import matcher.config.Config;
import matcher.model.config.Config;
import matcher.gui.cli.PreLaunchGuiCliParameterProvider;

public class Main {
Expand Down
16 changes: 8 additions & 8 deletions matcher-gui/src/main/java/matcher/gui/MatcherGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@
import net.fabricmc.mappingio.MappingReader;

import matcher.Matcher;
import matcher.NameType;
import matcher.cli.MatcherCli;
import matcher.config.Config;
import matcher.config.ProjectConfig;
import matcher.config.Theme;
import matcher.gui.cli.PostLaunchGuiCliParameterProvider;
import matcher.gui.srcprocess.BuiltinDecompiler;
import matcher.gui.ui.BottomPane;
Expand All @@ -60,10 +56,14 @@
import matcher.gui.ui.Shortcuts;
import matcher.gui.ui.menu.MainMenuBar;
import matcher.gui.ui.menu.NewProjectPane;
import matcher.mapping.MappingField;
import matcher.mapping.Mappings;
import matcher.type.ClassEnvironment;
import matcher.type.MatchType;
import matcher.model.NameType;
import matcher.model.config.Config;
import matcher.model.config.ProjectConfig;
import matcher.model.config.Theme;
import matcher.model.mapping.MappingField;
import matcher.model.mapping.Mappings;
import matcher.model.type.ClassEnvironment;
import matcher.model.type.MatchType;

public class MatcherGui extends Application {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import matcher.cli.provider.CliParameterProvider;
import matcher.cli.provider.builtin.BuiltinCliParameters;
import matcher.config.ProjectConfig;
import matcher.gui.MatcherGui;
import matcher.model.config.ProjectConfig;

public class PostLaunchGuiCliParameterProvider implements CliParameterProvider {
public PostLaunchGuiCliParameterProvider(MatcherGui gui) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import matcher.Matcher;
import matcher.cli.provider.CliParameterProvider;
import matcher.config.Config;
import matcher.config.Theme;
import matcher.model.config.Config;
import matcher.model.config.Theme;

public class PreLaunchGuiCliParameterProvider implements CliParameterProvider {
@Parameter(names = {BuiltinGuiCliParameters.THEME})
Expand Down
6 changes: 3 additions & 3 deletions matcher-gui/src/main/java/matcher/gui/srcprocess/Cfr.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import org.benf.cfr.reader.bytecode.analysis.parse.utils.Pair;

import matcher.Matcher;
import matcher.NameType;
import matcher.type.ClassFeatureExtractor;
import matcher.type.ClassInstance;
import matcher.model.NameType;
import matcher.model.type.ClassFeatureExtractor;
import matcher.model.type.ClassInstance;

public class Cfr implements Decompiler {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package matcher.gui.srcprocess;

import matcher.NameType;
import matcher.type.ClassEnvironment;
import matcher.type.ClassFeatureExtractor;
import matcher.type.ClassInstance;
import matcher.model.NameType;
import matcher.model.type.ClassEnvironment;
import matcher.model.type.ClassFeatureExtractor;
import matcher.model.type.ClassInstance;

public interface Decompiler {
static String decompile(ClassEnvironment env, Decompiler decompiler, ClassInstance cls, NameType nameType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
import com.github.javaparser.printer.configuration.Indentation.IndentType;
import com.github.javaparser.utils.Utils;

import matcher.type.FieldInstance;
import matcher.type.MethodInstance;
import matcher.model.type.FieldInstance;
import matcher.model.type.MethodInstance;

public class HtmlPrinter extends DefaultPrettyPrinterVisitor {
public HtmlPrinter(TypeResolver typeResolver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import java.util.regex.Pattern;

import matcher.type.FieldInstance;
import matcher.type.MethodInstance;
import matcher.model.type.FieldInstance;
import matcher.model.type.MethodInstance;

public class HtmlUtil {
public static String getId(MethodInstance method) {
Expand Down
6 changes: 3 additions & 3 deletions matcher-gui/src/main/java/matcher/gui/srcprocess/Procyon.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import com.strobel.decompiler.PlainTextOutput;

import matcher.Matcher;
import matcher.NameType;
import matcher.type.ClassFeatureExtractor;
import matcher.type.ClassInstance;
import matcher.model.NameType;
import matcher.model.type.ClassFeatureExtractor;
import matcher.model.type.ClassInstance;

public class Procyon implements Decompiler {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

import com.github.javaparser.JavaParser;
import com.github.javaparser.JavaToken;
import com.github.javaparser.JavaToken.Kind;
import com.github.javaparser.ParseResult;
import com.github.javaparser.ParserConfiguration;
import com.github.javaparser.ParserConfiguration.LanguageLevel;
import com.github.javaparser.Position;
import com.github.javaparser.Problem;
import com.github.javaparser.Range;
import com.github.javaparser.TokenRange;
import com.github.javaparser.JavaToken.Kind;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
Expand All @@ -30,11 +30,11 @@
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;

import matcher.Matcher;
import matcher.NameType;
import matcher.type.ClassInstance;
import matcher.type.FieldInstance;
import matcher.type.MethodInstance;
import matcher.type.MethodVarInstance;
import matcher.model.NameType;
import matcher.model.type.ClassInstance;
import matcher.model.type.FieldInstance;
import matcher.model.type.MethodInstance;
import matcher.model.type.MethodVarInstance;

public class SrcDecorator {
public static String decorate(String src, ClassInstance cls, NameType nameType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.type.VoidType;

import matcher.NameType;
import matcher.type.ClassInstance;
import matcher.type.FieldInstance;
import matcher.type.ClassEnv;
import matcher.type.Matchable;
import matcher.type.MethodInstance;
import matcher.model.NameType;
import matcher.model.type.ClassEnv;
import matcher.model.type.ClassInstance;
import matcher.model.type.FieldInstance;
import matcher.model.type.Matchable;
import matcher.model.type.MethodInstance;

class TypeResolver {
public void setup(ClassInstance rootCls, NameType nameType, CompilationUnit cu) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.jetbrains.java.decompiler.main.extern.IResultSaver;

import matcher.NameType;
import matcher.type.ClassFeatureExtractor;
import matcher.type.ClassInstance;
import matcher.model.NameType;
import matcher.model.type.ClassFeatureExtractor;
import matcher.model.type.ClassInstance;

public class Vineflower implements Decompiler {
@Override
Expand Down
20 changes: 10 additions & 10 deletions matcher-gui/src/main/java/matcher/gui/ui/BottomPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;

import matcher.classifier.ClassifierLevel;
import matcher.classifier.FieldClassifier;
import matcher.classifier.MethodClassifier;
import matcher.classifier.RankResult;
import matcher.gui.MatcherGui;
import matcher.type.ClassInstance;
import matcher.type.FieldInstance;
import matcher.type.MatchType;
import matcher.type.MemberInstance;
import matcher.type.MethodInstance;
import matcher.type.MethodVarInstance;
import matcher.model.classifier.ClassifierLevel;
import matcher.model.classifier.FieldClassifier;
import matcher.model.classifier.MethodClassifier;
import matcher.model.classifier.RankResult;
import matcher.model.type.ClassInstance;
import matcher.model.type.FieldInstance;
import matcher.model.type.MatchType;
import matcher.model.type.MemberInstance;
import matcher.model.type.MethodInstance;
import matcher.model.type.MethodVarInstance;

public class BottomPane extends StackPane implements IGuiComponent {
public BottomPane(MatcherGui gui, MatchPaneSrc srcPane, MatchPaneDst dstPane) {
Expand Down
Loading

0 comments on commit 0df97c6

Please sign in to comment.