Some more gradle debugging...
This commit is contained in:
parent
1835cbcabe
commit
5e315c55da
18
.idea/compiler.xml
generated
18
.idea/compiler.xml
generated
@ -11,5 +11,23 @@
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
</wildcardResourcePatterns>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="OpenRocket" target="17" />
|
||||
<module name="OpenRocket.core" target="17" />
|
||||
<module name="OpenRocket.core.main" target="17" />
|
||||
<module name="OpenRocket.core.test" target="17" />
|
||||
<module name="OpenRocket.info.openrocket.core" target="17" />
|
||||
<module name="OpenRocket.info.openrocket.core.main" target="17" />
|
||||
<module name="OpenRocket.info.openrocket.core.test" target="17" />
|
||||
<module name="OpenRocket.info.openrocket.swing" target="17" />
|
||||
<module name="OpenRocket.info.openrocket.swing.main" target="17" />
|
||||
<module name="OpenRocket.info.openrocket.swing.test" target="17" />
|
||||
<module name="OpenRocket.info.openrocket.swing.testFixtures" target="17" />
|
||||
<module name="OpenRocket.main" target="17" />
|
||||
<module name="OpenRocket.swing" target="17" />
|
||||
<module name="OpenRocket.swing.main" target="17" />
|
||||
<module name="OpenRocket.swing.test" target="17" />
|
||||
<module name="OpenRocket.test" target="17" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
14
build.gradle
14
build.gradle
@ -61,8 +61,6 @@ subprojects {
|
||||
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
|
||||
testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '2.2'
|
||||
testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.2'
|
||||
//testImplementation group: 'org.hamcrest', name: 'hamcrest-internal', version: '2.2'
|
||||
//testImplementation group: 'org.hamcrest', name: 'hamcrest-xml', version: '2.2'
|
||||
testImplementation group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.10.2'
|
||||
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.10.2'
|
||||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0'
|
||||
@ -72,11 +70,6 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':core')
|
||||
implementation project(':swing')
|
||||
}
|
||||
|
||||
//tasks.register('serializeEngines') {
|
||||
// dependsOn ':core:serializeEngines'
|
||||
//}
|
||||
@ -92,6 +85,11 @@ jar {
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":core"))
|
||||
implementation(project(":swing"))
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveBaseName.set('OpenRocket')
|
||||
archiveClassifier.set(null)
|
||||
@ -101,7 +99,7 @@ shadowJar {
|
||||
|
||||
// Packages the application for distribution.
|
||||
tasks.register('dist') {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
dependsOn 'shadowJar'
|
||||
doLast {
|
||||
println "Completed the deployable jar in './build/libs"
|
||||
|
@ -46,11 +46,10 @@ dependencies {
|
||||
implementation group: 'org.graalvm.sdk', name: 'graal-sdk', version: '23.0.3'
|
||||
implementation group: 'org.graalvm.js', name: 'js-scriptengine', version: '23.0.3'
|
||||
implementation group: 'org.graalvm.js', name: 'js', version: '23.0.3'
|
||||
//implementation group: 'javax.script', name: 'script-api', version: '1.0-osgi'
|
||||
implementation group: 'org.graalvm.truffle', name: 'truffle-api', version: '23.0.3'
|
||||
implementation group: 'com.ibm.icu', name: 'icu4j', version: '71.1' // 72.1
|
||||
implementation group: 'com.sun.istack', name: 'istack-commons-tools', version: '4.1.1' // TODO: Should be gotten rid of?
|
||||
implementation group: 'com.sun.istack', name: 'istack-commons-runtime', version: '4.1.1' // TODO: Should be gotten rid of?
|
||||
//implementation group: 'com.sun.istack', name: 'istack-commons-tools', version: '4.1.1' // TODO: Should be gotten rid of?
|
||||
//implementation group: 'com.sun.istack', name: 'istack-commons-runtime', version: '4.1.1' // TODO: Should be gotten rid of?
|
||||
implementation group: 'io.github.classgraph', name: 'classgraph', version: '4.8.165'
|
||||
|
||||
implementation 'de.javagl:obj:0.4.0'
|
||||
@ -67,17 +66,17 @@ def serializedEnginesPath = './src/main/resources/datafiles/thrustcurves/thrustc
|
||||
def serializedEnginesPathDist = './build/resources/main/datafiles/thrustcurves/thrustcurves.ser'
|
||||
// Executes the serialization of engines from ThrustCurve for a build.
|
||||
tasks.register('serializeEngines') {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
dependsOn serializeEnginesDelete
|
||||
dependsOn serializeEnginesExecute
|
||||
}
|
||||
tasks.register('serializeEnginesDist') {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
dependsOn serializeEnginesExecuteDist
|
||||
}
|
||||
// Deletes the serialize engine file if it exists.
|
||||
tasks.register('serializeEnginesDelete', Delete) {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
delete fileTree(serializedEnginesPath)
|
||||
|
||||
doFirst {
|
||||
@ -89,7 +88,7 @@ tasks.register('serializeEnginesDelete', Delete) {
|
||||
}
|
||||
// Executes the Java serialization program to fetch ThrustCurve rocket data and serialize it.
|
||||
tasks.register('serializeEnginesExecute', JavaExec) {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
dependsOn serializeEnginesDelete
|
||||
workingDir new File(projectDir, 'build/tmp')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
@ -108,7 +107,7 @@ tasks.register('serializeEnginesExecute', JavaExec) {
|
||||
// TODO: Shouldn't need a seperate task, but the args are not changing when dynamically updating
|
||||
// the variable.
|
||||
tasks.register('serializeEnginesExecuteDist', JavaExec) {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
dependsOn serializeEnginesDelete
|
||||
workingDir new File(projectDir, 'build/tmp')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
@ -124,7 +123,7 @@ tasks.register('serializeEnginesExecuteDist', JavaExec) {
|
||||
}
|
||||
// Validates that the serialize engines file exists.
|
||||
tasks.register('serializeEnginesValidate') {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
if (!project.file(serializedEnginesPath).exists()) {
|
||||
def message = "The serialized engine file does not exist at the following location:\n${project.file(serializedEnginesPath)}.\n" +
|
||||
"You will need to run the following from the command line in order to generate the serialized engine file:\n"
|
||||
@ -149,25 +148,3 @@ tasks.register('copyReadmeMain', Copy) {
|
||||
|
||||
processResources.dependsOn([copyReadmeMain])
|
||||
//processResources.dependsOn([serializeEnginesValidate])
|
||||
|
||||
// https://docs.gradle.org/7.4/userguide/cross_project_publications.html
|
||||
tasks.register('testCoreArtifactsJar', Jar) {
|
||||
archiveClassifier.set("tests")
|
||||
from sourceSets.test.output
|
||||
exclude "**/META-INF", "**/pix", "**/arch", "**/communication", "**/database", "**/file", "**/l10n", "**/models", "**/motor", "**/optimization", "**/plugin", "**/preset", "**/rocketcomponent", "**/simulation", "**/startup", "**/unit"
|
||||
include "**/ServicesForTesting.class", "**/util/BaseTestCase.class"
|
||||
}
|
||||
|
||||
// https://docs.gradle.org/7.4/userguide/cross_project_publications.html
|
||||
configurations {
|
||||
testArtifacts {
|
||||
canBeConsumed = true
|
||||
canBeResolved = false
|
||||
extendsFrom testImplementation
|
||||
}
|
||||
}
|
||||
|
||||
// https://docs.gradle.org/7.4/userguide/cross_project_publications.html
|
||||
artifacts {
|
||||
testArtifacts(testCoreArtifactsJar)
|
||||
}
|
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
open module openrocket.core {
|
||||
open module info.openrocket.core {
|
||||
uses javax.script.ScriptEngineFactory;
|
||||
uses javax.script.ScriptEngine;
|
||||
uses javax.script.Bindings;
|
||||
|
@ -343,7 +343,7 @@ public class DisableStageTest extends BaseTestCase {
|
||||
Assertions.fail("Simulation failed: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static double calculateDelta(double value, double delta) {
|
||||
return Double.isNaN(value) ? 0 : value * delta;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ pluginManagement {
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2"
|
||||
}
|
||||
}
|
||||
rootProject.name = 'OpenRocket'
|
||||
rootProject.name = 'info.openrocket'
|
||||
|
||||
include 'core'
|
||||
include 'swing'
|
||||
include ':core'
|
||||
include ':swing'
|
||||
|
@ -11,8 +11,6 @@ java {
|
||||
modularity.inferModulePath = false
|
||||
}
|
||||
|
||||
jar { from('resources') { include 'META-INF/services/*.*' } }
|
||||
|
||||
Properties props = new Properties()
|
||||
try {
|
||||
props.load(file('../core/src/main/resources/build.properties').newDataInputStream())
|
||||
@ -93,7 +91,6 @@ dependencies {
|
||||
|
||||
// implementation 'com.github.oshi:oshi-core:6.4.4'
|
||||
|
||||
implementation group: 'com.yuvimasory', name: 'orange-extensions', version: '1.3.0'
|
||||
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.5.0'
|
||||
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.0'
|
||||
implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
|
||||
@ -101,17 +98,13 @@ dependencies {
|
||||
implementation group: 'org.jogamp.gluegen', name: 'gluegen-rt-main', version:'2.5.0'
|
||||
implementation group: 'org.jogamp.jogl', name: 'jogl-all-main', version: '2.5.0'
|
||||
|
||||
// TODO: Including output from coreotherwise NoClassDefFound issue with BaseTestCase
|
||||
// The Cross Project Publications should work, but not seeming too.
|
||||
testImplementation project(':core').sourceSets.test.output
|
||||
testImplementation project (path: ':core', configuration: 'testArtifacts')
|
||||
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
|
||||
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.0'
|
||||
}
|
||||
|
||||
def externalComponentsPath = './src/main/resources/datafiles/components'
|
||||
// Copies the external components to the Swing resource folder.
|
||||
tasks.register('externalComponentsCopy', Copy) {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
dependsOn 'externalComponentsValidate'
|
||||
// gradle always performs up-to-date check which causes copying be skipped.
|
||||
from('./resources-src/datafiles/components-openrocket') {
|
||||
@ -127,13 +120,13 @@ tasks.register('externalComponentsCopy', Copy) {
|
||||
}
|
||||
// Deletes the external components resource folder.
|
||||
tasks.register('externalComponentsDelete', Delete) {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
delete fileTree(externalComponentsPath)
|
||||
}
|
||||
// Validates the external components resource folder. If it is a Git project, then
|
||||
// calls the submodule updates to fetch the latest submodules.
|
||||
tasks.register('externalComponentsValidate') {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
def externalResourceComponents = './resources-src/datafiles/components-dbcook/orc';
|
||||
def git = '../.git';
|
||||
if (!project.file(externalResourceComponents).exists()) {
|
||||
@ -164,7 +157,7 @@ tasks.register('externalComponentsValidate') {
|
||||
|
||||
// Initializes the submodules in Git.
|
||||
tasks.register('submoduleInit') {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
doLast {
|
||||
exec {
|
||||
workingDir "../"
|
||||
@ -176,7 +169,7 @@ tasks.register('submoduleInit') {
|
||||
}
|
||||
// Updates the initialized submodules in Git.
|
||||
tasks.register('subModuleUpdate') {
|
||||
group = 'openrocket'
|
||||
group = 'info.openrocket'
|
||||
dependsOn 'submoduleInit'
|
||||
doLast {
|
||||
exec {
|
||||
|
@ -1,5 +1,5 @@
|
||||
open module openrocket.swing {
|
||||
requires transitive openrocket.core;
|
||||
open module info.openrocket.swing {
|
||||
requires transitive info.openrocket.core;
|
||||
|
||||
uses javax.script.ScriptEngineFactory;
|
||||
uses javax.script.ScriptEngine;
|
||||
|
@ -0,0 +1,184 @@
|
||||
package info.openrocket.swing;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provider;
|
||||
import info.openrocket.core.formatting.RocketDescriptor;
|
||||
import info.openrocket.core.formatting.RocketDescriptorImpl;
|
||||
import info.openrocket.core.l10n.DebugTranslator;
|
||||
import info.openrocket.core.l10n.ResourceBundleTranslator;
|
||||
import info.openrocket.core.l10n.Translator;
|
||||
import info.openrocket.core.material.Material;
|
||||
import info.openrocket.core.preset.ComponentPreset;
|
||||
import info.openrocket.core.preset.ComponentPreset.Type;
|
||||
import info.openrocket.core.startup.Preferences;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.prefs.BackingStoreException;
|
||||
|
||||
public class ServicesForTesting extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(Preferences.class).to(PreferencesForTesting.class);
|
||||
bind(Translator.class).toProvider(TranslatorProviderForTesting.class);
|
||||
bind(RocketDescriptor.class).to(RocketDescriptorImpl.class);
|
||||
}
|
||||
|
||||
public static class TranslatorProviderForTesting implements Provider<Translator> {
|
||||
|
||||
private final AtomicReference<Translator> translator = new AtomicReference<Translator>();
|
||||
|
||||
@Override
|
||||
public Translator get() {
|
||||
|
||||
Translator oldTranslator = translator.get();
|
||||
|
||||
if (oldTranslator != null) {
|
||||
return oldTranslator;
|
||||
}
|
||||
|
||||
Locale.setDefault(Locale.US);
|
||||
|
||||
// Setup the translator
|
||||
Translator newTranslator;
|
||||
newTranslator = new ResourceBundleTranslator("l10n.messages");
|
||||
if (Locale.getDefault().getLanguage().equals("xx")) {
|
||||
newTranslator = new DebugTranslator(newTranslator);
|
||||
}
|
||||
|
||||
if (translator.compareAndSet(null, newTranslator)) {
|
||||
return newTranslator;
|
||||
} else {
|
||||
return translator.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class PreferencesForTesting extends Preferences {
|
||||
|
||||
private static java.util.prefs.Preferences root = null;
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(String key, boolean defaultValue) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putBoolean(String key, boolean value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(String key, int defaultValue) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putInt(String key, int value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDouble(String key, double defaultValue) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putDouble(String key, double value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String key, String defaultValue) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putString(String key, String value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String directory, String key, String defaultValue) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putString(String directory, String key, String value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUserMaterial(Material m) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Material> getUserMaterials() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUserMaterial(Material m) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComponentFavorite(ComponentPreset preset, Type type, boolean favorite) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getComponentFavorites(Type type) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.prefs.Preferences getNode(String nodeName) {
|
||||
return getBaseNode().node(nodeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.prefs.Preferences getPreferences() {
|
||||
return getBaseNode();
|
||||
}
|
||||
|
||||
private java.util.prefs.Preferences getBaseNode() {
|
||||
if (root == null) {
|
||||
final String name = "OpenRocket-unittest-" + System.currentTimeMillis();
|
||||
root = java.util.prefs.Preferences.userRoot().node(name);
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
root.removeNode();
|
||||
} catch (BackingStoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ import info.openrocket.core.rocketcomponent.BodyTube;
|
||||
import info.openrocket.core.rocketcomponent.CenteringRing;
|
||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||
import info.openrocket.core.rocketcomponent.position.AxialMethod;
|
||||
import info.openrocket.core.util.BaseTestCase;
|
||||
import info.openrocket.swing.util.BaseTestCase;
|
||||
|
||||
public class FinSetConfigTest extends BaseTestCase {
|
||||
|
||||
|
@ -5,8 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import java.util.List;
|
||||
|
||||
import info.openrocket.core.logging.Markers;
|
||||
import info.openrocket.core.util.BaseTestCase;
|
||||
import org.junit.Ignore;
|
||||
import info.openrocket.swing.util.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
package info.openrocket.swing.util;
|
||||
|
||||
import info.openrocket.swing.ServicesForTesting;
|
||||
import info.openrocket.core.l10n.DebugTranslator;
|
||||
import info.openrocket.core.l10n.Translator;
|
||||
import info.openrocket.core.plugin.PluginModule;
|
||||
import info.openrocket.core.startup.Application;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.util.Modules;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
public class BaseTestCase {
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
Module applicationModule = new ServicesForTesting();
|
||||
Module debugTranslator = new AbstractModule() {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(Translator.class).toInstance(new DebugTranslator(null));
|
||||
}
|
||||
|
||||
};
|
||||
Module pluginModule = new PluginModule();
|
||||
Injector injector = Guice.createInjector(Modules.override(applicationModule).with(debugTranslator),
|
||||
pluginModule);
|
||||
Application.setInjector(injector);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user