Skip to content

Commit

Permalink
Merge pull request #1235 from lf-lang/lfc-to-cli
Browse files Browse the repository at this point in the history
Rename org.lflang.lfc to org.lflang.cli
  • Loading branch information
lhstrh authored Jun 16, 2022
2 parents 90a4c97 + c7937fb commit 3c314c6
Show file tree
Hide file tree
Showing 30 changed files with 29 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/package_lfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ set -euo pipefail
./gradlew clean buildLfc

# find the version number
jar_path="org.lflang.lfc/build/libs/org.lflang.lfc-*-all.jar"
version="$(ls ${jar_path} | xargs -n 1 basename | sed 's/^org.lflang.lfc-\(.*\)-all.jar$/\1/')"
jar_path="org.lflang.cli/build/libs/org.lflang.cli-*-lfc.jar"
version="$(ls ${jar_path} | xargs -n 1 basename | sed 's/^org.lflang.cli-\(.*\)-lfc.jar$/\1/')"

# use a different naming convention for nightly build artifacts
if [[ "$#" > 0 && "$1" = "nightly" ]]; then
Expand All @@ -22,7 +22,7 @@ mkdir -p "${outname}/lib/scripts"
mkdir -p "${outname}/lib/jars"

# move the jar
mv org.lflang.lfc/build/libs/org.lflang.lfc-*-all.jar "${outname}/lib/jars"
mv org.lflang.cli/build/libs/org.lflang.cli-*-lfc.jar "${outname}/lib/jars"

# copy the Bash scripts
cp -a lib/scripts "${outname}/lib/"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ jobs:
needs: cancel

# Run tests for the standalone compiler.
# TODO: Change this back to master branch once merged!
cli-tests:
uses: lf-lang/lingua-franca/.github/workflows/cli-tests.yml@master
uses: lf-lang/lingua-franca/.github/workflows/cli-tests.yml@lfc-to-cli
needs: cancel

# Run the C benchmark tests.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cli-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
submodules: true
- name: Prepare build environment
uses: ./.github/actions/prepare-build-env
- name: Run standalone lfc tests
- name: Run standalone cli tests
run: |
./gradlew :org.lflang.lfc:test --stacktrace
./gradlew :org.lflang.cli:test --stacktrace
- name: Test Bash scripts (Linux or macOS only)
run: |
.github/scripts/test-lfc.sh
Expand Down
6 changes: 3 additions & 3 deletions bin/lfc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
$base="$PSScriptRoot\.."
$java_home = "$Env:JAVA_HOME"
$java_cmd = "$java_home\bin\java.exe"
$jarpath_dev="$base\org.lflang.lfc\build\libs\org.lflang.lfc-*-all.jar"
$jarpath_release="$base\lib\jars\org.lflang.lfc-*-all.jar"
$jarpath_dev="$base\org.lflang.cli\build\libs\org.lflang.cli-*-lfc.jar"
$jarpath_release="$base\lib\jars\org.lflang.cli-*-lfc.jar"

function Test-Dev {
Test-Path "$base\org.lflang.lfc" -PathType container
Test-Path "$base\org.lflang.cli" -PathType container
}

function Get-JarPath {
Expand Down
6 changes: 3 additions & 3 deletions lib/scripts/include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ set -euo pipefail
# Paths (relative to ${base}), which is assumed to have been set.
src_pkg_name="org.lflang"
src_pkg_path="${base}/${src_pkg_name}"
lfc_src_pkg_name="${src_pkg_name}.lfc"
lfc_src_pkg_name="${src_pkg_name}.cli"
lfc_src_pkg_path="${base}/${lfc_src_pkg_name}"
lfc_jar_build_path_pattern="${lfc_src_pkg_name}/build/libs/${lfc_src_pkg_name}-*-all.jar"
lfc_jar_release_path_pattern="lib/jars/${lfc_src_pkg_name}-*-all.jar"
lfc_jar_build_path_pattern="${lfc_src_pkg_name}/build/libs/${lfc_src_pkg_name}-*-lfc.jar"
lfc_jar_release_path_pattern="lib/jars/${lfc_src_pkg_name}-*-lfc.jar"

# Enter directory silently (without printing).
pushd() {
Expand Down
5 changes: 3 additions & 2 deletions org.lflang.lfc/build.gradle → org.lflang.cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ apply plugin: 'com.github.johnrengelman.shadow'
task buildLfc() {
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = 'org.lflang.lfc.Main'
mainClassName = 'org.lflang.cli.Lfc'

shadowJar {
archiveClassifier.set('lfc')
exclude 'test/*'
minimize() {
exclude(dependency('log4j:log4j:.*'))
Expand All @@ -57,6 +58,6 @@ task runLfc(type: JavaExec) {
description = "Build and run lfc, use --args to pass arguments"
group = "application"
classpath = sourceSets.main.runtimeClasspath
mainClass = 'org.lflang.lfc.Main'
mainClass = 'org.lflang.cli.Lfc'
workingDir = '..'
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* generated by Xtext 2.23.0
*/

package org.lflang.lfc;
package org.lflang.cli;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Stand-alone version of the Lingua Franca compiler (lfc).
*/

package org.lflang.lfc;
package org.lflang.cli;

import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -49,7 +49,7 @@
* @author {Marten Lohstroh <[email protected]>}
* @author {Christian Menard <[email protected]>}
*/
public class Main {
public class Lfc {

/// current lfc version as printed by --version
private static final String VERSION = "0.2.2-SNAPSHOT";
Expand Down Expand Up @@ -189,7 +189,7 @@ public static void main(final String[] args) {
final Injector injector = new LFStandaloneSetup(new LFRuntimeModule(), new LFStandaloneModule(reporter))
.createInjectorAndDoEMFRegistration();
// Main instance.
final Main main = injector.getInstance(Main.class);
final Lfc main = injector.getInstance(Lfc.class);
// Apache Commons Options object configured to according to available CLI arguments.
Options options = CLIOption.getOptions();
// CLI arguments parser.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.lflang.lfc
package org.lflang.cli

import com.google.inject.Inject
import com.google.inject.Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
***************/

package org.lflang.lfc;
package org.lflang.cli;

import java.nio.file.Path;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.lflang.lfc;
package org.lflang.cli;

import java.io.IOException;
import java.nio.file.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.lflang.lfc.tests
package org.lflang.cli.tests

import junit.framework.Assert.assertEquals
import junit.framework.AssertionFailedError
import org.junit.Test
import org.lflang.LFRuntimeModule
import org.lflang.LFStandaloneSetup
import org.lflang.lfc.*
import org.lflang.cli.*
import java.io.*
import java.nio.charset.StandardCharsets
import java.nio.file.Files
Expand All @@ -45,7 +45,7 @@ class SpyPrintStream {
}


class LfIssueReportingTest {
class LfcIssueReportingTest {
/*
Note: when executing these tests in Intellij, I get the following error:
Expand Down Expand Up @@ -115,7 +115,7 @@ class LfIssueReportingTest {
val backend = ReportingBackend(Io(err = stderr.ps), AnsiColors(useColors), 2)
val injector = LFStandaloneSetup(LFRuntimeModule(), LFStandaloneModule(backend))
.createInjectorAndDoEMFRegistration()
val main = injector.getInstance(Main::class.java)
val main = injector.getInstance(Lfc::class.java)

val packageName = loader.packageName.replace('.', '/')
// relative to root of gradle project
Expand Down
2 changes: 1 addition & 1 deletion org.lflang/src/org/lflang/generator/IntegratedBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public GeneratorResult run(
CancelIndicator cancelIndicator
) {
// FIXME: A refactoring of the following line is needed. This refactor will affect FileConfig and
// org.lflang.lfc.Main. The issue is that there is duplicated code.
// org.lflang.cli.Lfc. The issue is that there is duplicated code.
fileAccess.setOutputPath(
FileConfig.findPackageRoot(Path.of(uri.path()), s -> {}).resolve(FileConfig.DEFAULT_SRC_GEN_DIR).toString()
);
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include 'org.lflang'
include 'org.lflang.lfc'
include 'org.lflang.cli'
include 'org.lflang.tests'

0 comments on commit 3c314c6

Please sign in to comment.