Skip to content

Commit

Permalink
Enable creation of an Ubuntu snap
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Aug 8, 2017
1 parent 5ef7d68 commit c2f1bfb
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 110 deletions.
230 changes: 129 additions & 101 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,83 +51,23 @@ jabref.xml



# Created by https://www.gitignore.io/api/gradle,java,jabref,intellij,eclipse,netbeans,windows,linux,macos

### JabRef ###
# JabRef - https://www.jabref.org/
*.bak
*.sav


### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml

# Sensitive or high-churn files:
.idea/dataSources/
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Created by https://www.gitignore.io/api/gradle,java,jabref,intellij,eclipse,netbeans,windows,linux,macos,snapcraft

### Eclipse ###

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

Expand All @@ -140,9 +80,6 @@ local.properties
# CDT-specific (C/C++ Development Tooling)
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

Expand All @@ -164,36 +101,107 @@ local.properties
# Code Recommenders
.recommenders/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
### Eclipse Patch ###
# Eclipse Core
.project

# JDT-specific (Eclipse Java Development Tools)
.classpath

### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# Folder config file
Desktop.ini
# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Recycle Bin used on file shares
$RECYCLE.BIN/
# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# Windows shortcuts
*.lnk
# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### JabRef ###
# JabRef - https://www.jabref.org/
*.sav

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Linux ###
*~
Expand All @@ -210,16 +218,17 @@ $RECYCLE.BIN/
# .nfs files are created when an open file is removed but is still being accessed
.nfs*


### macOS ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
Expand All @@ -228,31 +237,49 @@ Icon
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/

### Java ###
*.class
### Snapcraft ###
# Snapcraft
parts/
prime/
stage/
*.snap

# BlueJ files
*.ctxt
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Folder config file
Desktop.ini

# Package Files #
*.jar
*.war
*.ear
# Recycle Bin used on file shares
$RECYCLE.BIN/

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

### Gradle ###
.gradle
Expand All @@ -269,4 +296,5 @@ gradle-app.setting

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
scenicView.properties

# End of https://www.gitignore.io/api/gradle,java,jabref,intellij,eclipse,netbeans,windows,linux,macos,snapcraft
Binary file added .snapcraft/travis_snapcraft.cfg
Binary file not shown.
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ sudo: required
services:
- postgresql
- mysql
- docker

env:
global:
- GRADLE_OPTS=-Dorg.gradle.daemon=false
- TERM=dumb
matrix:
- TEST_SUITE=check OPTIONS=modernizer
- TEST_SUITE=fetcherTest
- TEST_SUITE=databaseTest
- TEST_SUITE=guiTest
- TEST_SUITE=checkstyle
- TEST_SUITE=snapcraft

matrix:
fast_finish: true
Expand All @@ -40,14 +43,14 @@ before_script:
script:
# --scan enables the Gradle build scan, which can be used to investiage the time each action consumes
# For more information see https://gradle.com/scans/get-started
- if [ "$TEST_SUITE" != "guiTest" ] && [ "$TEST_SUITE" != "checkstyle" ]; then ./gradlew $TEST_SUITE $OPTIONS --scan; fi
- if [ "$TEST_SUITE" != "checkstyle" ] && [ "$TEST_SUITE" != "guiTest" ] && [ "$TEST_SUITE" != "snapcraft" ]; then ./gradlew $TEST_SUITE $OPTIONS --scan; fi
- if [ "$TEST_SUITE" == "checkstyle" ]; then ./gradlew checkstyleMain checkstyleTest checkstyleJmh; fi
- if [ "$TEST_SUITE" == "guiTest" ]; then ./buildres/gui-tests.sh; fi

after_success:
# enable codecov report
- ./gradlew jacocoTestReport
- bash <(curl -s https://codecov.io/bash)
- if [ "$TEST_SUITE" != "checkstyle" ] && [ "$TEST_SUITE" != "snapcraft" ]; then ./gradlew jacocoTestReport && bash <(curl -s https://codecov.io/bash); fi
- if [ "$TRAVIS_BRANCH" == "snapcraft" ] && [ "$TEST_SUITE" == "snapcraft" ]; then openssl aes-256-cbc -K $encrypted_5f91cda8b19d_key -iv $encrypted_5f91cda8b19d_iv -in .snapcraft/travis_snapcraft.cfg -out .snapcraft/snapcraft.cfg -d && sh ./scripts/run-snapcraft.sh; fi

after_failure:
# show test results if build fails
Expand Down
10 changes: 7 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ sourceSets {
}

processResources {
filteringCharset = 'UTF-8'

filesMatching("build.properties") {
expand(version: project.version,
"year": String.valueOf(Calendar.getInstance().get(Calendar.YEAR)),
Expand All @@ -161,7 +163,6 @@ processResources {
"azureInstrumentationKey": System.getenv('AzureInstrumentationKey'))
filteringCharset = 'UTF-8'
}
filteringCharset = 'UTF-8'

filesMatching("resource/**/meta.xml") {
expand version: project.version
Expand Down Expand Up @@ -368,19 +369,22 @@ task release(dependsOn: ["media", "releaseJar"]) {
task releaseJar(dependsOn: "shadowJar") {
group = 'JabRef - Release'
description "Creates a Jar release."

doLast {
copy {
from("$buildDir/libs/JabRef-${project.version}-fat.jar")
into("$buildDir/releases")

rename { String fileName ->
fileName.replace('-fat', '')
}
}
file("$buildDir/releases/JabRef-${project.version}.jar").setExecutable(true, true);
}
}

task snapJar(dependsOn: "releaseJar", type: Delete) {
delete fileTree(dir: "$buildDir/releases/", exclude: "JabRef-${project.version}.jar")
}

jmh {
warmupIterations = 5
iterations = 10
Expand Down
4 changes: 4 additions & 0 deletions scripts/run-snapcraft.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#/bin/bash
VERSION=`grep "^version =" build.gradle | sed "s/^version = \"\(.*\)\".*/\1/"`
sed -i "s/4.0-dev/$VERSION/" snapcraft.yaml
docker run -v $(pwd):$(pwd) -t koppor/snapcraft-java-de:v1.2.0 sh -c "cd $(pwd) && LANG=C.UTF-8 LC_ALL=C.UTF-8 snapcraft && LANG=C.UTF-8 LC_ALL=C.UTF-8 snapcraft push *.snap --release edge"
Loading

0 comments on commit c2f1bfb

Please sign in to comment.