UNPKG

git-semver-tagger

Version:

![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/robertfmurdock/ze-great-tools?label=Release) ![NPM Version](https://img.shields.io/npm/v/git-semver-tagger?label=npm%20git-semver-tagger)

796 lines (794 loc) 30.4 kB
(function (_, kotlin_kotlin, kotlin_com_zegreatrob_tools_digger_core) { 'use strict'; //region block: imports var imul = Math.imul; var split = kotlin_kotlin.$_$.kc; var collectionSizeOrDefault = kotlin_kotlin.$_$.t4; var ArrayList_init_$Create$ = kotlin_kotlin.$_$.f; var toInt = kotlin_kotlin.$_$.xc; var Unit_instance = kotlin_kotlin.$_$.v3; var charSequenceLength = kotlin_kotlin.$_$.t8; var charSequenceGet = kotlin_kotlin.$_$.s8; var digitToIntOrNull = kotlin_kotlin.$_$.ob; var substring = kotlin_kotlin.$_$.qc; var listOf = kotlin_kotlin.$_$.f6; var protoOf = kotlin_kotlin.$_$.ba; var initMetadataForClass = kotlin_kotlin.$_$.c9; var VOID = kotlin_kotlin.$_$.c; var enumEntries = kotlin_kotlin.$_$.s7; var Enum = kotlin_kotlin.$_$.rd; var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.g; var getStringHashCode = kotlin_kotlin.$_$.a9; var THROW_CCE = kotlin_kotlin.$_$.zd; var isCharSequence = kotlin_kotlin.$_$.m9; var trim = kotlin_kotlin.$_$.id; var toString = kotlin_kotlin.$_$.da; var Companion_instance = kotlin_kotlin.$_$.q3; var get = kotlin_kotlin.$_$.tb; var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.o1; var createFailure = kotlin_kotlin.$_$.oe; var _Result___get_isFailure__impl__jpiriv = kotlin_kotlin.$_$.q1; var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.s1; var substringBefore = kotlin_kotlin.$_$.oc; var contains = kotlin_kotlin.$_$.mb; var to = kotlin_kotlin.$_$.af; var _Result___get_isSuccess__impl__sndoy8 = kotlin_kotlin.$_$.r1; var Result__exceptionOrNull_impl_p6xea9 = kotlin_kotlin.$_$.p1; var mapOf = kotlin_kotlin.$_$.j6; var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.p; var joinToString = kotlin_kotlin.$_$.v5; var initMetadataForObject = kotlin_kotlin.$_$.h9; var hashCode = kotlin_kotlin.$_$.b9; var equals = kotlin_kotlin.$_$.w8; var Defaults_getInstance = kotlin_com_zegreatrob_tools_digger_core.$_$.a; var initMetadataForCompanion = kotlin_kotlin.$_$.d9; var toString_0 = kotlin_kotlin.$_$.ze; var emptyList = kotlin_kotlin.$_$.j5; //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(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(StatusCheck, 'StatusCheck'); 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.o(); while (_iterator__ex2g4s.p()) { var item = _iterator__ex2g4s.q(); var tmp$ret$0 = toInt(item); destination.g(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; return substring(_this__u8e3s4, startIndex); } function calculateNextVersion(_this__u8e3s4, implicitPatch, disableDetached, versionRegex, releaseBranch) { var gitStatus = _this__u8e3s4.tm_1.jm(); var tmp; if (disableDetached) { // Inline function 'kotlin.text.isEmpty' call var this_0 = gitStatus.pm_1; tmp = charSequenceLength(this_0) === 0; } else { tmp = false; } if (tmp) { return new Failure(listOf(FailureVersionReasons_NoRemote_getInstance())); } var tmp0_elvis_lhs = lastVersionAndTag(_this__u8e3s4); var tmp_0; if (tmp0_elvis_lhs == null) { return new Failure(listOf(FailureVersionReasons_NoTagsExist_getInstance())); } else { tmp_0 = tmp0_elvis_lhs; } var _destruct__k2r9zo = tmp_0; var previousVersionNumber = _destruct__k2r9zo.z9(); var lastTagDescription = _destruct__k2r9zo.aa(); var tmp1_elvis_lhs = asSemverComponents(previousVersionNumber); var tmp_1; if (tmp1_elvis_lhs == null) { return new Failure(listOf(FailureVersionReasons_VersionMissingElements_getInstance())); } else { tmp_1 = tmp1_elvis_lhs; } var previousVersionComponents = tmp_1; var incrementComponent = findAppropriateIncrement(_this__u8e3s4.tm_1, lastTagDescription, implicitPatch, versionRegex); var tmp3_elvis_lhs = incrementComponent == null ? null : incrementComponent.xm(previousVersionComponents); var currentVersionNumber = tmp3_elvis_lhs == null ? previousVersionNumber : tmp3_elvis_lhs; var reasonsToUseSnapshot = snapshotReasons(releaseBranch, currentVersionNumber, previousVersionNumber, gitStatus); return new Success_0(reasonsToUseSnapshot.l() ? currentVersionNumber : currentVersionNumber + '-SNAPSHOT', reasonsToUseSnapshot); } function SnapshotReason$DIRTY() { SnapshotReason.call(this, 'DIRTY', 0); SnapshotReason_DIRTY_instance = this; } protoOf(SnapshotReason$DIRTY).an = function (_this__u8e3s4) { return !_this__u8e3s4.bn_1.lm_1; }; var SnapshotReason_DIRTY_instance; function SnapshotReason$AHEAD() { SnapshotReason.call(this, 'AHEAD', 1); SnapshotReason_AHEAD_instance = this; } protoOf(SnapshotReason$AHEAD).an = function (_this__u8e3s4) { return !(_this__u8e3s4.bn_1.mm_1 === 0); }; var SnapshotReason_AHEAD_instance; function SnapshotReason$BEHIND() { SnapshotReason.call(this, 'BEHIND', 2); SnapshotReason_BEHIND_instance = this; } protoOf(SnapshotReason$BEHIND).an = function (_this__u8e3s4) { return !(_this__u8e3s4.bn_1.nm_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).an = function (_this__u8e3s4) { return !(_this__u8e3s4.bn_1.om_1 === _this__u8e3s4.cn_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).an = function (_this__u8e3s4) { return _this__u8e3s4.dn_1 === _this__u8e3s4.en_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).hn = function (check) { return this.an(check); }; function ChangeType$Major() { ChangeType.call(this, 'Major', 0, 3); ChangeType_Major_instance = this; } protoOf(ChangeType$Major).xm = function (components) { // Inline function 'kotlin.collections.component1' call var major = components.r(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).xm = function (components) { // Inline function 'kotlin.collections.component1' call var major = components.r(0); // Inline function 'kotlin.collections.component2' call var minor = components.r(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).xm = function (components) { // Inline function 'kotlin.collections.component1' call var major = components.r(0); // Inline function 'kotlin.collections.component2' call var minor = components.r(1); // Inline function 'kotlin.collections.component3' call var patch = components.r(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).xm = function (components) { // Inline function 'kotlin.collections.component1' call var major = components.r(0); // Inline function 'kotlin.collections.component2' call var minor = components.r(1); // Inline function 'kotlin.collections.component3' call var patch = components.r(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.wm_1 = priority; } function findAppropriateIncrement(gitAdapter, previousTag, implicitPatch, minorRegex) { // Inline function 'kotlin.also' call var this_0 = gitAdapter.im('HEAD', '^' + previousTag); if (this_0.l()) 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.o(); while (_iterator__ex2g4s.p()) { var item = _iterator__ex2g4s.q(); var tmp0_elvis_lhs = changeType(item, minorRegex); var tmp$ret$2 = tmp0_elvis_lhs == null ? implicitPatch ? ChangeType_Patch_getInstance() : null : tmp0_elvis_lhs; destination.g(tmp$ret$2); } // Inline function 'kotlin.collections.fold' call var accumulator = null; var _iterator__ex2g4s_0 = destination.o(); while (_iterator__ex2g4s_0.p()) { var element = _iterator__ex2g4s_0.q(); 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.o(); while (_iterator__ex2g4s.p()) { var element = _iterator__ex2g4s.q(); if (element.hn(statusCheck)) { destination.g(element); } } return destination; } function StatusCheck(gitStatus, releaseBranch, currentVersionNumber, previousVersionNumber) { this.bn_1 = gitStatus; this.cn_1 = releaseBranch; this.dn_1 = currentVersionNumber; this.en_1 = previousVersionNumber; } protoOf(StatusCheck).toString = function () { return 'StatusCheck(gitStatus=' + this.bn_1.toString() + ', releaseBranch=' + this.cn_1 + ', currentVersionNumber=' + this.dn_1 + ', previousVersionNumber=' + this.en_1 + ')'; }; protoOf(StatusCheck).hashCode = function () { var result = this.bn_1.hashCode(); result = imul(result, 31) + getStringHashCode(this.cn_1) | 0; result = imul(result, 31) + getStringHashCode(this.dn_1) | 0; result = imul(result, 31) + getStringHashCode(this.en_1) | 0; return result; }; protoOf(StatusCheck).equals = function (other) { if (this === other) return true; if (!(other instanceof StatusCheck)) return false; if (!this.bn_1.equals(other.bn_1)) return false; if (!(this.cn_1 === other.cn_1)) return false; if (!(this.dn_1 === other.dn_1)) return false; if (!(this.en_1 === other.en_1)) return false; return true; }; function changeType(_this__u8e3s4, versionRegex) { // Inline function 'kotlin.text.trim' call var this_0 = _this__u8e3s4.am_1; var tmp$ret$0 = toString(trim(isCharSequence(this_0) ? this_0 : THROW_CCE())); return changeType_0(versionRegex, tmp$ret$0); } function highestPriority(left, right) { return left == null ? right : right == null ? left : left.wm_1 > right.wm_1 ? left : right; } function changeType_0(_this__u8e3s4, message) { var tmp; var tmp0_safe_receiver = _this__u8e3s4.go_1; if ((tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ic(message)) === true) { tmp = findMatchType(message, _this__u8e3s4.go_1); } else { if (_this__u8e3s4.fo_1.ic(message)) { tmp = ChangeType_Major_getInstance(); } else { if (_this__u8e3s4.eo_1.ic(message)) { tmp = ChangeType_Minor_getInstance(); } else { if (_this__u8e3s4.do_1.ic(message)) { tmp = ChangeType_Patch_getInstance(); } else { if (_this__u8e3s4.co_1.ic(message)) { tmp = ChangeType_None_getInstance(); } else { tmp = null; } } } } } return tmp; } function findMatchType(message, regex) { var tmp0_safe_receiver = regex.mc(message); var groups = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.vc(); 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 tmp0 = tmp; var tmp$ret$4; $l$block: { // Inline function 'kotlin.getOrDefault' call if (_Result___get_isFailure__impl__jpiriv(tmp0)) { tmp$ret$4 = false; break $l$block; } var tmp_1 = _Result___get_value__impl__bjfvqg(tmp0); 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.jo_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.tm_1.km(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.tm_1.hm('HEAD'); var alreadyTagged = !(headTag == null); var headBranch = _this__u8e3s4.tm_1.jm().om_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.lo(headTag == null ? null : headTag.qm_1)), to(isNotOnReleaseBranch, TagErrors_instance.mo(releaseBranch, headBranch))]); var result = LinkedHashMap_init_$Create$(); // Inline function 'kotlin.collections.iterator' call var _iterator__ex2g4s = this_0.z().o(); while (_iterator__ex2g4s.p()) { var entry = _iterator__ex2g4s.q(); if (entry.a1()) { result.e2(entry.a1(), entry.b1()); } } tmp = new Error_0(tmp_0.no(joinToString(result.d2(), ', '))); } else { // Inline function 'kotlin.runCatching' call var tmp_3; try { _this__u8e3s4.tm_1.fm(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); if (!(tmp_6 == null ? true : !(tmp_6 == null))) THROW_CCE(); _this__u8e3s4.tm_1.gm(); // 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.ko_1 = 'being snapshot'; } protoOf(TagErrors).no = function (messages) { return 'skipping tag due to ' + messages; }; protoOf(TagErrors).lo = function (headTag) { return 'already tagged ' + headTag; }; protoOf(TagErrors).mo = 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; 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.oo_1 = message; } protoOf(Error_0).toString = function () { return 'Error(message=' + this.oo_1 + ')'; }; protoOf(Error_0).hashCode = function () { return getStringHashCode(this.oo_1); }; protoOf(Error_0).equals = function (other) { if (this === other) return true; if (!(other instanceof Error_0)) return false; if (!(this.oo_1 === other.oo_1)) return false; return true; }; function TagResult() { } function TaggerCore(adapter) { this.tm_1 = adapter; } protoOf(TaggerCore).toString = function () { return 'TaggerCore(adapter=' + toString(this.tm_1) + ')'; }; protoOf(TaggerCore).hashCode = function () { return hashCode(this.tm_1); }; protoOf(TaggerCore).equals = function (other) { if (this === other) return true; if (!(other instanceof TaggerCore)) return false; if (!equals(this.tm_1, other.tm_1)) return false; return true; }; function Defaults() { Defaults_instance = this; this.po_1 = Defaults_getInstance().sl_1; this.qo_1 = Defaults_getInstance().rl_1; this.ro_1 = Defaults_getInstance().ql_1; this.so_1 = Defaults_getInstance().pl_1; } var Defaults_instance; function Defaults_getInstance_0() { if (Defaults_instance == null) new Defaults(); return Defaults_instance; } function Companion() { this.to_1 = "version regex must include groups named 'major', 'minor', 'patch', and 'none'."; } protoOf(Companion).uo = 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.co_1 = none; this.do_1 = patch; this.eo_1 = minor; this.fo_1 = major; this.go_1 = unified; } protoOf(VersionRegex).toString = function () { return 'VersionRegex(none=' + this.co_1.toString() + ', patch=' + this.do_1.toString() + ', minor=' + this.eo_1.toString() + ', major=' + this.fo_1.toString() + ', unified=' + toString_0(this.go_1) + ')'; }; protoOf(VersionRegex).hashCode = function () { var result = hashCode(this.co_1); result = imul(result, 31) + hashCode(this.do_1) | 0; result = imul(result, 31) + hashCode(this.eo_1) | 0; result = imul(result, 31) + hashCode(this.fo_1) | 0; result = imul(result, 31) + (this.go_1 == null ? 0 : hashCode(this.go_1)) | 0; return result; }; protoOf(VersionRegex).equals = function (other) { if (this === other) return true; if (!(other instanceof VersionRegex)) return false; if (!equals(this.co_1, other.co_1)) return false; if (!equals(this.do_1, other.do_1)) return false; if (!equals(this.eo_1, other.eo_1)) return false; if (!equals(this.fo_1, other.fo_1)) return false; if (!equals(this.go_1, other.go_1)) return false; return true; }; function VersionResult$Failure$_get_message_$lambda_nuugae(it) { return it.jo_1; } function Success_0(version, snapshotReasons) { snapshotReasons = snapshotReasons === VOID ? emptyList() : snapshotReasons; this.vo_1 = version; this.wo_1 = snapshotReasons; } protoOf(Success_0).toString = function () { return 'Success(version=' + this.vo_1 + ', snapshotReasons=' + toString(this.wo_1) + ')'; }; protoOf(Success_0).hashCode = function () { var result = getStringHashCode(this.vo_1); result = imul(result, 31) + hashCode(this.wo_1) | 0; return result; }; protoOf(Success_0).equals = function (other) { if (this === other) return true; if (!(other instanceof Success_0)) return false; if (!(this.vo_1 === other.vo_1)) return false; if (!equals(this.wo_1, other.wo_1)) return false; return true; }; function Failure(reasons) { this.xo_1 = reasons; } protoOf(Failure).e = function () { return 'Inappropriate configuration: ' + joinToString(this.xo_1, '\n', VOID, VOID, VOID, VOID, VersionResult$Failure$_get_message_$lambda_nuugae); }; protoOf(Failure).toString = function () { return 'Failure(reasons=' + toString(this.xo_1) + ')'; }; protoOf(Failure).hashCode = function () { return hashCode(this.xo_1); }; protoOf(Failure).equals = function (other) { if (this === other) return true; if (!(other instanceof Failure)) return false; if (!equals(this.xo_1, other.xo_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