Skip to content

Commit

Permalink
Fix Format Violations
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyk02 committed Jun 26, 2024
1 parent 1d45280 commit 220a3ac
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 39 deletions.
52 changes: 26 additions & 26 deletions core/src/main/java/org/lflang/generator/python/PythonGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -560,36 +560,36 @@ protected void additionalPostProcessingForModes() {
}

private static String setUpMainTarget(
boolean hasMain, String executableName, Stream<String> cSources) {
boolean hasMain, String executableName, Stream<String> 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 <pyModuleName>)
find_package(Python <pyVersion> 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 <pyModuleName>)
find_package(Python <pyVersion> 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=<pyModuleName>)
""")
.replace("<pyModuleName>", generatePythonModuleName(executableName))
.replace("<pyVersion>", 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=<pyModuleName>)
""")
.replace("<pyModuleName>", generatePythonModuleName(executableName))
.replace("<pyVersion>", pyVersion);
// The use of fileConfig.name will break federated execution, but that's fine
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/lflang/target/Target.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
}
}

0 comments on commit 220a3ac

Please sign in to comment.