mike-mcgann commented on code in PR #919: URL: https://github.com/apache/daffodil/pull/919#discussion_r1092215573
########## scripts/refactor/rename-dirs.sh: ########## @@ -0,0 +1,152 @@ +#!/bin/bash -ex + +# 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. + +cd "$(dirname $0)/../.." +SRC_ROOT=src/main/scala/org/apache/daffodil +TEST_ROOT=src/test/scala/org/apache/daffodil + +function move { + local source_dir=$1 + local target_dir=$2 + local tmp=/tmp/daffodil-refactor + + rm -rf $tmp + mkdir $tmp + mv $source_dir/* $tmp + rmdir $source_dir + mkdir -p $target_dir + mv $tmp/* $target_dir + rm -rf $tmp +} + +function rename { + local lib_name=$1 + local target_dir=$2 + local source_suffix=$3 + ( + cd $lib_name + move $SRC_ROOT/$source_suffix $SRC_ROOT/$target_dir + + if [ -e $TEST_ROOT/$source_suffix ]; then + move $TEST_ROOT/$source_suffix $TEST_ROOT/$target_dir + fi + ) +} + +rename daffodil-cli cli +rename daffodil-core core +rename daffodil-lib lib +rename daffodil-macro-lib lib +rename daffodil-runtime1 runtime1 +rename daffodil-runtime1-layers layers/runtime1 layers +rename daffodil-runtime1-unparser unparsers/runtime1 processors/unparsers +rename daffodil-tdml-processor processor/tdml tdml/processor + +mv daffodil-io/src/main/scala/org/apache/daffodil/processors \ + daffodil-io/src/main/scala/org/apache/daffodil/io +mv daffodil-cli/src/test/scala/org/apache/daffodil/cli/CLI/* \ + daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest +rmdir daffodil-cli/src/test/scala/org/apache/daffodil/cli/CLI +mv daffodil-cli/src/test/resources/org/apache/daffodil/CLI \ + daffodil-cli/src/test/resources/org/apache/daffodil/cli +find daffodil-cli/src/test/scala -name "*.scala" -exec sed -i "s_/CLI/_/cli/_g" {} \; +sed -i "s_/CLI/_/cli/_g" project/Rat.scala + +mkdir -p daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tak +mv daffodil-tdml-lib/src/main/scala/org/apache/daffodil/Tak.scala \ + daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tak/Tak.scala +sed -i 's/package org.apache.daffodil/package org.apache.daffodil.tak/' daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tak/Tak.scala + +sed -i 's/package org.apache.daffodil.tdml/package org.apache.daffodil.processor.tdml/' daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/*.scala +mv daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/*.scala daffodil-tdml-processor/src/main/scala/org/apache/daffodil/processor/tdml +rmdir daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml + +rmdir daffodil-runtime1-unparser/$SRC_ROOT/processors + +move daffodil-tdml-processor/src/test/scala/org/apache/daffodil/tdml \ + daffodil-tdml-processor/src/test/scala/org/apache/daffodil/processor/tdml +sed -i 's/package org.apache.daffodil.tdml/package org.apache.daffodil.processor.tdml/' \ + daffodil-tdml-processor/src/test/scala/org/apache/daffodil/processor/tdml/* +move daffodil-tdml-processor/src/test/java/org/apache/daffodil/tdml \ + daffodil-tdml-processor/src/test/java/org/apache/daffodil/processor/tdml Review Comment: There was a similar discussion about package names towards the top of the thread. In a video call with Mike B., he said that we should just use what we have for now and package names can easily be refactored later. The key for these scripts is to do the heavy lifting that is too tedious with the IDE. Once the refactoring is close enough, the IDE can be used for any final polish. We can either keep these awkward names for now and rename them later or we can do it now but I'll need consensus on what the new package names should be. I'm not familiar with the code and cannot provide any suggestions on what are good names here. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
