import { Configuration } from "@atomist/automation-client" ; import { anySatisfied , metadata , PushImpact , ToDefaultBranch , } from "@atomist/sdm" ; import { configure , DeliveryGoals , isInLocalMode , } from "@atomist/sdm-core" ; import { aspectSupport , DefaultVirtualProjectFinder , } from "@atomist/sdm-pack-aspect" ; import { sdmConfigClientFactory } from "@atomist/sdm-pack-aspect/lib/analysis/offline/persist/pgClientFactory" ; import { PostgresProjectAnalysisResultStore } from "@atomist/sdm-pack-aspect/lib/analysis/offline/persist/PostgresProjectAnalysisResultStore" ; import { storeFingerprints , storeFingerprintsFor , } from "@atomist/sdm-pack-aspect/lib/aspect/delivery/storeFingerprintsPublisher" ; import { Build } from "@atomist/sdm-pack-build" ; import { VirtualProjectFinder } from "@atomist/sdm-pack-fingerprint" ; import { IsMaven , mavenBuilder , MavenDefaultOptions , } from "@atomist/sdm-pack-spring" ; import { aspects } from "./lib/aspect/aspects" ; import * as commonCommitRiskScorers from "./lib/aspect/push/commonCommitRiskScorers" ; import { addSuggestedFingerprintCommand } from "./lib/aspect/push/suggestTag" ; import { scorers } from "./lib/scorer/scorers" ; import { combinationTaggers , taggers , } from "./lib/tagger/taggers" ; import { startEmbeddedPostgres } from "./lib/util/postgres" ; const virtualProjectFinder = DefaultVirtualProjectFinder ; interface TestGoals extends DeliveryGoals { build : Build ; pushImpact : PushImpact ; } export const configuration = configure < TestGoals > ( async ( sdm ) => { const pushImpact = new PushImpact ( ) ; const build = new Build ( ) . with ( { ... MavenDefaultOptions , builder : mavenBuilder ( ) , } ) ; const store = new PostgresProjectAnalysisResultStore ( sdmConfigClientFactory ( sdm . configuration ) ) ; sdm . addCommand ( addSuggestedFingerprintCommand ( isInLocalMode ( ) ? storeFingerprintsFor ( store ) : undefined ) ) ; sdm . addExtensionPacks ( aspectSupport ( { aspects : aspects ( ) , scorers : { all : scorers ( ) , commitRisk : [ commonCommitRiskScorers . fileChangeCount ( { limitTo : 2 } ) , commonCommitRiskScorers . pomChanged ( ) , ] , } , taggers : taggers ( { } ) . concat ( combinationTaggers ( { } ) ) , goals : { pushImpact , build , } , virtualProjectFinder , publishFingerprints : isInLocalMode ( ) ? storeFingerprints ( store ) : undefined , instanceMetadata : metadata ( ) , } ) ) ; return { fingerprint : { test : ToDefaultBranch , goals : pushImpact , } , build : { test : anySatisfied ( IsMaven ) , goals : build , } , } ; } , { name : "Org Visualizer" , preProcessors : [ startEmbeddedPostgres ] , } ) ;