Compiling from Source: Difference between revisions
Update Linux / Mac instructions to be more consistent about fetching updates from the remote repository. |
|||
Line 6: | Line 6: | ||
The good news is that the IDE setup is a lot easier. The bad news is you'll need to take some steps to build anything. In addition, we are discussing changing to a newer required JDK, so even these instructions will not be permanent. | The good news is that the IDE setup is a lot easier. The bad news is you'll need to take some steps to build anything. In addition, we are discussing changing to a newer required JDK, so even these instructions will not be permanent. | ||
To contribute to the Mafia project, you'll need to be able to install the Java Development Kit, connect to the | To contribute to the Mafia project, you'll need to be able to install the Java Development Kit, connect to the git repository, and be comfortable writing Java Code. Instructions for the first two are included below: | ||
==Windows== | ==Windows== | ||
Line 32: | Line 32: | ||
Do once: | Do once: | ||
# Install git - you probably already have this. If not, follow [https://www.atlassian.com/git/tutorials/install-git#linux this guide.] | # Install git - you probably already have this. If not, follow [https://www.atlassian.com/git/tutorials/install-git#linux this guide.] | ||
# Get an appropriate JDK. | # Get an appropriate JDK. If your package manager does not contain a sufficiently up-to-date version of Java, the safest and easiest way to do this is with [https://adoptium.net/installation.html#x64_linux-jdk Adoptium]. | ||
# Clone the repo: | # Clone the repo: | ||
## If you have a github account:<syntaxhighlight lang="bash"> | ## If you have a github account:<syntaxhighlight lang="bash"> | ||
Line 39: | Line 39: | ||
Do every session: | Do every session: | ||
Set up your environment to use that JDK you just downloaded<pre> export PATH="/where/you/put/that/jdk/bin:${PATH}"</pre> | # Set up your environment to use that JDK you just downloaded<pre> export PATH="/where/you/put/that/jdk/bin:${PATH}"</pre> (Optionally, put this in your ''.profile'' or ''.bashrc'' if you want to set and forget.) | ||
# Navigate to your cloned repository: <pre>cd /where/you/cloned/kolmafia</pre> | |||
# Get new updates with <pre>git pull</pre> If you have local uncommitted changes, you may want to instead use ''git stash && git pull && git stash pop''. | |||
<pre> | # Build the new jar: <pre>./gradlew clean shadowJar</pre> | ||
You have a KoLmafia jar file that can be invoked with <pre>java -jar dist/KoLmafia-*.jar</pre> | You have a KoLmafia jar file that can be invoked with <pre>java -jar dist/KoLmafia-*.jar</pre> | ||
Line 50: | Line 48: | ||
Do other installation steps as you wish. | Do other installation steps as you wish. | ||
== | ==macOS== | ||
# Verify required packages | # Verify required packages | ||
## <code>''java --version''</code> | ## <code>''java --version''</code> | ||
Line 63: | Line 61: | ||
git clone git@github.com:kolmafia/kolmafia.git</syntaxhighlight> | git clone git@github.com:kolmafia/kolmafia.git</syntaxhighlight> | ||
##''If not:''<syntaxhighlight lang="bash">git clone https://github.com/kolmafia/kolmafia.git</syntaxhighlight> | ##''If not:''<syntaxhighlight lang="bash">git clone https://github.com/kolmafia/kolmafia.git</syntaxhighlight> | ||
# Compile KoLmafia with the Gradle wrapper ''<syntaxhighlight lang="bash"> | |||
Do every session: | |||
# Navigate to your cloned repository: <pre>cd ~/projects/kolmafia</pre> | |||
# Get new updates with <pre>git pull</pre> If you have local uncommitted changes, you may want to instead use ''git stash && git pull && git stash pop''. | |||
# Compile KoLmafia with the Gradle wrapper: ''<syntaxhighlight lang="bash">./gradlew runShadow</syntaxhighlight>'' | |||
=== Optional === | === Optional === | ||
If you intend to commit code to GitHub, you will need to follow GitHub's instructions for [https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token adding a Personal Access Token (PAT)] | If you intend to commit code to GitHub, you will need to follow GitHub's instructions for [https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token adding a Personal Access Token (PAT)] | ||
''[[Category:Tech Support]]'' | ''[[Category:Tech Support]]'' |
Revision as of 13:28, 6 December 2021
GREAT BIG NEWS
KoLmafia has migrated to the GitHub repository and we are retooling for GIT and gradle builds.
The Windows, Linux and macOS instructions have been updated, and might have been lightly tested
The good news is that the IDE setup is a lot easier. The bad news is you'll need to take some steps to build anything. In addition, we are discussing changing to a newer required JDK, so even these instructions will not be permanent.
To contribute to the Mafia project, you'll need to be able to install the Java Development Kit, connect to the git repository, and be comfortable writing Java Code. Instructions for the first two are included below:
Windows
- Download Tools
- Download and install Java Development Kit 11 or newer, available from Adoption. The current recommended version is Java 17.
- Download and install GIT following the instructions from Atlassian's GIT install page.
- Download and install Tortoise GIT (if needed) from https://tortoisegit.org
- Configure Windows Environment Variables
- Windows 10
- Go to settings
- type 'enviro' in the search
- click on the 'edit environment variables' suggestion
- add or edit JAVA_HOME, and PATH variables
PATH should include JAVA_HOME
If the JAVA installer has already set these variables, they can be updated or left alone.
- Windows 10
- Open a new Command Prompt (or Powershell) window and navigate to the directory to which you wish to create kolmafia (e.g.
cd %USERPROFILE%\projects
, or some similar directory) - Clone the source code for the KoLmafia Project.
- If you have a github account:
git clone git@github.com:kolmafia/kolmafia.git
- If not:
git clone https://github.com/kolmafia/kolmafia.git
- If you have a github account:
- Compile KoLmafia with the Gradle wrapper
cd kolmafia && gradlew.bat runShadow
Optional
If you intend to commit code to GitHub, you will need to follow GitHub's instructions for adding a Personal Access Token (PAT)
Linux
Do once:
- Install git - you probably already have this. If not, follow this guide.
- Get an appropriate JDK. If your package manager does not contain a sufficiently up-to-date version of Java, the safest and easiest way to do this is with Adoptium.
- Clone the repo:
- If you have a github account:If not:
git clone git@github.com:kolmafia/kolmafia.git
git clone https://github.com/kolmafia/kolmafia.git
- If you have a github account:
Do every session:
- Set up your environment to use that JDK you just downloaded
export PATH="/where/you/put/that/jdk/bin:${PATH}"
(Optionally, put this in your .profile or .bashrc if you want to set and forget.) - Navigate to your cloned repository:
cd /where/you/cloned/kolmafia
- Get new updates with
git pull
If you have local uncommitted changes, you may want to instead use git stash && git pull && git stash pop. - Build the new jar:
./gradlew clean shadowJar
You have a KoLmafia jar file that can be invoked with
java -jar dist/KoLmafia-*.jar
Do other installation steps as you wish.
macOS
- Verify required packages
java --version
- if not found or less than Java 11... Install Java Development Kit version 17 from Adoptium Temurin
git --version
- If not found ... Install git: Atlassian has a great document on the various ways to install Git
- Configure development environment
Most of these steps can be included in.profile
or the equivalent for your terminal of choice.- In the terminal set JAVA_HOME to the java home directory.
/usr/libexec/java_home -V
will list all known values for java_home.
If you have multiple copies of java, choose the version you want to use.export JAVA_HOME=`/usr/libexec/java_home -v17
- In the terminal set JAVA_HOME to the java home directory.
- Open a new terminal window and navigate to the directory to which you wish to create kolmafia (e.g.
cd ~/projects
, or some similar directory) - Clone the source code for the KoLmafia Project.
- If you have a github account:
git clone git@github.com:kolmafia/kolmafia.git
- If not:
git clone https://github.com/kolmafia/kolmafia.git
- If you have a github account:
Do every session:
- Navigate to your cloned repository:
cd ~/projects/kolmafia
- Get new updates with
git pull
If you have local uncommitted changes, you may want to instead use git stash && git pull && git stash pop. - Compile KoLmafia with the Gradle wrapper:
./gradlew runShadow
Optional
If you intend to commit code to GitHub, you will need to follow GitHub's instructions for adding a Personal Access Token (PAT) '