initial commit
This commit is contained in:
commit
47393b74c9
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
17
.idea/gradle.xml
Normal file
17
.idea/gradle.xml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleHome" value="" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/kotlinc.xml
Normal file
6
.idea/kotlinc.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinJpsPluginSettings">
|
||||||
|
<option name="version" value="1.9.23" />
|
||||||
|
</component>
|
||||||
|
</project>
|
10
.idea/misc.xml
Normal file
10
.idea/misc.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
302
LICENSE
Normal file
302
LICENSE
Normal file
|
@ -0,0 +1,302 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en-US" data-theme="forgejo-auto">
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<title>Sign In - Esnesnon Git</title>
|
||||||
|
<link rel="manifest" href="data:application/json;base64,eyJuYW1lIjoiRXNuZXNub24gR2l0Iiwic2hvcnRfbmFtZSI6IkVzbmVzbm9uIEdpdCIsInN0YXJ0X3VybCI6Imh0dHBzOi8vZ2l0LWVzbmVzbm9uLmVjb3JvdXMub3JnLyIsImljb25zIjpbeyJzcmMiOiJodHRwczovL2dpdC1lc25lc25vbi5lY29yb3VzLm9yZy9hc3NldHMvaW1nL2xvZ28ucG5nIiwidHlwZSI6ImltYWdlL3BuZyIsInNpemVzIjoiNTEyeDUxMiJ9LHsic3JjIjoiaHR0cHM6Ly9naXQtZXNuZXNub24uZWNvcm91cy5vcmcvYXNzZXRzL2ltZy9sb2dvLnN2ZyIsInR5cGUiOiJpbWFnZS9zdmcreG1sIiwic2l6ZXMiOiI1MTJ4NTEyIn1dfQ==">
|
||||||
|
<meta name="author" content="Forgejo – Beyond coding. We forge.">
|
||||||
|
<meta name="description" content="Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.">
|
||||||
|
<meta name="keywords" content="git,forge,forgejo">
|
||||||
|
<meta name="referrer" content="no-referrer">
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="icon" href="/assets/img/favicon.svg" type="image/svg+xml">
|
||||||
|
<link rel="alternate icon" href="/assets/img/favicon.png" type="image/png">
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
|
||||||
|
window.addEventListener('unhandledrejection', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
|
||||||
|
window.config = {
|
||||||
|
appUrl: 'https:\/\/git-esnesnon.ecorous.org\/',
|
||||||
|
appSubUrl: '',
|
||||||
|
assetVersionEncoded: encodeURIComponent('7.0.2~gitea-1.22.0'),
|
||||||
|
assetUrlPrefix: '\/assets',
|
||||||
|
runModeIsProd: true ,
|
||||||
|
customEmojis: {"codeberg":":codeberg:","forgejo":":forgejo:","git":":git:","gitea":":gitea:","github":":github:","gitlab":":gitlab:","gogs":":gogs:"},
|
||||||
|
csrfToken: 'yoeeMlyoInSEwUBCQiFwhupHXP46MTcxNTU0MDMxMzAyMDMxNjcyNw',
|
||||||
|
pageData: {},
|
||||||
|
notificationSettings: {"EventSourceUpdateTime":10000,"MaxTimeout":60000,"MinTimeout":10000,"TimeoutStep":10000},
|
||||||
|
enableTimeTracking: true ,
|
||||||
|
|
||||||
|
mermaidMaxSourceCharacters: 5000 ,
|
||||||
|
|
||||||
|
i18n: {
|
||||||
|
copy_success: "Copied!",
|
||||||
|
copy_error: "Copy failed",
|
||||||
|
error_occurred: "An error occurred",
|
||||||
|
network_error: "Network error",
|
||||||
|
remove_label_str: "Remove item \"%s\"",
|
||||||
|
modal_confirm: "Confirm",
|
||||||
|
modal_cancel: "Cancel",
|
||||||
|
more_items: "More items",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
window.config.pageData = window.config.pageData || {};
|
||||||
|
</script>
|
||||||
|
<script src="/assets/js/webcomponents.js?v=7.0.2~gitea-1.22.0"></script>
|
||||||
|
|
||||||
|
<noscript>
|
||||||
|
<style>
|
||||||
|
.dropdown:hover > .menu { display: block; }
|
||||||
|
.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
|
||||||
|
</style>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<meta property="og:title" content="Esnesnon Git">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<meta property="og:image" content="/assets/img/logo.png">
|
||||||
|
<meta property="og:url" content="https://git-esnesnon.ecorous.org/">
|
||||||
|
<meta property="og:description" content="Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job.">
|
||||||
|
|
||||||
|
<meta property="og:site_name" content="Esnesnon Git">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/assets/css/index.css?v=7.0.2~gitea-1.22.0">
|
||||||
|
<link rel="stylesheet" href="/assets/css/theme-forgejo-auto.css?v=7.0.2~gitea-1.22.0">
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body hx-headers='{"x-csrf-token": "yoeeMlyoInSEwUBCQiFwhupHXP46MTcxNTU0MDMxMzAyMDMxNjcyNw"}' hx-swap="outerHTML" hx-ext="morph" hx-push-url="false">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="full height">
|
||||||
|
<noscript>This website requires JavaScript.</noscript>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<nav id="navbar" aria-label="Navigation Bar">
|
||||||
|
<div class="navbar-left ui secondary menu">
|
||||||
|
|
||||||
|
<a class="item" id="navbar-logo" href="/" aria-label="Home">
|
||||||
|
<img width="30" height="30" src="/assets/img/logo.svg" alt="Logo" aria-hidden="true">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="ui secondary menu item navbar-mobile-right only-mobile">
|
||||||
|
|
||||||
|
<button class="item tw-w-auto ui icon mini button tw-p-2 tw-m-0" id="navbar-expand-toggle" aria-label="Toggle Menu"><svg viewBox="0 0 16 16" class="svg octicon-three-bars" aria-hidden="true" width="16" height="16"><path d="M1 2.75A.75.75 0 0 1 1.75 2h12.5a.75.75 0 0 1 0 1.5H1.75A.75.75 0 0 1 1 2.75m0 5A.75.75 0 0 1 1.75 7h12.5a.75.75 0 0 1 0 1.5H1.75A.75.75 0 0 1 1 7.75M1.75 12h12.5a.75.75 0 0 1 0 1.5H1.75a.75.75 0 0 1 0-1.5"/></svg></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="item" href="/explore/repos">Explore</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="item" target="_blank" rel="noopener noreferrer" href="https://forgejo.org/docs/latest/">Help</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="navbar-right ui secondary menu">
|
||||||
|
|
||||||
|
|
||||||
|
<a class="item active" rel="nofollow" href="/user/login">
|
||||||
|
<svg viewBox="0 0 16 16" class="svg octicon-sign-in" aria-hidden="true" width="16" height="16"><path d="M2 2.75C2 1.784 2.784 1 3.75 1h2.5a.75.75 0 0 1 0 1.5h-2.5a.25.25 0 0 0-.25.25v10.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 0 1.5h-2.5A1.75 1.75 0 0 1 2 13.25Zm6.56 4.5h5.69a.75.75 0 0 1 0 1.5H8.56l1.97 1.97a.749.749 0 0 1-.326 1.275.75.75 0 0 1-.734-.215L6.22 8.53a.75.75 0 0 1 0-1.06l3.25-3.25a.749.749 0 0 1 1.275.326.75.75 0 0 1-.215.734Z"/></svg> Sign In
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div role="main" aria-label="Sign In" class="page-content user signin">
|
||||||
|
|
||||||
|
<overflow-menu class="ui secondary pointing tabular top attached borderless menu navbar secondary-nav">
|
||||||
|
<div class="overflow-menu-items tw-justify-center">
|
||||||
|
<a class="active item" rel="nofollow" href="/user/login">
|
||||||
|
Sign In
|
||||||
|
</a>
|
||||||
|
<a class=" item" rel="nofollow" href="/user/sign_up">
|
||||||
|
Sign Up
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a class="item" rel="nofollow" href="/user/login/openid">
|
||||||
|
<svg viewBox="0 0 448 448" class="svg fontawesome-openid" aria-hidden="true" width="16" height="16"><path d="M271.5 0v384l-68 32C88.5 405.75 0 344.5 0 270.25c0-71.5 82.5-131 191.75-144.25v43c-71.5 12.5-124 53-124 101.25 0 51 58.5 93.25 135.75 103v-340zm167.25 145.5L448 243l-131.25-28.5 36.75-20.75c-19.5-11.5-43.5-20-70-24.75v-43c46.25 5.5 87.75 19.5 120.25 39.25z"/></svg>
|
||||||
|
OpenID
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</overflow-menu>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="ui middle very relaxed page grid">
|
||||||
|
<div class="ui container column fluid">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h4 class="ui top attached header center">
|
||||||
|
|
||||||
|
Sign In
|
||||||
|
|
||||||
|
</h4>
|
||||||
|
<div class="ui attached segment">
|
||||||
|
<form class="ui form tw-max-w-2xl tw-m-auto" action="/user/login" method="post">
|
||||||
|
<input type="hidden" name="_csrf" value="yoeeMlyoInSEwUBCQiFwhupHXP46MTcxNTU0MDMxMzAyMDMxNjcyNw">
|
||||||
|
<div class="required field ">
|
||||||
|
<label for="user_name">Username or Email address</label>
|
||||||
|
<input id="user_name" type="text" name="user_name" value="" autofocus required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="required field ">
|
||||||
|
<label for="password">Password</label>
|
||||||
|
<input id="password" name="password" type="password" value="" autocomplete="current-password" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<label>Remember this device</label>
|
||||||
|
<input name="remember" type="checkbox">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<button class="ui primary button">
|
||||||
|
|
||||||
|
Sign In
|
||||||
|
|
||||||
|
</button>
|
||||||
|
<a href="/user/forgot_password">Forgot password?</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<footer class="page-footer" role="group" aria-label="Footer">
|
||||||
|
<div class="left-links" role="contentinfo" aria-label="About Software">
|
||||||
|
<a target="_blank" rel="noopener noreferrer" href="https://forgejo.org">Powered by Forgejo</a>
|
||||||
|
|
||||||
|
Version:
|
||||||
|
|
||||||
|
7.0.2+gitea-1.22.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Page: <strong>2ms</strong>
|
||||||
|
Template: <strong>1ms</strong>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="right-links" role="group" aria-label="Links">
|
||||||
|
<div class="ui dropdown upward language">
|
||||||
|
<span class="flex-text-inline"><svg viewBox="0 0 16 16" class="svg octicon-globe" aria-hidden="true" width="14" height="14"><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M5.78 8.75a9.64 9.64 0 0 0 1.363 4.177q.383.64.857 1.215c.245-.296.551-.705.857-1.215A9.64 9.64 0 0 0 10.22 8.75Zm4.44-1.5a9.64 9.64 0 0 0-1.363-4.177c-.307-.51-.612-.919-.857-1.215a10 10 0 0 0-.857 1.215A9.64 9.64 0 0 0 5.78 7.25Zm-5.944 1.5H1.543a6.51 6.51 0 0 0 4.666 5.5q-.184-.271-.352-.552c-.715-1.192-1.437-2.874-1.581-4.948m-2.733-1.5h2.733c.144-2.074.866-3.756 1.58-4.948q.18-.295.353-.552a6.51 6.51 0 0 0-4.666 5.5m10.181 1.5c-.144 2.074-.866 3.756-1.58 4.948q-.18.296-.353.552a6.51 6.51 0 0 0 4.666-5.5Zm2.733-1.5a6.51 6.51 0 0 0-4.666-5.5q.184.272.353.552c.714 1.192 1.436 2.874 1.58 4.948Z"/></svg> English</span>
|
||||||
|
<div class="menu language-menu">
|
||||||
|
|
||||||
|
<a lang="id-ID" data-url="/?lang=id-ID" class="item ">Bahasa Indonesia</a>
|
||||||
|
|
||||||
|
<a lang="de-DE" data-url="/?lang=de-DE" class="item ">Deutsch</a>
|
||||||
|
|
||||||
|
<a lang="en-US" data-url="/?lang=en-US" class="item active selected">English</a>
|
||||||
|
|
||||||
|
<a lang="es-ES" data-url="/?lang=es-ES" class="item ">Español</a>
|
||||||
|
|
||||||
|
<a lang="eo" data-url="/?lang=eo" class="item ">Esperanto</a>
|
||||||
|
|
||||||
|
<a lang="fil" data-url="/?lang=fil" class="item ">Filipino</a>
|
||||||
|
|
||||||
|
<a lang="fr-FR" data-url="/?lang=fr-FR" class="item ">Français</a>
|
||||||
|
|
||||||
|
<a lang="it-IT" data-url="/?lang=it-IT" class="item ">Italiano</a>
|
||||||
|
|
||||||
|
<a lang="lv-LV" data-url="/?lang=lv-LV" class="item ">Latviešu</a>
|
||||||
|
|
||||||
|
<a lang="hu-HU" data-url="/?lang=hu-HU" class="item ">Magyar nyelv</a>
|
||||||
|
|
||||||
|
<a lang="nl-NL" data-url="/?lang=nl-NL" class="item ">Nederlands</a>
|
||||||
|
|
||||||
|
<a lang="pl-PL" data-url="/?lang=pl-PL" class="item ">Polski</a>
|
||||||
|
|
||||||
|
<a lang="pt-PT" data-url="/?lang=pt-PT" class="item ">Português de Portugal</a>
|
||||||
|
|
||||||
|
<a lang="pt-BR" data-url="/?lang=pt-BR" class="item ">Português do Brasil</a>
|
||||||
|
|
||||||
|
<a lang="sl" data-url="/?lang=sl" class="item ">Slovenščina</a>
|
||||||
|
|
||||||
|
<a lang="fi-FI" data-url="/?lang=fi-FI" class="item ">Suomi</a>
|
||||||
|
|
||||||
|
<a lang="sv-SE" data-url="/?lang=sv-SE" class="item ">Svenska</a>
|
||||||
|
|
||||||
|
<a lang="tr-TR" data-url="/?lang=tr-TR" class="item ">Türkçe</a>
|
||||||
|
|
||||||
|
<a lang="cs-CZ" data-url="/?lang=cs-CZ" class="item ">Čeština</a>
|
||||||
|
|
||||||
|
<a lang="el-GR" data-url="/?lang=el-GR" class="item ">Ελληνικά</a>
|
||||||
|
|
||||||
|
<a lang="bg" data-url="/?lang=bg" class="item ">Български</a>
|
||||||
|
|
||||||
|
<a lang="ru-RU" data-url="/?lang=ru-RU" class="item ">Русский</a>
|
||||||
|
|
||||||
|
<a lang="uk-UA" data-url="/?lang=uk-UA" class="item ">Українська</a>
|
||||||
|
|
||||||
|
<a lang="fa-IR" data-url="/?lang=fa-IR" class="item ">فارسی</a>
|
||||||
|
|
||||||
|
<a lang="ml-IN" data-url="/?lang=ml-IN" class="item ">മലയാളം</a>
|
||||||
|
|
||||||
|
<a lang="ja-JP" data-url="/?lang=ja-JP" class="item ">日本語</a>
|
||||||
|
|
||||||
|
<a lang="zh-CN" data-url="/?lang=zh-CN" class="item ">简体中文</a>
|
||||||
|
|
||||||
|
<a lang="zh-TW" data-url="/?lang=zh-TW" class="item ">繁體中文(台灣)</a>
|
||||||
|
|
||||||
|
<a lang="zh-HK" data-url="/?lang=zh-HK" class="item ">繁體中文(香港)</a>
|
||||||
|
|
||||||
|
<a lang="ko-KR" data-url="/?lang=ko-KR" class="item ">한국어</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a href="/assets/licenses.txt">Licenses</a>
|
||||||
|
<a href="/api/swagger">API</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="/assets/js/index.js?v=7.0.2~gitea-1.22.0" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# bad gradle
|
||||||
|
# bad gradle
|
||||||
|
# bad gradle
|
||||||
|
# bad gradle
|
43
build.gradle.kts
Normal file
43
build.gradle.kts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
plugins {
|
||||||
|
kotlin("jvm") version "1.9.23"
|
||||||
|
`java-gradle-plugin`
|
||||||
|
`maven-publish`
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "org.ecorous.esnesnon"
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
testImplementation(kotlin("test"))
|
||||||
|
}
|
||||||
|
|
||||||
|
gradlePlugin {
|
||||||
|
plugins {
|
||||||
|
create("nonsense-gradle") {
|
||||||
|
id = "org.ecorous.esnesnon.nonsense-gradle"
|
||||||
|
implementationClass = "org.ecorous.esnesnon.gradle.NonsenseGradlePlugin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
kotlin {
|
||||||
|
jvmToolchain(17)
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
repositories {
|
||||||
|
mavenLocal {
|
||||||
|
url = uri("file://home/ecorous/wawa/test-repo")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
gradle.properties
Normal file
1
gradle.properties
Normal file
|
@ -0,0 +1 @@
|
||||||
|
kotlin.code.style=official
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#Sun May 12 17:35:40 BST 2024
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
234
gradlew
vendored
Executable file
234
gradlew
vendored
Executable file
|
@ -0,0 +1,234 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# https://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.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${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='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
89
gradlew.bat
vendored
Normal file
89
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@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="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
5
settings.gradle.kts
Normal file
5
settings.gradle.kts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
plugins {
|
||||||
|
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
|
||||||
|
}
|
||||||
|
rootProject.name = "nonsense-gradle"
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.ecorous.esnesnon.gradle
|
||||||
|
|
||||||
|
import org.gradle.api.Plugin
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class NonsenseGradlePlugin : Plugin<Project> {
|
||||||
|
|
||||||
|
val toInject = listOf("com.electronwill.night-config:toml:3.6.0", "")
|
||||||
|
|
||||||
|
override fun apply(project: Project) {
|
||||||
|
println("> Applying Nonsense Gradle Plugin")
|
||||||
|
val buildTask = project.tasks.getByPath("build")
|
||||||
|
buildTask.dependsOn("setupNonsense")
|
||||||
|
project.dependencies.apply {
|
||||||
|
add("implementation", "com.electronwill.night-config:toml:3.6.0")
|
||||||
|
// create("com.electronwill.night-config:toml:3.6.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
project.task("setupNonsense").apply {
|
||||||
|
group = "nonsense"
|
||||||
|
doFirst {
|
||||||
|
println("Setting up nonsense...")
|
||||||
|
println("Imagine actually doing stuff")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
116
src/main/kotlin/org/ecorous/esnesnon/gradle/VersionChecker.kt
Normal file
116
src/main/kotlin/org/ecorous/esnesnon/gradle/VersionChecker.kt
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
package org.ecorous.esnesnon.gradle
|
||||||
|
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.GsonBuilder
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import java.net.URI
|
||||||
|
import java.net.http.HttpClient
|
||||||
|
import java.net.http.HttpRequest
|
||||||
|
import java.net.http.HttpResponse
|
||||||
|
import kotlin.io.path.Path
|
||||||
|
import kotlin.io.path.createDirectories
|
||||||
|
import kotlin.io.path.exists
|
||||||
|
import kotlin.io.path.writeBytes
|
||||||
|
|
||||||
|
object VersionChecker {
|
||||||
|
private var validVersions = mutableListOf<VersionUrl>()
|
||||||
|
|
||||||
|
fun downloadClient(version: String) {
|
||||||
|
val clientData = fetchClientDownload(version)
|
||||||
|
// download client data
|
||||||
|
val downloadDirectory = Path(".gradle/.nonsense-gradle/net/minecraft/client/$version/")
|
||||||
|
val downloadFile = downloadDirectory.resolve("client-$version.jar")
|
||||||
|
if (downloadFile.exists()) {
|
||||||
|
println("Client already downloaded to $downloadFile. Assuming it's valid. FIXME: Add checksum validation.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!downloadDirectory.parent.parent.parent.parent.exists() ||
|
||||||
|
!downloadDirectory.parent.parent.parent.exists() ||
|
||||||
|
!downloadDirectory.parent.parent.exists() ||
|
||||||
|
!downloadDirectory.parent.exists() ||
|
||||||
|
!downloadDirectory.exists()
|
||||||
|
) { // .gradle/.nonsense-gradle/
|
||||||
|
println("Creating directory: ${downloadDirectory.parent.parent.parent.parent}")
|
||||||
|
downloadDirectory.parent.parent.parent.parent.createDirectories() // .gradle/.nonsense-gradle/
|
||||||
|
println("Creating directory: ${downloadDirectory.parent.parent.parent}")
|
||||||
|
downloadDirectory.parent.parent.parent.createDirectories() // .gradle/.nonsense-gradle/net/
|
||||||
|
println("Creating directory: ${downloadDirectory.parent.parent}")
|
||||||
|
downloadDirectory.parent.parent.createDirectories() // .gradle/.nonsense-gradle/net/minecraft/
|
||||||
|
println("Creating directory: ${downloadDirectory.parent}")
|
||||||
|
downloadDirectory.parent.createDirectories() // .gradle/.nonsense-gradle/net/minecraft/minecraft/
|
||||||
|
println("Creating directory: $downloadDirectory")
|
||||||
|
downloadDirectory.createDirectories() // .gradle/.nonsense-gradle/net/minecraft/minecraft/$version/
|
||||||
|
}
|
||||||
|
downloadDirectory.createDirectories()
|
||||||
|
val raw = rawDownload(clientData.url)
|
||||||
|
downloadFile.writeBytes(raw)
|
||||||
|
println("Downloaded client to $downloadFile")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun validateVersion(version: String): Boolean {
|
||||||
|
if (validVersions.isEmpty()) getValidVersions()
|
||||||
|
return validVersions.any { it.id == version }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getVersionUrl(version: String): String {
|
||||||
|
if (validVersions.isEmpty()) getValidVersions()
|
||||||
|
return validVersions.first { it.id == version }.url
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fetchClientDownload(version: String): VersionClientData {
|
||||||
|
val url = getVersionUrl(version)
|
||||||
|
val response = getUrl(url)
|
||||||
|
return Gson().fromJson(response, VersionData::class.java).downloads.client
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun rawDownload(url: String): ByteArray {
|
||||||
|
val client = HttpClient.newHttpClient()
|
||||||
|
val request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create(url))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val response = client.send(request, HttpResponse.BodyHandlers.ofByteArray())
|
||||||
|
|
||||||
|
return response.body()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getUrl(url: String): String {
|
||||||
|
val client = HttpClient.newHttpClient()
|
||||||
|
val request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create(url))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
|
||||||
|
|
||||||
|
return response.body()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun getValidVersions() {
|
||||||
|
if (validVersions.isNotEmpty()) return
|
||||||
|
// get json from https://piston-meta.mojang.com/mc/game/version_manifest_v2.json
|
||||||
|
// make http request
|
||||||
|
|
||||||
|
val url = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json"
|
||||||
|
val response = getUrl(url)
|
||||||
|
// response is in format of {versions: [{id: "1.17.1", type: "release"}, ...]}
|
||||||
|
// parse json
|
||||||
|
// get all versions
|
||||||
|
// return list of versions
|
||||||
|
val mR = GsonBuilder().create().fromJson(response, MojangResponse::class.java)
|
||||||
|
validVersions = mR.versions.map { VersionUrl(it.id, it.url) }.toMutableList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MojangResponse(val latest: Latest, val versions: List<Version>)
|
||||||
|
|
||||||
|
private class Latest(val release: String, val snapshot: String)
|
||||||
|
|
||||||
|
private class Version(val id: String, val type: String, val url: String, val time: String, val releaseTime: String, val sha1: String, val complianceLevel: Int)
|
||||||
|
|
||||||
|
private class VersionUrl(val id: String, val url: String)
|
||||||
|
|
||||||
|
private class VersionData(val downloads: VersionDownloads)
|
||||||
|
|
||||||
|
private class VersionDownloads(val client: VersionClientData)
|
||||||
|
|
||||||
|
class VersionClientData(val sha1: String, val size: Int, val url: String)
|
22
src/main/kotlin/org/ecorous/esnesnon/gradle/ext/Stuff.kt
Normal file
22
src/main/kotlin/org/ecorous/esnesnon/gradle/ext/Stuff.kt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package org.ecorous.esnesnon.gradle.ext
|
||||||
|
|
||||||
|
import org.ecorous.esnesnon.gradle.VersionChecker
|
||||||
|
import org.gradle.api.Project
|
||||||
|
|
||||||
|
fun Project.minecraft(version: String) {
|
||||||
|
if (VersionChecker.validateVersion(version)) {
|
||||||
|
println("Valid version! $version")
|
||||||
|
val clientData = VersionChecker.fetchClientDownload(version)
|
||||||
|
println("Client data: ${clientData.url}")
|
||||||
|
// download client data
|
||||||
|
println("Downloading client...")
|
||||||
|
VersionChecker.downloadClient(version)
|
||||||
|
println("Downloaded client!")
|
||||||
|
println("Time to setup Minecraft!")
|
||||||
|
dependencies.add("implementation", files(absoluteProjectPath(".gradle/.nonsense-gradle/net/minecraft/client/$version/client-$version.jar")))
|
||||||
|
} else {
|
||||||
|
println("Invalid version! $version")
|
||||||
|
error("Invalid minecraft version provided: $version")
|
||||||
|
}
|
||||||
|
println("Minecraft!")
|
||||||
|
}
|
Loading…
Reference in a new issue