Skip to content

Commit

Permalink
大版本迭代修复完成和更新补丁问题
Browse files Browse the repository at this point in the history
  • Loading branch information
baka4n committed Jan 9, 2024
1 parent f3232ae commit b26878f
Show file tree
Hide file tree
Showing 806 changed files with 5,291 additions and 281 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/io/github/xenfork/acl/MainAware.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.architectury.plugin.ArchitecturyPlugin;
import io.github.xenfork.acl.projects.Main;
import io.github.xenfork.acl.settings.MainSettings;
import net.fabricmc.loom.bootstrap.LoomGradlePluginBootstrap;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.initialization.Settings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class AclExtensions {
private String mcversion, group, project$name, srg, flv;
public static String srg_out = "";
public String srg_out = "";
public Type mappings;

public String getGroup() {
Expand Down
22 changes: 10 additions & 12 deletions core/src/main/java/io/github/xenfork/acl/projects/AllProjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin;
import dev.architectury.plugin.ArchitecturyPlugin;
import io.github.xenfork.acl.settings.MainSettings;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
Expand Down Expand Up @@ -33,19 +34,16 @@ public void apply(Project target) {
mvn.setUrl("https://maven.parchmentmc.org");
mvn.setName("ParchmentMc Mapping");
});

action.afterEvaluate(project -> {
project.setGroup(acl.getGroup());
project.getExtensions().getExtraProperties().set("archivesBaseName", project.getName().split("-")[0]);
TaskCollection<JavaCompile> javaCompiles = project.getTasks().withType(JavaCompile.class);
javaCompiles.configureEach(it -> {
CompileOptions options = it.getOptions();
options.setEncoding("UTF-8");
options.getRelease().set(17);
});
JavaPluginExtension javaPluginExtension = project.getExtensions().getByType(JavaPluginExtension.class);
javaPluginExtension.withSourcesJar();
target.setGroup(MainSettings.acl.getGroup());
target.getExtensions().getExtraProperties().set("archivesBaseName", target.getName().split("-")[0]);
TaskCollection<JavaCompile> javac = target.getTasks().withType(JavaCompile.class);
javac.configureEach(it -> {
CompileOptions options = it.getOptions();
options.setEncoding("UTF-8");
options.getRelease().set(17);
});
JavaPluginExtension java = target.getExtensions().getByType(JavaPluginExtension.class);
java.withSourcesJar();
});
}
}
84 changes: 15 additions & 69 deletions core/src/main/java/io/github/xenfork/acl/projects/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,14 @@ public void apply(@NotNull Project target) {
target.getPlugins().apply(ArchitecturyPlugin.class);
System.out.println(MainSettings.acl.getSrg());
System.out.println(MainSettings.acl.getMcversion());
init(acl, target);
init(MainSettings.acl, target);
ArchitectPluginExtension architectury = target.getExtensions().getByType(ArchitectPluginExtension.class);
architectury.setMinecraft(MainSettings.acl.getMcversion());

target.getPlugins().apply(AllProjects.class);
target.getPlugins().apply(SubProjects.class);


findProject(target);
// target.apply(action -> {
// action.plugin(ArchitecturyPlugin.class);
// });

// target.getPluginManager().apply(AllProjects.class);
// target.getPluginManager().apply(SubProjects.class);
// acl = target.getExtensions().create("acl", AclExtensions.class);
// String projects = (String) target.getProperties().get("sts.projects");
// if (!projects.isEmpty()) {
// for (String name : projects.split(",")) {
// Project common = target.findProject(":" + name + "-common");
// if (common != null)
// new Common().apply(common);
// Project fabric = target.findProject(":" + name + "-fabric");
// if (fabric != null)
// new Fabric().apply(fabric);
// Project forge = target.findProject(":" + name + "-forge");
// if (forge != null) {
// new Forge().apply(forge);
// }
// Project quilt = target.findProject(":" + name + "-quilt");
// if (quilt != null) {
// new Quilt().apply(quilt);
// }
// Project neoforge = target.findProject(":" + name + "-neoforge");
// if (neoforge != null) {
// new NeoForge().apply(neoforge);
// }
// }
// }
//
// target.afterEvaluate(project -> {
// init(acl, project);
// ArchitectPluginExtension architectPluginExtension = (ArchitectPluginExtension) project.getExtensions().getByName("loom");
// architectPluginExtension.setMinecraft(acl.getMcversion());
//
// });
// SourceSetContainer sourceSets = target.getExtensions().getByType(SourceSetContainer.class);
// Project common = target.getRootProject().getSubprojects().stream().filter(p -> p.getName().equals("common")).toList().get(0);
// Project fabric = target.getRootProject().getSubprojects().stream().filter(p -> p.getName().equals("fabric")).toList().get(0);
Expand Down Expand Up @@ -141,42 +103,26 @@ public static void findProject(Project target) {
}

private static void init(AclExtensions acl, Project project) {
if (acl.getMcversion() == null) {
if (project.getProperties().containsKey("acl.mcversion"))
acl.setMcversion(String.valueOf(project.getProperties().get("acl.mcversion")));

else
throw new RuntimeException("don't set minecraft version, can use acl.mcversion=\"1.20.1\" or other version");
if (MainSettings.acl.getMcversion() == null) {
throw new RuntimeException("don't set minecraft version, can use acl.mcversion=\"1.20.1\" or other version");
}
if (acl.getFlv() == null) {
if (project.getProperties().containsKey("acl.flv")) {
acl.setFlv(String.valueOf(project.getProperties().get("acl.flv")));
}
else
throw new RuntimeException("don't set fabric loader version, can use acl.flv=\"flv_version\"");
if (MainSettings.acl.getFlv() == null) {
throw new RuntimeException("don't set fabric loader version, can use acl.flv=\"flv_version\"");
}
if (acl.getProject$name() == null) {
if (project.getProperties().containsKey("archives_base_name")) {
acl.setProject$name(String.valueOf(project.getProperties().get("archives_base_name")));
} else {
acl.setProject$name(project.getName());
}
if (MainSettings.acl.getProject$name() == null) {
MainSettings.acl.setProject$name(project.getName());
}
if (acl.getGroup() == null) {
if (project.getProperties().containsKey("acl.group")) {
acl.setGroup(String.valueOf(project.getProperties().get("acl.group")));
} else {
acl.setGroup("io.github.xenfork");
}
if (MainSettings.acl.getGroup() == null) {
MainSettings.acl.setGroup("io.github.xenfork");
}
Type mappings = acl.getMappings();
String srg = acl.getSrg();
Type mappings = MainSettings.acl.getMappings();
String srg = MainSettings.acl.getSrg();
if (mappings instanceof Mojang) {
if (!srg.isEmpty()) {
if (srg.contains(":")) {
AclExtensions.srg_out = "org.parchmentmc.data:parchment-%s@zip".formatted(srg);
MainSettings.acl.srg_out = "org.parchmentmc.data:parchment-%s@zip".formatted(srg);
} else {
AclExtensions.srg_out = "org.parchmentmc.data.parchment-%s:%s@zip".formatted(acl.getMcversion(), srg);
MainSettings.acl.srg_out = "org.parchmentmc.data:parchment-" + MainSettings.acl.getMcversion() + ":" + srg + "@zip";
}
}
}
Expand All @@ -186,9 +132,9 @@ else if (mappings instanceof Yarn) {
}
if (srg.contains(":")) {
String[] split = srg.split(":", 2);
AclExtensions.srg_out = "net.fabricmc:yarn:%s+build.%s".formatted(split[0], split[1]);
MainSettings.acl.srg_out = "net.fabricmc:yarn:%s+build.%s".formatted(split[0], split[1]);
} else {
AclExtensions.srg_out = "net.fabricmc:yarn:%s+build.%s".formatted(acl.getMcversion(), srg);
MainSettings.acl.srg_out = "net.fabricmc:yarn:%s+build.%s".formatted(acl.getMcversion(), srg);
}
}
}
Expand Down
34 changes: 14 additions & 20 deletions core/src/main/java/io/github/xenfork/acl/projects/SubProjects.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
package io.github.xenfork.acl.projects;

import io.github.xenfork.acl.mappings.Mojang;
import net.fabricmc.loom.LoomGradleExtension;
import io.github.xenfork.acl.settings.MainSettings;
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
import net.fabricmc.loom.api.mappings.layered.MappingContext;
import net.fabricmc.loom.bootstrap.LoomGradlePluginBootstrap;
import net.fabricmc.loom.configuration.DependencyInfo;
import net.fabricmc.loom.configuration.LoomDependencyManager;
import net.fabricmc.loom.configuration.providers.mappings.GradleMappingContext;
import net.fabricmc.loom.configuration.providers.mappings.LayeredMappingsDependency;
import net.fabricmc.loom.configuration.providers.minecraft.MinecraftSourceSets;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.service.SharedServiceManager;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.DependencySet;
import org.gradle.api.artifacts.dsl.DependencyHandler;
import org.gradle.api.artifacts.dsl.GradleDependencies;
import org.gradle.api.plugins.ExtraPropertiesExtension;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

public class SubProjects implements Plugin<Project> {

public static LoomGradleExtensionAPI loom;

@Override
public void apply(@NotNull Project target) {
target.subprojects(action -> {
Expand All @@ -38,24 +31,25 @@ public void apply(@NotNull Project target) {
else
action.setVersion("1.0.0.0");

action.afterEvaluate(project -> {
// LoomGradleExtensionAPI loom = project.getExtensions().getByType(LoomGradleExtensionAPI.class);
LoomGradleExtension loom = LoomGradleExtension.get(project);
loom = (LoomGradleExtensionAPI) action.getExtensions().findByName("loom");
if (loom != null) {
loom.silentMojangMappingsLicense();
DependencyHandler dependencies = project.getDependencies();
dependencies.add(Constants.Configurations.MINECRAFT, "com.mojang:minecraft:" + Main.acl.getMcversion());
if (Main.acl.getMappings() instanceof Mojang) {
DependencyHandler dependencies = action.getDependencies();
dependencies.add(Constants.Configurations.MINECRAFT, "com.mojang:minecraft:" + MainSettings.acl.getMcversion());
if (MainSettings.acl.getMappings() instanceof Mojang) {

if (AclExtensions.srg_out.isEmpty()) {
if (MainSettings.acl.srg_out.isEmpty()) {
dependencies.add(Constants.Configurations.MAPPINGS, loom.officialMojangMappings());
} {
}
{
dependencies.add(Constants.Configurations.MAPPINGS, loom.layered(layered -> {
layered.officialMojangMappings();
layered.parchment(AclExtensions.srg_out);
layered.parchment(MainSettings.acl.srg_out);
}));
}
}
});
}

});
}
}
19 changes: 19 additions & 0 deletions core/src/main/java/io/github/xenfork/acl/projects/sub/Basic.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.github.xenfork.acl.projects.sub;

import io.github.xenfork.acl.mappings.Mojang;
import io.github.xenfork.acl.projects.AclExtensions;
import io.github.xenfork.acl.settings.MainSettings;
import net.fabricmc.loom.util.Constants;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.dsl.DependencyHandler;
import org.jetbrains.annotations.NotNull;

import static io.github.xenfork.acl.projects.SubProjects.loom;

public class Basic implements Plugin<Project> {
@Override
public void apply(@NotNull Project target) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

import java.io.File;

public class Common implements Plugin<Project> {
public class Common extends Basic {
@Override
public void apply(@NotNull Project target) {
super.apply(target);
// target.afterEvaluate(project -> {
// SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
// SourceDirectorySet main = sourceSets.getByName("main").getResources();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.gradle.api.Project;
import org.jetbrains.annotations.NotNull;

public class Fabric implements Plugin<Project> {
public class Fabric extends Basic {
@Override
public void apply(@NotNull Project target) {

super.apply(target);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.gradle.api.Project;
import org.jetbrains.annotations.NotNull;

public class Forge implements Plugin<Project> {
public class Forge extends Basic {
@Override
public void apply(@NotNull Project target) {

super.apply(target);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.gradle.api.Project;
import org.jetbrains.annotations.NotNull;

public class NeoForge implements Plugin<Project> {
public class NeoForge extends Basic {
@Override
public void apply(@NotNull Project target) {

super.apply(target);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.gradle.api.Project;
import org.jetbrains.annotations.NotNull;

public class Quilt implements Plugin<Project> {
public class Quilt extends Basic {
@Override
public void apply(@NotNull Project target) {

super.apply(target);
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
acl_test_version=1.0.51-SNAPSHOT
acl_version=1.0.88-SNAPSHOT
acl_version=1.1.1-SNAPSHOT


sts.projects=
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>acl</groupId>
<artifactId>acl.gradle.plugin</artifactId>
<version>1.0.88-SNAPSHOT</version>
<version>1.0.94-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>io.github.xenfork</groupId>
<artifactId>acl-core</artifactId>
<version>1.0.88-SNAPSHOT</version>
<version>1.0.94-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
307bd0b2bfee929b3ca35e308a010cd4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
81fb1117b5ad3eaf1ff94c663dd5e3cc39095d28
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f17703af78a9f6d823c1a42a80d69009e361c22080e190577a11d03fa4a7bd78
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f34e5de705e5e908511bdf72910886942fdb04925e133bb72a0bc60f4f74613f9e0bb78df11de1be8fb98e1a656dfd8d313a99787ccfba77e2887366d79c8fc2
Loading

0 comments on commit b26878f

Please sign in to comment.