From 220a3ac25ba64c9e1c2fdca9068029d093a00c08 Mon Sep 17 00:00:00 2001 From: jackyk02 Date: Wed, 26 Jun 2024 00:05:32 -0700 Subject: [PATCH] Fix Format Violations --- .../generator/python/PythonGenerator.java | 52 +++++++++---------- .../main/java/org/lflang/target/Target.java | 2 +- .../property/PythonVersionProperty.java | 22 ++++---- 3 files changed, 37 insertions(+), 39 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/python/PythonGenerator.java b/core/src/main/java/org/lflang/generator/python/PythonGenerator.java index 20a8ef52cf..aadd9ed75e 100644 --- a/core/src/main/java/org/lflang/generator/python/PythonGenerator.java +++ b/core/src/main/java/org/lflang/generator/python/PythonGenerator.java @@ -560,36 +560,36 @@ protected void additionalPostProcessingForModes() { } private static String setUpMainTarget( - boolean hasMain, String executableName, Stream cSources) { + boolean hasMain, String executableName, Stream cSources) { String pyVersion = pythonVersion.isEmpty() ? "3.10.0...<3.11.0" : pythonVersion + " EXACT"; return (""" - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - add_compile_definitions(_PYTHON_TARGET_ENABLED) - add_subdirectory(core) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}) - set(LF_MAIN_TARGET ) - find_package(Python REQUIRED COMPONENTS Interpreter Development) - Python_add_library( - ${LF_MAIN_TARGET} - MODULE - """ + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + add_compile_definitions(_PYTHON_TARGET_ENABLED) + add_subdirectory(core) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}) + set(LF_MAIN_TARGET ) + find_package(Python REQUIRED COMPONENTS Interpreter Development) + Python_add_library( + ${LF_MAIN_TARGET} + MODULE + """ + cSources.collect(Collectors.joining("\n ", " ", "\n")) + """ - ) - if (MSVC) - set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}) - set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}) - set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}) - set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_SOURCE_DIR}) - set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_SOURCE_DIR}) - endif (MSVC) - set_target_properties(${LF_MAIN_TARGET} PROPERTIES PREFIX "") - include_directories(${Python_INCLUDE_DIRS}) - target_link_libraries(${LF_MAIN_TARGET} PRIVATE ${Python_LIBRARIES}) - target_compile_definitions(${LF_MAIN_TARGET} PUBLIC MODULE_NAME=) - """) - .replace("", generatePythonModuleName(executableName)) - .replace("", pyVersion); +) +if (MSVC) + set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}) + set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}) + set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}) + set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_SOURCE_DIR}) + set_target_properties(${LF_MAIN_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_SOURCE_DIR}) +endif (MSVC) +set_target_properties(${LF_MAIN_TARGET} PROPERTIES PREFIX "") +include_directories(${Python_INCLUDE_DIRS}) +target_link_libraries(${LF_MAIN_TARGET} PRIVATE ${Python_LIBRARIES}) +target_compile_definitions(${LF_MAIN_TARGET} PUBLIC MODULE_NAME=) +""") + .replace("", generatePythonModuleName(executableName)) + .replace("", pyVersion); // The use of fileConfig.name will break federated execution, but that's fine } diff --git a/core/src/main/java/org/lflang/target/Target.java b/core/src/main/java/org/lflang/target/Target.java index 08974b7411..da52237f62 100644 --- a/core/src/main/java/org/lflang/target/Target.java +++ b/core/src/main/java/org/lflang/target/Target.java @@ -49,6 +49,7 @@ import org.lflang.target.property.PlatformProperty; import org.lflang.target.property.PrintStatisticsProperty; import org.lflang.target.property.ProtobufsProperty; +import org.lflang.target.property.PythonVersionProperty; import org.lflang.target.property.Ros2DependenciesProperty; import org.lflang.target.property.Ros2Property; import org.lflang.target.property.RuntimeVersionProperty; @@ -60,7 +61,6 @@ import org.lflang.target.property.TracingProperty; import org.lflang.target.property.VerifyProperty; import org.lflang.target.property.WorkersProperty; -import org.lflang.target.property.PythonVersionProperty; /** * Enumeration of targets and their associated properties. diff --git a/core/src/main/java/org/lflang/target/property/PythonVersionProperty.java b/core/src/main/java/org/lflang/target/property/PythonVersionProperty.java index 05ee718acd..1f8c63443c 100644 --- a/core/src/main/java/org/lflang/target/property/PythonVersionProperty.java +++ b/core/src/main/java/org/lflang/target/property/PythonVersionProperty.java @@ -1,19 +1,17 @@ package org.lflang.target.property; -/** - * Directive for specifying a specific version of the reactor runtime library. - */ +/** Directive for specifying a specific version of the reactor runtime library. */ public final class PythonVersionProperty extends StringProperty { - /** Singleton target property instance. */ - public static final PythonVersionProperty INSTANCE = new PythonVersionProperty(); + /** Singleton target property instance. */ + public static final PythonVersionProperty INSTANCE = new PythonVersionProperty(); - private PythonVersionProperty() { - super(); - } + private PythonVersionProperty() { + super(); + } - @Override - public String name() { - return "python-version"; - } + @Override + public String name() { + return "python-version"; + } }