diff --git a/build.gradle b/build.gradle index 933573b1..420c0452 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,20 @@ application { repositories { mavenCentral() + google() + ivy { + name 'dex2jarV24Release' + url 'https://github.com/pxb1988/dex2jar/releases/download' + patternLayout { + artifact 'v[revision]/[artifact]-v[revision].[ext]' + } + metadataSources { + artifact() + } + content { + includeModule 'com.googlecode.dex2jar', 'dex-tools' + } + } maven { url 'https://repo.lanink.com/repository/maven-public/' } @@ -28,15 +42,35 @@ repositories { configurations { // Isolated classpath for the forked codegen JVM (the :codegen subproject + JavaParser). codegenClasspath + // The official v2.4 distribution is not published as a Maven module. + dex2jarV24Distribution } +def dex2jarV24Directory = file("$buildDir/dependencies/dex2jar-v2.4") +def dex2jarV24Jars = [ + 'd2j-base-cmd-v2.4.jar', + 'dex-ir-v2.4.jar', + 'dex-reader-api-v2.4.jar', + 'dex-reader-v2.4.jar', + 'dex-tools-v2.4.jar', + 'dex-translator-v2.4.jar', + 'dex-writer-v2.4.jar', + 'asm-9.5.jar', + 'asm-analysis-9.5.jar', + 'asm-commons-9.5.jar', + 'asm-tree-9.5.jar', + 'asm-util-9.5.jar' +] +def dex2jarV24ArchiveSha256 = 'ee7c45eb3c1d2474a6145d8d447e651a736a22d9664b6d3d3be5a5a817dda23a' + dependencies { codegenClasspath project(':codegen') + dex2jarV24Distribution('com.googlecode.dex2jar:dex-tools:2.4@zip') { + transitive = false + } - // https://repo.lanink.cn/#browse/browse:maven-public:cn/nukkit/Nukkit/MOT-SNAPSHOT - /*implementation (group: 'cn.nukkit', name: 'Nukkit', version: 'MOT-20240213.074103-139') { - exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl' - }*/ + // The repository POM is packaging=pom, so the JAR artifact must be explicit. + implementation 'com.reider745.nukkit-mot:Nukkit-MOT:1.5.0-SNAPSHOT@jar' // https://mvnrepository.com/artifact/org.jetbrains/annotations implementation 'org.jetbrains:annotations:26.0.1' @@ -47,12 +81,18 @@ dependencies { // https://central.sonatype.com/artifact/org.json/json/versions implementation group: 'org.json', name: 'json', version: '20231013' + implementation 'com.cedarsoftware:json-io:4.9.12' + implementation fileTree(dir: dex2jarV24Directory, include: '*.jar') + implementation 'org.javassist:javassist:3.29.1-GA' + + // Generated API-only Android compatibility stubs. This is the only + // intentionally vendored JAR; rebuild it with rebuildAndroidStubs. + implementation files('iclibs/android.jar') + compileOnly 'com.android.support:support-annotations:25.3.1' + compileOnly("org.projectlombok:lombok:1.18.44") annotationProcessor("org.projectlombok:lombok:1.18.44") - implementation fileTree (dir: 'iclibs', include: '*.jar') - implementation fileTree (dir: 'iclibs/dex2jar', include: '*.jar') - testImplementation(platform("org.junit:junit-bom:5.10.0")) testImplementation("org.junit.jupiter:junit-jupiter") testRuntimeOnly("org.junit.platform:junit-platform-launcher") @@ -78,7 +118,9 @@ jar { manifest { attributes 'Main-Class': application.mainClass } - from configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } + from { + configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } + } } run { @@ -96,6 +138,40 @@ def apiGenOutputDir = layout.projectDirectory.dir('src/main/java/com/zhekasmirno def apiGenSourceTestRoot = file('src/test/java/org/innercore') def apiGenOutputTestDir = layout.projectDirectory.dir('src/test/java/com/zhekasmirnov/innercore/api/gen') +tasks.register('prepareDex2jarV24', Sync) { + group = 'build setup' + description = 'Downloads and extracts the exact dex2jar v2.4 libraries used by the legacy build.' + + def distribution = configurations.dex2jarV24Distribution + inputs.files(distribution) + from { + distribution.collect { zipTree(it) } + } + include dex2jarV24Jars.collect { "**/lib/$it" } + eachFile { details -> + details.path = details.name + } + includeEmptyDirs = false + into dex2jarV24Directory + + doFirst { + def archive = distribution.singleFile + def checksumProperty = 'dex2jarV24ArchiveSha256Actual' + ant.checksum(file: archive, algorithm: 'SHA-256', property: checksumProperty) + def actualSha256 = ant.project.properties[checksumProperty] + if (actualSha256 != dex2jarV24ArchiveSha256) { + throw new GradleException("Unexpected dex2jar v2.4 archive SHA-256: $actualSha256") + } + } + + doLast { + def missing = dex2jarV24Jars.findAll { !file("$dex2jarV24Directory/$it").isFile() } + if (!missing.isEmpty()) { + throw new GradleException("dex2jar v2.4 archive is missing expected libraries: $missing") + } + } +} + tasks.register('generateApiBindingsTest', JavaExec) { group = 'codegen' description = 'Generates JS binding base classes from @ApiBinding-annotated sources.' @@ -129,7 +205,7 @@ tasks.register('generateApiBindings', JavaExec) { } tasks.named('compileJava') { - dependsOn 'generateApiBindings' + dependsOn 'generateApiBindings', 'prepareDex2jarV24' } task rebuildAndroidStubs(type: JavaExec, dependsOn: classes) { @@ -178,4 +254,4 @@ publishing { } } } -} \ No newline at end of file +} diff --git a/iclibs/Nukkit-MOT-SNAPSHOT.jar b/iclibs/Nukkit-MOT-SNAPSHOT.jar deleted file mode 100644 index 16b72046..00000000 Binary files a/iclibs/Nukkit-MOT-SNAPSHOT.jar and /dev/null differ diff --git a/iclibs/README.md b/iclibs/README.md new file mode 100644 index 00000000..8651a0e6 --- /dev/null +++ b/iclibs/README.md @@ -0,0 +1,17 @@ +# Android compatibility stubs + +This directory intentionally contains only `android.jar`, a generated set of +API-only Android compatibility stubs required to compile and run the legacy +Inner Core API on the standalone server. + +The stubs can be regenerated from a locally supplied Android API input with: + +```shell +./gradlew rebuildAndroidStubs +``` + +The input file is expected at `.todo/android.jar` and is excluded from Git. +All other project dependencies are resolved from the remote repositories +declared in `build.gradle` and must not be vendored here. The legacy dex2jar +libraries are extracted into `build/dependencies` from the checksum-pinned +official v2.4 release during the build. diff --git a/iclibs/android-support-multidex.jar b/iclibs/android-support-multidex.jar deleted file mode 100644 index 92c2c8ec..00000000 Binary files a/iclibs/android-support-multidex.jar and /dev/null differ diff --git a/iclibs/android-support-v4.jar b/iclibs/android-support-v4.jar deleted file mode 100644 index 10ff45ae..00000000 Binary files a/iclibs/android-support-v4.jar and /dev/null differ diff --git a/iclibs/android-support-v7-recyclerview.jar b/iclibs/android-support-v7-recyclerview.jar deleted file mode 100644 index d01b2068..00000000 Binary files a/iclibs/android-support-v7-recyclerview.jar and /dev/null differ diff --git a/iclibs/desugar_jdk_libs-1.0.10.jar b/iclibs/desugar_jdk_libs-1.0.10.jar deleted file mode 100644 index f2d003bf..00000000 Binary files a/iclibs/desugar_jdk_libs-1.0.10.jar and /dev/null differ diff --git a/iclibs/dex2jar/asm-9.5.jar b/iclibs/dex2jar/asm-9.5.jar deleted file mode 100644 index f5701dca..00000000 Binary files a/iclibs/dex2jar/asm-9.5.jar and /dev/null differ diff --git a/iclibs/dex2jar/asm-analysis-9.5.jar b/iclibs/dex2jar/asm-analysis-9.5.jar deleted file mode 100644 index 3385bff9..00000000 Binary files a/iclibs/dex2jar/asm-analysis-9.5.jar and /dev/null differ diff --git a/iclibs/dex2jar/asm-commons-9.5.jar b/iclibs/dex2jar/asm-commons-9.5.jar deleted file mode 100644 index 21898dfd..00000000 Binary files a/iclibs/dex2jar/asm-commons-9.5.jar and /dev/null differ diff --git a/iclibs/dex2jar/asm-tree-9.5.jar b/iclibs/dex2jar/asm-tree-9.5.jar deleted file mode 100644 index 5c6da657..00000000 Binary files a/iclibs/dex2jar/asm-tree-9.5.jar and /dev/null differ diff --git a/iclibs/dex2jar/asm-util-9.5.jar b/iclibs/dex2jar/asm-util-9.5.jar deleted file mode 100644 index f059066c..00000000 Binary files a/iclibs/dex2jar/asm-util-9.5.jar and /dev/null differ diff --git a/iclibs/dex2jar/d2j-base-cmd-v2.4.jar b/iclibs/dex2jar/d2j-base-cmd-v2.4.jar deleted file mode 100644 index 459c5f41..00000000 Binary files a/iclibs/dex2jar/d2j-base-cmd-v2.4.jar and /dev/null differ diff --git a/iclibs/dex2jar/dex-ir-v2.4.jar b/iclibs/dex2jar/dex-ir-v2.4.jar deleted file mode 100644 index 5dbb4af7..00000000 Binary files a/iclibs/dex2jar/dex-ir-v2.4.jar and /dev/null differ diff --git a/iclibs/dex2jar/dex-reader-api-v2.4.jar b/iclibs/dex2jar/dex-reader-api-v2.4.jar deleted file mode 100644 index f367f8b1..00000000 Binary files a/iclibs/dex2jar/dex-reader-api-v2.4.jar and /dev/null differ diff --git a/iclibs/dex2jar/dex-reader-v2.4.jar b/iclibs/dex2jar/dex-reader-v2.4.jar deleted file mode 100644 index 5d7519be..00000000 Binary files a/iclibs/dex2jar/dex-reader-v2.4.jar and /dev/null differ diff --git a/iclibs/dex2jar/dex-tools-v2.4.jar b/iclibs/dex2jar/dex-tools-v2.4.jar deleted file mode 100644 index 860b1c35..00000000 Binary files a/iclibs/dex2jar/dex-tools-v2.4.jar and /dev/null differ diff --git a/iclibs/dex2jar/dex-translator-v2.4.jar b/iclibs/dex2jar/dex-translator-v2.4.jar deleted file mode 100644 index 15369cd4..00000000 Binary files a/iclibs/dex2jar/dex-translator-v2.4.jar and /dev/null differ diff --git a/iclibs/dex2jar/dex-writer-v2.4.jar b/iclibs/dex2jar/dex-writer-v2.4.jar deleted file mode 100644 index 1bd986e8..00000000 Binary files a/iclibs/dex2jar/dex-writer-v2.4.jar and /dev/null differ diff --git a/iclibs/dex2jar/open-source-license.txt b/iclibs/dex2jar/open-source-license.txt deleted file mode 100644 index e8669c54..00000000 --- a/iclibs/dex2jar/open-source-license.txt +++ /dev/null @@ -1,67 +0,0 @@ -==== dx-*.jar -Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html - - -==== antlr-*.jar -[The BSD License] -Copyright (c) 2003-2007, Terence Parr -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. -* Neither the name of the author nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - - -==== asm-*.jar - - ASM: a very small and fast Java bytecode manipulation framework - Copyright (c) 2000-2005 INRIA, France Telecom - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/iclibs/glide-3.6.0.jar b/iclibs/glide-3.6.0.jar deleted file mode 100644 index 13ce8f95..00000000 Binary files a/iclibs/glide-3.6.0.jar and /dev/null differ diff --git a/iclibs/javassist.jar b/iclibs/javassist.jar deleted file mode 100644 index 9035cdf8..00000000 Binary files a/iclibs/javassist.jar and /dev/null differ diff --git a/iclibs/json-io.jar b/iclibs/json-io.jar deleted file mode 100644 index 9e00ebfb..00000000 Binary files a/iclibs/json-io.jar and /dev/null differ diff --git a/iclibs/recyclerview-1.1.0.jar b/iclibs/recyclerview-1.1.0.jar deleted file mode 100644 index c703ef41..00000000 Binary files a/iclibs/recyclerview-1.1.0.jar and /dev/null differ diff --git a/iclibs/reflections.jar b/iclibs/reflections.jar deleted file mode 100644 index c2556418..00000000 Binary files a/iclibs/reflections.jar and /dev/null differ diff --git a/iclibs/support-annotations-25.3.1.jar b/iclibs/support-annotations-25.3.1.jar deleted file mode 100644 index cf84b573..00000000 Binary files a/iclibs/support-annotations-25.3.1.jar and /dev/null differ diff --git a/iclibs/zip4j.jar b/iclibs/zip4j.jar deleted file mode 100644 index c0b03953..00000000 Binary files a/iclibs/zip4j.jar and /dev/null differ diff --git a/src/main/java/com/zhekasmirnov/mcpe161/InnerCore.java b/src/main/java/com/zhekasmirnov/mcpe161/InnerCore.java index 7d431d74..fc9acfd2 100644 --- a/src/main/java/com/zhekasmirnov/mcpe161/InnerCore.java +++ b/src/main/java/com/zhekasmirnov/mcpe161/InnerCore.java @@ -28,7 +28,6 @@ import java.util.List; public class InnerCore { public static final String LOGGER_TAG = "INNERCORE-LAUNHER"; - public static final boolean isLicenceVersion = false; private static InnerCore instance; private static JavaEnvironment javaEnvironment; @@ -62,7 +61,7 @@ public class InnerCore { } public static boolean checkLicence(Activity activity) { - return !isLicenceVersion; + throw new UnsupportedOperationException("InnerCore.checkLicence(activity)"); } public void load() {