Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
PenghaiZhang committed Jul 31, 2019
2 parents f06e2a7 + dc3a605 commit 526fcae
Show file tree
Hide file tree
Showing 41 changed files with 3,374 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
bin
dist
# IDEA output
out

.vscode
.classpath
.project
.settings
.factorypath

### Intellij ###

.idea/artifacts/
.idea/httpRequests/

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/google-java-format.xml

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

# Gradle:
.idea/gradle.xml
.idea/libraries
## And seeing gradle projects also regenerates .iml module files
## (see here -
https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems),
## lets ignore them all:
.idea/modules/

# We're not using SBT, but the plugin is at play it seems:
.idea/sbt.xml

### Intellij - END ###
4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: java
jdk:
- openjdk8

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

before_install:
- sudo apt-get install -y awscli

install: true

script:
- ./gradlew build
after_success:
- aws s3 --region us-east-1 cp --recursive build/distributions s3://oeq-admin-console-package/`printf %04d $TRAVIS_BUILD_NUMBER`/

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

env:
global:
- secure: aY/WM0UPndWHcsHMT6M658Q1bBWYQ635brtMavLZnGRn0FCiB94rUgOo6vn+y3H7BBPBBRk2z0UMaA/VXBV/EcVxrfZx8q9BZg7/jUrlzA/FC01LA1nFCHH4+PGl9GvEd4D6hRMp9UYBbb3sLTucSwtiXIT7mNNC910uRWI+wG/ceIqNz1v4peqhEbDepwN5/7sYqHk9SlWYw9lPwmp3nok0o8Crhv1OTzgeLitWnwXKf4wnzpdcCHI7WJHYtcA0nV09DNJmkJcUdseTT86qztBti5inGXE6/eDV5jj5JXGSHCHiLxG0/a6ZDnDQd3OL8dcqxjzL0JHG9uDROlsgPBy+8SB4nhZj3CdTMfYQr09l4+oN0WmSHIm/CaNGR4hEG7hr5EuHzttFChg84F9i9sJOaVHA6NLjkJYBvydr3Sajn4bRVyZusldwoWsAlo9wJScRdYsepcVo7NQdROfRWEwJiJk1H3uOb0xvBSbpg92v0puskdOHqiv8jT1HNaHpBjFrxtTLv13JA3brKWQUEbVZoR3oa1iZxNEIC5J4x7EVzXJzuwup0TAH7Z03oYC8FPksWyjsCF5mUFrPmg6U/dl+V+SeD/OTThZzngVcHm9L+lB3S1boO+hdvmD08+PkM0ZvCcyAMWss4eJ8Rdy5f1q327IE43FXbC3P231oWIA=
- secure: G2sEQTeSn74fP4jjInA+IidpXNitfRNxR7qFuU49dvtbFOuqnKsDvwCGakpStRRChcu9SQSh+N2U0x/1KNmYOxKReqVTwd4UksNzcdVvvMmxDMqtQCpJuT7TWIgtTpgd52PySAcZSqs4ZKYFZRlydOWgZ3rWOrdAHTXkZXOieF0PHNwkc43f7JaDPml8fZThKDLIc0dfRfigSiHjk4K2AKyLP9h5DK6G0irlSP8QaE0TnNt+it+R5qEA5Thx1dWg0J6qiMLUhHqBwiiHeV7riGDe/PkhuSGe5jnKWDwHu/MimSWsdlvYsMw/S1zOsif3erokBxzcmFAW/JAJLcisJqTMYp+JkyykKljmsdVdw9DUSsJX9ldjmYIK4flCU6o17BxFxRvhWdVPYrniyxsB6WbMi5pPxBUGA769qAFORZuuc4wHyjphhbOLvDqqHDcQS9kRZXzzjba/G3sTCZcEeaqK1ZBkVbMXS8a5Ia2n0UlZxtCQTycivzQa4LJmSVrCKwnOFYPGKKuBYcWsSC8w52hi6UTlL8OFAMOq4dIXAPrN6YFS9RuoH883sH0xJ6mi/qID48DlQPzH9NEHv//Z3m+X/uMdL4Fe+7o6FPbzE2yRlXmJdoOG2BTV5CmK7A/bNiIaetNPYlMtzQTCvsvJ3vZ/qD4KEn+Z3ZKfO5RpZsw=
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Licensed to The Apereo Foundation under one or more contributor license
agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership.

The Apereo Foundation licenses this file to you under the Apache License,
Version 2.0, (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
29 changes: 29 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright <2019>, The Apereo Foundation

This project includes software developed by The Apereo Foundation.
http://www.apereo.org/

Licensed under the Apache License, Version 2.0, (the "License"); you may not
use this software except in compliance with the License. You may obtain a
copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.

# admin-console-package-licenses

| Category | License | Dependency | Notes |
| --------------------- | ------------------------------------------------------------------------- | ---------------------------------------------------- | ----------------------- |
| Apache | [ASF 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | nebula.lint # 9.3.4 | <notextile></notextile> |
| Apache | [ASF 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.github.hierynomus.license # 0.15.0 | <notextile></notextile> |
| Apache | [ASF 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.google.guava:guava # 27.0.1-jre | <notextile></notextile> |
| Apache | [ASF 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | com.fasterxml.jackson.core:jackson-databind # 2.9.8 | <notextile></notextile> |
| Apache | [ASF 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) | org.jasypt:jasypt # 1.9.2 | <notextile></notextile> |
| Eclipse Public License| [Eclipse Public License 1.0](http://www.eclipse.org/legal/epl-v10.html ) | junit:junit # 4.12 | <notextile></notextile> |
| MIT License | [MIT License](http://www.opensource.org/licenses/mit-license.php) | org.slf4j:slf4j-api # 1.7.26 | <notextile></notextile> |
| MIT License | [MIT License](http://www.opensource.org/licenses/mit-license.php) | org.slf4j:slf4j-simple # 1.6.4 | <notextile></notextile> |
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
# admin-console-package
Project to build a stand-alone admin console (launcher) package

## Building the configurator
```
~$ ./gradlew jar --console=verbose
```
The jar is placed in .../build/libs/

For development, you can run the app via:

```
~$ ./gradlew run --console=verbose
```

##Apereo Header validation
The gradle build includes a task which will check that each source file in the common and configurator projects has an Apereo
license notice at the top of the file. This license is stored in `LICENSE` in the root of this repository.
In order to apply the headers, run:

```
-$ ./gradlew licenseFormat
```
In order to check that the headers have been applied, run:

```
-$ ./gradlew license
```
NOTE: The license check is executed as part of the standard `build` target.

## Creating packages for Linux, Windows and Mac
The gradle build includes a task which creates three packages by bundling OpenJDK, all dependencies of this project and a system-specific launcher script.

* For Linux user, extract the package and run: ./Linux-launcher.sh
* For Windows user, extract the package and double click Windows-launcher.bat
* For Mac user, extract the package and run: ./Mac-launcher.sh

These packages will be produced as part of the standard build task.

```
-$ ./gradlew build
```
196 changes: 196 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
plugins {
id 'java'
id 'application'
id 'base'
id 'nebula.lint' version '9.3.4'
id 'com.github.hierynomus.license' version '0.15.0'
}

apply plugin: 'java'
apply plugin: 'base'
apply plugin: 'nebula.lint'
apply plugin: 'com.github.hierynomus.license'
apply plugin: "application"

repositories {
mavenLocal()
jcenter()
}

dependencies {
implementation 'org.slf4j:slf4j-api:1.7.26'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
implementation 'org.jasypt:jasypt:1.9.2'
runtimeOnly 'org.slf4j:slf4j-simple:1.6.4'
testImplementation "junit:junit:$junitVersion"
}

group = 'org.apereo.openequella.adminconsole'
version = artifactVersion
mainClassName = 'org.apereo.openequella.adminconsole.launcher.ClientLauncher'

// Gradlelint is broken: https://github.com/nebula-plugins/gradle-lint-plugin/issues/203
gradleLint.rules = [/*'all-dependency', */'dependency-parentheses', 'duplicate-dependency-class']

license {
strictCheck
header = file('LICENSE')
}

jar {
archiveFileName = 'admin.jar'
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version,
'Main-Class': mainClassName,
"Class-Path": configurations.runtimeClasspath.files.collect { it.getName() }.join(' '))
}
}

final jreDownloadDir = file("$buildDir/jre-downloads")
final jreExtractDir = {sys -> "${jreDownloadDir.absolutePath}/jre/${sys}"}
final jarDir = "${buildDir}/libs"
final launcherScripts = [
windows: 'Windows-launcher.bat',
linux: 'Linux-launcher.sh',
mac: 'Mac-launcher.sh'
]

class JreProperties {
String hash
String fileName
String getDownloadUrl() {"https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u212-b03/${fileName}"}
File getJre() {new File("build/jre-downloads/${fileName}")}
}

final jreProperties = [
windows: new JreProperties(
hash: 'c09bab89cd82483c371597c5c364094a145c1fbba43a1d3d7c3e350b89dedc89',
fileName: 'OpenJDK8U-jre_x64_windows_hotspot_8u212b03.zip'),
linux: new JreProperties(
hash: '74daf0b77a7fd679cbb3a6228e0efa8c4a90b7664aa057f211e34bbfb38640fb',
fileName: 'OpenJDK8U-jre_x64_linux_hotspot_8u212b03.tar.gz'),
mac: new JreProperties(
hash: '80855320c42a3b06617c6e466c64df67731542a805972185b075ca6cb1222c7f',
fileName: 'OpenJDK8U-jre_x64_mac_hotspot_8u212b03.tar.gz')
]

task copyDependencies(type: Copy, description: 'Copy dependencies to /build/libs') {
from configurations.default
into(jarDir)
}

task downloadJre(description: 'Download OpenJRE of Linux, Windows and Mac') {
doFirst {
if (!jreDownloadDir.exists()) {
jreDownloadDir.mkdirs()
}
// Filter out entries that already have JRE downloaded
jreProperties.findAll {String sys, JreProperties props -> !props.jre.exists()}
.collect {String sys, JreProperties props ->
Thread.start {
println("Start downloading OpenJRE for ${sys}...")
new URL(props.downloadUrl as String).withInputStream {
props.jre.newOutputStream() << it
}
}
}*.join()
}
}
// Execute downloadJre only when any one of three JREs is missing
downloadJre.onlyIf {
jreProperties.any {sys,props ->
!props.jre.exists()
}
}

import java.security.MessageDigest
static String calculateHash(File jre) {
MessageDigest.getInstance('SHA-256').with {
jre.eachByte(1024) {buff,len ->
update(buff, 0, len)
}
digest().encodeHex() as String
}
}

task checkJre(dependsOn: downloadJre, description: 'Check if the hash of each JRE is correct') {
doFirst {
if (jreProperties.any { String sys, JreProperties props ->
props.hash != calculateHash(props.jre)
}) {
throw new GradleException("Hash mismatch for downloaded JRE. Files may have been modified.")
}
}
}
// Execute checkJre only when downloadJre was not skipped
checkJre.onlyIf {
downloadJre.didWork
}

task unzipJre(description: 'Unzip a JRE when the extract directory is missing', dependsOn: checkJre) {
doFirst {
// Find out unzipped JREs and extract them
jreProperties.findAll {String sys, JreProperties props ->
!new File(jreExtractDir(sys)).exists()
}.each {String sys, JreProperties props ->
println "Unzip JRE for ${sys}"
if (props.jre.name.endsWith('zip')) {
copy {
from zipTree(props.jre)
into file(jreExtractDir(sys))
}
} else {
copy {
from tarTree(resources.gzip(props.jre))
into file(jreExtractDir(sys))
}
}
}
}
}
// Execute unzipJre only when any one of three JRE extract folders is missing
unzipJre.onlyIf {
jreProperties.any {String sys, JreProperties props->
!new File(jreExtractDir(sys)).exists()
}
}

distributions {
launcherScripts.each { String sys, String scriptFileName ->
String scriptFileDir = "${projectDir}/launcher-scripts/${scriptFileName}"
"${sys}Packages" {
baseName = "admin-console-package-for-${sys}"
contents {
from("${buildDir}") {
include "libs/*"
}
from {file(jreExtractDir(sys))}
from {file(scriptFileDir)}
}
}
}
}

Object[] dependentTasks = [unzipJre,copyDependencies]
build.dependsOn(dependentTasks)

// We want TAR files to be compressed by GZIP with the file extension of '.tar.gz'
tasks.withType(Tar){
compression = Compression.GZIP
archiveExtension = 'tar.gz'
}

// We do not need the default distributions that have no JRE bundled
distTar.enabled = false
distZip.enabled = false

// We do not need tar for Windows and zip for both Mac and Linux.
windowsPackagesDistTar.enabled = false
linuxPackagesDistZip.enabled = false
macPackagesDistZip.enabled = false

// These plugin-generated distribution tasks must run after JREs are downloaded and unzipped.
linuxPackagesDistTar.mustRunAfter(dependentTasks)
macPackagesDistTar.mustRunAfter(dependentTasks)
windowsPackagesDistZip.mustRunAfter(dependentTasks)
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
junitVersion=4.12
artifactVersion=1.0.0
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon May 13 17:09:22 AEST 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 526fcae

Please sign in to comment.