You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "stevedlawrence (via GitHub)" <gi...@apache.org> on 2024/01/23 18:12:18 UTC
[PR] Add setting to enable flattened directory layout [daffodil-sbt]
stevedlawrence opened a new pull request, #12:
URL: https://github.com/apache/daffodil-sbt/pull/12
- Add new "daffodilFlatLayout" setting--if true the plugin configures SBT so project files are in root "src/" or "test/" directories, and sources vs. resources is determined by file extension.
- Scripted uses a file called "test" for scripted commands, but this conflicts with the "test/" directory if daffodilFlatLayout is true. Fortunately, scripted supports "test.script" as an alternative, so scripted "test" files are renamed to this.
Closes #8
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add setting to enable flattened directory layout [daffodil-sbt]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on code in PR #12:
URL: https://github.com/apache/daffodil-sbt/pull/12#discussion_r1465204913
##########
src/sbt-test/sbt-daffodil/flat-layout-01/build.sbt:
##########
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+version := "0.1"
+
+name := "test"
+
+organization := "com.example"
Review Comment:
Also note that `com.example` is good namespace for tests since they are reserved and should avoid issues if accidentally used outside of these tests:
https://www.iana.org/help/example-domains
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add setting to enable flattened directory layout [daffodil-sbt]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on code in PR #12:
URL: https://github.com/apache/daffodil-sbt/pull/12#discussion_r1465160553
##########
src/sbt-test/sbt-daffodil/flat-layout-01/build.sbt:
##########
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+version := "0.1"
+
+name := "test"
+
+organization := "com.example"
Review Comment:
These are just for the scripted tests. We could use something else, but it doesn't really matter what the value is for the tests to work.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add setting to enable flattened directory layout [daffodil-sbt]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence merged PR #12:
URL: https://github.com/apache/daffodil-sbt/pull/12
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add setting to enable flattened directory layout [daffodil-sbt]
Posted by "mbeckerle (via GitHub)" <gi...@apache.org>.
mbeckerle commented on code in PR #12:
URL: https://github.com/apache/daffodil-sbt/pull/12#discussion_r1463944639
##########
README.md:
##########
@@ -94,6 +94,22 @@ If used, one may want to use the first value of this setting to configure
daffodilVersion := daffodilPackageBinVersions.value.head
```
+## Flat Directory Layout
+
+Instead of using the standard `src/{main,test}/{scala,resources}/` directory
+layout that SBT default to, a flatter layout can be used for simple schemas,
Review Comment:
defaults (plural)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add setting to enable flattened directory layout [daffodil-sbt]
Posted by "tuxji (via GitHub)" <gi...@apache.org>.
tuxji commented on code in PR #12:
URL: https://github.com/apache/daffodil-sbt/pull/12#discussion_r1465138835
##########
src/sbt-test/sbt-daffodil/flat-layout-01/build.sbt:
##########
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+version := "0.1"
+
+name := "test"
+
+organization := "com.example"
Review Comment:
Are these values for version, name, and organization appropriate to use?
##########
src/sbt-test/sbt-daffodil/flat-layout-01/test/test.scala:
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package com.example
+
+import org.junit.Test
+import org.apache.daffodil.tdml.Runner
+import org.junit.AfterClass
+
+object TestExample {
+ lazy val runner = Runner("/", "test.tdml")
+
+ @AfterClass def shutdown: Unit = { runner.reset }
+}
+
+class TestExample {
+ import TestExample._
+
+ @Test def test_test01() { runner.runOneTest("test01") }
+}
Review Comment:
I remember the wish list for the sbt-daffodil plugin includes making these Scala files unnecessary (as long as IDEs are given some way to debug individual tests through sbt). I think that feature would be very helpful :-).
An idea might be to automatically generate this kind of file in a `test-managed` directory during `sbt compile` (or `sbt Test/compile` or `sbt test`). Then we still can open this kind of Scala file in our IDEs to debug individual tests within the debugger, but our responsibility for creating and updating these files is handed over to the sbt plugin.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add setting to enable flattened directory layout [daffodil-sbt]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on code in PR #12:
URL: https://github.com/apache/daffodil-sbt/pull/12#discussion_r1465173149
##########
src/sbt-test/sbt-daffodil/flat-layout-01/test/test.scala:
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package com.example
+
+import org.junit.Test
+import org.apache.daffodil.tdml.Runner
+import org.junit.AfterClass
+
+object TestExample {
+ lazy val runner = Runner("/", "test.tdml")
+
+ @AfterClass def shutdown: Unit = { runner.reset }
+}
+
+class TestExample {
+ import TestExample._
+
+ @Test def test_test01() { runner.runOneTest("test01") }
+}
Review Comment:
> I think that feature would be very helpful :-).
Agreed. I'll open a ticket for that.
A code generator is a good option.
Another possibility, which I think Mike discovered, was to do something like this:
```scala
@Test def test_test01(): Unit = doTest(runner)
```
And the `doTest` function looks at the stack to figure out the function that called it, strips off the "test_" prefix and calls `runner.runOneTest` passing in the name. It still requires managing scala file, but it's a bit less verbose.
I wonder if now that IDE's have much better SBT support, if creating a SBT Test Interface for TDML would just magically give IDE's the capabilities we expect out of IDEs (e.g. list of tests, ability to right-click a location in a TDML file to run a test). Might be another option.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org