diff --git a/Modules/MicX/Mic/Mic.yml b/Modules/MicX/Mic/Mic.yml index 9a910a7..cb5b314 100644 --- a/Modules/MicX/Mic/Mic.yml +++ b/Modules/MicX/Mic/Mic.yml @@ -7,8 +7,8 @@ model: service: actions: - shouldDeliverActivityDates: Bus.deliver(K.activityDate, v);/**/print("ИГР Mic.shouldDAD:'\(v)'") - shouldResetActivityDates: Bus.send(K.activityDates, v);/**/print("ИГР Mic.shouldRAD:'\(v)'") + shouldDeliverActivityDates: Bus.deliver(K.activityDate, v) + shouldResetActivityDates: Bus.send(K.activityDates, v) pipes: activeIds: [recent, K.activeIds] diff --git a/Modules/MicX/Mic/src/Mic.Generated.swift b/Modules/MicX/Mic/src/Mic.Generated.swift index 6c42862..fd4bdfe 100644 --- a/Modules/MicX/Mic/src/Mic.Generated.swift +++ b/Modules/MicX/Mic/src/Mic.Generated.swift @@ -83,12 +83,12 @@ extension Mic { ctrl.m .compactMap { shouldDeliverActivityDates($0) } .receive(on: DispatchQueue.main) - .sink { v in Bus.deliver(K.activityDate, v);/**/print("ИГР Mic.shouldDAD:'\(v)'") } + .sink { v in Bus.deliver(K.activityDate, v) } .store(in: &service.subscriptions) ctrl.m .compactMap { shouldResetActivityDates($0) } .receive(on: DispatchQueue.main) - .sink { v in Bus.send(K.activityDates, v);/**/print("ИГР Mic.shouldRAD:'\(v)'") } + .sink { v in Bus.send(K.activityDates, v) } .store(in: &service.subscriptions) diff --git a/Modules/MicX/Mic/src/Mic.K.swift b/Modules/MicX/Mic/src/Mic.K.swift index 68b48cf..fa528df 100644 --- a/Modules/MicX/Mic/src/Mic.K.swift +++ b/Modules/MicX/Mic/src/Mic.K.swift @@ -4,7 +4,7 @@ public extension Mic { public static let activityDate = "Mic.activityDate" public static let activityDates = "Mic.activityDates" public static let isActive = "Mic.isActive" - public static let MI = "Mic.Model.Item" + public static let MI = "MicItem.Model" public static let requestActivityDate = "Mic.requestActivityDate" public static let timeout = "Mic.timeout" } diff --git a/Modules/MicX/MicItem/src/MicItem.Shoulds.swift b/Modules/MicX/MicItem/src/MicItem.Shoulds.swift index 6f96f07..c45283f 100644 --- a/Modules/MicX/MicItem/src/MicItem.Shoulds.swift +++ b/Modules/MicX/MicItem/src/MicItem.Shoulds.swift @@ -1,4 +1,11 @@ public extension MicItem { + /// Следует задать активность элемента + /// + /// Условия: + /// 1. Пришла актуальная дата завершения активности + /// 2. Таймер сообщил о завершении активности + /// + /// - Returns: Состояние активности элемента static func shouldResetActivity(_ c: MicItemContext) -> Bool? { if c.activityDate.isRecent, @@ -15,6 +22,12 @@ public extension MicItem { return nil } + /// Следует задать время истечения активности + /// + /// Условия: + /// 1. Пришла актуальная дата завершения активности + /// + /// - Returns: Время истечения активности static func shouldResetTimeout(_ c: MicItemContext) -> TimeInterval? { if c.activityDate.isRecent, diff --git a/Modules/MicX/MicItem/src/MicItem.V.swift b/Modules/MicX/MicItem/src/MicItem.V.swift index 7d9ecb7..0c5ee9e 100644 --- a/Modules/MicX/MicItem/src/MicItem.V.swift +++ b/Modules/MicX/MicItem/src/MicItem.V.swift @@ -3,7 +3,7 @@ import SwiftUI extension MicItem { public struct V: View { - var id: String? + let id: String? @StateObject var holder = BusUI.Holder() @StateObject var isActive = BusUI.Value(K.isActive, false) @@ -11,13 +11,12 @@ extension MicItem { self.id = id } - func config(_ id: String? = nil) { - /**/print("ИГР MicIV.config id: '\(id)'") + func configure(_ id: String? = nil) { isActive.id = id holder.items = [ Bus.Delay(shouldResetTimeout, K.MI, K.timeout, id), Bus.Sync(shouldResetActivity, K.MI, K.isActive, id), - MicItem.Controller(id) + MicItem.Controller(id), ] // Запрашиваем актуальные данные при (пере)создании. Bus.send(K.requestActivityDate, id) @@ -31,8 +30,8 @@ extension MicItem { width: isActive.v ? 3 : 1 ) .animation(.easeInOut(duration: 0.3)) - .onAppear { self.config(id) } - .onChange(of: id) { id in self.config(id) } + .onAppear { self.configure(id) } + .onChange(of: id) { id in self.configure(id) } } } } diff --git a/Modules/MicX/MicItem/src/MicItem.WillBe.swift b/Modules/MicX/MicItem/src/MicItem.WillBe.swift index 5e0a34a..0efe274 100644 --- a/Modules/MicX/MicItem/src/MicItem.WillBe.swift +++ b/Modules/MicX/MicItem/src/MicItem.WillBe.swift @@ -20,7 +20,6 @@ extension MicItem { if let id { sid = " : \(id)" } - /**/print("MicIC.init\(sid)") super.init( MicItem.Model(), debugClassName: "MicICtrl", diff --git a/Utilities/platform/1/generate b/Utilities/_platform/1/generate similarity index 100% rename from Utilities/platform/1/generate rename to Utilities/_platform/1/generate diff --git a/Utilities/_platform/2/generate b/Utilities/_platform/2/generate new file mode 100755 index 0000000..3cf34a2 --- /dev/null +++ b/Utilities/_platform/2/generate @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +import os +import sys +from argparse import ArgumentParser +from generation.generateStructure import * +from generation.shortenName import * +from generation.Result import * +from parsing.parseLines import * +from parsing.Structure import * + +DIR = os.path.dirname(os.path.realpath(sys.argv[0])) + +# Импорт из общей для всех генераторов директории. +sys.path.append(f"{DIR}/../common") +from modulePaths import * +from readFile import * + +parser = ArgumentParser(prog='generate v2') +parser.add_argument('module', type=str, + help='the name of the module to generate') +parser.add_argument('-i', '--input', type=str, + help='The path and name of the input file') +parser.add_argument('-o', '--output', type=str, + help='The path of the output files') +parser.add_argument('-s', '--source', type=str, + help='The path of the source files') + +args = parser.parse_args() + +(PATH, MODULE) = modulePaths(args.module) + +print(f"Generating platform for module '{PATH}'...") + +FILE_IN = args.input or f"{DIR}/../../../Modules/{PATH}/{MODULE}.yml" +DIR_OUT = args.output or f"{DIR}/../../../Modules/{PATH}/src/" +FILE_OUT = os.path.join(DIR_OUT, f"{MODULE}.Generated.swift") +FILE_OUT_V1 = os.path.join(DIR_OUT, f"{MODULE}.SectionGenerated.swift") +MODULE_SRC = args.source or f"{DIR}/../../../Modules/{PATH}/src" + +# Удаляем первую версию генерированного файла при его наличии. +if os.path.isfile(FILE_OUT_V1): + os.remove(FILE_OUT_V1) + +# Читаем файл и разбираем его на ключи-значения. +lines = readFile(FILE_IN) +structure = Structure() +parseLines(lines, structure) + +# Генерируем код. +result = Result(DIR, PATH, MODULE, readFile, shortenName, MODULE_SRC, structure) +generateStructure(result) + +# Сохраняем файл. +with open(FILE_OUT, "w") as file: + file.write(result.file) diff --git a/Utilities/platform/2/generation/Result.py b/Utilities/_platform/2/generation/Result.py similarity index 100% rename from Utilities/platform/2/generation/Result.py rename to Utilities/_platform/2/generation/Result.py diff --git a/Utilities/platform/2/generation/fieldFormat.py b/Utilities/_platform/2/generation/fieldFormat.py similarity index 100% rename from Utilities/platform/2/generation/fieldFormat.py rename to Utilities/_platform/2/generation/fieldFormat.py diff --git a/Utilities/platform/2/generation/generateContextFields.py b/Utilities/_platform/2/generation/generateContextFields.py similarity index 100% rename from Utilities/platform/2/generation/generateContextFields.py rename to Utilities/_platform/2/generation/generateContextFields.py diff --git a/Utilities/platform/2/generation/generateCore.py b/Utilities/_platform/2/generation/generateCore.py similarity index 100% rename from Utilities/platform/2/generation/generateCore.py rename to Utilities/_platform/2/generation/generateCore.py diff --git a/Utilities/platform/2/generation/generateCoreSectionGenerated.py b/Utilities/_platform/2/generation/generateCoreSectionGenerated.py similarity index 100% rename from Utilities/platform/2/generation/generateCoreSectionGenerated.py rename to Utilities/_platform/2/generation/generateCoreSectionGenerated.py diff --git a/Utilities/platform/2/generation/generateCoreSectionGeneratedActions.py b/Utilities/_platform/2/generation/generateCoreSectionGeneratedActions.py similarity index 100% rename from Utilities/platform/2/generation/generateCoreSectionGeneratedActions.py rename to Utilities/_platform/2/generation/generateCoreSectionGeneratedActions.py diff --git a/Utilities/platform/2/generation/generateCoreSectionsDestroy.py b/Utilities/_platform/2/generation/generateCoreSectionsDestroy.py similarity index 100% rename from Utilities/platform/2/generation/generateCoreSectionsDestroy.py rename to Utilities/_platform/2/generation/generateCoreSectionsDestroy.py diff --git a/Utilities/platform/2/generation/generateCoreSectionsSetup.py b/Utilities/_platform/2/generation/generateCoreSectionsSetup.py similarity index 100% rename from Utilities/platform/2/generation/generateCoreSectionsSetup.py rename to Utilities/_platform/2/generation/generateCoreSectionsSetup.py diff --git a/Utilities/platform/2/generation/generateCoreWindow.py b/Utilities/_platform/2/generation/generateCoreWindow.py similarity index 100% rename from Utilities/platform/2/generation/generateCoreWindow.py rename to Utilities/_platform/2/generation/generateCoreWindow.py diff --git a/Utilities/platform/2/generation/generateFile.py b/Utilities/_platform/2/generation/generateFile.py similarity index 100% rename from Utilities/platform/2/generation/generateFile.py rename to Utilities/_platform/2/generation/generateFile.py diff --git a/Utilities/platform/2/generation/generateImports.py b/Utilities/_platform/2/generation/generateImports.py similarity index 100% rename from Utilities/platform/2/generation/generateImports.py rename to Utilities/_platform/2/generation/generateImports.py diff --git a/Utilities/platform/2/generation/generateModelFields.py b/Utilities/_platform/2/generation/generateModelFields.py similarity index 100% rename from Utilities/platform/2/generation/generateModelFields.py rename to Utilities/_platform/2/generation/generateModelFields.py diff --git a/Utilities/platform/2/generation/generateServiceSectionGenerated.py b/Utilities/_platform/2/generation/generateServiceSectionGenerated.py similarity index 100% rename from Utilities/platform/2/generation/generateServiceSectionGenerated.py rename to Utilities/_platform/2/generation/generateServiceSectionGenerated.py diff --git a/Utilities/platform/2/generation/generateServiceSectionGeneratedActions.py b/Utilities/_platform/2/generation/generateServiceSectionGeneratedActions.py similarity index 100% rename from Utilities/platform/2/generation/generateServiceSectionGeneratedActions.py rename to Utilities/_platform/2/generation/generateServiceSectionGeneratedActions.py diff --git a/Utilities/platform/2/generation/generateServiceSections.py b/Utilities/_platform/2/generation/generateServiceSections.py similarity index 100% rename from Utilities/platform/2/generation/generateServiceSections.py rename to Utilities/_platform/2/generation/generateServiceSections.py diff --git a/Utilities/platform/2/generation/generateStructure.py b/Utilities/_platform/2/generation/generateStructure.py similarity index 100% rename from Utilities/platform/2/generation/generateStructure.py rename to Utilities/_platform/2/generation/generateStructure.py diff --git a/Utilities/platform/2/generation/generateWorldConstructor.py b/Utilities/_platform/2/generation/generateWorldConstructor.py similarity index 100% rename from Utilities/platform/2/generation/generateWorldConstructor.py rename to Utilities/_platform/2/generation/generateWorldConstructor.py diff --git a/Utilities/platform/2/generation/generateWorldFields.py b/Utilities/_platform/2/generation/generateWorldFields.py similarity index 100% rename from Utilities/platform/2/generation/generateWorldFields.py rename to Utilities/_platform/2/generation/generateWorldFields.py diff --git a/Utilities/platform/2/generation/generateWorldParameters.py b/Utilities/_platform/2/generation/generateWorldParameters.py similarity index 100% rename from Utilities/platform/2/generation/generateWorldParameters.py rename to Utilities/_platform/2/generation/generateWorldParameters.py diff --git a/Utilities/platform/2/generation/hasSectionGenerated.py b/Utilities/_platform/2/generation/hasSectionGenerated.py similarity index 100% rename from Utilities/platform/2/generation/hasSectionGenerated.py rename to Utilities/_platform/2/generation/hasSectionGenerated.py diff --git a/Utilities/platform/2/generation/isNotKeyword.py b/Utilities/_platform/2/generation/isNotKeyword.py similarity index 100% rename from Utilities/platform/2/generation/isNotKeyword.py rename to Utilities/_platform/2/generation/isNotKeyword.py diff --git a/Utilities/platform/2/generation/isPipeRecent.py b/Utilities/_platform/2/generation/isPipeRecent.py similarity index 100% rename from Utilities/platform/2/generation/isPipeRecent.py rename to Utilities/_platform/2/generation/isPipeRecent.py diff --git a/Utilities/platform/2/generation/isToggle.py b/Utilities/_platform/2/generation/isToggle.py similarity index 100% rename from Utilities/platform/2/generation/isToggle.py rename to Utilities/_platform/2/generation/isToggle.py diff --git a/Utilities/platform/2/generation/pipeBusSource.py b/Utilities/_platform/2/generation/pipeBusSource.py similarity index 100% rename from Utilities/platform/2/generation/pipeBusSource.py rename to Utilities/_platform/2/generation/pipeBusSource.py diff --git a/Utilities/platform/2/generation/pipeFormat.py b/Utilities/_platform/2/generation/pipeFormat.py similarity index 100% rename from Utilities/platform/2/generation/pipeFormat.py rename to Utilities/_platform/2/generation/pipeFormat.py diff --git a/Utilities/platform/2/generation/pipeSource.py b/Utilities/_platform/2/generation/pipeSource.py similarity index 100% rename from Utilities/platform/2/generation/pipeSource.py rename to Utilities/_platform/2/generation/pipeSource.py diff --git a/Utilities/platform/2/generation/sectionFunctions.py b/Utilities/_platform/2/generation/sectionFunctions.py similarity index 100% rename from Utilities/platform/2/generation/sectionFunctions.py rename to Utilities/_platform/2/generation/sectionFunctions.py diff --git a/Utilities/platform/2/generation/sectionGeneratedActionShouldLoad.py b/Utilities/_platform/2/generation/sectionGeneratedActionShouldLoad.py similarity index 100% rename from Utilities/platform/2/generation/sectionGeneratedActionShouldLoad.py rename to Utilities/_platform/2/generation/sectionGeneratedActionShouldLoad.py diff --git a/Utilities/platform/2/generation/sectionGeneratedPipes.py b/Utilities/_platform/2/generation/sectionGeneratedPipes.py similarity index 100% rename from Utilities/platform/2/generation/sectionGeneratedPipes.py rename to Utilities/_platform/2/generation/sectionGeneratedPipes.py diff --git a/Utilities/platform/2/generation/sectionNames.py b/Utilities/_platform/2/generation/sectionNames.py similarity index 100% rename from Utilities/platform/2/generation/sectionNames.py rename to Utilities/_platform/2/generation/sectionNames.py diff --git a/Utilities/platform/2/generation/shortenName.py b/Utilities/_platform/2/generation/shortenName.py similarity index 100% rename from Utilities/platform/2/generation/shortenName.py rename to Utilities/_platform/2/generation/shortenName.py diff --git a/Utilities/platform/2/generation/worldFieldTypeInit.py b/Utilities/_platform/2/generation/worldFieldTypeInit.py similarity index 100% rename from Utilities/platform/2/generation/worldFieldTypeInit.py rename to Utilities/_platform/2/generation/worldFieldTypeInit.py diff --git a/Utilities/platform/2/generation/worldFieldTypePS.py b/Utilities/_platform/2/generation/worldFieldTypePS.py similarity index 100% rename from Utilities/platform/2/generation/worldFieldTypePS.py rename to Utilities/_platform/2/generation/worldFieldTypePS.py diff --git a/Utilities/platform/2/parsing/CoreService.py b/Utilities/_platform/2/parsing/CoreService.py similarity index 100% rename from Utilities/platform/2/parsing/CoreService.py rename to Utilities/_platform/2/parsing/CoreService.py diff --git a/Utilities/platform/2/parsing/Mode.py b/Utilities/_platform/2/parsing/Mode.py similarity index 100% rename from Utilities/platform/2/parsing/Mode.py rename to Utilities/_platform/2/parsing/Mode.py diff --git a/Utilities/platform/2/parsing/ModelWorld.py b/Utilities/_platform/2/parsing/ModelWorld.py similarity index 100% rename from Utilities/platform/2/parsing/ModelWorld.py rename to Utilities/_platform/2/parsing/ModelWorld.py diff --git a/Utilities/platform/2/parsing/Structure.py b/Utilities/_platform/2/parsing/Structure.py similarity index 100% rename from Utilities/platform/2/parsing/Structure.py rename to Utilities/_platform/2/parsing/Structure.py diff --git a/Utilities/platform/2/parsing/parseLines.py b/Utilities/_platform/2/parsing/parseLines.py similarity index 100% rename from Utilities/platform/2/parsing/parseLines.py rename to Utilities/_platform/2/parsing/parseLines.py diff --git a/Utilities/platform/2/parsing/readKeyValue.py b/Utilities/_platform/2/parsing/readKeyValue.py similarity index 100% rename from Utilities/platform/2/parsing/readKeyValue.py rename to Utilities/_platform/2/parsing/readKeyValue.py diff --git a/Utilities/platform/2/parsing/valueArray.py b/Utilities/_platform/2/parsing/valueArray.py similarity index 100% rename from Utilities/platform/2/parsing/valueArray.py rename to Utilities/_platform/2/parsing/valueArray.py diff --git a/Utilities/platform/2/templates/context-field b/Utilities/_platform/2/templates/context-field similarity index 100% rename from Utilities/platform/2/templates/context-field rename to Utilities/_platform/2/templates/context-field diff --git a/Utilities/platform/2/templates/core b/Utilities/_platform/2/templates/core similarity index 100% rename from Utilities/platform/2/templates/core rename to Utilities/_platform/2/templates/core diff --git a/Utilities/platform/2/templates/core-section b/Utilities/_platform/2/templates/core-section similarity index 100% rename from Utilities/platform/2/templates/core-section rename to Utilities/_platform/2/templates/core-section diff --git a/Utilities/platform/2/templates/core-section-generated b/Utilities/_platform/2/templates/core-section-generated similarity index 100% rename from Utilities/platform/2/templates/core-section-generated rename to Utilities/_platform/2/templates/core-section-generated diff --git a/Utilities/platform/2/templates/core-section-generated-action b/Utilities/_platform/2/templates/core-section-generated-action similarity index 100% rename from Utilities/platform/2/templates/core-section-generated-action rename to Utilities/_platform/2/templates/core-section-generated-action diff --git a/Utilities/platform/2/templates/core-section-generated-action-instant b/Utilities/_platform/2/templates/core-section-generated-action-instant similarity index 100% rename from Utilities/platform/2/templates/core-section-generated-action-instant rename to Utilities/_platform/2/templates/core-section-generated-action-instant diff --git a/Utilities/platform/2/templates/core-window b/Utilities/_platform/2/templates/core-window similarity index 100% rename from Utilities/platform/2/templates/core-window rename to Utilities/_platform/2/templates/core-window diff --git a/Utilities/platform/2/templates/file b/Utilities/_platform/2/templates/file similarity index 100% rename from Utilities/platform/2/templates/file rename to Utilities/_platform/2/templates/file diff --git a/Utilities/platform/2/templates/model-field b/Utilities/_platform/2/templates/model-field similarity index 100% rename from Utilities/platform/2/templates/model-field rename to Utilities/_platform/2/templates/model-field diff --git a/Utilities/platform/2/templates/section-generated-action-shouldLoad b/Utilities/_platform/2/templates/section-generated-action-shouldLoad similarity index 100% rename from Utilities/platform/2/templates/section-generated-action-shouldLoad rename to Utilities/_platform/2/templates/section-generated-action-shouldLoad diff --git a/Utilities/platform/2/templates/section-generated-pipe-ex-recent b/Utilities/_platform/2/templates/section-generated-pipe-ex-recent similarity index 100% rename from Utilities/platform/2/templates/section-generated-pipe-ex-recent rename to Utilities/_platform/2/templates/section-generated-pipe-ex-recent diff --git a/Utilities/platform/2/templates/section-generated-pipe-recent b/Utilities/_platform/2/templates/section-generated-pipe-recent similarity index 100% rename from Utilities/platform/2/templates/section-generated-pipe-recent rename to Utilities/_platform/2/templates/section-generated-pipe-recent diff --git a/Utilities/platform/2/templates/section-generated-pipe-set b/Utilities/_platform/2/templates/section-generated-pipe-set similarity index 100% rename from Utilities/platform/2/templates/section-generated-pipe-set rename to Utilities/_platform/2/templates/section-generated-pipe-set diff --git a/Utilities/platform/2/templates/section-generated-pipe-src-bus b/Utilities/_platform/2/templates/section-generated-pipe-src-bus similarity index 100% rename from Utilities/platform/2/templates/section-generated-pipe-src-bus rename to Utilities/_platform/2/templates/section-generated-pipe-src-bus diff --git a/Utilities/platform/2/templates/section-generated-pipe-toggle b/Utilities/_platform/2/templates/section-generated-pipe-toggle similarity index 100% rename from Utilities/platform/2/templates/section-generated-pipe-toggle rename to Utilities/_platform/2/templates/section-generated-pipe-toggle diff --git a/Utilities/platform/2/templates/section-generated-pipe-toggleNil b/Utilities/_platform/2/templates/section-generated-pipe-toggleNil similarity index 100% rename from Utilities/platform/2/templates/section-generated-pipe-toggleNil rename to Utilities/_platform/2/templates/section-generated-pipe-toggleNil diff --git a/Utilities/platform/2/templates/service-core b/Utilities/_platform/2/templates/service-core similarity index 100% rename from Utilities/platform/2/templates/service-core rename to Utilities/_platform/2/templates/service-core diff --git a/Utilities/platform/2/templates/service-section b/Utilities/_platform/2/templates/service-section similarity index 100% rename from Utilities/platform/2/templates/service-section rename to Utilities/_platform/2/templates/service-section diff --git a/Utilities/platform/2/templates/service-section-generated b/Utilities/_platform/2/templates/service-section-generated similarity index 100% rename from Utilities/platform/2/templates/service-section-generated rename to Utilities/_platform/2/templates/service-section-generated diff --git a/Utilities/platform/2/templates/service-section-generated-action b/Utilities/_platform/2/templates/service-section-generated-action similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action rename to Utilities/_platform/2/templates/service-section-generated-action diff --git a/Utilities/platform/2/templates/service-section-generated-action-bus-model b/Utilities/_platform/2/templates/service-section-generated-action-bus-model similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-bus-model rename to Utilities/_platform/2/templates/service-section-generated-action-bus-model diff --git a/Utilities/platform/2/templates/service-section-generated-action-instant b/Utilities/_platform/2/templates/service-section-generated-action-instant similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-instant rename to Utilities/_platform/2/templates/service-section-generated-action-instant diff --git a/Utilities/platform/2/templates/service-section-generated-action-instant-delay b/Utilities/_platform/2/templates/service-section-generated-action-instant-delay similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-instant-delay rename to Utilities/_platform/2/templates/service-section-generated-action-instant-delay diff --git a/Utilities/platform/2/templates/service-section-generated-action-instant-model b/Utilities/_platform/2/templates/service-section-generated-action-instant-model similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-instant-model rename to Utilities/_platform/2/templates/service-section-generated-action-instant-model diff --git a/Utilities/platform/2/templates/service-section-generated-action-instant-relay b/Utilities/_platform/2/templates/service-section-generated-action-instant-relay similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-instant-relay rename to Utilities/_platform/2/templates/service-section-generated-action-instant-relay diff --git a/Utilities/platform/2/templates/service-section-generated-action-instant-shouldResetCore b/Utilities/_platform/2/templates/service-section-generated-action-instant-shouldResetCore similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-instant-shouldResetCore rename to Utilities/_platform/2/templates/service-section-generated-action-instant-shouldResetCore diff --git a/Utilities/platform/2/templates/service-section-generated-action-model b/Utilities/_platform/2/templates/service-section-generated-action-model similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-model rename to Utilities/_platform/2/templates/service-section-generated-action-model diff --git a/Utilities/platform/2/templates/service-section-generated-action-relay b/Utilities/_platform/2/templates/service-section-generated-action-relay similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-relay rename to Utilities/_platform/2/templates/service-section-generated-action-relay diff --git a/Utilities/platform/2/templates/service-section-generated-action-shouldResetCore b/Utilities/_platform/2/templates/service-section-generated-action-shouldResetCore similarity index 100% rename from Utilities/platform/2/templates/service-section-generated-action-shouldResetCore rename to Utilities/_platform/2/templates/service-section-generated-action-shouldResetCore diff --git a/Utilities/platform/2/templates/world-constructor b/Utilities/_platform/2/templates/world-constructor similarity index 100% rename from Utilities/platform/2/templates/world-constructor rename to Utilities/_platform/2/templates/world-constructor diff --git a/Utilities/platform/2/templates/world-field b/Utilities/_platform/2/templates/world-field similarity index 100% rename from Utilities/platform/2/templates/world-field rename to Utilities/_platform/2/templates/world-field diff --git a/Utilities/platform/2/templates/world-parameter b/Utilities/_platform/2/templates/world-parameter similarity index 100% rename from Utilities/platform/2/templates/world-parameter rename to Utilities/_platform/2/templates/world-parameter diff --git a/Utilities/platform/3/Mode.py b/Utilities/_platform/3/Mode.py similarity index 100% rename from Utilities/platform/3/Mode.py rename to Utilities/_platform/3/Mode.py diff --git a/Utilities/platform/3/Replace.py b/Utilities/_platform/3/Replace.py similarity index 100% rename from Utilities/platform/3/Replace.py rename to Utilities/_platform/3/Replace.py diff --git a/Utilities/platform/3/Result.py b/Utilities/_platform/3/Result.py similarity index 100% rename from Utilities/platform/3/Result.py rename to Utilities/_platform/3/Result.py diff --git a/Utilities/platform/3/Source.py b/Utilities/_platform/3/Source.py similarity index 100% rename from Utilities/platform/3/Source.py rename to Utilities/_platform/3/Source.py diff --git a/Utilities/platform/3/Structure.py b/Utilities/_platform/3/Structure.py similarity index 100% rename from Utilities/platform/3/Structure.py rename to Utilities/_platform/3/Structure.py diff --git a/Utilities/platform/3/generate b/Utilities/_platform/3/generate similarity index 100% rename from Utilities/platform/3/generate rename to Utilities/_platform/3/generate diff --git a/Utilities/platform/3/generateStructure.py b/Utilities/_platform/3/generateStructure.py similarity index 100% rename from Utilities/platform/3/generateStructure.py rename to Utilities/_platform/3/generateStructure.py diff --git a/Utilities/platform/3/parseLines.py b/Utilities/_platform/3/parseLines.py similarity index 100% rename from Utilities/platform/3/parseLines.py rename to Utilities/_platform/3/parseLines.py diff --git a/Utilities/platform/3/readKeyValue.py b/Utilities/_platform/3/readKeyValue.py similarity index 100% rename from Utilities/platform/3/readKeyValue.py rename to Utilities/_platform/3/readKeyValue.py diff --git a/Utilities/platform/3/readModuleSrc.py b/Utilities/_platform/3/readModuleSrc.py similarity index 100% rename from Utilities/platform/3/readModuleSrc.py rename to Utilities/_platform/3/readModuleSrc.py diff --git a/Utilities/platform/4/FeatureToggle.py b/Utilities/_platform/4/FeatureToggle.py similarity index 100% rename from Utilities/platform/4/FeatureToggle.py rename to Utilities/_platform/4/FeatureToggle.py diff --git a/Utilities/platform/4/Mode.py b/Utilities/_platform/4/Mode.py similarity index 100% rename from Utilities/platform/4/Mode.py rename to Utilities/_platform/4/Mode.py diff --git a/Utilities/platform/4/Structure.py b/Utilities/_platform/4/Structure.py similarity index 100% rename from Utilities/platform/4/Structure.py rename to Utilities/_platform/4/Structure.py diff --git a/Utilities/platform/4/generate b/Utilities/_platform/4/generate similarity index 100% rename from Utilities/platform/4/generate rename to Utilities/_platform/4/generate diff --git a/Utilities/platform/4/generateFeatureToggle.py b/Utilities/_platform/4/generateFeatureToggle.py similarity index 100% rename from Utilities/platform/4/generateFeatureToggle.py rename to Utilities/_platform/4/generateFeatureToggle.py diff --git a/Utilities/platform/4/parseLines.py b/Utilities/_platform/4/parseLines.py similarity index 100% rename from Utilities/platform/4/parseLines.py rename to Utilities/_platform/4/parseLines.py diff --git a/Utilities/platform/4/readKeyValue.py b/Utilities/_platform/4/readKeyValue.py similarity index 100% rename from Utilities/platform/4/readKeyValue.py rename to Utilities/_platform/4/readKeyValue.py diff --git a/Utilities/platform/Platfile b/Utilities/_platform/Platfile similarity index 100% rename from Utilities/platform/Platfile rename to Utilities/_platform/Platfile diff --git a/Utilities/platform/common/modulePaths.py b/Utilities/_platform/common/modulePaths.py similarity index 100% rename from Utilities/platform/common/modulePaths.py rename to Utilities/_platform/common/modulePaths.py diff --git a/Utilities/platform/common/readFile.py b/Utilities/_platform/common/readFile.py similarity index 100% rename from Utilities/platform/common/readFile.py rename to Utilities/_platform/common/readFile.py diff --git a/Utilities/_platform/generate-platform b/Utilities/_platform/generate-platform new file mode 100755 index 0000000..52dbb97 --- /dev/null +++ b/Utilities/_platform/generate-platform @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +import os +import sys +import subprocess +from argparse import ArgumentParser + +parser = ArgumentParser() +parser.add_argument('module', type=str, + help='the name of the module to generate') +parser.add_argument('-i', '--input', type=str, + help='The path and name of the input file') + +args, _ = parser.parse_known_args() +DIR = os.path.dirname(os.path.realpath(sys.argv[0])) + +# Импорт из общей для всех генераторов директории. +sys.path.append(f"{DIR}/common") +from modulePaths import * + + +(PATH, MODULE) = modulePaths(args.module) + +FILE_IN = args.input or f"{DIR}/../../Modules/{PATH}/{MODULE}.yml" + +# Запускаем указанную в файле YML версию генератора. +with open(FILE_IN) as file: + ln = file.readline().rstrip() + version = ln[-1] + cmd = f"{DIR}/{version}/generate" + subprocess.call(args=[cmd] + sys.argv[1:]) diff --git a/Utilities/platform/generate-platforms b/Utilities/_platform/generate-platforms similarity index 100% rename from Utilities/platform/generate-platforms rename to Utilities/_platform/generate-platforms diff --git a/Utilities/platform/2/generation b/Utilities/platform/2/generation new file mode 120000 index 0000000..2034343 --- /dev/null +++ b/Utilities/platform/2/generation @@ -0,0 +1 @@ +/Users/mk/m/u/Utilities/platform/2/generation \ No newline at end of file diff --git a/Utilities/platform/2/parsing b/Utilities/platform/2/parsing new file mode 120000 index 0000000..2a59eef --- /dev/null +++ b/Utilities/platform/2/parsing @@ -0,0 +1 @@ +/Users/mk/m/u/Utilities/platform/2/parsing \ No newline at end of file diff --git a/Utilities/platform/2/templates b/Utilities/platform/2/templates new file mode 120000 index 0000000..51398c3 --- /dev/null +++ b/Utilities/platform/2/templates @@ -0,0 +1 @@ +/Users/mk/m/u/Utilities/platform/2/templates \ No newline at end of file diff --git a/Utilities/platform/common b/Utilities/platform/common new file mode 120000 index 0000000..73c7ae5 --- /dev/null +++ b/Utilities/platform/common @@ -0,0 +1 @@ +/Users/mk/m/u/Utilities/platform/common \ No newline at end of file