Skip to content

Commit

Permalink
[Feature:Autograding] Add Salsa image (#49)
Browse files Browse the repository at this point in the history
### Please check if the PR fulfills these requirements:

* [x] Tests for the changes have been added/updated (if possible)
* [x] Documentation has been updated/added if relevant

### What is the current behavior?
<!-- List issue if it fixes/closes/implements one using the "Fixes
#<number>" or "Closes #<number>" syntax -->
none

### What is the new behavior?
we can now run salsa files

### Other information?
<!-- Is this a breaking change? -->
<!-- How did you test -->
this is not a breaking change and I tested it using some simple files (I
included an example below):

```salsa
module demo;

/*
   Actors with this behavior simply create a migrate actor with the specified UAN and first UAL    
   and then migrate to the second UAL.
*/
behavior Migrate {

   void print() {

      standardOutput<-println( "Migrate actor just migrated here." );
   }

   void act( String[] args ) {

         if (args.length != 3) {
                 standardOutput<-println( "Usage: java migration.Migrate  <UAN> <srcUAL> <destUAL> " );

                 return;
        }

        UAN uan = new UAN(args[0]);
        UAL ual = new UAL(args[1]);
        
        Migrate  migrateActor = new Migrate() at (uan, ual);
      
        migrateActor<-print() @ 
        migrateActor<-migrate( args[2] ) @ 
        migrateActor<-print(); 
         
   }     
    
}   
```
  • Loading branch information
ION606 authored Oct 11, 2024
1 parent b22a0ef commit be77488
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
34 changes: 34 additions & 0 deletions dockerfiles/salsa/1.1.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ubuntu:22.04

# DO NOT EXPOSE ANY PORTS IN THIS FILE

# Install necessary packages (Java and curl)
RUN apt-get update \
&& apt-get install -y openjdk-17-jdk curl --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app

RUN mkdir -p /usr/local/lib/salsa
ENV SALSA_JAR_SHA256=821fe5ec2922ff32f09fa55280afd023aa9852c7cc074f90cd086a4691e327af

# Download the Salsa compiler jar file
RUN curl -SL -o /usr/local/lib/salsa/salsa1.1.6.jar http://wcl.cs.rpi.edu/salsa/releases/salsa1.1.6.jar \
&& echo "$SALSA_JAR_SHA256 /usr/local/lib/salsa/salsa1.1.6.jar" | sha256sum -c -

RUN apt-get remove curl -y && apt autoremove -y && apt clean -y

# Set environment variable for the Salsa compiler jar location
ENV SALSA_COMPILER_JAR=/usr/local/lib/salsa/salsa1.1.6.jar
ENV SALSAOPTS=""

# Write aliases to a separate file
RUN echo "alias salsac='java -cp $SALSA_COMPILER_JAR:. salsac.SalsaCompiler *.salsa; javac -classpath $SALSA_COMPILER_JAR:. *.java'" >> /usr/src/app/salsa_aliases.sh && \
echo "alias salsa='java -cp $SALSA_COMPILER_JAR:. $SALSAOPTS'" >> /usr/src/app/salsa_aliases.sh && \
echo "alias wwcns='java -cp $SALSA_COMPILER_JAR:. wwc.naming.WWCNamingServer'" >> /usr/src/app/salsa_aliases.sh && \
echo "alias wwctheater='java -cp $SALSA_COMPILER_JAR:. $SALSAOPTS wwc.messaging.Theater'" >> /usr/src/app/salsa_aliases.sh

# make sure the aliases script gets sourced on container start
RUN echo "source /usr/src/app/salsa_aliases.sh" >> /etc/bash.bashrc

CMD ["bash"]
3 changes: 3 additions & 0 deletions dockerfiles/salsa/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pushLatest": false
}

0 comments on commit be77488

Please sign in to comment.