git-semver-tagger
Version:
 
797 lines (795 loc) • 31.2 kB
JavaScript
(function (_, kotlin_kotlin, kotlin_com_zegreatrob_tools_digger_core) {
'use strict';
//region block: imports
var imul = Math.imul;
var split = kotlin_kotlin.$_$.nc;
var collectionSizeOrDefault = kotlin_kotlin.$_$.c5;
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.i;
var toInt = kotlin_kotlin.$_$.zc;
var Unit_instance = kotlin_kotlin.$_$.e4;
var charSequenceLength = kotlin_kotlin.$_$.r8;
var charSequenceGet = kotlin_kotlin.$_$.q8;
var digitToIntOrNull = kotlin_kotlin.$_$.ob;
var protoOf = kotlin_kotlin.$_$.aa;
var initMetadataForClass = kotlin_kotlin.$_$.a9;
var VOID = kotlin_kotlin.$_$.f;
var enumEntries = kotlin_kotlin.$_$.g8;
var Enum = kotlin_kotlin.$_$.ud;
var listOf = kotlin_kotlin.$_$.p6;
var getStringHashCode = kotlin_kotlin.$_$.y8;
var THROW_CCE = kotlin_kotlin.$_$.ce;
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.j;
var isCharSequence = kotlin_kotlin.$_$.k9;
var trim = kotlin_kotlin.$_$.kd;
var toString = kotlin_kotlin.$_$.ea;
var Companion_instance = kotlin_kotlin.$_$.z3;
var get = kotlin_kotlin.$_$.tb;
var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.y1;
var createFailure = kotlin_kotlin.$_$.re;
var _Result___get_isFailure__impl__jpiriv = kotlin_kotlin.$_$.a2;
var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.c2;
var substringBefore = kotlin_kotlin.$_$.sc;
var contains = kotlin_kotlin.$_$.mb;
var to = kotlin_kotlin.$_$.df;
var _Result___get_isSuccess__impl__sndoy8 = kotlin_kotlin.$_$.b2;
var Result__exceptionOrNull_impl_p6xea9 = kotlin_kotlin.$_$.z1;
var mapOf = kotlin_kotlin.$_$.t6;
var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.s;
var joinToString = kotlin_kotlin.$_$.f6;
var initMetadataForObject = kotlin_kotlin.$_$.f9;
var hashCode = kotlin_kotlin.$_$.z8;
var equals = kotlin_kotlin.$_$.u8;
var Defaults_getInstance = kotlin_com_zegreatrob_tools_digger_core.$_$.a;
var initMetadataForCompanion = kotlin_kotlin.$_$.b9;
var toString_0 = kotlin_kotlin.$_$.cf;
var emptyList = kotlin_kotlin.$_$.t5;
//endregion
//region block: pre-declaration
initMetadataForClass(SnapshotReason, 'SnapshotReason', VOID, Enum);
initMetadataForClass(SnapshotReason$DIRTY, 'DIRTY', VOID, SnapshotReason);
initMetadataForClass(SnapshotReason$AHEAD, 'AHEAD', VOID, SnapshotReason);
initMetadataForClass(SnapshotReason$BEHIND, 'BEHIND', VOID, SnapshotReason);
initMetadataForClass(SnapshotReason$NOT_RELEASE_BRANCH, 'NOT_RELEASE_BRANCH', VOID, SnapshotReason);
initMetadataForClass(SnapshotReason$NO_NEW_VERSION, 'NO_NEW_VERSION', VOID, SnapshotReason);
initMetadataForClass(StatusCheck, 'StatusCheck');
initMetadataForClass(ChangeType, 'ChangeType', VOID, Enum);
initMetadataForClass(ChangeType$Major, 'Major', VOID, ChangeType);
initMetadataForClass(ChangeType$Minor, 'Minor', VOID, ChangeType);
initMetadataForClass(ChangeType$Patch, 'Patch', VOID, ChangeType);
initMetadataForClass(ChangeType$None, 'None', VOID, ChangeType);
initMetadataForClass(FailureVersionReasons, 'FailureVersionReasons', VOID, Enum);
initMetadataForObject(TagErrors, 'TagErrors');
initMetadataForClass(TagResult, 'TagResult');
initMetadataForObject(Success, 'Success', VOID, TagResult);
initMetadataForClass(Error_0, 'Error', VOID, TagResult);
initMetadataForClass(TaggerCore, 'TaggerCore');
initMetadataForObject(Defaults, 'Defaults');
initMetadataForCompanion(Companion);
initMetadataForClass(VersionRegex, 'VersionRegex');
initMetadataForClass(Success_0, 'Success');
initMetadataForClass(Failure, 'Failure');
//endregion
function asSemverComponents(_this__u8e3s4) {
// Inline function 'kotlin.collections.map' call
var this_0 = split(stripPrefix(_this__u8e3s4), ['.']);
// Inline function 'kotlin.collections.mapTo' call
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
var _iterator__ex2g4s = this_0.p();
while (_iterator__ex2g4s.q()) {
var item = _iterator__ex2g4s.r();
var tmp$ret$0 = toInt(item);
destination.e(tmp$ret$0);
}
// Inline function 'kotlin.let' call
return destination.s() === 3 ? destination : null;
}
function stripPrefix(_this__u8e3s4) {
var tmp$ret$1;
$l$block: {
// Inline function 'kotlin.text.indexOfFirst' call
var inductionVariable = 0;
var last = charSequenceLength(_this__u8e3s4) - 1 | 0;
if (inductionVariable <= last)
do {
var index = inductionVariable;
inductionVariable = inductionVariable + 1 | 0;
var it = charSequenceGet(_this__u8e3s4, index);
if (!(digitToIntOrNull(it) == null)) {
tmp$ret$1 = index;
break $l$block;
}
}
while (inductionVariable <= last);
tmp$ret$1 = -1;
}
var startIndex = tmp$ret$1;
// Inline function 'kotlin.text.substring' call
// Inline function 'kotlin.js.asDynamic' call
return _this__u8e3s4.substring(startIndex);
}
function SnapshotReason$DIRTY() {
SnapshotReason.call(this, 'DIRTY', 0);
SnapshotReason_DIRTY_instance = this;
}
protoOf(SnapshotReason$DIRTY).v1m = function (_this__u8e3s4) {
return !_this__u8e3s4.w1m_1.f1m_1;
};
var SnapshotReason_DIRTY_instance;
function SnapshotReason$AHEAD() {
SnapshotReason.call(this, 'AHEAD', 1);
SnapshotReason_AHEAD_instance = this;
}
protoOf(SnapshotReason$AHEAD).v1m = function (_this__u8e3s4) {
return !(_this__u8e3s4.w1m_1.g1m_1 === 0);
};
var SnapshotReason_AHEAD_instance;
function SnapshotReason$BEHIND() {
SnapshotReason.call(this, 'BEHIND', 2);
SnapshotReason_BEHIND_instance = this;
}
protoOf(SnapshotReason$BEHIND).v1m = function (_this__u8e3s4) {
return !(_this__u8e3s4.w1m_1.h1m_1 === 0);
};
var SnapshotReason_BEHIND_instance;
function SnapshotReason$NOT_RELEASE_BRANCH() {
SnapshotReason.call(this, 'NOT_RELEASE_BRANCH', 3);
SnapshotReason_NOT_RELEASE_BRANCH_instance = this;
}
protoOf(SnapshotReason$NOT_RELEASE_BRANCH).v1m = function (_this__u8e3s4) {
return !(_this__u8e3s4.w1m_1.i1m_1 === _this__u8e3s4.x1m_1);
};
var SnapshotReason_NOT_RELEASE_BRANCH_instance;
function SnapshotReason$NO_NEW_VERSION() {
SnapshotReason.call(this, 'NO_NEW_VERSION', 4);
SnapshotReason_NO_NEW_VERSION_instance = this;
}
protoOf(SnapshotReason$NO_NEW_VERSION).v1m = function (_this__u8e3s4) {
return _this__u8e3s4.y1m_1 === _this__u8e3s4.z1m_1;
};
var SnapshotReason_NO_NEW_VERSION_instance;
function values() {
return [SnapshotReason_DIRTY_getInstance(), SnapshotReason_AHEAD_getInstance(), SnapshotReason_BEHIND_getInstance(), SnapshotReason_NOT_RELEASE_BRANCH_getInstance(), SnapshotReason_NO_NEW_VERSION_getInstance()];
}
function get_entries() {
if ($ENTRIES == null)
$ENTRIES = enumEntries(values());
return $ENTRIES;
}
var SnapshotReason_entriesInitialized;
function SnapshotReason_initEntries() {
if (SnapshotReason_entriesInitialized)
return Unit_instance;
SnapshotReason_entriesInitialized = true;
SnapshotReason_DIRTY_instance = new SnapshotReason$DIRTY();
SnapshotReason_AHEAD_instance = new SnapshotReason$AHEAD();
SnapshotReason_BEHIND_instance = new SnapshotReason$BEHIND();
SnapshotReason_NOT_RELEASE_BRANCH_instance = new SnapshotReason$NOT_RELEASE_BRANCH();
SnapshotReason_NO_NEW_VERSION_instance = new SnapshotReason$NO_NEW_VERSION();
}
var $ENTRIES;
function SnapshotReason(name, ordinal) {
Enum.call(this, name, ordinal);
}
protoOf(SnapshotReason).c1n = function (check) {
return this.v1m(check);
};
function calculateNextVersion(_this__u8e3s4, implicitPatch, versionRegex, releaseBranch) {
var gitStatus = _this__u8e3s4.l1n_1.d1m();
// Inline function 'kotlin.text.isEmpty' call
var this_0 = gitStatus.j1m_1;
if (charSequenceLength(this_0) === 0) {
return new Failure(listOf(FailureVersionReasons_NoRemote_getInstance()));
}
var tmp0_elvis_lhs = lastVersionAndTag(_this__u8e3s4);
var tmp;
if (tmp0_elvis_lhs == null) {
return new Failure(listOf(FailureVersionReasons_NoTagsExist_getInstance()));
} else {
tmp = tmp0_elvis_lhs;
}
var _destruct__k2r9zo = tmp;
var previousVersionNumber = _destruct__k2r9zo.qa();
var lastTagDescription = _destruct__k2r9zo.ra();
var tmp1_elvis_lhs = asSemverComponents(previousVersionNumber);
var tmp_0;
if (tmp1_elvis_lhs == null) {
return new Failure(listOf(FailureVersionReasons_VersionMissingElements_getInstance()));
} else {
tmp_0 = tmp1_elvis_lhs;
}
var previousVersionComponents = tmp_0;
var incrementComponent = findAppropriateIncrement(_this__u8e3s4.l1n_1, lastTagDescription, implicitPatch, versionRegex);
var tmp3_elvis_lhs = incrementComponent == null ? null : incrementComponent.p1n(previousVersionComponents);
var currentVersionNumber = tmp3_elvis_lhs == null ? previousVersionNumber : tmp3_elvis_lhs;
var reasonsToUseSnapshot = snapshotReasons(releaseBranch, currentVersionNumber, previousVersionNumber, gitStatus);
return new Success_0(reasonsToUseSnapshot.m() ? currentVersionNumber : currentVersionNumber + '-SNAPSHOT', reasonsToUseSnapshot);
}
function StatusCheck(gitStatus, releaseBranch, currentVersionNumber, previousVersionNumber) {
this.w1m_1 = gitStatus;
this.x1m_1 = releaseBranch;
this.y1m_1 = currentVersionNumber;
this.z1m_1 = previousVersionNumber;
}
protoOf(StatusCheck).toString = function () {
return 'StatusCheck(gitStatus=' + this.w1m_1.toString() + ', releaseBranch=' + this.x1m_1 + ', currentVersionNumber=' + this.y1m_1 + ', previousVersionNumber=' + this.z1m_1 + ')';
};
protoOf(StatusCheck).hashCode = function () {
var result = this.w1m_1.hashCode();
result = imul(result, 31) + getStringHashCode(this.x1m_1) | 0;
result = imul(result, 31) + getStringHashCode(this.y1m_1) | 0;
result = imul(result, 31) + getStringHashCode(this.z1m_1) | 0;
return result;
};
protoOf(StatusCheck).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof StatusCheck))
return false;
var tmp0_other_with_cast = other instanceof StatusCheck ? other : THROW_CCE();
if (!this.w1m_1.equals(tmp0_other_with_cast.w1m_1))
return false;
if (!(this.x1m_1 === tmp0_other_with_cast.x1m_1))
return false;
if (!(this.y1m_1 === tmp0_other_with_cast.y1m_1))
return false;
if (!(this.z1m_1 === tmp0_other_with_cast.z1m_1))
return false;
return true;
};
function ChangeType$Major() {
ChangeType.call(this, 'Major', 0, 3);
ChangeType_Major_instance = this;
}
protoOf(ChangeType$Major).p1n = function (components) {
// Inline function 'kotlin.collections.component1' call
var major = components.t(0);
return '' + (major + 1 | 0) + '.0.0';
};
var ChangeType_Major_instance;
function ChangeType$Minor() {
ChangeType.call(this, 'Minor', 1, 2);
ChangeType_Minor_instance = this;
}
protoOf(ChangeType$Minor).p1n = function (components) {
// Inline function 'kotlin.collections.component1' call
var major = components.t(0);
// Inline function 'kotlin.collections.component2' call
var minor = components.t(1);
return '' + major + '.' + (minor + 1 | 0) + '.0';
};
var ChangeType_Minor_instance;
function ChangeType$Patch() {
ChangeType.call(this, 'Patch', 2, 1);
ChangeType_Patch_instance = this;
}
protoOf(ChangeType$Patch).p1n = function (components) {
// Inline function 'kotlin.collections.component1' call
var major = components.t(0);
// Inline function 'kotlin.collections.component2' call
var minor = components.t(1);
// Inline function 'kotlin.collections.component3' call
var patch = components.t(2);
return '' + major + '.' + minor + '.' + (patch + 1 | 0);
};
var ChangeType_Patch_instance;
function ChangeType$None() {
ChangeType.call(this, 'None', 3, 0);
ChangeType_None_instance = this;
}
protoOf(ChangeType$None).p1n = function (components) {
// Inline function 'kotlin.collections.component1' call
var major = components.t(0);
// Inline function 'kotlin.collections.component2' call
var minor = components.t(1);
// Inline function 'kotlin.collections.component3' call
var patch = components.t(2);
return '' + major + '.' + minor + '.' + patch;
};
var ChangeType_None_instance;
var ChangeType_entriesInitialized;
function ChangeType_initEntries() {
if (ChangeType_entriesInitialized)
return Unit_instance;
ChangeType_entriesInitialized = true;
ChangeType_Major_instance = new ChangeType$Major();
ChangeType_Minor_instance = new ChangeType$Minor();
ChangeType_Patch_instance = new ChangeType$Patch();
ChangeType_None_instance = new ChangeType$None();
}
function ChangeType(name, ordinal, priority) {
Enum.call(this, name, ordinal);
this.o1n_1 = priority;
}
function findAppropriateIncrement(gitAdapter, previousTag, implicitPatch, minorRegex) {
// Inline function 'kotlin.also' call
var this_0 = gitAdapter.c1m('HEAD', '^' + previousTag);
if (this_0.m())
return null;
// Inline function 'kotlin.collections.map' call
// Inline function 'kotlin.collections.mapTo' call
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
var _iterator__ex2g4s = this_0.p();
while (_iterator__ex2g4s.q()) {
var item = _iterator__ex2g4s.r();
var tmp0_elvis_lhs = changeType(item, minorRegex);
var tmp$ret$2 = tmp0_elvis_lhs == null ? implicitPatch ? ChangeType_Patch_getInstance() : null : tmp0_elvis_lhs;
destination.e(tmp$ret$2);
}
// Inline function 'kotlin.collections.fold' call
var accumulator = null;
var _iterator__ex2g4s_0 = destination.p();
while (_iterator__ex2g4s_0.q()) {
var element = _iterator__ex2g4s_0.r();
var p0 = accumulator;
accumulator = highestPriority(p0, element);
}
var tmp0_elvis_lhs_0 = accumulator;
return tmp0_elvis_lhs_0 == null ? implicitPatch ? ChangeType_Patch_getInstance() : ChangeType_None_getInstance() : tmp0_elvis_lhs_0;
}
function snapshotReasons(releaseBranch, currentVersionNumber, previousVersionNumber, gitStatus) {
// Inline function 'kotlin.let' call
var statusCheck = new StatusCheck(gitStatus, releaseBranch, currentVersionNumber, previousVersionNumber);
// Inline function 'kotlin.collections.filter' call
var tmp0 = get_entries();
// Inline function 'kotlin.collections.filterTo' call
var destination = ArrayList_init_$Create$_0();
var _iterator__ex2g4s = tmp0.p();
while (_iterator__ex2g4s.q()) {
var element = _iterator__ex2g4s.r();
if (element.c1n(statusCheck)) {
destination.e(element);
}
}
return destination;
}
function highestPriority(left, right) {
return left == null ? right : right == null ? left : left.o1n_1 > right.o1n_1 ? left : right;
}
function changeType(_this__u8e3s4, versionRegex) {
// Inline function 'kotlin.text.trim' call
var this_0 = _this__u8e3s4.u1l_1;
var tmp$ret$0 = toString(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
return changeType_0(versionRegex, tmp$ret$0);
}
function changeType_0(_this__u8e3s4, message) {
var tmp;
var tmp0_safe_receiver = _this__u8e3s4.g1o_1;
if ((tmp0_safe_receiver == null ? null : tmp0_safe_receiver.zc(message)) === true) {
tmp = findMatchType(message, _this__u8e3s4.g1o_1);
} else {
if (_this__u8e3s4.f1o_1.zc(message)) {
tmp = ChangeType_Major_getInstance();
} else {
if (_this__u8e3s4.e1o_1.zc(message)) {
tmp = ChangeType_Minor_getInstance();
} else {
if (_this__u8e3s4.d1o_1.zc(message)) {
tmp = ChangeType_Patch_getInstance();
} else {
if (_this__u8e3s4.c1o_1.zc(message)) {
tmp = ChangeType_None_getInstance();
} else {
tmp = null;
}
}
}
}
}
return tmp;
}
function findMatchType(message, regex) {
var tmp0_safe_receiver = regex.dd(message);
var groups = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ld();
return groupExists(groups, 'major') ? ChangeType_Major_getInstance() : groupExists(groups, 'minor') ? ChangeType_Minor_getInstance() : groupExists(groups, 'patch') ? ChangeType_Patch_getInstance() : groupExists(groups, 'none') ? ChangeType_None_getInstance() : null;
}
function groupExists(_this__u8e3s4, groupName) {
// Inline function 'kotlin.runCatching' call
var tmp;
try {
// Inline function 'kotlin.Companion.success' call
var value = !((_this__u8e3s4 == null ? null : get(_this__u8e3s4, groupName)) == null);
tmp = _Result___init__impl__xyqfz8(value);
} catch ($p) {
var tmp_0;
if ($p instanceof Error) {
var e = $p;
// Inline function 'kotlin.Companion.failure' call
tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
} else {
throw $p;
}
tmp = tmp_0;
}
var tmp2 = tmp;
var tmp$ret$4;
$l$block: {
// Inline function 'kotlin.getOrDefault' call
if (_Result___get_isFailure__impl__jpiriv(tmp2)) {
tmp$ret$4 = false;
break $l$block;
}
var tmp_1 = _Result___get_value__impl__bjfvqg(tmp2);
tmp$ret$4 = (tmp_1 == null ? true : !(tmp_1 == null)) ? tmp_1 : THROW_CCE();
}
return tmp$ret$4;
}
function SnapshotReason_DIRTY_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_DIRTY_instance;
}
function SnapshotReason_AHEAD_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_AHEAD_instance;
}
function SnapshotReason_BEHIND_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_BEHIND_instance;
}
function SnapshotReason_NOT_RELEASE_BRANCH_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_NOT_RELEASE_BRANCH_instance;
}
function SnapshotReason_NO_NEW_VERSION_getInstance() {
SnapshotReason_initEntries();
return SnapshotReason_NO_NEW_VERSION_instance;
}
function ChangeType_Major_getInstance() {
ChangeType_initEntries();
return ChangeType_Major_instance;
}
function ChangeType_Minor_getInstance() {
ChangeType_initEntries();
return ChangeType_Minor_instance;
}
function ChangeType_Patch_getInstance() {
ChangeType_initEntries();
return ChangeType_Patch_instance;
}
function ChangeType_None_getInstance() {
ChangeType_initEntries();
return ChangeType_None_instance;
}
var FailureVersionReasons_NoRemote_instance;
var FailureVersionReasons_NoTagsExist_instance;
var FailureVersionReasons_VersionMissingElements_instance;
var FailureVersionReasons_entriesInitialized;
function FailureVersionReasons_initEntries() {
if (FailureVersionReasons_entriesInitialized)
return Unit_instance;
FailureVersionReasons_entriesInitialized = true;
FailureVersionReasons_NoRemote_instance = new FailureVersionReasons('NoRemote', 0, 'repository has no remote.');
FailureVersionReasons_NoTagsExist_instance = new FailureVersionReasons('NoTagsExist', 1, 'repository has no tags.\nIf this is a new repository, use `tag` to set the initial version.');
FailureVersionReasons_VersionMissingElements_instance = new FailureVersionReasons('VersionMissingElements', 2, 'the most recent tag did not have all three semver components.');
}
function FailureVersionReasons(name, ordinal, message) {
Enum.call(this, name, ordinal);
this.j1o_1 = message;
}
function FailureVersionReasons_NoRemote_getInstance() {
FailureVersionReasons_initEntries();
return FailureVersionReasons_NoRemote_instance;
}
function FailureVersionReasons_NoTagsExist_getInstance() {
FailureVersionReasons_initEntries();
return FailureVersionReasons_NoTagsExist_instance;
}
function FailureVersionReasons_VersionMissingElements_getInstance() {
FailureVersionReasons_initEntries();
return FailureVersionReasons_VersionMissingElements_instance;
}
function lastVersionAndTag(_this__u8e3s4) {
var tmp0_elvis_lhs = _this__u8e3s4.l1n_1.e1m(0);
var tmp;
if (tmp0_elvis_lhs == null) {
return null;
} else {
tmp = tmp0_elvis_lhs;
}
var description = tmp;
var tmp_0;
if (contains(description, '-')) {
tmp_0 = substringBefore(description, '-');
} else {
tmp_0 = description;
}
var previousVersionNumber = tmp_0;
// Inline function 'kotlin.text.ifEmpty' call
var tmp_1;
// Inline function 'kotlin.text.isEmpty' call
if (charSequenceLength(previousVersionNumber) === 0) {
tmp_1 = null;
} else {
tmp_1 = previousVersionNumber;
}
var tmp1_safe_receiver = tmp_1;
var tmp_2;
if (tmp1_safe_receiver == null) {
tmp_2 = null;
} else {
// Inline function 'kotlin.let' call
tmp_2 = to(tmp1_safe_receiver, description);
}
return tmp_2;
}
function tag(_this__u8e3s4, version, releaseBranch, userName, userEmail) {
var isSnapshot_0 = isSnapshot(version);
var headTag = _this__u8e3s4.l1n_1.b1m('HEAD');
var alreadyTagged = !(headTag == null);
var headBranch = _this__u8e3s4.l1n_1.d1m().i1m_1;
var isNotOnReleaseBranch = !(headBranch === releaseBranch);
var tmp;
if (isSnapshot_0 || alreadyTagged || isNotOnReleaseBranch) {
var tmp_0 = TagErrors_instance;
var tmp_1 = to(isSnapshot_0, 'being snapshot');
var tmp_2 = TagErrors_instance;
// Inline function 'kotlin.collections.filterKeys' call
var this_0 = mapOf([tmp_1, to(alreadyTagged, tmp_2.l1o(headTag == null ? null : headTag.k1m_1)), to(isNotOnReleaseBranch, TagErrors_instance.m1o(releaseBranch, headBranch))]);
var result = LinkedHashMap_init_$Create$();
// Inline function 'kotlin.collections.iterator' call
var _iterator__ex2g4s = this_0.x().p();
while (_iterator__ex2g4s.q()) {
var entry = _iterator__ex2g4s.r();
if (entry.y()) {
result.m2(entry.y(), entry.z());
}
}
tmp = new Error_0(tmp_0.n1o(joinToString(result.g2(), ', ')));
} else {
// Inline function 'kotlin.runCatching' call
var tmp_3;
try {
_this__u8e3s4.l1n_1.z1l(version, 'HEAD', userName, userEmail);
// Inline function 'kotlin.Companion.success' call
tmp_3 = _Result___init__impl__xyqfz8(Unit_instance);
} catch ($p) {
var tmp_4;
if ($p instanceof Error) {
var e = $p;
// Inline function 'kotlin.Companion.failure' call
tmp_4 = _Result___init__impl__xyqfz8(createFailure(e));
} else {
throw $p;
}
tmp_3 = tmp_4;
}
// Inline function 'kotlin.map' call
var this_1 = tmp_3;
var tmp_5;
if (_Result___get_isSuccess__impl__sndoy8(this_1)) {
var tmp_6 = _Result___get_value__impl__bjfvqg(this_1);
(tmp_6 == null ? true : !(tmp_6 == null)) || THROW_CCE();
_this__u8e3s4.l1n_1.a1m();
// Inline function 'kotlin.Companion.success' call
var value = Success_getInstance();
tmp_5 = _Result___init__impl__xyqfz8(value);
} else {
tmp_5 = _Result___init__impl__xyqfz8(_Result___get_value__impl__bjfvqg(this_1));
}
// Inline function 'kotlin.getOrElse' call
var this_2 = tmp_5;
var exception = Result__exceptionOrNull_impl_p6xea9(this_2);
var tmp_7;
if (exception == null) {
var tmp_8 = _Result___get_value__impl__bjfvqg(this_2);
tmp_7 = (tmp_8 == null ? true : !(tmp_8 == null)) ? tmp_8 : THROW_CCE();
} else {
var tmp0_elvis_lhs = exception.message;
tmp_7 = new Error_0(tmp0_elvis_lhs == null ? 'Unknown error during tagging' : tmp0_elvis_lhs);
}
tmp = tmp_7;
}
return tmp;
}
function isSnapshot(_this__u8e3s4) {
return contains(_this__u8e3s4, 'SNAPSHOT');
}
function TagErrors() {
this.k1o_1 = 'being snapshot';
}
protoOf(TagErrors).n1o = function (messages) {
return 'skipping tag due to ' + messages;
};
protoOf(TagErrors).l1o = function (headTag) {
return 'already tagged ' + headTag;
};
protoOf(TagErrors).m1o = function (releaseBranch, headBranch) {
return 'not on release branch ' + releaseBranch + ' - branch was ' + headBranch;
};
var TagErrors_instance;
function TagErrors_getInstance() {
return TagErrors_instance;
}
function Success() {
Success_instance = this;
TagResult.call(this);
}
protoOf(Success).toString = function () {
return 'Success';
};
protoOf(Success).hashCode = function () {
return -888110432;
};
protoOf(Success).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Success))
return false;
other instanceof Success || THROW_CCE();
return true;
};
var Success_instance;
function Success_getInstance() {
if (Success_instance == null)
new Success();
return Success_instance;
}
function Error_0(message) {
TagResult.call(this);
this.o1o_1 = message;
}
protoOf(Error_0).toString = function () {
return 'Error(message=' + this.o1o_1 + ')';
};
protoOf(Error_0).hashCode = function () {
return getStringHashCode(this.o1o_1);
};
protoOf(Error_0).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Error_0))
return false;
var tmp0_other_with_cast = other instanceof Error_0 ? other : THROW_CCE();
if (!(this.o1o_1 === tmp0_other_with_cast.o1o_1))
return false;
return true;
};
function TagResult() {
}
function TaggerCore(adapter) {
this.l1n_1 = adapter;
}
protoOf(TaggerCore).toString = function () {
return 'TaggerCore(adapter=' + toString(this.l1n_1) + ')';
};
protoOf(TaggerCore).hashCode = function () {
return hashCode(this.l1n_1);
};
protoOf(TaggerCore).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof TaggerCore))
return false;
var tmp0_other_with_cast = other instanceof TaggerCore ? other : THROW_CCE();
if (!equals(this.l1n_1, tmp0_other_with_cast.l1n_1))
return false;
return true;
};
function Defaults() {
Defaults_instance = this;
this.p1o_1 = Defaults_getInstance().q1m_1;
this.q1o_1 = Defaults_getInstance().p1m_1;
this.r1o_1 = Defaults_getInstance().o1m_1;
this.s1o_1 = Defaults_getInstance().n1m_1;
}
var Defaults_instance;
function Defaults_getInstance_0() {
if (Defaults_instance == null)
new Defaults();
return Defaults_instance;
}
function Companion() {
this.t1o_1 = "version regex must include groups named 'major', 'minor', 'patch', and 'none'.";
}
protoOf(Companion).u1o = function (regexPattern) {
return contains(regexPattern, '?<major>') && contains(regexPattern, '?<minor>') && contains(regexPattern, '?<patch>') && contains(regexPattern, '?<none>');
};
var Companion_instance_0;
function Companion_getInstance() {
return Companion_instance_0;
}
function VersionRegex(none, patch, minor, major, unified) {
this.c1o_1 = none;
this.d1o_1 = patch;
this.e1o_1 = minor;
this.f1o_1 = major;
this.g1o_1 = unified;
}
protoOf(VersionRegex).toString = function () {
return 'VersionRegex(none=' + this.c1o_1.toString() + ', patch=' + this.d1o_1.toString() + ', minor=' + this.e1o_1.toString() + ', major=' + this.f1o_1.toString() + ', unified=' + toString_0(this.g1o_1) + ')';
};
protoOf(VersionRegex).hashCode = function () {
var result = hashCode(this.c1o_1);
result = imul(result, 31) + hashCode(this.d1o_1) | 0;
result = imul(result, 31) + hashCode(this.e1o_1) | 0;
result = imul(result, 31) + hashCode(this.f1o_1) | 0;
result = imul(result, 31) + (this.g1o_1 == null ? 0 : hashCode(this.g1o_1)) | 0;
return result;
};
protoOf(VersionRegex).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof VersionRegex))
return false;
var tmp0_other_with_cast = other instanceof VersionRegex ? other : THROW_CCE();
if (!equals(this.c1o_1, tmp0_other_with_cast.c1o_1))
return false;
if (!equals(this.d1o_1, tmp0_other_with_cast.d1o_1))
return false;
if (!equals(this.e1o_1, tmp0_other_with_cast.e1o_1))
return false;
if (!equals(this.f1o_1, tmp0_other_with_cast.f1o_1))
return false;
if (!equals(this.g1o_1, tmp0_other_with_cast.g1o_1))
return false;
return true;
};
function VersionResult$Failure$_get_message_$lambda_nuugae(it) {
return it.j1o_1;
}
function Success_0(version, snapshotReasons) {
snapshotReasons = snapshotReasons === VOID ? emptyList() : snapshotReasons;
this.v1o_1 = version;
this.w1o_1 = snapshotReasons;
}
protoOf(Success_0).toString = function () {
return 'Success(version=' + this.v1o_1 + ', snapshotReasons=' + toString(this.w1o_1) + ')';
};
protoOf(Success_0).hashCode = function () {
var result = getStringHashCode(this.v1o_1);
result = imul(result, 31) + hashCode(this.w1o_1) | 0;
return result;
};
protoOf(Success_0).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Success_0))
return false;
var tmp0_other_with_cast = other instanceof Success_0 ? other : THROW_CCE();
if (!(this.v1o_1 === tmp0_other_with_cast.v1o_1))
return false;
if (!equals(this.w1o_1, tmp0_other_with_cast.w1o_1))
return false;
return true;
};
function Failure(reasons) {
this.x1o_1 = reasons;
}
protoOf(Failure).ma = function () {
return 'Inappropriate configuration: ' + joinToString(this.x1o_1, '\n', VOID, VOID, VOID, VOID, VersionResult$Failure$_get_message_$lambda_nuugae);
};
protoOf(Failure).toString = function () {
return 'Failure(reasons=' + toString(this.x1o_1) + ')';
};
protoOf(Failure).hashCode = function () {
return hashCode(this.x1o_1);
};
protoOf(Failure).equals = function (other) {
if (this === other)
return true;
if (!(other instanceof Failure))
return false;
var tmp0_other_with_cast = other instanceof Failure ? other : THROW_CCE();
if (!equals(this.x1o_1, tmp0_other_with_cast.x1o_1))
return false;
return true;
};
//region block: init
TagErrors_instance = new TagErrors();
Companion_instance_0 = new Companion();
//endregion
//region block: exports
_.$_$ = _.$_$ || {};
_.$_$.a = Error_0;
_.$_$.b = TaggerCore;
_.$_$.c = VersionRegex;
_.$_$.d = Failure;
_.$_$.e = Success_0;
_.$_$.f = calculateNextVersion;
_.$_$.g = tag;
_.$_$.h = Success_getInstance;
_.$_$.i = Companion_instance_0;
_.$_$.j = Defaults_getInstance_0;
//endregion
return _;
}(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./tools-digger-core.js')));
//# sourceMappingURL=tools-tagger-core.js.map