Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
</modules>

<profiles>
<profile>
<id>tools</id>
<modules>
<module>tools</module>
</modules>
</profile>
<profile>
<id>codecoverage</id>
<activation>
Expand Down
36 changes: 36 additions & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Property code generator

The optional Maven `tools` profile builds the property generator, its Eclipse
UI handler, and the generator's JUnit tests. All sources use Java 21. Normal root
builds do not include these bundles.

To build and test only the tools reactor, run from the repository root after
installing the OSATE dependencies:

```sh
mvn -o -T5 -s releng/osate.releng/settings.xml -f tools/pom.xml -Plocal,tools \
-Dtycho.localArtifacts=default -Dpr.build=true -Dsign=false \
-Dspotbugs=false -Dcodecoverage=false -Djavadoc=false \
clean verify
```

Use `verify` to execute the Tycho tests. The 26 exact-output tests also compile
their generated Java, including imported property sets, using the JDK compiler
with `--release 21`. They continue to compare imports, indentation, and final
newlines. Generated Java uses `var` for obvious local types, pattern matching,
expression lambdas, and `Optional.isEmpty()`. Blank lines contain no spaces or
tabs. List extraction uses `Stream.toList()`, so returned lists are unmodifiable,
including nested lists and lists extracted from constants and record fields.

Six additional tests load the freshly compiled classes and exercise scalar
getters, constant and property references, missing values, defaults, modes,
nested lists and rejection of list mutations, ranges, imported enums and units, and nested
record round-tripping. These tests use the validated AADL project in
`org.osate.propertiescodegen.tests/models/generatedjava/`.

A JDK with the Java compiler is required. Compilation failures include compiler
diagnostics, and temporary source/class files and class loaders are cleaned up
after each test.

Test reports are written to
`org.osate.propertiescodegen.tests/target/surefire-reports/`.
5 changes: 0 additions & 5 deletions tools/org.osate.propertiescodegen.tests/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,5 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="xtend-gen">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions tools/org.osate.propertiescodegen.tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/bin/
/.tycho-consumer-pom.xml
6 changes: 0 additions & 6 deletions tools/org.osate.propertiescodegen.tests/.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
Expand All @@ -29,6 +24,5 @@
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
12 changes: 6 additions & 6 deletions tools/org.osate.propertiescodegen.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Bundle-SymbolicName: org.osate.propertiescodegen.tests
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.osate.propertiescodegen.tests
Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: com.google.guava,
org.eclipse.xtext.xbase.lib,
org.eclipse.xtend.lib,
org.eclipse.xtend.lib.macro,
org.osate.propertiescodegen;bundle-version="1.0.0",
Require-Bundle: org.osate.propertiescodegen;bundle-version="1.0.0",
org.osate.testsupport;bundle-version="1.0.0",
org.osate.aadl2;bundle-version="1.0.0"
org.osate.aadl2;bundle-version="1.0.0",
org.osate.aadl2.modelsupport,
org.osate.pluginsupport,
org.eclipse.core.runtime
Import-Package: javax.tools
Export-Package: org.osate.propertiescodegen.tests
Bundle-Vendor: CMU/SEI
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.aadlbin-gen/
/instances/
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>generatedjava</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.osate.core.aadlnature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- Copyright (c) 2004-2026 Carnegie Mellon University and others. (see Contributors file).
-- All Rights Reserved.
--
-- NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
-- KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
-- OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
-- MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
--
-- This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0
-- which is available at https://www.eclipse.org/legal/epl-2.0/
-- SPDX-License-Identifier: EPL-2.0
--
-- Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
--
-- This program includes and/or can make use of certain third party source code, object code, documentation and other
-- files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
-- configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
-- conditions contained in any such Third Party Software or separate license file distributed with such Third Party
-- Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party beneficiaries
-- to this license with respect to the terms applicable to their Third Party Software. Third Party Software licenses
-- only apply to the Third Party Software and not any other portion of this program or this program as a whole.

-- @codegen-package generated.runtime.types
property set External_Types is
Time_Units: type units (ms, sec => ms * 1000);
Choice: type enumeration (red, green);
end External_Types;
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
-- Copyright (c) 2004-2026 Carnegie Mellon University and others. (see Contributors file).
-- All Rights Reserved.
--
-- NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
-- KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
-- OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
-- MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
--
-- This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0
-- which is available at https://www.eclipse.org/legal/epl-2.0/
-- SPDX-License-Identifier: EPL-2.0
--
-- Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
--
-- This program includes and/or can make use of certain third party source code, object code, documentation and other
-- files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
-- configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
-- conditions contained in any such Third Party Software or separate license file distributed with such Third Party
-- Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party beneficiaries
-- to this license with respect to the terms applicable to their Third Party Software. Third Party Software licenses
-- only apply to the Third Party Software and not any other portion of this program or this program as a whole.

package Generated_Runtime
public
with Runtime_Properties;

system Populated
properties
Runtime_Properties::Enabled => true;
Runtime_Properties::Count => Runtime_Properties::Alias_Constant;
Runtime_Properties::Count_Alias => Runtime_Properties::Count;
Runtime_Properties::Ratio => 1.5;
Runtime_Properties::Label => "hello";
Runtime_Properties::Matrix => ((1, 2), (), (3, 4));
Runtime_Properties::Duration => 2 sec;
Runtime_Properties::Selection => green;
Runtime_Properties::Bounds => 1 .. 9 delta 2;
Runtime_Properties::Settings => [
enabled => true;
retries => 3;
labels => ("a", "b");
kind => green;
nested => [amount => 8;];
];
end Populated;

system implementation Populated.i
modes
low: initial mode;
high: mode;
properties
Runtime_Properties::Mode_Count => 10 in modes (low), 20 in modes (high);
end Populated.i;

system Empty
end Empty;
end Generated_Runtime;
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-- Copyright (c) 2004-2026 Carnegie Mellon University and others. (see Contributors file).
-- All Rights Reserved.
--
-- NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
-- KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
-- OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
-- MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
--
-- This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0
-- which is available at https://www.eclipse.org/legal/epl-2.0/
-- SPDX-License-Identifier: EPL-2.0
--
-- Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
--
-- This program includes and/or can make use of certain third party source code, object code, documentation and other
-- files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
-- configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
-- conditions contained in any such Third Party Software or separate license file distributed with such Third Party
-- Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party beneficiaries
-- to this license with respect to the terms applicable to their Third Party Software. Third Party Software licenses
-- only apply to the Third Party Software and not any other portion of this program or this program as a whole.

-- @codegen-package generated.runtime
property set Runtime_Properties is
with External_Types;

Base: constant aadlinteger => 41;
Alias_Constant: constant aadlinteger => Runtime_Properties::Base;
Matrix_Constant: constant list of list of aadlinteger => ((5, 6), ());
Enabled: aadlboolean applies to (all);
Count: aadlinteger applies to (all);
Count_Alias: aadlinteger applies to (all);
Default_Count: aadlinteger => 7 applies to (all);
Thread_Only: aadlboolean applies to (thread);
Ratio: aadlreal applies to (all);
Label: aadlstring applies to (all);
Matrix: list of list of aadlinteger applies to (all);
Mode_Count: aadlinteger applies to (all);
Duration: aadlinteger units External_Types::Time_Units applies to (all);
Selection: External_Types::Choice applies to (all);
Bounds: range of aadlinteger applies to (all);
Settings_Type: type record (
enabled: aadlboolean;
retries: aadlinteger;
labels: list of aadlstring;
kind: External_Types::Choice;
nested: record (amount: aadlinteger;);
);
Settings: Runtime_Properties::Settings_Type applies to (all);
Settings_Constant: constant Runtime_Properties::Settings_Type => [enabled => false; retries => 2;];
end Runtime_Properties;
18 changes: 18 additions & 0 deletions tools/org.osate.propertiescodegen.tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.osate</groupId>
<artifactId>tools.parent</artifactId>
<version>2.20.0-SNAPSHOT</version>
</parent>

<groupId>org.osate</groupId>
<artifactId>org.osate.propertiescodegen.tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

</project>
Loading