diff --git a/.gitignore b/.gitignore index 82e2b93..02e481a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,111 +1,30 @@ -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff: -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries - -# Sensitive or high-churn files: -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.xml -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml - -# Gradle: -.idea/**/gradle.xml -.idea/**/libraries - -# CMake -cmake-build-debug/ - -# Mongo Explorer plugin: -.idea/**/mongoSettings.xml - -## File-based project format: -*.iws - -## Plugin-specific files: - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties -### Windows template -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk -### Gradle template -.gradle -/build/ - -# Ignore Gradle GUI config -gradle-app.setting - -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar - -# Cache of project -.gradletasknamecache - -# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 -# gradle/wrapper/gradle-wrapper.properties - +## .gitignore ## +# ignore all +* +changelog.md + +1.*/* +common/* + +# allow any +!*.md +!src/ +!gradle/ +!lib/ +!info/ +!build.gradle +!common.gradle +!project.gradle +!settings.gradle +!gradle.properties +!properties.gradle +!gradlew +!gradlew.bat +!install.bat +!build.bat +!install.sh +!build.sh +!.gitmodules +!.gitignore +!.gitattributes +!.travis.yml \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 1e6b572..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 99fa241..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index d1b8874..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/SuperCompressedCobblestoneMod_api.iml b/.idea/modules/SuperCompressedCobblestoneMod_api.iml deleted file mode 100644 index 59f23bc..0000000 --- a/.idea/modules/SuperCompressedCobblestoneMod_api.iml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/SuperCompressedCobblestoneMod_main.iml b/.idea/modules/SuperCompressedCobblestoneMod_main.iml deleted file mode 100644 index 45bbb4d..0000000 --- a/.idea/modules/SuperCompressedCobblestoneMod_main.iml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/SuperCompressedCobblestoneMod_test.iml b/.idea/modules/SuperCompressedCobblestoneMod_test.iml deleted file mode 100644 index 7ab2e79..0000000 --- a/.idea/modules/SuperCompressedCobblestoneMod_test.iml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0fa87dd --- /dev/null +++ b/.travis.yml @@ -0,0 +1,32 @@ +language: java +jdk: oraclejdk8 +branches: + except: + - /^b[0-9]/ +before_install: + - sh gradlew clean +install: + - sh gradlew setupCIWorkspace --continue +script: + - sh gradlew build --continue +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/ +deploy: + - provider: script + skip_cleanup: true +# CurseForgeやBintrayのAPIなどが準備できたらこっち +# script: "sh gradlew githubRelease bintrayUpload curseforge --continue" + script: "sh gradlew githubRelease --continue" + on: + all_branches: true + condition: '! "$TRAVIS_BRANCH" =~ ^(dev\\-|feature\\/).*$' +notifications: + email: false + webhooks: + urls: + secure: "l0p54ziHmZszGmy0MyqvDAbj5d9+vbqkUDjvjQuENS+rJuRO+MD83txViIO6Y3eRO9D7PpR0MRdeDesTMFSvsRsYjF9uC7k95Hk/+3JMEyjJ2CN6TW+f3SrKktMJypA6mdqH6ylhMTVkAONoZ+01iB3lRmlLnnYcBuk0juF+zQ9FzUF/MZpl54tjPwlnn+clpB0B6llcJcP8MhYw7y2Wqr6tBXc7wnYyF9os7H7pLuQuBov17D4E6FX2ZDCa2tw3HDXaxHyvEElmP+nGdmo7xwdSLDrD1eyT/+3aoXLygV1SijfT/zEmCIvEGoUp8znRWhOhN2k4b4m8Khp908IoXFxtoVID/VLiJuRPW9vRkQuYB0pGaWeJXVY8PnUKPeidN+6hzBxw6Ky9J+yq2qrkfxX5cUTYnLsOFgXlev6LdgzIefLbsQ/xOelkf485w+jXNk7Flx1Tmnt0XWmWoHWWcAiDm9dMlES9GjWbb62AEUpI/mLCzLBZZVZwZd8/UUGAOpqcsi5uWrXCohOJN5rDXeje9PqUP0CIrrOkTE5JWZDPhSCpKgoU7t6z8sRrcUlDhUoAW2TVLKjyMpTMAwLKmsndr+UP4bGeX6q2hle4RxvFcubP8WCw3GjL2Eqb5w9X1eCiFva6U0zGBDhctJoG0bvwzdTbNL3/8t6dqk+T/d4=" \ No newline at end of file diff --git a/README.md b/README.md index 3aa63d9..b4f40f7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# SuperCompressedCobblestoneMod +[![Build Status](https://travis-ci.org/KotlinModdingNetwork/SuperCompressedCobblestoneMod.svg?branch=master)](https://travis-ci.org/KotlinModdingNetwork/SuperCompressedCobblestoneMod) +# SuperCompressedCobblestoneMod ## 詳細/タスク 超圧縮丸石mod.mdを見てください。 diff --git a/SuperCompressedCobblestoneMod.iml b/SuperCompressedCobblestoneMod.iml deleted file mode 100644 index 0b80208..0000000 --- a/SuperCompressedCobblestoneMod.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..1e07217 --- /dev/null +++ b/build.bat @@ -0,0 +1,3 @@ +cd /d %~dp0 +call gradlew build +pause \ No newline at end of file diff --git a/build.gradle b/build.gradle index b514727..a60db10 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,15 @@ // For those who want the bleeding edge buildscript { - ext.kotlin_version = '1.1.4-2' - ext.mc_version = '1.10.2' - ext.jei_version = '3.14.7.420' repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } + maven { + name = 'sonatype' + url = 'https://oss.sonatype.org/content/repositories/snapshots/' + } maven { name = "CurseForge" url = "https://minecraft.curseforge.com/api/maven/" @@ -18,34 +19,199 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath forgegradle + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" + } +} + +plugins { + id 'com.palantir.git-version' version '0.7.1' + id 'co.riiid.gradle' version '0.4.2' + id 'com.jfrog.bintray' version '1.7.3' + id 'com.matthewprenger.cursegradle' version '1.0.8' +} + +project.metaClass { + isProperty = { propName -> + return delegate.hasProperty(propName) && !delegate.property(propName).empty } } -apply plugin: 'net.minecraftforge.gradle.forge' + +apply plugin: forgegradle_plugin apply plugin: 'kotlin' +apply plugin: 'maven-publish' + +import org.apache.commons.lang.StringUtils + +ext { + mod_build_prefix = 'b' + + assert project.isProperty('version_major'): 'missing property: version_major' + assert project.isProperty('version_minor'): 'missing property: version_minor' + assert project.isProperty('version_patch'): 'missing property: version_patch' + + mod_travis = System.getenv('TRAVIS') as boolean + mod_buildnumber = System.getenv('TRAVIS_BUILD_NUMBER') as Integer + mod_buildtag = System.getenv('TRAVIS_TAG') + mod_prerelease = mod_autorelease = mod_travis && StringUtils.isEmpty(mod_buildtag) + + if (mod_buildtag != null && mod_buildtag.startsWith(mod_build_prefix)) + throw new GradleException("Oops, circulated travis build. A push starting with the prefix '${mod_build_prefix}' was detected: ${mod_buildtag}") + + mod_version_min = "${project.version_major}.${project.version_minor}.${project.version_patch}" + mod_version = mod_buildnumber != null ? "${mod_version_min}.${mod_buildnumber}" : "${mod_version_min}" + mod_artifacts_dir = file "artifacts/${mod_version_min}/${mod_version}" + mod_artifacts_release_dir = file 'artifacts/release' + + mod_git_repo = plugins.findPlugin('com.palantir.git-version').gitRepo(rootProject).repository + mod_git_head = mod_git_repo.getRef('HEAD').objectId.name() + + def parseChangelog = { changelog -> + def title = null + def msg = null + def releasetype = 'release' + + if (changelog != null) { + if (StringUtils.contains(changelog, '[beta]')) { + changelog = StringUtils.replace(changelog, '[beta]', '') + releasetype = 'beta' + } else if (StringUtils.contains(changelog, '[alpha]')) { + changelog = StringUtils.replace(changelog, '[alpha]', '') + releasetype = 'alpha' + } + + def tagtitle = StringUtils.substringBefore(changelog, '\n') + def tagmsg = StringUtils.stripStart(StringUtils.substringAfter(changelog, '\n'), '\n') + if (!StringUtils.isEmpty(tagtitle) && !StringUtils.isEmpty(tagmsg)) { + title = tagtitle + msg = tagmsg + } + } + return [title, msg, releasetype] + } + + (mod_changelog_title, mod_changelog, mod_releasetype) = ({ + def (changelog_title, changelog, releasetype) = parseChangelog(({ + if (!StringUtils.isEmpty(mod_buildtag)) { + def git_ref = mod_git_repo.getRef "refs/tags/${mod_buildtag}" + + if (git_ref != null) { + def git_revwalk = new org.eclipse.jgit.revwalk.RevWalk(mod_git_repo) + try { + return git_revwalk.parseTag(git_ref.getObjectId()).getFullMessage() + } catch (org.eclipse.jgit.errors.IncorrectObjectTypeException e) { + } finally { + git_revwalk.dispose() + } + } + } + return null + })()) + + def (r_changelog_title, r_changelog) = ({ + def r_change = [changelog_title, changelog] + *.replace('{version}', mod_version) + if (mod_buildnumber == null) + return r_change + else if (mod_buildnumber != null) + return r_change + *.replace('{version_number}', mod_buildnumber) + })() + + if (mod_buildnumber != null) { + if (changelog_title != null && changelog != null) + return [r_changelog_title, r_changelog, releasetype] + return ["v${mod_version}", "v${mod_version_min} Build${mod_buildnumber}", 'alpha'] + } else { + if (changelog_title != null && changelog != null) + return [r_changelog_title, r_changelog, releasetype] + return ["v${mod_version}", "v${mod_version}", 'alpha'] + } + })() + + mod_deploy_target = file 'deploy.txt' + + sec_curseforge_key = System.getenv('CURSEFORGE_TOKEN') ?: project.isProperty('api_key_curseforge') ? project.api_key_curseforge : null + sec_github_key = System.getenv('GITHUB_TOKEN') ?: project.isProperty('api_key_github') ? project.api_key_github : null + sec_bintray_user = System.getenv('BINTRAY_USER') ?: project.isProperty('api_user_bintray') ? project.api_user_bintray : null + sec_bintray_key = System.getenv('BINTRAY_KEY') ?: project.isProperty('api_key_bintray') ? project.api_key_github : null + sec_keystore_location = System.getenv('KEYSTORE_LOCATION') ?: project.isProperty('keystore_location') ? project.keystore_location : null + sec_keystore_alias = System.getenv('KEYSTORE_ALIAS') ?: project.isProperty('keystore_alias') ? project.keystore_alias : null + sec_keystore_password = System.getenv('KEYSTORE_PASSWORD') ?: project.isProperty('keystore_password') ? project.keystore_password : null + + commonManifest = { + if (project.isProperty('extra_fmlcore')) + attributes 'FMLCorePlugin': project.extra_fmlcore + if (project.isProperty('extra_fmlmod')) + attributes 'FMLCorePluginContainsFMLMod': project.extra_fmlcore + if (project.isProperty('extra_fmlat')) + attributes 'FMLAT': project.extra_fmlat + } +} tasks.withType(Jar) { compileJava.options.encoding = 'UTF-8' compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } +task setupSourceSets { + doLast { + sourceSets*.java.srcDirs*.each { it.mkdirs() } + sourceSets*.kotlin.srcDirs*.each { it.mkdirs() } + sourceSets*.resources.srcDirs*.each { it.mkdirs() } + } + [tasks.eclipseClasspath, tasks.ideaModule]*.dependsOn 'setupSourceSets' +} + sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly. compileJava { sourceCompatibility = targetCompatibility = "1.8" } -version = "1.0.0" -group= "C6H2Cl2.mod.SuperCompressedCobblestoneMod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = "SCCSM-1.10.2" +version = "${version_minecraft}-${mod_version}" minecraft { - version = "1.10.2-12.18.3.2185" - runDir = "run" - mappings = "snapshot_20161111" + version = "${project.version_minecraft}-${project.version_forge}" + + if (project.isProperty('version_mappings')) + mappings = project.version_mappings + + if (!project.isProperty('run_location')) + runDir = 'run' + else + runDir = run_location.replace('{modid}', project.modid).replace('{mcversion}', project.version_minecraft) + + replaceIn 'Reference.java' + replaceIn 'Reference.kt' + replace '{modid}', project.modid + replace '{modname}', project.modname + replace '{version}', mod_version + replace '{mcversion}', project.version_minecraft + replace '{forgeversion}', project.version_forge +} + +import net.minecraftforge.gradle.user.TaskSourceCopy + +// Mad hacks to make source replacements work for Kotlin +for (set in sourceSets) { + def taskName = "source${set.name.capitalize()}Kotlin" + def dir = new File(project.getBuildDir(), "sources/${set.name}/kotlin") + task(taskName, type: TaskSourceCopy) { + source = set.getKotlin() + output = dir + } + def compileTask = tasks[set.getCompileTaskName("kotlin")] + compileTask.source = dir + compileTask.dependsOn taskName + def dirPath = dir.toPath() + compileKotlin.include { + return it.file.toPath().startsWith(dirPath) + } } repositories { + mavenCentral() + jcenter() maven { name = "CurseForge" url = "https://minecraft.curseforge.com/api/maven/" @@ -59,39 +225,246 @@ repositories { name = "ModMaven" url = "modmaven.k-4u.nl" } + maven { + url = "http://maven.shadowfacts.net/" + } } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" compile 'yukarilib:YukariLib-1.10.2:release:dev' - compile "mezz.jei:jei_${mc_version}:${jei_version}:api" - runtime "mezz.jei:jei_${mc_version}:${jei_version}" - compile group: "net.shadowfacts", name: "Forgelin", version: "LATEST_VERSION" + compile "mezz.jei:jei_${version_minecraft}:${jei_version}:api" + runtime "mezz.jei:jei_${version_minecraft}:${jei_version}" + compile "net.shadowfacts:Forgelin:1.5.1" } processResources -{ - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + { + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand([ + 'modid' : project.modid, + 'modname' : project.modname, + 'version' : mod_version, + 'mcversion' : project.version_minecraft, + 'forgeversion' : project.version_forge, + 'minforgeversion': project.isProperty('version_minforge') ? project.version_minforge : project.version_forge, + ]) + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + +// An Error occured while switching above 1.8 -> under 1.7 +task cleanMakeStart(type: Delete) { + // makeStart.dependsOn 'cleanMakeStart' + delete file(new File(tasks.makeStart.getTemporaryDir(), 'extracted')) +} + +jar { + from sourceSets.main.output + from sourceSets.api.output + manifest commonManifest +} - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' +sourceJar { + from sourceSets.main.allSource + from sourceSets.api.allSource + classifier 'sources' + manifest commonManifest +} - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version +task devJar(dependsOn: 'classes', type: Jar) { + from sourceSets.main.output + from sourceSets.api.output + classifier 'dev' + manifest commonManifest +} + +task apiJar(dependsOn: 'classes', type: Jar) { + from sourceSets.api.output + classifier 'api' + manifest commonManifest +} + +[jar, devJar, sourceJar, apiJar]*.destinationDir = mod_artifacts_dir + +artifacts { + archives jar + archives devJar + archives sourceJar + archives apiJar +} + +task signJars(dependsOn: 'build') { + gradle.taskGraph.whenReady { taskGraph -> + if (taskGraph.hasTask(tasks.signJars)) + assert sec_keystore_location != null, 'missing sec_keystore_location' } - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + def keystore_location = sec_keystore_location ?: '' + def keystore_alias = sec_keystore_alias ?: '' + def keystore_password = sec_keystore_password ?: '' + + inputs.dir jar.destinationDir + inputs.file keystore_location + inputs.property 'keystore_alias', keystore_alias + inputs.property 'keystore_password', keystore_password + outputs.dir jar.destinationDir + + doLast { + [jar, devJar, sourceJar, apiJar].each { eachtask -> + eachtask.outputs.files.each { file -> + if (!file.path.endsWith('.jar')) + return + + logger.lifecycle "signing ${file}" + ant.signjar( + destDir: file.parentFile, + jar: file, + keystore: keystore_location, + alias: keystore_alias, + storepass: keystore_password + ) + } + } } } -repositories { - mavenCentral() - jcenter() - maven { - url "http://maven.shadowfacts.net/" + +task deploy(dependsOn: 'build', type: Copy) { + mustRunAfter 'signJars' + + if (mod_deploy_target.exists()) + mod_deploy_target.eachLine { target -> + def dest = target.endsWith('.jar') ? target.parentFile : target + + from(project.tasks.jar.outputs.files.singleFile) + into(dest) + + rename { String oldname -> + target.endsWith('.jar') ? target.name : oldname + } + + eachFile { file -> + def path = file.relativePath.getFile(dest) + logger.lifecycle "copying to ${path}" + } + } +} + +gradle.taskGraph.whenReady { taskGraph -> + if (taskGraph.hasTask(tasks.curseforge)) { + assert sec_curseforge_key != null, 'missing sec_curseforge_key' + assert project.isProperty('extra_curseforge_id'), 'missing extra_curseforge_id' } } +if (sec_curseforge_key != null && project.isProperty('extra_curseforge_id')) { + curseforge { + tasks.curseforge.enabled = !mod_autorelease + + tasks.curseforge.dependsOn 'reobfShadowJar' + tasks.curseforge.mustRunAfter 'signJars' + apiKey = sec_curseforge_key + project { + id = project.extra_curseforge_id + + changelogType = 'markdown' + changelog = mod_changelog + + releaseType = mod_releasetype + + mainArtifact(jar) { + displayName = "${jar.baseName}-${jar.version}" + } + [devJar, sourceJar, apiJar].each { jar -> + addArtifact(jar) { + displayName = "${jar.baseName}-${jar.version}-${jar.classifier}" + } + } + + relations { + } + } + } +} else + tasks.curseforge.enabled = false + +task releaseArtifacts(dependsOn: 'build', type: Sync) { + from mod_artifacts_dir + into mod_artifacts_release_dir +} + +gradle.taskGraph.whenReady { taskGraph -> + if (taskGraph.hasTask(tasks.githubRelease)) { + assert sec_github_key != null, 'missing sec_github_key' + assert project.isProperty('extra_github_owner'), 'missing extra_github_owner' + assert project.isProperty('extra_github_repo'), 'missing extra_github_repo' + } +} +if (sec_github_key != null && project.isProperty('extra_github_owner') && project.isProperty('extra_github_repo')) { + github { + tasks.githubRelease.dependsOn 'build' + prerelease = mod_prerelease + owner = project.extra_github_owner + repo = project.extra_github_repo + token = sec_github_key + tagName = mod_travis ? (mod_autorelease ? "${mod_build_prefix}${mod_buildnumber}" : mod_buildtag) : mod_version + targetCommitish = mod_git_head + name = mod_changelog_title + body = mod_changelog + draft = false + assets = [jar, devJar, sourceJar, apiJar]*.outputs*.files*.asPath*.tr('\\', '/') + } +} + +publishing { + publications { + ModPublication(MavenPublication) { + groupId = project.group + artifactId = project.modid + version = "${mod_version}" + artifact jar + artifact jar + artifact devJar + artifact sourceJar + artifact apiJar + } + } +} + +gradle.taskGraph.whenReady { taskGraph -> + if (taskGraph.hasTask(tasks.bintrayUpload)) { + assert sec_bintray_user != null, 'missing sec_bintray_user' + assert sec_bintray_key != null, 'missing sec_bintray_key' + assert project.isProperty('extra_bintray_repo'), 'missing extra_bintray_repo' + assert project.isProperty('extra_bintray_name'), 'missing extra_bintray_name' + } +} +if (sec_bintray_user != null && sec_bintray_key != null && project.isProperty('extra_bintray_repo') && project.isProperty('extra_bintray_name')) { + bintray { + tasks.bintrayUpload.enabled = !mod_autorelease + user = sec_bintray_user + key = sec_bintray_key + publications = ['ModPublication'] + publish = true + pkg { + repo = project.extra_bintray_repo + name = project.extra_bintray_name + version { + name = "${mod_version}" + released = new Date() + } + } + } +} else + tasks.bintrayUpload.enabled = false \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..60623d4 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd `dirname $0` +bash gradlew build +echo 'Press any key to continue . . .' +read Wait \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 7cab1f2..99d57e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,39 @@ +# ForgeGradle +forgegradle=net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT +forgegradle_plugin=net.minecraftforge.gradle.forge + +# MinecraftForge +version_minecraft=1.10.2 +version_forge=12.18.3.2477 +version_minforge=12.18.3.2185 +version_mappings=snapshot_20161111 + +# Dependency +kotlin_version=1.1.4-2 +jei_version=3.14.7.420 + +# Mod Information +group=kotlinmoddingnetwork +modid=sccsm +modname=SuperCompressedCobblestoneMod + +# Version +version_major=1 +version_minor=0 +version_patch=0 + +# CoreMods +extra_fmlcore= +extra_fmlmod= +extra_fmlat= + +# CurseForge, Bintray, Github +extra_curseforge_id= +extra_bintray_repo= +extra_bintray_name= +extra_github_owner=KotlinModdingNetwork +extra_github_repo=SuperCompressedCobblestoneMod + # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx4G diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7c368f7 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6944bf1..ac3912e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Sep 24 18:46:55 JST 2016 +#Tue Sep 12 02:55:59 JST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.1-all.zip diff --git a/gradlew b/gradlew index c5543e9..cccdd3d 100644 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -111,10 +110,10 @@ if $darwin; then fi # For Cygwin, switch paths to Windows format before running java - if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -134,11 +133,11 @@ if $cygwin ; then CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option -# if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition -# eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` -# else -# eval `echo args$i`="\"$arg\"" -# fi + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi i=$((i+1)) done case $i in @@ -155,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282..f955316 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..f1e1015 --- /dev/null +++ b/install.bat @@ -0,0 +1,3 @@ +cd /d %~dp0 +call gradlew setupDevWorkspace setupDecompWorkspace eclipse +pause \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..9a9e864 --- /dev/null +++ b/install.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd `dirname $0` +bash gradlew setupDevWorkspace setupDecompWorkspace eclipse +echo 'Press any key to continue . . .' +read Wait \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..9efe1f1 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'SCCSM' \ No newline at end of file diff --git a/src/main/kotlin/c6h2cl2/sccsm/Reference.kt b/src/main/kotlin/c6h2cl2/sccsm/Reference.kt new file mode 100644 index 0000000..fda1f81 --- /dev/null +++ b/src/main/kotlin/c6h2cl2/sccsm/Reference.kt @@ -0,0 +1,18 @@ +package c6h2cl2.sccsm + +/** + * @author C6H2Cl2 + * @author Kamesuta + */ +// ※Gradleから変数の書き換えを行うため、グローバル定数はご利用いただけません。 +object Reference { + const val MODID = "sccsm" + const val NAME = "SuperCompressedCobblestoneMod" + const val VERSION = "{version}" + const val FORGE = "{forgeversion}" + const val MINECRAFT = "{mcversion}" + const val DEPENDENCIES = "required-after:forgelin" + const val PROXY_SERVER = "c6h2cl2.sccsm.CommonProxy" + const val PROXY_CLIENT = "c6h2cl2.sccsm.ClientProxy" + const val GUI_FACTORY = "c6h2cl2.sccsm.gui.config.ConfigGuiFactory" +} \ No newline at end of file diff --git a/src/main/kotlin/c6h2cl2/sccsm/SCCSMConst.kt b/src/main/kotlin/c6h2cl2/sccsm/SCCSMConst.kt deleted file mode 100644 index 8e435d3..0000000 --- a/src/main/kotlin/c6h2cl2/sccsm/SCCSMConst.kt +++ /dev/null @@ -1,10 +0,0 @@ -package c6h2cl2.sccsm - -/** - * @author C6H2Cl2 - */ - -const val MOD_ID = "sccsm" -const val MOD_NAME = "Super-Compressed Cobblestone Mod" -const val VERSION = "1.0.0" -const val DEPENDENT = "required-after:forgelin;after:ExtraUtilities" \ No newline at end of file diff --git a/src/main/kotlin/c6h2cl2/sccsm/SCCSMCore.kt b/src/main/kotlin/c6h2cl2/sccsm/SCCSMCore.kt index 50ddec9..e9152c8 100644 --- a/src/main/kotlin/c6h2cl2/sccsm/SCCSMCore.kt +++ b/src/main/kotlin/c6h2cl2/sccsm/SCCSMCore.kt @@ -13,7 +13,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent * @author C6H2Cl2 */ -@Mod(modid = MOD_ID, name = MOD_NAME, version = VERSION, useMetadata = true, dependencies = DEPENDENT) +@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION, dependencies = Reference.DEPENDENCIES, useMetadata = true) class SCCSMCore { companion object { @@ -44,10 +44,7 @@ class SCCSMCore { private fun loadMeta() { meta.autogenerated = false - meta.modId = MOD_ID - meta.name = MOD_NAME - meta.version = VERSION meta.authorList.add("C6H2Cl2") - meta.description = "You can compress cobblestone up to 500 Billion" + meta.authorList.add("Kamesuta") } } \ No newline at end of file diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000..de27998 --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,26 @@ +{ + "modListVersion": 2, + "modList": [ + { + "modid": "sccsm", + "name": "SuperCompressedCobblestoneMod", + "description": "You can compress cobblestone up to 500 Billion", + "mcversion": "${mcversion}", + "version": "${version}", + "authorList": [ + "C6H2Cl2", + "Kamesuta" + ], + "credits": "2017 KotlinModdingNetwork", + "dependants": [], + "dependencies": ["Forge@[${minforgeversion},)", "forgelin", "ExtraUtilities"], + "parent": "", + "requiredMods": ["Forge@[${minforgeversion},)", "forgelin"], + "logoFile": "", + "screenshots": [], + "updateUrl": "https://github.com/KotlinModdingNetwork/SuperCompressedCobblestoneMod/releases", + "url": "https://github.com/KotlinModdingNetwork/SuperCompressedCobblestoneMod/", + "useDependencyInformation": true + } + ] +} \ No newline at end of file