Skip to content
Snippets Groups Projects
Verified Commit 7f3268d2 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski Committed by Janne Mareike Koschinski
Browse files

Split libquassel out from quasseldroid

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 887 additions and 0 deletions
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
max_line_length = 120
*.iml
.gradle
/local.properties
/signing.properties
/.idea/*
!/.idea/copyright/
.DS_Store
/captures
build/
/reports/
/persistence/schemas/
image: "k8r.eu/justjanne/quasseldroid-build-env:5d24a78"
cache:
key: "$CI_PROJECT_NAME"
paths:
- ".gradle/caches"
before_script:
- "mkdir -p $(pwd)/.gradle"
- "export GRADLE_USER_HOME=$(pwd)/.gradle"
- "echo $SIGNING_properties | base64 -d > .gradle/gradle.properties"
- "echo $SIGNING_secretKey | base64 -d > .gradle/sonatype_upload.gpg"
- "chmod +x ./gradlew"
stages:
- "test"
- "release"
test:
stage: "test"
services:
- name: "k8r.eu/justjanne/quassel-docker:v0.13.1"
alias: "quasselcore"
variables:
QUASSEL_CONTAINER: "quasselcore"
SSL_CERT_DATA: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZIekNDQXdlZ0F3SUJBZ0lVRVYvUmY1RGNlUWhqdWwyeXFIRGEvT0RyNStZd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0hqRWNNQm9HQTFVRUF3d1RjWFZoYzNObGJIUmxjM1F1YVc1MllXeHBaREFnRncweU1UQXlNRGd5TXpNNQpNalJhR0E4eU1USXhNREV4TlRJek16a3lORm93SGpFY01Cb0dBMVVFQXd3VGNYVmhjM05sYkhSbGMzUXVhVzUyCllXeHBaRENDQWlJd0RRWUpLb1pJaHZjTkFRRUJCUUFEZ2dJUEFEQ0NBZ29DZ2dJQkFNMk9aVGFlNEJLenBwQjIKbkVGMmUyb0dMbDFZR2FDZnFhVmVRaktOUzNEWThmaklHOWxiNmhEekUxTW5lb0d0b3U3VGF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FJOG9NRFhSTWFaMwotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg=="
SSL_REQUIRED: "true"
script:
- "./gradlew check ktlintCheck coberturaTestReport --stacktrace"
artifacts:
paths:
- "*/build/test-results/**/TEST-*.xml"
- "*/build/reports/*.xml"
- "*/build/reports/cobertura/*.xml"
reports:
cobertura:
- "*/build/reports/cobertura/*.xml"
junit:
- "*/build/test-results/**/TEST-*.xml"
- "*/build/reports/*.xml"
rules:
- if: "$CI_COMMIT_BRANCH == 'master'"
when: on_success
release:
stage: "release"
cache: { }
script:
- "./gradlew publish"
artifacts:
paths:
- "build/libs/*"
rules:
- if: "$CI_COMMIT_TAG != '' && $CI_COMMIT_BRANCH == 'master'"
when: on_success
This diff is collapsed.
# libquassel
libquassel is a pure kotlin implementation of the Quassel protocol.
import de.justjanne.coverageconverter.CoverageConverterExtension
plugins {
id("org.jlleitschuh.gradle.ktlint") version "10.0.0" apply false
id("org.jetbrains.dokka") version "1.4.20" apply false
id("com.vanniktech.maven.publish") version "0.13.0" apply false
id("de.justjanne.jacoco-cobertura-converter") apply false
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.4.30")
}
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "jacoco")
apply(plugin = "de.justjanne.jacoco-cobertura-converter")
repositories {
mavenCentral()
exclusiveContent {
forRepository {
maven {
name = "JCenter"
setUrl("https://jcenter.bintray.com/")
}
}
filter {
// Required for Dokka
includeModule("com.soywiz.korlibs.korte", "korte-jvm")
includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm")
includeGroup("org.jetbrains.dokka")
includeModule("org.jetbrains", "markdown")
}
}
}
dependencies {
val implementation by configurations
val testImplementation by configurations
val testRuntimeOnly by configurations
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx", "kotlinx-coroutines-core", "1.4.2")
testImplementation(kotlin("test-junit5"))
testImplementation("org.jetbrains.kotlinx", "kotlinx-coroutines-test", "1.4.2")
val junit5Version: String by project
testImplementation("org.junit.jupiter", "junit-jupiter-api", junit5Version)
testImplementation("org.junit.jupiter", "junit-jupiter-params", junit5Version)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junit5Version)
val hamcrestVersion: String by project
testImplementation("org.hamcrest", "hamcrest-library", hamcrestVersion)
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf(
"-Xinline-classes",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes"
)
}
}
configure<CoverageConverterExtension> {
autoConfigureCoverage = true
}
configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
}
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2019 Janne Mareike Koschinski
* Copyright (c) 2019 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
plugins {
`kotlin-dsl`
}
kotlinDslPluginOptions {
experimentalWarning.set(false)
}
repositories {
google()
jcenter()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30")
implementation(gradleApi())
implementation(localGroovy())
}
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.justjanne.coverageconverter
import org.gradle.api.Action
import org.gradle.api.Task
import org.gradle.testing.jacoco.tasks.JacocoReport
import java.io.File
internal class CoverageConverterAction(
private val jacocoReportTask: JacocoReport
) : Action<Task> {
private fun findOutputFile(jacocoFile: File): File? {
val actualFile = jacocoFile.absoluteFile
if (actualFile.exists() && actualFile.parentFile.name == "jacoco") {
val folder = File(actualFile.parentFile.parentFile, "cobertura")
folder.mkdirs()
return File(folder, actualFile.name)
}
return null
}
private fun createPythonScript(name: String, temporaryDir: File): File {
val file = File(temporaryDir, name)
if (file.exists()) {
file.delete()
}
val source = CoverageConverterPlugin::class.java.getResourceAsStream("/coverageconverter/$name")
file.writeBytes(source.readAllBytes())
return file
}
override fun execute(task: Task) {
val cover2coverScript = createPythonScript("cover2cover.py", task.temporaryDir)
val source2filenameScript = createPythonScript("source2filename.py", task.temporaryDir)
fun cover2cover(reportFile: File, outputFile: File, sourceDirectories: Iterable<File>) {
task.project.exec {
commandLine("python3")
args(cover2coverScript.absolutePath)
args(reportFile.absolutePath)
args(sourceDirectories.map(File::getAbsolutePath))
standardOutput = outputFile.outputStream()
}
}
fun source2filename(reportFile: File) {
task.project.exec {
commandLine("python3")
args(source2filenameScript.absolutePath)
args(reportFile.absolutePath)
}
}
jacocoReportTask.reports.forEach {
if (it.isEnabled && it.destination.extension == "xml") {
val outputFile = findOutputFile(it.destination)
if (outputFile != null) {
cover2cover(it.destination, outputFile, jacocoReportTask.sourceDirectories)
source2filename(outputFile)
}
}
}
}
}
/*
* Kotlin Bitflags
* Copyright (c) 2021 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
package de.justjanne.coverageconverter
open class CoverageConverterExtension {
var autoConfigureCoverage: Boolean = false
}
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.justjanne.coverageconverter
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
import org.gradle.testing.jacoco.tasks.JacocoReport
import java.io.File
class CoverageConverterPlugin : Plugin<Project> {
override fun apply(project: Project) {
val extension = project.extensions.create("coverage", CoverageConverterExtension::class.java)
if (extension.autoConfigureCoverage) {
val jacocoPluginExtension = project.extensions.findByType(JacocoPluginExtension::class.java)
if (jacocoPluginExtension != null) {
jacocoPluginExtension.toolVersion = "0.8.3"
}
}
project.afterEvaluate {
val testTask = tasks.getByName("test")
val jacocoReportTask = tasks.getByName("jacocoTestReport") as? JacocoReport
if (jacocoReportTask != null) {
jacocoReportTask.dependsOn(testTask)
if (extension.autoConfigureCoverage) {
jacocoReportTask.sourceDirectories.from(fileTree("src/main/kotlin"))
jacocoReportTask.classDirectories.from(fileTree("build/classes"))
jacocoReportTask.reports {
xml.destination = File("${buildDir}/reports/jacoco/report.xml")
html.isEnabled = true
xml.isEnabled = true
csv.isEnabled = false
}
}
tasks.register("coberturaTestReport") {
dependsOn(jacocoReportTask)
mustRunAfter(jacocoReportTask)
group = "verification"
doLast(CoverageConverterAction(jacocoReportTask))
}
}
}
}
}
implementation-class=de.justjanne.coverageconverter.CoverageConverterPlugin
#!/usr/bin/env python
import os.path
import sys
import time
import xml.etree.ElementTree as ET
# branch-rate="0.0" complexity="0.0" line-rate="1.0"
# branch="true" hits="1" number="86"
def find_lines(j_package, filename):
"""Return all <line> elements for a given source file in a package."""
lines = list()
sourcefiles = j_package.findall("sourcefile")
for sourcefile in sourcefiles:
if sourcefile.attrib.get("name") == os.path.basename(filename):
lines = lines + sourcefile.findall("line")
return lines
def line_is_after(jm, start_line):
return int(jm.attrib.get('line', 0)) > start_line
def method_lines(jmethod, jmethods, jlines):
"""Filter the lines from the given set of jlines that apply to the given jmethod."""
start_line = int(jmethod.attrib.get('line', 0))
larger = list(int(jm.attrib.get('line', 0)) for jm in jmethods if line_is_after(jm, start_line))
end_line = min(larger) if len(larger) else 99999999
for jline in jlines:
if start_line <= int(jline.attrib['nr']) < end_line:
yield jline
def convert_lines(j_lines, into):
"""Convert the JaCoCo <line> elements into Cobertura <line> elements, add them under the given element."""
c_lines = ET.SubElement(into, 'lines')
for jline in j_lines:
mb = int(jline.attrib['mb'])
cb = int(jline.attrib['cb'])
ci = int(jline.attrib['ci'])
cline = ET.SubElement(c_lines, 'line')
cline.set('number', jline.attrib['nr'])
cline.set('hits', '1' if ci > 0 else '0') # Probably not true but no way to know from JaCoCo XML file
if mb + cb > 0:
percentage = str(int(100 * (float(cb) / (float(cb) + float(mb))))) + '%'
cline.set('branch', 'true')
cline.set('condition-coverage', percentage + ' (' + str(cb) + '/' + str(cb + mb) + ')')
cond = ET.SubElement(ET.SubElement(cline, 'conditions'), 'condition')
cond.set('number', '0')
cond.set('type', 'jump')
cond.set('coverage', percentage)
else:
cline.set('branch', 'false')
def path_to_filepath(path_to_class, sourcefilename):
return path_to_class[0: path_to_class.rfind("/") + 1] + sourcefilename
def add_counters(source, target):
target.set('line-rate', counter(source, 'LINE'))
target.set('branch-rate', counter(source, 'BRANCH'))
target.set('complexity', counter(source, 'COMPLEXITY', sum))
def fraction(covered, missed):
return covered / (covered + missed)
def sum(covered, missed):
return covered + missed
def counter(source, type, operation=fraction):
cs = source.findall('counter')
c = next((ct for ct in cs if ct.attrib.get('type') == type), None)
if c is not None:
covered = float(c.attrib['covered'])
missed = float(c.attrib['missed'])
return str(operation(covered, missed))
else:
return '0.0'
def convert_method(j_method, j_lines):
c_method = ET.Element('method')
c_method.set('name', j_method.attrib['name'])
c_method.set('signature', j_method.attrib['desc'])
add_counters(j_method, c_method)
convert_lines(j_lines, c_method)
return c_method
def convert_class(j_class, j_package):
c_class = ET.Element('class')
c_class.set('name', j_class.attrib['name'].replace('/', '.'))
c_class.set('filename', path_to_filepath(j_class.attrib['name'], j_class.attrib['sourcefilename']))
all_j_lines = list(find_lines(j_package, c_class.attrib['filename']))
c_methods = ET.SubElement(c_class, 'methods')
all_j_methods = list(j_class.findall('method'))
for j_method in all_j_methods:
j_method_lines = method_lines(j_method, all_j_methods, all_j_lines)
c_methods.append(convert_method(j_method, j_method_lines))
add_counters(j_class, c_class)
convert_lines(all_j_lines, c_class)
return c_class
def convert_package(j_package):
c_package = ET.Element('package')
c_package.attrib['name'] = j_package.attrib['name'].replace('/', '.')
c_classes = ET.SubElement(c_package, 'classes')
for j_class in j_package.findall('class'):
c_classes.append(convert_class(j_class, j_package))
add_counters(j_package, c_package)
return c_package
def convert_root(source, target, source_roots):
try:
target.set('timestamp', str(int(source.find('sessioninfo').attrib['start']) / 1000))
except AttributeError as e:
target.set('timestamp', str(int(time.time() / 1000)))
sources = ET.SubElement(target, 'sources')
for s in source_roots:
ET.SubElement(sources, 'source').text = s
packages = ET.SubElement(target, 'packages')
for group in source.findall('group'):
for package in group.findall('package'):
packages.append(convert_package(package))
for package in source.findall('package'):
packages.append(convert_package(package))
add_counters(source, target)
def jacoco2cobertura(filename, source_roots):
if filename == '-':
root = ET.fromstring(sys.stdin.read())
else:
tree = ET.parse(filename)
root = tree.getroot()
into = ET.Element('coverage')
convert_root(root, into, source_roots)
print('<?xml version="1.0" ?>')
print(ET.tostring(into, encoding='unicode'))
if __name__ == '__main__':
if len(sys.argv) < 2:
print("Usage: cover2cover.py FILENAME [SOURCE_ROOTS]")
sys.exit(1)
filename = sys.argv[1]
source_roots = sys.argv[2:] if 2 < len(sys.argv) else '.'
jacoco2cobertura(filename, source_roots)
#!/usr/bin/env python
import lxml.etree
import os.path
import sys
def convert_source(filename):
# read input file
root = lxml.etree.parse(filename)
sources = root.find('sources')
packages = root.find('packages')
for package in packages:
classes = package.find('classes')
for clazz in classes:
file_not_found = True
for source in sources:
full_filename = source.text + '/' + clazz.attrib['filename']
if os.path.isfile(full_filename):
clazz.attrib['filename'] = full_filename
file_not_found = False
if file_not_found:
print("Warning: File {} not found in all sources; removing from sources.".format(clazz.attrib['filename']))
clazz.getparent().remove(clazz)
data = lxml.etree.tostring(root, pretty_print=True)
# open the input file in write mode
fin = open(filename, "wb")
# overrite the input file with the resulting data
fin.write(data)
# close the file
fin.close()
if __name__ == '__main__':
if len(sys.argv) < 2:
print("Usage: source2filename.py FILENAME")
sys.exit(1)
filename = sys.argv[1]
convert_source(filename)
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
kotlin.code.style=official
hamcrestVersion=2.1
junit5Version=5.6.0
kotlinBitflagsVersion=1.1.0
sl4jVersion=1.7.30
testcontainersCiVersion=1.1.0
GROUP=de.justjanne.libquassel
VERSION_NAME=0.1.0
POM_URL=https://git.kuschku.de/justJanne/libquassel
POM_SCM_URL=https://git.kuschku.de/justJanne/libquassel
POM_SCM_CONNECTION=scm:git:https://git.kuschku.de/justJanne/libquassel.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git.kuschku.de:2222/justJanne/libquassel.git
POM_LICENSE_NAME=GNU GENERAL PUBLIC LICENSE Version 3
POM_LICENSE_URL=https://www.gnu.org/licenses/gpl-3.0.en.html
POM_LICENSE_DIST=repo
POM_DEVELOPER_ID=justJanne
POM_DEVELOPER_NAME=Janne Mareike Koschinski
File added
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
distributionSha256Sum=8de6efc274ab52332a9c820366dd5cf5fc9d35ec7078fd70c8ec6913431ee610
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
gradlew 0 → 100755
#!/usr/bin/env sh
#
# Copyright 2015 the original author or 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 UN*X
##
##############################################################################
# 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='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn() {
echo "$*"
}
die() {
echo
echo "$*"
echo
exit 1
}
# 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
;;
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" = "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
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ]; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ]; 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)
SEP=""
for dir in $ROOTDIRSRAW; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ]; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@"; do
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
i=$(expr $i + 1)
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save() {
for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done
echo " "
}
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"
exec "$JAVACMD" "$@"
@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
plugins {
id("com.vanniktech.maven.publish")
}
POM_ARTIFACT_ID=libquassel-annotations
POM_NAME=libquassel Annotations
POM_DESCRIPTION=Annotations for the libquassel code generator
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment