Skip to content

Commit

Permalink
create zip of all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
artoonie committed Jan 24, 2024
1 parent 7b45e7e commit db985df
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .github/actions/gradle-and-sha/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ runs:
- name: "Rename output file"
shell: bash
run: mv ${{ inputs.intermediate-filepath }} ${{ inputs.final-filepath }}
run: |
ls build/*/*
mv ${{ inputs.intermediate-filepath }} ${{ inputs.final-filepath }}
- name: "Generate SHA512 for Linux"
shell: bash
Expand Down
32 changes: 26 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: "Generate Releases"
on:
release:
types: [ published ]
## To test this workflow without creating a release, uncomment the following and add a branch name (making sure "push"
## is at the same indent level as "release":
# push:
# branches:
# - 'branch-name'
# To test this workflow without creating a release, uncomment the following and add a branch name (making sure "push"
# is at the same indent level as "release":
push:
branches:
- 'feature/issue-756_airgap'

jobs:
release:
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
if [ ${{ runner.os }} == 'Windows' ]; then
echo "FILEPATH=build/jpackage/RCTab-1.3.999.exe" >> $GITHUB_OUTPUT
elif [ ${{ runner.os }} == 'Linux' ]; then
echo "FILEPATH=build/jpackage/rctab_1.3.999-1_amd64.deb" >> $GITHUB_OUTPUT
echo "FILEPATH=build/jpackage/rctab_1.3.999_amd64.deb" >> $GITHUB_OUTPUT
else
echo "FILEPATH=build/jpackage/RCTab-1.3.999.dmg" >> $GITHUB_OUTPUT
fi
Expand All @@ -77,6 +77,22 @@ jobs:
intermediate-filepath: build/rcv.zip
final-filepath: ${{ steps.zipfn.outputs.FILEPATH }}

- name: "Create caches filename"
id: cachefn
shell: bash
run: echo "DEPENDENCY_FILEPATH=dependency.${{ runner.os }}.zip" >> $GITHUB_OUTPUT
run: echo "PLUGIN_FILEPATH=plugin.${{ runner.os }}.zip" >> $GITHUB_OUTPUT

- name: "Create dependency zip"
shell: bash
run: |
./gradlew copyLibs
./gradlew assemble
zip -r ${{cachefn.DEPENDENCY_FILEPATH}} .dependencycache
zip -r ${{cachefn.PLUGIN_FILEPATH}} ~/.gradle/caches
sha512sum ${{cachefn.DEPENDENCY_FILEPATH}} > ${{cachefn.DEPENDENCY_FILEPATH}}.sha512
sha512sum ${{cachefn.PLUGIN_FILEPATH}} > ${{cachefn.PLUGIN_FILEPATH}}.sha512
- name: "Prepare keychain"
if: matrix.os == 'macOS-latest'
env:
Expand Down Expand Up @@ -132,6 +148,10 @@ jobs:
${{ github.workspace }}/${{ steps.zipfn.outputs.FILEPATH }}.sha512
${{ github.workspace }}/${{ steps.exefn.outputs.FILEPATH }}
${{ github.workspace }}/${{ steps.exefn.outputs.FILEPATH }}.sha512
${{ github.workspace }}/dependencycache.zip
${{ github.workspace }}/dependencycache.zip.sha512
${{ github.workspace }}/plugincache.zip
${{ github.workspace }}/plugincache.zip.sha512
retention-days: 90

- name: "Upload binaries to release"
Expand Down
46 changes: 39 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,24 @@ repositories {
mavenCentral()
}

// Caching dependencies for a fully-offline build
def DEPENDENCY_CACHE_DIR = "$projectDir/.dependencycache/"

dependencies {
implementation 'commons-cli:commons-cli:1.5.0'
implementation 'org.apache.commons:commons-csv:1.10.0'
implementation 'org.apache.poi:poi-ooxml:5.2.3'
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2'
if (gradle.startParameter.isOffline()) {
implementation fileTree(dir: DEPENDENCY_CACHE_DIR)
} else {
implementation 'commons-cli:commons-cli:1.5.0'
implementation 'org.apache.commons:commons-csv:1.10.0'
implementation 'org.apache.poi:poi-ooxml:5.2.3'
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2'
implementation "com.github.spotbugs:spotbugs:4.8.3"

}

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
}
Expand Down Expand Up @@ -235,3 +245,25 @@ tasks.jlink.doLast {
into JLINK_DIR + "/sample_input"
}
}

// Tooling to copy dependencies for a fully-offline build
configurations {
cacheableImplementation.extendsFrom implementation
}

task deleteLibraryCache(type: Delete) {
delete DEPENDENCY_CACHE_DIR
}

task copyLibs(type: Copy, dependsOn: 'deleteLibraryCache') {
from configurations.cacheableImplementation
into DEPENDENCY_CACHE_DIR
}

// Necessary for offline builds to succeed
tasks.withType(Tar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType(Zip) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

0 comments on commit db985df

Please sign in to comment.