From 9c380cb36695832c5825aa3d2b563d8bd06d6b29 Mon Sep 17 00:00:00 2001 From: Steve Lawrence Date: Thu, 25 Apr 2024 10:03:18 -0400 Subject: [PATCH] Update to use Daffodil SBT plugin Also changes the default to be namespaced, non-namespaced should only be used for testing or examples --- build.sbt | 4 ++-- project/build.properties | 2 +- src/main/g8/build.sbt | 28 ++++------------------------ src/main/g8/default.properties | 4 ++-- src/main/g8/project/build.properties | 2 +- src/main/g8/project/plugins.sbt | 17 +++++++++++++++++ 6 files changed, 27 insertions(+), 30 deletions(-) create mode 100644 src/main/g8/project/plugins.sbt diff --git a/build.sbt b/build.sbt index c042d41..29c02ec 100644 --- a/build.sbt +++ b/build.sbt @@ -17,8 +17,8 @@ lazy val root = (project in file(".")) .enablePlugins(ScriptedPlugin) .settings( name := "daffodil-schema.g8", - scalaVersion := "2.12.15", - crossScalaVersions := Seq("2.12.15"), + scalaVersion := "2.12.19", + crossScalaVersions := Seq("2.12.19"), Test / test := { val _ = (Test / g8Test).toTask("").value }, diff --git a/project/build.properties b/project/build.properties index e7ff87f..36f0e34 100644 --- a/project/build.properties +++ b/project/build.properties @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -sbt.version=1.6.2 +sbt.version=1.9.9 diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt index 32dd11c..3777bdc 100644 --- a/src/main/g8/build.sbt +++ b/src/main/g8/build.sbt @@ -20,29 +20,9 @@ organization := "$package$" version := "0.1.0-SNAPSHOT" -scalaVersion := "2.12.15" +scalaVersion := "2.12.19" -libraryDependencies ++= Seq( - "com.github.sbt" % "junit-interface" % "0.13.2" % "test", - "junit" % "junit" % "4.13.2" % "test", - "org.apache.daffodil" %% "daffodil-tdml-processor" % "$daffodil_version$" % "test", - "org.apache.logging.log4j" % "log4j-core" % "2.17.1" % "test", -) +// for details about DaffodilPlugin settings, see https://github.com/apache/daffodil-sbt +enablePlugins(DaffodilPlugin) -testOptions += Tests.Argument(TestFrameworks.JUnit, "-v") - -crossPaths := false - -$if(!namespaced.truthy)$ -// Use flat folder structure. This means *.java and *.scala files are in the -// same directory as resources files, and source/resource files are only -// differentiated by their file extension. -Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src") -Compile / unmanagedResourceDirectories := Seq(baseDirectory.value / "src") -Compile / unmanagedSources / includeFilter := "*.java" | "*.scala" -Compile / unmanagedResources / excludeFilter := "*.java" | "*.scala" -Test / unmanagedSourceDirectories := Seq(baseDirectory.value / "test") -Test / unmanagedResourceDirectories := Seq(baseDirectory.value / "test") -Test / unmanagedSources / includeFilter := "*.java" | "*.scala" -Test / unmanagedResources / excludeFilter := "*.java" | "*.scala" -$endif$ +$if(!namespaced.truthy)$daffodilFlatLayout := true$endif$ diff --git a/src/main/g8/default.properties b/src/main/g8/default.properties index 002ef3f..efc329e 100644 --- a/src/main/g8/default.properties +++ b/src/main/g8/default.properties @@ -16,5 +16,5 @@ name=format extension=dat package=com.example -namespaced=no -daffodil_version=maven(org.apache.daffodil, daffodil-tdml-processor_2.12) +namespaced=yes +daffodil_plugin_version=maven(org.apache.daffodil, sbt-daffodil) diff --git a/src/main/g8/project/build.properties b/src/main/g8/project/build.properties index f00b8c9..c3f8670 100644 --- a/src/main/g8/project/build.properties +++ b/src/main/g8/project/build.properties @@ -14,4 +14,4 @@ $! # See the License for the specific language governing permissions and # limitations under the License. !$ -sbt.version=1.6.2 +sbt.version=1.9.9 diff --git a/src/main/g8/project/plugins.sbt b/src/main/g8/project/plugins.sbt new file mode 100644 index 0000000..e61f357 --- /dev/null +++ b/src/main/g8/project/plugins.sbt @@ -0,0 +1,17 @@ +$! +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +!$ +addSbtPlugin("org.apache.daffodil" % "sbt-daffodil" % "$daffodil_plugin_version$")