-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
471 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
dist: trusty | ||
|
||
language: java | ||
jdk: | ||
- openjdk8 | ||
- oraclejdk8 | ||
|
||
before_cache: | ||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock | ||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ | ||
cache: | ||
directories: | ||
- $HOME/.gradle/caches/ | ||
- $HOME/.gradle/wrapper/ | ||
|
||
before_install: | ||
- chmod +x ./gradlew | ||
|
||
install: | ||
- ./gradlew --refresh-dependencies | ||
|
||
script: | ||
- ./gradlew clean build | ||
|
||
after_success: | ||
- ./gradlew bintrayUpload | ||
|
||
notifications: | ||
email: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
# MixinBootstrap | ||
|
||
[![Build Status](https://api.travis-ci.com/LXGaming/MixinBootstrap.svg?branch=master)](https://travis-ci.com/LXGaming/MixinBootstrap) | ||
[![License](https://lxgaming.github.io/badges/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) | ||
[![Patreon](https://lxgaming.github.io/badges/Patreon-donate-yellow.svg)](https://www.patreon.com/lxgaming) | ||
[![Paypal](https://lxgaming.github.io/badges/Paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CZUUA6LE7YS44&item_name=MixinBootstrap+(from+GitHub.com)) | ||
|
||
**MixinBootstrap** is a way of booting [Mixin](https://github.com/SpongePowered/Mixin) in a [MinecraftForge](https://github.com/MinecraftForge/MinecraftForge) production environment by utilizing a [ModLauncher](https://github.com/cpw/modlauncher) ITransformationService. | ||
|
||
## Prerequisites | ||
[MinecraftForge](https://github.com/MinecraftForge/MinecraftForge) must be running [ModLauncher](https://github.com/cpw/modlauncher) v4.2.0 | ||
|
||
## Usage | ||
Simply drop the `MixinBootstrap-<VERSION>.jar` into the [MinecraftForge](https://github.com/MinecraftForge/MinecraftForge) mods folder | ||
|
||
## Download | ||
MixinBootstrap is available on [GitHub](https://github.com/LXGaming/MixinBootstrap/releases) | ||
|
||
## License | ||
MixinBootstrap is licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
plugins { | ||
id "java" | ||
id "signing" | ||
} | ||
|
||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
|
||
group = "io.github.lxgaming" | ||
archivesBaseName = "MixinBootstrap" | ||
version = "1.0.0" | ||
|
||
configurations { | ||
provided { | ||
compile.extendsFrom(provided) | ||
} | ||
|
||
build.dependsOn("signJar") | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
maven { | ||
name = "minecraftforge" | ||
url = "https://files.minecraftforge.net/maven" | ||
} | ||
maven { | ||
name = "spongepowered" | ||
url = "https://repo.spongepowered.org/maven" | ||
} | ||
} | ||
|
||
dependencies { | ||
provided("com.google.code.findbugs:jsr305:3.0.2") | ||
provided("cpw.mods:modlauncher:4.2.0") { | ||
exclude(module: "asm-analysis") | ||
} | ||
provided("net.sf.jopt-simple:jopt-simple:5.0.4") | ||
provided("org.apache.logging.log4j:log4j-api:2.11.2") | ||
compile("org.ow2.asm:asm-analysis:6.2") { | ||
transitive = false | ||
} | ||
compile("org.ow2.asm:asm-util:6.2") { | ||
transitive = false | ||
} | ||
compile("org.spongepowered:mixin:0.8-SNAPSHOT") { | ||
transitive = false | ||
} | ||
} | ||
|
||
jar { | ||
from ((configurations.compile - configurations.provided).findAll({ | ||
it.isDirectory() || it.name.endsWith(".jar") | ||
}).collect({ | ||
it.isDirectory() ? it : zipTree(it) | ||
})) { | ||
|
||
exclude("META-INF/services/cpw.mods.modlauncher.*") | ||
exclude("META-INF/*.RSA") | ||
exclude("META-INF/*.SF") | ||
} | ||
|
||
exclude("module-info.class") | ||
} | ||
|
||
processResources { | ||
from("LICENSE") | ||
rename("LICENSE", "LICENSE-" + archivesBaseName) | ||
} | ||
|
||
task signJar { | ||
doFirst { | ||
if (!project.hasProperty("signing.keyStorePath") || !project.hasProperty("signing.secretKeyRingFile")) { | ||
project.logger.warn("========== [WARNING] ==========") | ||
project.logger.warn("") | ||
project.logger.warn(" This build is not signed! ") | ||
project.logger.warn("") | ||
project.logger.warn("========== [WARNING] ==========") | ||
throw new StopExecutionException() | ||
} | ||
} | ||
|
||
doLast { | ||
configurations.archives.allArtifacts.files.each { | ||
ant.signjar( | ||
jar: it, | ||
alias: project.property("signing.alias"), | ||
storepass: project.property("signing.keyStorePassword"), | ||
keystore: project.property("signing.keyStorePath"), | ||
keypass: project.property("signing.keyStorePassword"), | ||
preservelastmodified: project.property("signing.preserveLastModified"), | ||
tsaurl: project.property("signing.timestampAuthority"), | ||
digestalg: project.property("signing.digestAlgorithm") | ||
) | ||
project.logger.lifecycle("JAR Signed: " + it.name) | ||
|
||
signing.sign(it) | ||
project.logger.lifecycle("PGP Signed: " + it.name) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.gradle.jvmargs=-Xmx512M |
82 changes: 82 additions & 0 deletions
82
src/main/java/io/github/lxgaming/mixin/launch/MixinLaunchPluginService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright 2019 Alex Thomson | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.github.lxgaming.mixin.launch; | ||
|
||
import cpw.mods.modlauncher.TransformingClassLoader; | ||
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService; | ||
import org.objectweb.asm.Type; | ||
import org.objectweb.asm.tree.ClassNode; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Arrays; | ||
import java.util.EnumSet; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class MixinLaunchPluginService implements ILaunchPluginService { | ||
|
||
public static final String NAME = "mixinbootstrap"; | ||
|
||
private static final List<String> SKIP_PACKAGES = Arrays.asList( | ||
"org.objectweb.asm.", | ||
"org.spongepowered.asm.launch.", | ||
"org.spongepowered.asm.lib.", | ||
"org.spongepowered.asm.mixin.", | ||
"org.spongepowered.asm.service.", | ||
"org.spongepowered.asm.util." | ||
); | ||
|
||
@Override | ||
public String name() { | ||
return MixinLaunchPluginService.NAME; | ||
} | ||
|
||
@Override | ||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) { | ||
throw new UnsupportedOperationException("Outdated ModLauncher"); | ||
} | ||
|
||
@Override | ||
public boolean processClass(Phase phase, ClassNode classNode, Type classType) { | ||
throw new UnsupportedOperationException("Outdated ModLauncher"); | ||
} | ||
|
||
@Override | ||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty, String reason) { | ||
return EnumSet.noneOf(Phase.class); | ||
} | ||
|
||
@Override | ||
public boolean processClass(Phase phase, ClassNode classNode, Type classType, String reason) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void addResources(List<Map.Entry<String, Path>> resources) { | ||
} | ||
|
||
@Override | ||
public void initializeLaunch(ITransformerLoader transformerLoader, Path[] specialPaths) { | ||
TransformingClassLoader classLoader = (TransformingClassLoader) Thread.currentThread().getContextClassLoader(); | ||
classLoader.addTargetPackageFilter(name -> SKIP_PACKAGES.stream().noneMatch(name::startsWith)); | ||
} | ||
|
||
@Override | ||
public <T> T getExtension() { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.