Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge update of native code handling #218

Merged
merged 18 commits into from
Feb 28, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 40 additions & 0 deletions .github/workflows/subflow-native.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Native Code

on:
workflow_call:


jobs:
build:
runs-on: macos-latest

steps:
- name: Install GMP
run: brew install gmp

- name: Check out code
uses: actions/checkout@v2

- name: Run Shell Script
run: |
export HOMEBREW_NO_INSTALL_CLEANUP=true
brew install docker
colima start
./gradlew --parallel compileJava
make -C org.alloytools.pardinus.native/satsolvers install
colima stop

- name: Commit and Push Changes
run: |
git config user.name github-actions
git config user.email github-actions@galloytools.org

- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Native code update request"
title: "Native code update"
delete-branch: true
branch: native-code
base: master
13 changes: 13 additions & 0 deletions .github/workflows/trigger-master-native.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Native Code on master branch

on:
push:
branches:
- master
paths:
- 'org.alloytools.solvers.natv/satsolvers/**'

jobs:
call-native:
uses: ./.github/workflows/subflow-native.yaml
secrets: inherit
11 changes: 11 additions & 0 deletions .github/workflows/trigger-native.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Native code branch changed

on:
push:
branches:
- native

jobs:
call-native:
uses: ./.github/workflows/subflow-native.yaml
secrets: inherit
3 changes: 0 additions & 3 deletions cnf/central.mvn
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ com.google.code.gson:gson:2.8.9
commons-io:commons-io:jar:2.6
commons-io:commons-io:jar:2.6
de.jflex:jflex:1.6.1
org.alloytools:pardinus.core:1.3.0
org.alloytools:pardinus.nativesat:1.3.0
org.eclipse.equinox:org.eclipse.equinox.common:jar:3.6.0
org.eclipse.equinox:org.eclipse.equinox.common:jar:3.6.0
org.eclipse.jdt:org.eclipse.jdt.annotation:2.1.100
Expand All @@ -20,7 +18,6 @@ org.sat4j:org.sat4j.maxsat:2.3.1
org.sat4j:org.sat4j.pb:2.3.1
org.slf4j:slf4j-api:1.7.28
org.slf4j:slf4j-simple:1.7.5
org.alloytools:pardinus.core:1.3.0
org.alloytools:pardinus.nativesat:1.3.0
biz.aQute:biz.aQute.wrapper.hamcrest:1.3
biz.aQute:biz.aQute.wrapper.junit:4.13.1
Expand Down
4 changes: 2 additions & 2 deletions org.alloytools.alloy.application/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

-buildpath: \
lib/apple-osx-ui.jar;version=file,\
org.alloytools:pardinus.core;version='1.3.0',\
org.alloytools.alloy.core;version=latest,\
aQute.libg,\
org.alloytools.api
org.alloytools.api,\
org.alloytools.pardinus.core
-testpath: \
biz.aQute.wrapper.junit, \
biz.aQute.wrapper.hamcrest, \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
import edu.mit.csail.sdg.alloy4.OurBorder;
import edu.mit.csail.sdg.alloy4.OurUtil;
import edu.mit.csail.sdg.alloy4.OurUtil.GridBagConstraintsBuilder;
import edu.mit.csail.sdg.translator.A4Options.SatSolver;
import kodkod.engine.satlab.SATFactory;

/**
* @modified [electrum] only log when debugging; load electrod binary
Expand Down Expand Up @@ -194,7 +194,8 @@ public int getExtent() {
}

@Override
public void setValueIsAdjusting(boolean b) {}
public void setValueIsAdjusting(boolean b) {
}

@Override
public boolean getValueIsAdjusting() {
Expand Down Expand Up @@ -254,26 +255,14 @@ public Component getListCellRendererComponent(JList list, Object value, int inde
public PreferencesDialog(SwingLogPanel log, String binary) {
this.log = log;
if (log != null && binary != null) {
List<SatSolver> solvers = testSolvers();
Solver.setChoices(solvers, SatSolver.SAT4J);
List<SATFactory> solvers = SATFactory.getSolvers();
Solver.setChoices(solvers, SATFactory.DEFAULT);
log.log("Available solvers on " + System.getProperty("os.name") + ":" + System.getProperty("os.arch") + "\n");
solvers.forEach(s -> log.log(s.toString() + "\n"));
}
initUI();
}

protected List<SatSolver> testSolvers() {
List<SatSolver> satChoices = SatSolver.values();
satChoices.removeIf(solver -> !solver.present());

SatSolver now = Solver.get();
if (!satChoices.contains(now)) {
Solver.set(SatSolver.SAT4J);
}

return satChoices;
}



protected final void initUI() {
Expand Down Expand Up @@ -321,7 +310,7 @@ protected Component initSolverPane() {

@Override
public void stateChanged(ChangeEvent e) {
boolean enableCore = Solver.get() == SatSolver.MiniSatProverJNI;
boolean enableCore = Solver.get().prover();
pref2comp.get(CoreGranularity).setEnabled(enableCore);
pref2comp.get(CoreMinimization).setEnabled(enableCore);
}
Expand Down Expand Up @@ -451,7 +440,8 @@ private void updatePref() {
String val = jtf.getText();
try {
pref.set(Integer.parseInt(val));
} catch (NumberFormatException ex) {}
} catch (NumberFormatException ex) {
}
}
});
return OurUtil.makeH(pref.title + ": ", jtf);
Expand Down
Loading
Loading