Skip to content

Commit

Permalink
Merge pull request #64 from aml-org/release/4.7.0
Browse files Browse the repository at this point in the history
Publish 4.7.0 - vocabulary 7.0.0 and transform 1.7.0
  • Loading branch information
AgustinBettati authored Feb 9, 2021
2 parents 035dc00 + d8ef8e1 commit 671e053
Show file tree
Hide file tree
Showing 59 changed files with 663 additions and 230 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,6 @@ project/boot/
project/plugins/project/
.history
.cache
.lib/
.lib/
# Ignore Gradle build output directory
build
52 changes: 43 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,64 @@ pipeline {
}
environment {
NEXUS = credentials('exchange-nexus')
NEXUSIQ = credentials('nexus-iq')
GITHUB_ORG = 'aml-org'
GITHUB_REPO = 'amf-metadata'
}
stages {
stage('Exporters Test') {
stage('Test') {
steps {
script {
try{
sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean exporters/test'
sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean coverage test coverageReport'
} catch (ignored) {
failedStage = failedStage + " TEST "
unstable "Failed tests"
}
}
}
}
stage('Transform Test') {
stage('SonarQube Analysis') {
when {
anyOf {
branch 'master'
branch 'develop'
}
}
steps {
script {
try{
sh 'sbt -mem 4096 -Dfile.encoding=UTF-8 clean transform/test'
} catch (ignored) {
failedStage = failedStage + " TEST "
unstable "Failed tests"
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-official', passwordVariable: 'SONAR_SERVER_TOKEN', usernameVariable: 'SONAR_SERVER_URL']]) {
script {
try {
if (failedStage.isEmpty()) {
sh 'sbt -Dsonar.host.url=${SONAR_SERVER_URL} sonarScan'
}
} catch (ignored) {
failedStage = failedStage + " COVERAGE "
unstable "Failed coverage"
}
}
}
}
}
}
stage('Nexus IQ') {
when {
anyOf {
branch 'develop'
}
}
steps {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
script {
try{
if (failedStage.isEmpty()){
sh './gradlew nexusIq'
}
} catch(ignored) {
failedStage = failedStage + " NEXUSIQ "
unstable "Failed Nexus IQ"
}
}
}
}
Expand Down
51 changes: 51 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
name "mule-ee-releases"
url "https://repository.mulesoft.org/nexus/content/repositories/releases/"
}
maven { url "https://jitpack.io" }
}
dependencies {
classpath "com.mulesoft:gradle-tools:0.2.6"
classpath files('lib/nexus-iq-cli-1.68.0-01.jar')
}
}

apply plugin: 'com.mulesoft.gradle.nexusIq'
apply plugin: 'application'
apply plugin: 'distribution'
apply plugin: 'java'

repositories {
mavenCentral()
maven {
url "https://repository-master.mulesoft.org/nexus/content/repositories/snapshots"
}
maven {
url "https://repository-master.mulesoft.org/nexus/content/repositories/releases"
}
maven { url 'https://jitpack.io' }
}

def name = 'amf-metadata'

nexusIq.user = "${System.env.NEXUSIQ_USR}"
nexusIq.password = "${System.env.NEXUSIQ_PSW}"
nexusIq.applicationId = "${name}"

def versions = new Properties()
file("versions.yaml").withInputStream {
stream -> versions.load(stream)
}

dependencies {
compile "com.github.amlorg:amf-transform_2.12:${versions.'amf.transform'}"
}

tasks.nexusIq.dependsOn(distZip)
34 changes: 28 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ name := "amf-metadata"
organization in ThisBuild := "com.github.amlorg"
scalaVersion in ThisBuild := "2.12.11"

lazy val amfVocabularyVersion = majorVersionOrSnapshot(6)
val amfCanonicalVersion = versionOrSnapshot(1, 6)
val artifactVersions = new {
val vocabularyVersion = versions("versions.yaml")("amf.vocabulary")
val transformVersion = versions("versions.yaml")("amf.transform")
}

val ivyLocal = Resolver.file("ivy", file(Path.userHome.absolutePath + "/.ivy2/local"))(Resolver.ivyStylePatterns)

Expand Down Expand Up @@ -33,8 +35,8 @@ lazy val vocabulary = project
.settings(
commonSettings,
name := "amf-vocabulary",
version := amfVocabularyVersion
)
version := artifactVersions.vocabularyVersion
).disablePlugins(SonarPlugin)

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Canonical ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -44,10 +46,11 @@ lazy val transform = project
.settings(
commonSettings,
name := "amf-transform",
version := amfCanonicalVersion,
version := artifactVersions.transformVersion,
libraryDependencies ++= commonDependencies
)
.sourceDependency(amfClientRef, amfClientLibJVM)
.disablePlugins(SonarPlugin)

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Exporters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -59,6 +62,7 @@ lazy val exporters = project
libraryDependencies ++= commonDependencies
)
.sourceDependency(amfClientRef, amfClientLibJVM)
.disablePlugins(SonarPlugin)

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Common ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -85,6 +89,24 @@ def majorVersionOrSnapshot(major: Int) = {
}

def versionOrSnapshot(major: Int, minor: Int) = {
lazy val branch = sys.env.get("BRANCH_NAME")
if (branch.contains("master")) s"$major.$minor.0" else s"$major.${minor + 1}.0-SNAPSHOT"
}

lazy val sonarUrl = sys.env.getOrElse("SONAR_SERVER_URL", "Not found url.")
lazy val sonarToken = sys.env.getOrElse("SONAR_SERVER_TOKEN", "Not found token.")
lazy val branch = sys.env.getOrElse("BRANCH_NAME", "develop")

//enablePlugins(ScalaJSBundlerPlugin)

sonarProperties ++= Map(
"sonar.login" -> sonarToken,
"sonar.projectKey" -> "mulesoft.amf-metadata",
"sonar.projectName" -> "AMF-Metadata",
"sonar.projectVersion" -> artifactVersions.transformVersion,
"sonar.sourceEncoding" -> "UTF-8",
"sonar.github.repository" -> "mulesoft/amf-metadata",
"sonar.branch.name" -> branch,
"sonar.scala.coverage.reportPaths" -> "transform/target/scala-2.12/scoverage-report/scoverage.xml,exporters/target/scala-2.12/scoverage-report/scoverage.xml",
"sonar.sources" -> "transform/src/main/scala,exporters/src/main/scala",
"sonar.tests" -> "transform/src/test/scala,exporters/src/test/scala"
)
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,17 @@ class CanonicalWebAPISpecDialectExporter(logger: Logger = ConsoleLogger) {
| - OpenIDSettings
""".stripMargin

val abstractDeclarationUnion: String =
"""
| AbstractDeclarationUnion:
| typeDiscriminatorName: elementType
| typeDiscriminator:
| Trait: Trait
| ResourceType: ResourceType
| union:
| - Trait
| - ResourceType""".stripMargin

val abstractDeclarationsRange: String =
""" - ResourceType
| - Trait
Expand Down Expand Up @@ -523,6 +534,9 @@ class CanonicalWebAPISpecDialectExporter(logger: Logger = ConsoleLogger) {
// domain element union
stringBuilder.append(domainElementUnion + "\n")

// abstract declaration union
stringBuilder.append(abstractDeclarationUnion + "\n")

// Parsed unit union
stringBuilder.append(parsedUnitUnion + "\n")

Expand Down Expand Up @@ -603,8 +617,7 @@ class CanonicalWebAPISpecDialectExporter(logger: Logger = ConsoleLogger) {
} else if (propertyMapping.range == "Settings") {
stringBuilder.append(s" range: $settingsUnionDeclaration\n")
} else if (propertyMapping.range == "AbstractDeclaration") {
stringBuilder.append(s" range:\n")
stringBuilder.append(abstractDeclarationsRange ++ "\n")
stringBuilder.append(s" range: AbstractDeclarationUnion\n")
} else if (propertyMapping.range == "DomainElement") {
stringBuilder.append(s" range: $domainElementUnionDeclaration\n")
} else if (propertyMapping.range == "BaseUnit") {
Expand Down Expand Up @@ -687,9 +700,9 @@ class CanonicalWebAPISpecDialectExporter(logger: Logger = ConsoleLogger) {
}

def compact(url: String): (String, String, String) = {
val compacted = Namespace.compact(url).replace(":", ".")
val compacted = Namespace.staticAliases.compact(url).replace(":", ".")
val prefix = compacted.split("\\.").head
val base = Namespace.ns(prefix).base
val base = Namespace.staticAliases.ns(prefix).base
(compacted, prefix, base)
}

Expand Down
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 671e053

Please sign in to comment.